##
##  epic4.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 version
%define       V_epic4      2.10.1
%define       V_epic4_help 20050315

#   package information
Name:         epic4
Summary:      Enhanced Programmable ircII Client
URL:          http://www.epicsol.org/
Vendor:       EPIC Software Labs.
Packager:     OpenPKG Project
Distribution: OpenPKG Community
Class:        EVAL
Group:        InstantMessaging
License:      GPL
Version:      %{V_epic4}
Release:      20090906

#   package options
%option       with_ssl  no

#   list of sources
Source0:      ftp://ftp.epicsol.org/pub/ircii/EPIC4-PRODUCTION/epic4-%{V_epic4}.tar.gz
Source1:      ftp://ftp.epicsol.org/pub/ircii/EPIC4-PRODUCTION/epic4-help-%{V_epic4_help}.tar.gz
Patch0:       epic4.patch

#   build information
BuildPreReq:  OpenPKG, openpkg >= 20160101
PreReq:       OpenPKG, openpkg >= 20160101
%if "%{with_ssl}" == "yes"
BuildPreReq:  openssl
PreReq:       openssl
%endif

%description
    EPIC4 is a new direction in ircII development. No longer is EPIC
    100% backwards compatable with ircII, but instead we have chosen
    to find those things where compatability is undesirable, and fix
    them. No gratuitous incompatabilities have been added, but lots of
    new code has been added to make EPIC the best ircII client we could
    make.

%track
    prog epic4 = {
        version   = %{V_epic4}
        url       = ftp://ftp.epicsol.org/pub/ircii/EPIC4-PRODUCTION/
        regex     = epic4-(__VER__)\.tar\.gz
    }
    prog epic4:help = {
        version   = %{V_epic4_help}
        url       = ftp://ftp.epicsol.org/pub/ircii/EPIC4-PRODUCTION/
        regex     = epic4-help-(__VER__)\.tar\.gz
    }

%prep
    %setup -q
    %setup -q -T -D -a 1
    %patch -p0

%build
    CC="%{l_cc}" \
%if "%{with_ssl}" == "yes"
    CFLAGS="%{l_cflags -O} %{l_cppflags openssl .}" \
%else
    CFLAGS="%{l_cflags -O} %{l_cppflags}" \
%endif
    LDFLAGS="%{l_ldflags}" \
    ./configure \
        --prefix=%{l_prefix} \
        --datadir=%{l_prefix}/share/epic \
%if "%{with_ssl}" == "yes"
        --with-ssl=%{l_prefix}
%else
        --without-ssl
%endif
    %{l_make} %{l_mflags}

%install
    %{l_make} %{l_mflags} install installhelp \
        DESTDIR=$RPM_BUILD_ROOT \
        INSTALL_PROGRAM="%{l_shtool} install -c -m 755" \
        INSTALL_DATA="%{l_shtool} install -c -m 644"
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}

%files -f files

%clean

