Mon, 28 Jan 2013 17:37:18 +0100
Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.
1 ##
2 ## apache.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2000-2012 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: apache
26 Summary: Apache HTTP Server
27 URL: http://httpd.apache.org/
28 Vendor: Apache Software Foundation
29 Packager: OpenPKG Foundation e.V.
30 Distribution: OpenPKG Community
31 Class: BASE
32 Group: Web
33 License: ASF
34 Version: 2.2.22
35 Release: 20120800
37 # package options
38 %option with_mpm_prefork yes
39 %option with_mpm_worker no
40 %option with_mpm_event no
41 %option with_suexec yes
42 %option with_suexec_caller %{l_nusr}
43 %option with_suexec_userdir public_html
44 %option with_mod_deflate no
45 %option with_mod_ext_filter no
46 %option with_mod_substitute no
47 %option with_mod_ssl no
48 %option with_mod_dav no
49 %option with_mod_ldap no
50 %option with_mod_dbd no
51 %option with_mod_proxy no
52 %option with_mod_cache no
53 %option with_mod_diskcache no
54 %option with_mod_memcache no
55 %option with_mod_filecache no
56 %option with_mod_authn_alias no
58 # fixing implicit inter-module dependencies and correlations
59 %if "%{with_mpm_prefork}" == "yes"
60 %undefine with_mpm_worker
61 %undefine with_mpm_event
62 %endif
63 %if "%{with_mpm_worker}" == "yes"
64 %undefine with_mpm_prefork
65 %undefine with_mpm_event
66 %endif
67 %if "%{with_mpm_event}" == "yes"
68 %undefine with_mpm_prefork
69 %undefine with_mpm_worker
70 %endif
71 %if "%{with_mod_memcache}" == "yes" || "%{with_mod_diskcache}" == "yes"
72 %undefine with_mod_cache
73 %define with_mod_cache yes
74 %endif
76 # list of sources
77 Source0: http://www.apache.org/dist/httpd/httpd-%{version}.tar.bz2
78 Source1: rc.apache
79 Source2: apache.base
80 Source3: apache.conf
81 Source4: apache.sh
82 Patch0: apache.patch
83 Patch1: apache.patch.davquo
85 # build information
86 BuildPreReq: OpenPKG, openpkg >= 20100101, perl, make
87 PreReq: OpenPKG, openpkg >= 20100101, perl
88 BuildPreReq: apr, pcre
89 PreReq: apr, pcre
90 %if "%{with_mpm_worker}" == "yes" || "%{with_mpm_event}" == "yes" || "%{with_mod_memcache}" == "yes"
91 BuildPreReq: apr::with_threads = yes
92 PreReq: apr::with_threads = yes
93 %endif
94 %if "%{with_mod_ldap}" == "yes"
95 BuildPreReq: apr::with_ldap = yes
96 PreReq: apr::with_ldap = yes
97 %endif
98 %if "%{with_mod_ssl}" == "yes"
99 BuildPreReq: openssl >= 0.9.8
100 PreReq: openssl >= 0.9.8
101 PreReq: x509
102 %endif
103 %if "%{with_mod_deflate}" == "yes"
104 BuildPreReq: zlib
105 PreReq: zlib
106 %endif
108 %description
109 The Apache Project is a collaborative software development effort
110 aimed at creating a robust, commercial-grade, featureful, and
111 freely-available source code implementation of an HTTP (Web) server.
112 The project is jointly managed by a group of volunteers located
113 around the world, using the Internet and the Web to communicate,
114 plan, and develop the server and its related documentation. These
115 volunteers are known as the Apache Group. In addition, hundreds
116 of users have contributed ideas, code, and documentation to the
117 project.
119 %track
120 prog apache = {
121 version = %{version}
122 url = http://www.apache.org/dist/httpd/
123 regex = httpd-(2\.\d*[02468]\.\d+)\.tar\.(bz2|gz)
124 }
126 %prep
127 # unpack Apache distribution
128 %setup -q -n httpd-%{version}
129 %patch -p0
130 %patch -p0 -P 1
131 %{l_shtool} subst \
132 -e 's;(" PLATFORM ");(%{l_openpkg_release -F "OpenPKG/%%t"});g' \
133 server/core.c
135 %build
136 # configure package
137 ( echo "ac_cv_func_uuid_create=no"
138 ) >config.cache
139 export CC="%{l_cc}"
140 export CFLAGS="%{l_cflags -O}"
141 export CPPFLAGS="%{l_cppflags}"
142 export LDFLAGS="%{l_ldflags}"
143 export LIBS=""
144 case "%{l_platform -t}" in
145 *-sunos* ) LIBS="$LIBS -lrt" ;;
146 esac
147 %if "%{with_mod_ldap}" == "yes"
148 LIBS="$LIBS -lssl -lcrypto"
149 %endif
150 ./configure \
151 --cache-file=./config.cache \
152 --enable-layout=GNU \
153 --prefix=%{l_prefix} \
154 --with-program-name=apache \
155 --sysconfdir=%{l_prefix}/etc/apache \
156 --libexecdir=%{l_prefix}/libexec/apache \
157 --includedir=%{l_prefix}/include/apache \
158 --datadir=%{l_prefix}/share/apache \
159 --localstatedir=%{l_prefix}/var/apache \
160 --with-apr=%{l_prefix}/bin/apr-1-config \
161 --with-apr-util=%{l_prefix}/bin/apu-1-config \
162 --with-pcre=%{l_prefix} \
163 %if "%{with_mpm_prefork}" == "yes"
164 --with-mpm="prefork" \
165 %endif
166 %if "%{with_mpm_worker}" == "yes"
167 --with-mpm="worker" \
168 %endif
169 %if "%{with_mpm_event}" == "yes"
170 --with-mpm="event" \
171 %endif
172 %if "%{with_mpm_worker}" == "yes" || "%{with_mpm_event}" == "yes" || "%{with_mod_memcache}" == "yes"
173 --enable-threads \
174 %else
175 --disable-threads \
176 %endif
177 %if "%{with_suexec}" == "yes"
178 --enable-suexec \
179 --with-suexec-bin=%{l_prefix}/sbin/suexec \
180 --with-suexec-caller=%{with_suexec_caller} \
181 --with-suexec-userdir=%{with_suexec_userdir} \
182 --with-suexec-logfile=%{l_prefix}/var/apache/log/suexec.log \
183 %endif
184 %if "%{with_mod_deflate}" == "yes"
185 --enable-deflate \
186 --with-z=%{l_prefix} \
187 %endif
188 %if "%{with_mod_ext_filter}" == "yes"
189 --enable-ext-filter \
190 %endif
191 %if "%{with_mod_substitute}" == "yes"
192 --enable-substitute \
193 %endif
194 %if "%{with_mod_ssl}" == "yes"
195 --enable-ssl \
196 --with-ssl=%{l_prefix} \
197 %endif
198 %if "%{with_mod_dav}" == "yes"
199 --enable-dav \
200 --enable-dav-fs \
201 --enable-dav-lock \
202 %endif
203 %if "%{with_mod_ldap}" == "yes"
204 --enable-ldap \
205 --enable-authnz-ldap \
206 %endif
207 %if "%{with_mod_dbd}" == "yes"
208 --enable-dbd \
209 --enable-authn-dbd \
210 %endif
211 %if "%{with_mod_proxy}" == "yes"
212 --enable-proxy \
213 --enable-proxy-connect \
214 --enable-proxy-http \
215 --enable-proxy-ftp \
216 --enable-proxy-ajp \
217 --enable-proxy-balancer \
218 %endif
219 %if "%{with_mod_cache}" == "yes"
220 --enable-cache \
221 %if "%{with_mod_diskcache}" == "yes"
222 --enable-disk-cache \
223 %endif
224 %if "%{with_mod_memcache}" == "yes"
225 --enable-mem-cache \
226 %endif
227 %endif
228 %if "%{with_mod_filecache}" == "yes"
229 --enable-file-cache \
230 %endif
231 %if "%{with_mod_authn_alias}" == "yes"
232 --enable-authn-alias \
233 %endif
234 --enable-filter \
235 --enable-reqtimeout \
236 --enable-usertrack \
237 --enable-expires \
238 --enable-so \
239 --enable-speling \
240 --enable-rewrite \
241 --enable-headers \
242 --enable-info \
243 --enable-mime-magic \
244 --enable-vhost-alias \
245 --enable-auth-digest \
246 --enable-auth-dbm \
247 --enable-authz-dbm \
248 --enable-authz-owner \
249 --enable-unique-id \
250 --enable-logio \
251 --disable-shared
253 # build package
254 %{l_make} %{l_mflags}
256 %install
257 # install package
258 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
260 # create additional directories
261 %{l_shtool} mkdir -f -p -m 755 \
262 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
263 $RPM_BUILD_ROOT%{l_prefix}/etc/apache/apache.d \
264 $RPM_BUILD_ROOT%{l_prefix}/var/apache/run/apache.dav \
265 $RPM_BUILD_ROOT%{l_prefix}/var/apache/run/apache.cache
267 # adjust GNU libtool configuration for apxs(1) runtime
268 %{l_shtool} install -c -m 755 \
269 -e 's;^build_libtool_libs=no;build_libtool_libs=yes;' \
270 %{l_prefix}/share/apr/build-1/libtool \
271 $RPM_BUILD_ROOT%{l_prefix}/share/apache/build/libtool
273 # install shell environment script
274 %{l_shtool} install -c -m 644 %{l_value -s -a} \
275 -e 's;@l_path@;%{l_build_path};' \
276 -e 's;@l_ld_library_path@;%{l_build_ldlp};' \
277 %{SOURCE apache.sh} \
278 $RPM_BUILD_ROOT%{l_prefix}/etc/apache/
280 # create default configuration
281 l_hostname=`%{l_shtool} echo -e %h`
282 l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
283 %{l_shtool} install -c -m 644 %{l_value -s -a} \
284 -e "s;@l_hostname@;$l_hostname;g" \
285 -e "s;@l_domainname@;$l_domainname;g" \
286 %{SOURCE apache.base} \
287 %{SOURCE apache.conf} \
288 $RPM_BUILD_ROOT%{l_prefix}/etc/apache/
289 mv $RPM_BUILD_ROOT%{l_prefix}/etc/apache/magic \
290 $RPM_BUILD_ROOT%{l_prefix}/etc/apache/mime.magic
292 # install run-command script
293 %{l_shtool} install -c -m 755 %{l_value -s -a} \
294 -e 's;@with_mod_filecache@;%{with_mod_filecache};g' \
295 %{SOURCE rc.apache} \
296 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
298 # strip down installation
299 find $RPM_BUILD_ROOT%{l_prefix}/share/apache -name "*.orig" -print | xargs rm -f
300 rm -f $RPM_BUILD_ROOT%{l_prefix}/share/apache/htdocs/apache_pb*
301 rm -rf $RPM_BUILD_ROOT%{l_prefix}/etc/apache/{extra,original}
302 rm -rf $RPM_BUILD_ROOT%{l_prefix}/libexec/apache
303 rm -f $RPM_BUILD_ROOT%{l_prefix}/cgi/test-cgi
304 strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
305 strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
306 ( cd $RPM_BUILD_ROOT%{l_prefix}/share/apache/manual
307 find . -name "*.xml" -print | xargs rm -f
308 find . -name "*.xml.*" -print | xargs rm -f
309 find . -name "*.xsl" -print | xargs rm -f
310 rm -rf style/xsl
311 rm -rf style/latex
312 ) || exit $?
314 # determine installation files
315 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
316 %{l_files_std} \
317 %if "%{with_suexec}" == "yes"
318 '%attr(4755,%{l_susr},%{l_mgrp}) %{l_prefix}/sbin/suexec' \
319 %endif
320 '%config %{l_prefix}/etc/apache/*' \
321 '%config %attr(444,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/apache/apache.base' \
322 '%dir %attr(750,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/apache/run/apache.dav' \
323 '%dir %attr(750,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/apache/run/apache.cache'
325 %files -f files
327 %clean
329 %post
330 # after upgrade, restart service
331 [ $1 -eq 2 ] || exit 0
332 eval `%{l_rc} apache status 2>/dev/null`
333 [ ".$apache_active" = .yes ] && %{l_rc} apache restart
334 exit 0
336 %preun
337 # before erase, stop service and remove log files
338 [ $1 -eq 0 ] || exit 0
339 %{l_rc} apache stop 2>/dev/null
340 rm -f $RPM_INSTALL_PREFIX/var/apache/log/* >/dev/null 2>&1 || true
341 rm -f $RPM_INSTALL_PREFIX/var/apache/run/*/* >/dev/null 2>&1 || true
342 rm -f $RPM_INSTALL_PREFIX/var/apache/run/* >/dev/null 2>&1 || true
343 exit 0