##
##  snownews.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:         snownews
Summary:      Text-Mode RDF/RSS News Reader
URL:          http://kiza.kcore.de/software/snownews/
Vendor:       Oliver Feiler
Packager:     OpenPKG Project
Distribution: OpenPKG Community
Class:        EVAL
Group:        Web
License:      GPL
Version:      1.5.12
Release:      20090919

#   list of sources
Source0:      http://kiza.kcore.de/software/snownews/download/snownews-%{version}.tar.gz
Patch0:       snownews.patch

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

%description
    SnowNews is a text-mode RSS/RDF news reader. It supports RSS 1.0
    feeds that comply with the W3C RDF specification and also supports
    Radio Userland's RSS 0.91 and 2.0 versions.

%track
    prog snownews = {
        version   = %{version}
        url       = http://kiza.kcore.de/software/snownews/download/
        regex     = snownews-(__VER__)\.tar\.gz
    }

%prep
    %setup -q
    %patch -p0

%build
    %{l_prefix}/bin/perl ./configure
    %{l_shtool} subst \
        -e 's;^\(CC=\).*$;\1%{l_cc};' \
        -e 's;^\(MAKE=\).*$;\1%{l_make};' \
        -e 's;^\(CFLAGS=\)\(.*\)$;\1%{l_cflags} %{l_cppflags ncurses} -DOS=\\"$(shell uname)\\" `%{l_prefix}/bin/xml2-config --cflags`;' \
        -e 's;^\(LDFLAGS=\)\(.*\)$;\1%{l_ldflags} -lncurses `%{l_prefix}/bin/xml2-config --libs` -lintl -liconv -lcrypto;' \
        -e 's;^\(INSTALL=\).*$;\1%{l_shtool} install;' \
        -e 's;^\(PREFIX=\).*$;\1%{l_prefix};' \
        -e 's;^\(LANGS=\).*$;\1;' \
        -e 's;^\(LOCALES=\).*$;\1;' \
        -e 's;\($(CC)\) \($(LDFLAGS)\) \($(OBJFILES)\);\1 \3 \2;' \
        -e 's;^\([ 	]*cat $(MAN).*\| sed s#PREFIX#\)\$(PREFIX)\(#.*\)$;\1%{l_prefix}\2;' \
        Makefile platform_settings
    %{l_make} %{l_mflags -O}

%install
    %{l_make} %{l_mflags} install 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

