##
##  ypanything.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:         ypanything
Summary:      NIS/YP Server for Arbitrary Data Sources
URL:          http://www.radux.com/ypAnything/
Vendor:       Jeff McElroy
Packager:     OpenPKG Project
Distribution: OpenPKG Community
Class:        EVAL
Group:        Networking
License:      GPL
Version:      1.1
Release:      20080101

#   list of sources
Source0:      http://download.sourceforge.net/ypanything/ypanything-%{version}.tar.gz
Source1:      rc.ypanything
Source2:      ypanything.conf
Source3:      ypanything.passwd.sh
Source4:      ypanything.passwd.pl
Source5:      ypanything.group.sh
Source6:      ypanything.group.pl
Patch0:       ypanything.patch

#   build information
BuildPreReq:  OpenPKG, openpkg >= 20160101, gcc, flex, bison
PreReq:       OpenPKG, openpkg >= 20160101, perl

%description
    ypAnything is a NIS/YP gateway to non-NIS/YP data sources. This
    allows one to publish data from an LDAP Directory or an RDBMS via
    NIS/YP.

%track
    prog ypanything = {
        version   = %{version}
        url       = http://sourceforge.net/projects/ypanything/files/
        regex     = ypanything-(__VER__)\.tar\.gz
    }

%prep
    %setup -q
    %patch -p0
    rm -f ypanything

%build
    cd src
    %{l_make} %{l_mflags} \
        CC="%{l_cc} %{l_cflags -O}"

%install
    %{l_shtool} mkdir -f -p -m 755 \
        $RPM_BUILD_ROOT%{l_prefix}/sbin \
        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
        $RPM_BUILD_ROOT%{l_prefix}/etc/ypanything \
        $RPM_BUILD_ROOT%{l_prefix}/var/ypanything
    %{l_shtool} install -c -s -m 755 \
        ypanything $RPM_BUILD_ROOT%{l_prefix}/sbin/
    %{l_shtool} install -c -m 755 %{l_value -s -a} \
        %{SOURCE rc.ypanything} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
    %{l_shtool} install -c -m 644 %{l_value -s -a} \
        %{SOURCE ypanything.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/ypanything/
    %{l_shtool} install -c -m 700 %{l_value -s -a} \
        %{SOURCE ypanything.passwd.sh} %{SOURCE ypanything.passwd.pl} \
        %{SOURCE ypanything.group.sh} %{SOURCE ypanything.group.pl} \
        $RPM_BUILD_ROOT%{l_prefix}/etc/ypanything/
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
        %{l_files_std} \
        '%config %{l_prefix}/etc/ypanything/*'

%files -f files

%clean

