dhcpd/dhcpd.spec

Tue, 29 Mar 2011 20:04:34 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 29 Mar 2011 20:04:34 +0200
changeset 334
4a34d7a82eab
parent 13
cb59d6afeb61
child 354
4ca17af53013
permissions
-rw-r--r--

Rework package yet again, correcting and introducing new buildconf logic:
Conditionally disable bootstrap stage comparison correctly, correct
english grammar, better find system as(1) and ld(1), indotruce detailed
optimization option messages, more completely guess cpu types, allow
profiled bootstrapping without a preinstalled GCC because many other
compilers have long since implemented 64-bit arithmetic, instruct make
to build sequentially (not in sparallel) when building a profiled
bootstrap as GCC online documents recommend, and generally improve
comment blocks.

The single most important correction in this changeset relates to the
GCC changed optimization policy since at least GCC 4.5, in which -march
is always passed and not always correctly guessed. In the case of this
package, allowing GCC to guess the architecture leads to wild build
errors at various subcomponents (zlib, libgcc, libiberty...) and
bootstrap stages. It seems quite platform specific, and the safest
approach to correcting this seems to be explicitly always specifying the
-march argument when bootstrapping GCC. Because the best choice 'native'
is not available when bootstrapping using a foreign (non GCC) compiler,
a guess is made according to rpmmacros l_platform in that case.

It is questionable as to whether these recent optimization changes
on the part of GCC or this package are compatible with each other,
or if either are complete or correct at all. At least applying these
corrections allows this package to build again in most cases test.

     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:      20090105
    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     %{l_shtool} subst \
    79         -e 's;struct option\([, )]\);struct option_dhcpd\1;g' \
    80         includes/*.h \
    81         client/*.c \
    82         common/*.c \
    83         server/*.c
    84     CC="%{l_cc}" \
    85     CFLAGS="%{l_cflags -O}" \
    86     CPPFLAGS="%{l_cppflags} -DNOMINUM" \
    87     LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \
    88     LIBS="%{l_fsl_libs}" \
    89     ./configure \
    90         --prefix=%{l_prefix} \
    91         --mandir=%{l_prefix}/man \
    92         --sysconfdir=%{l_prefix}/etc/dhcpd \
    93         --localstatedir=%{l_prefix}/var/dhcpd \
    94         --disable-dhcpv6 \
    95         --with-srv-lease-file=%{l_prefix}/var/dhcpd/db/dhcpd.leases \
    96         --with-cli-lease-file=%{l_prefix}/var/dhcpd/db/dhclient.leases \
    97         --with-srv-pid-file=%{l_prefix}/var/dhcpd/run/dhcpd.pid \
    98         --with-cli-pid-file=%{l_prefix}/var/dhcpd/run/dhclient.pid \
    99         --with-relay-pid-file=%{l_prefix}/var/dhcpd/run/dhrelay.pid
   101     #   build program
   102     %{l_make} %{l_mflags}
   104 %install
   105     #   install program
   106     rm -rf $RPM_BUILD_ROOT
   107     %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
   109     #   install default configuration
   110     %{l_shtool} install -c -m 644 \
   111         %{SOURCE dhcpd.conf} \
   112         $RPM_BUILD_ROOT%{l_prefix}/etc/dhcpd/dhcpd.conf
   114     #   post-adjust and strip down installation
   115     rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/dhclient-script
   116     rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/dhclient-script.8
   117     strip $RPM_BUILD_ROOT%{l_prefix}/bin/*  2>/dev/null || true
   118     strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2>/dev/null || true
   120     #   install run-command script
   121     %{l_shtool} mkdir -f -p -m 755 \
   122         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   123     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   124         %{SOURCE rc.dhcpd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   126     #   install OSSP fsl configuration
   127     %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
   128     %{l_shtool} install -c -m 644 %{l_value -s -a} \
   129         %{SOURCE fsl.dhcpd} \
   130         $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
   132     #   create run-time directories
   133     %{l_shtool} mkdir -f -p -m 755 \
   134         $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/db \
   135         $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/run \
   136         $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/log
   138     #   determine installation files
   139     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   140         %{l_files_std} \
   141         '%config %{l_prefix}/etc/fsl/fsl.dhcpd' \
   142         '%config %{l_prefix}/etc/dhcpd/*'
   144 %files -f files
   146 %clean
   147     rm -rf $RPM_BUILD_ROOT
   149 %post
   150     if [ $1 -eq 1 ]; then
   151         #   display final hints on initial installation
   152         ( echo "Before starting DHCP daemon, please set the configuration variable"
   153           echo "\"dhcpd_if\" in $RPM_INSTALL_PREFIX/etc/rc.conf to the name of the"
   154           echo "used network interface."
   155         ) | %{l_rpmtool} msg -b -t notice
   156     fi
   158     #   after upgrade, restart service
   159     [ $1 -eq 2 ] || exit 0
   160     eval `%{l_rc} dhcpd status 2>/dev/null`
   161     [ ".$dhcpd_active" = .yes ] && %{l_rc} dhcpd restart
   162     exit 0
   164 %preun
   165     #   before erase, stop service and remove log files
   166     [ $1 -eq 0 ] || exit 0
   167     %{l_rc} dhcpd stop 2>/dev/null
   168     rm -f $RPM_INSTALL_PREFIX/var/dhcpd/db/*  >/dev/null 2>&1 || true
   169     rm -f $RPM_INSTALL_PREFIX/var/dhcpd/run/* >/dev/null 2>&1 || true
   170     exit 0

mercurial