dhcpd/dhcpd.spec

Tue, 06 Jan 2009 23:43:55 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2009 23:43:55 +0100
changeset 15
0b0ffb65d705
child 17
dabc4f22486f
permissions
-rw-r--r--

Replace imake with xmkmf for portability across X11 installations.

     1 ##
     2 ##  dhcpd.spec -- OpenPKG RPM Package Specification
     3 ##  Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/>
     4 ##
     5 ##  Permission to use, copy, modify, and distribute this software for
     6 ##  any purpose with or without fee is hereby granted, provided that
     7 ##  the above copyright notice and this permission notice appear in all
     8 ##  copies.
     9 ##
    10 ##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    11 ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    12 ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    13 ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    14 ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    15 ##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    16 ##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    17 ##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    18 ##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    19 ##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    20 ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    21 ##  SUCH DAMAGE.
    22 ##
    24 #   package information
    25 Name:         dhcpd
    26 Summary:      DHCP Daemon
    27 URL:          http://www.isc.org/products/DHCP/
    28 Vendor:       Internet Software Consortium
    29 Packager:     OpenPKG Foundation e.V.
    30 Distribution: OpenPKG Community
    31 Class:        BASE
    32 Group:        DHCP
    33 License:      ISC/BSD
    34 Version:      4.1.0
    35 Release:      20081220
    37 #   package options
    38 %option       with_fsl  yes
    40 #   list of sources
    41 Source0:      ftp://ftp.isc.org/isc/dhcp/dhcp-%{version}.tar.gz
    42 Source1:      dhcpd.conf
    43 Source2:      rc.dhcpd
    44 Source3:      fsl.dhcpd
    46 #   build information
    47 Prefix:       %{l_prefix}
    48 BuildRoot:    %{l_buildroot}
    49 BuildPreReq:  OpenPKG, openpkg >= 20060823
    50 PreReq:       OpenPKG, openpkg >= 20060823
    51 %if "%{with_fsl}" == "yes"
    52 BuildPreReq:  fsl
    53 PreReq:       fsl
    54 %endif
    55 AutoReq:      no
    56 AutoReqProv:  no
    58 %description
    59     This is the ISC DHCP daemon reference implementation.
    61 %track
    62     prog dhcpd = {
    63         version   = %{version}
    64         url       = ftp://ftp.isc.org/isc/dhcp/
    65         regex     = dhcp-(\d+\.\d+\.\d+)\.tar\.gz
    66     }
    68 %prep
    69     %setup -q -n dhcp-%{version}
    71 %build
    72     #   configure program
    73     %{l_shtool} subst \
    74         -e 's;^[^#]*\(#define[^_]*_PATH_DHCPD_PID[^"]*\).*;\1 "%{l_prefix}/var/dhcpd/run/dhcpd.pid";' \
    75         -e 's;^[^#]*\(#define[^_]*_PATH_DHCPD_DB[^"]*\).*;\1 "%{l_prefix}/var/dhcpd/db/dhcpd.leases";' \
    76         -e 's;^[^#]*\(#define[^_]*_PATH_DHCPD_CONF[^"]*\).*;\1 "%{l_prefix}/etc/dhcpd/dhcpd.conf";' \
    77         includes/site.h
    78     CC="%{l_cc}" \
    79     CFLAGS="%{l_cflags -O}" \
    80     CPPFLAGS="%{l_cppflags} -DNOMINUM" \
    81     LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \
    82     LIBS="%{l_fsl_libs}" \
    83     ./configure \
    84         --prefix=%{l_prefix} \
    85         --mandir=%{l_prefix}/man \
    86         --sysconfdir=%{l_prefix}/etc/dhcpd \
    87         --localstatedir=%{l_prefix}/var/dhcpd \
    88         --with-srv-lease-file=%{l_prefix}/var/dhcpd/db/dhcpd.leases \
    89         --with-cli-lease-file=%{l_prefix}/var/dhcpd/db/dhclient.leases \
    90         --with-srv-pid-file=%{l_prefix}/var/dhcpd/run/dhcpd.pid \
    91         --with-cli-pid-file=%{l_prefix}/var/dhcpd/run/dhclient.pid \
    92         --with-relay-pid-file=%{l_prefix}/var/dhcpd/run/dhrelay.pid
    94     #   build program
    95     %{l_make} %{l_mflags}
    97 %install
    98     #   install program
    99     rm -rf $RPM_BUILD_ROOT
   100     %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
   102     #   install default configuration
   103     %{l_shtool} install -c -m 644 \
   104         %{SOURCE dhcpd.conf} \
   105         $RPM_BUILD_ROOT%{l_prefix}/etc/dhcpd/dhcpd.conf
   107     #   post-adjust and strip down installation
   108     rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/dhclient-script
   109     rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/dhclient-script.8
   110     strip $RPM_BUILD_ROOT%{l_prefix}/bin/*  2>/dev/null || true
   111     strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2>/dev/null || true
   113     #   install run-command script
   114     %{l_shtool} mkdir -f -p -m 755 \
   115         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   116     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   117         %{SOURCE rc.dhcpd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   119     #   install OSSP fsl configuration
   120     %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
   121     %{l_shtool} install -c -m 644 %{l_value -s -a} \
   122         %{SOURCE fsl.dhcpd} \
   123         $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
   125     #   create run-time directories
   126     %{l_shtool} mkdir -f -p -m 755 \
   127         $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/db \
   128         $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/run \
   129         $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/log
   131     #   determine installation files
   132     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   133         %{l_files_std} \
   134         '%config %{l_prefix}/etc/fsl/fsl.dhcpd' \
   135         '%config %{l_prefix}/etc/dhcpd/*'
   137 %files -f files
   139 %clean
   140     rm -rf $RPM_BUILD_ROOT
   142 %post
   143     if [ $1 -eq 1 ]; then
   144         #   display final hints on initial installation
   145         ( echo "Before starting DHCP daemon, please set the configuration variable"
   146           echo "\"dhcpd_if\" in $RPM_INSTALL_PREFIX/etc/rc.conf to the name of the"
   147           echo "used network interface."
   148         ) | %{l_rpmtool} msg -b -t notice
   149     fi
   151     #   after upgrade, restart service
   152     [ $1 -eq 2 ] || exit 0
   153     eval `%{l_rc} dhcpd status 2>/dev/null`
   154     [ ".$dhcpd_active" = .yes ] && %{l_rc} dhcpd restart
   155     exit 0
   157 %preun
   158     #   before erase, stop service and remove log files
   159     [ $1 -eq 0 ] || exit 0
   160     %{l_rc} dhcpd stop 2>/dev/null
   161     rm -f $RPM_INSTALL_PREFIX/var/dhcpd/db/*  >/dev/null 2>&1 || true
   162     rm -f $RPM_INSTALL_PREFIX/var/dhcpd/run/* >/dev/null 2>&1 || true
   163     exit 0

mercurial