##
##  centericq.spec -- OpenPKG RPM Package Specification
##  Copyright (c) 2000-2025 OpenPKG Project <http://openpkg.org/>
##
##  Permission to use, copy, modify, and distribute this software for
##  any purpose with or without fee is hereby granted, provided that
##  the above copyright notice and this permission notice appear in all
##  copies.
##
##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
##  SUCH DAMAGE.
##

#   package information
Name:         centericq
Summary:      Text-Based Multi-Protocol Instant Messaging Client
URL:          http://thekonst.net/en/centericq/
Vendor:       Konstantin Klyagin
Packager:     OpenPKG Project
Distribution: OpenPKG Community
Class:        EVAL
Group:        InstantMessaging
License:      GPL
Version:      4.21.0
Release:      20080101

#   list of sources
Source0:      http://thekonst.net/download/centericq-%{version}.tar.bz2

#   build information
BuildPreReq:  OpenPKG, openpkg >= 20160101, make, gcc, autoconf
PreReq:       OpenPKG, openpkg >= 20160101
BuildPreReq:  openssl, libiconv, ncurses
PreReq:       openssl, libiconv, ncurses

%description
    Centericq is a text mode menu- and window-driven IM interface that
    supports the ICQ2000, Yahoo!, AIM, IRC, MSN, Gadu-Gadu and Jabber
    protocols.

%track
    prog centericq = {
        version   = %{version}
        url       = http://thekonst.net/en/centericq/
        regex     = centericq-(__VER__)\.tar\.bz2
    }

%prep
    %setup -q
    #   Released generated configure's (autoconf 2.13) do not understand
    #   VAR=VALUE in the commandline. Regenerate with current autoconf.
    for subdir in connwrap-0.1 kkconsui-0.1 kkstrtext-0.1 kksystr-0.1 \
                  libicq2000-0.1 libjabber-0.1 libmsn-0.1 libyahoo2-0.1
    do (cd $subdir; autoconf) || exit $?
    done

%build
    CC="%{l_cc} %{l_cppflags} %{l_cppflags nurses} %{l_cflags -O}" \
    CXX="%{l_cxx} %{l_cppflags} %{l_cppflags ncurses} %{l_cxxflags -O}" \
    CFLAGS="%{l_cflags -O}" \
    CXXFLAGS="%{l_cxxflags -O}" \
    CPPFLAGS="%{l_cppflags} %{l_cppflags ncurses}" \
    LDFLAGS="%{l_ldflags}" \
    ./configure \
        --prefix=%{l_prefix} \
        --with-ssl \
        --with-openssl=%{l_prefix} \
        --with-libiconv-prefix=%{l_prefix} \
        --with-included-gettext \
        --without-curl \
        --without-fribidi \
        --without-gpgme \
        --disable-aim \
        --disable-gg \
        --without-libjpeg \
        --disable-irc \
        --disable-konst \
        --disable-lj \
        --disable-msn \
        --disable-rss \
        --disable-yahoo \
        --disable-nls
    %{l_make} %{l_mflags -O}

%install
    %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
    strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}

%files -f files

%clean

