Fri, 16 Jan 2009 10:58:21 +0100
Correct and improve code logic, buildconf, and packaging. In particular:
1. Use descriptive variable names <var>libs instead of just <var>.
2. Although Nokia states in all Qt builds that 'NOTE: When linking
against OpenSSL, you can override the default library names
through OPENSSL_LIBS.' and even gives an example, their own
configuration logic rejects such an attempt. Correct this by
hard coding the OpenSSL library string in the configure script.
3. Consistently use the whitespace substitution [\t ] throughout.
4. Patch the buggy INCPATH of SQL plugin Qmake project files.
5. Add the 'x11' configuration variable to the qtconfig Qmake
project using the src/gui/gui.pro file as a model. This is
needed for qtconfig although not in other tools, because
the qtconfig buildconf indirectly includes qt_x11_p.h which
is dependent on X11 headers.
6. Avoid 'ld.so: fatal: hardware capability unsupported: SSE2 AMD_3DNow'
on platforms for which the config.tests/unix/[3dnow|sse2] succeed
although unsopported at run time by testing for the x86-64
instruction set at build time and regulating hardware capabilities.
7. Correctly install the desinger plugin by explicitly building it.
8. Remove custom plugin installation logic which is unnecessary.
9. Correct removal of temporary paths from shared object files.
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