##
##  nn.spec -- OpenPKG RPM Specification
##  Copyright (c) 2000-2003 Cable & Wireless Deutschland GmbH
##  Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
##  Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.com>
##
##  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:         nn
Summary:      No News Is Good News
URL:          http://www.nndev.org/
Vendor:       Kim Fabricius Storm
Packager:     The OpenPKG Project
Distribution: OpenPKG [BASE]
Group:        News
License:      BSD-style
Version:      6.6.4
Release:      20020821

#   list of sources
Source0:      ftp://ftp.nndev.org/pub/nn-6.6/nn-%{version}.tar.Z

#   build information
Prefix:       %{l_prefix}
BuildRoot:    %{l_buildroot}
BuildPreReq:  OpenPKG, openpkg >= 20020206, gcc
PreReq:       OpenPKG, openpkg >= 20020206, MTA
AutoReq:      no
AutoReqProv:  no

%description
    NN ("No News is Good News") is one of the oldest and most popular
    Usenet News clients.

%prep
    %setup -q

%build
    S="template"; M="template"
    case "%{l_target}" in
        *-freebsd* ) S="freebsd"; M="i80386" ;;
        *-linux*   ) S="linux";   M="i80386" ;;
        *-solaris* ) S="sunos5";  M="sparc"  ;;
    esac
    %{l_shtool} install -c -m 644 \
        -e "s;s-sunos5.h;s-${S}.h;" \
        -e "s;m-sparc.h;m-${M}.h;" \
        -e 's;/usr/local/bin;%{l_prefix}/bin;' \
        -e 's;/usr/local/lib/nn;%{l_prefix}/libexec/nn;' \
        -e 's;/usr/local/man/man1;%{l_prefix}/man/man1;' \
        -e 's;/usr/local/man/man8;%{l_prefix}/man/man8;' \
        -e 's;/usr/local/lib/nntp_server;%{l_prefix}/etc/nn/nntp_server;' \
        -e 's;/usr/lib/sendmail;%{l_prefix}/sbin/sendmail;' \
        -e 's;\(OWNER[^"]*"\)news\("\);\1%{l_rusr}\2;' \
        -e 's;\(GROUP[^"]*"\)news\("\);\1%{l_rgrp}\2;' \
        config.h-dist config.h
    %{l_make} %{l_mflags} \
        CC="%{l_cc}" all

%install
    rm -rf $RPM_BUILD_ROOT
    %{l_shtool} mkdir -f -p -m 755 \
        $RPM_BUILD_ROOT%{l_prefix}/bin \
        $RPM_BUILD_ROOT%{l_prefix}/etc/nn \
        $RPM_BUILD_ROOT%{l_prefix}/libexec/nn \
        $RPM_BUILD_ROOT%{l_prefix}/man/man1 \
        $RPM_BUILD_ROOT%{l_prefix}/man/man8
    %{l_shtool} subst \
        -e 's;%{l_prefix}/sbin/sendmail -t;/bin/sh;' \
        -e "s;=\"%{l_prefix};=\"$RPM_BUILD_ROOT%{l_prefix};g" \
        -e "s;=%{l_prefix};=$RPM_BUILD_ROOT%{l_prefix};g" \
        inst
    echo "n" | sh ./inst
    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
    rm -rf $RPM_BUILD_ROOT

