apache.spec 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. ##
  2. ## apache.spec -- RPM Specification for Apache
  3. ## Copyright (c) 2000-2002 Cable & Wireless Deutschland GmbH
  4. ## Copyright (c) 2000-2002 The OpenPKG Project <http://www.openpkg.org/>
  5. ## Copyright (c) 2000-2002 Ralf S. Engelschall <rse@engelschall.com>
  6. ##
  7. ## Permission to use, copy, modify, and distribute this software for
  8. ## any purpose with or without fee is hereby granted, provided that
  9. ## the above copyright notice and this permission notice appear in all
  10. ## copies.
  11. ##
  12. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  13. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  15. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  16. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  18. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  19. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  20. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  21. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23. ## SUCH DAMAGE.
  24. ##
  25. ## ATTENTION: This package specification is a cruel one. It allows
  26. ## one to build an Apache package in hundreds of variants with just
  27. ## a single specification through the use of lots of condition
  28. ## variables. The reason for this attempt is that it was born out of
  29. ## the needs from the daily practice at an ISP. So do not treat this
  30. ## specification as a reference example of any kind, except perhaps as
  31. ## a example of what is maximum possible with RPM and how far one can
  32. ## go with the macro mechanism. But do not try to repeat this!
  33. # the additionally used Apache modules (can be enabled without thinking)
  34. %{!?with_mod_ssl: %define with_mod_ssl no}
  35. %{!?with_mod_perl: %define with_mod_perl no}
  36. %{!?with_mod_php: %define with_mod_php no}
  37. %{!?with_mod_dav: %define with_mod_dav no}
  38. %{!?with_mod_layout: %define with_mod_layout no}
  39. %{!?with_mod_macro: %define with_mod_macro no}
  40. # the additionally used Apache modules (you have to know what you do)
  41. %{!?with_mod_auth_pam: %define with_mod_auth_pam no}
  42. %{!?with_mod_gzip: %define with_mod_gzip no}
  43. %{!?with_mod_zmod: %define with_mod_zmod no}
  44. %{!?with_mod_fastcgi: %define with_mod_fastcgi no}
  45. %{!?with_mod_throttle: %define with_mod_throttle no}
  46. %{!?with_mod_access_referer: %define with_mod_access_referer no}
  47. %{!?with_mod_roaming: %define with_mod_roaming no}
  48. %{!?with_mod_relocate: %define with_mod_relocate no}
  49. # more optional settings
  50. # (requires "with_mod_php" set to "yes" above!)
  51. %{!?with_mod_php_mysql: %define with_mod_php_mysql no}
  52. %{!?with_mod_php_gd: %define with_mod_php_gd no}
  53. %{!?with_mod_php_db: %define with_mod_php_db no}
  54. %{!?with_mod_php_pdflib: %define with_mod_php_pdflib no}
  55. %{!?with_mod_php_zlib: %define with_mod_php_zlib no}
  56. %{!?with_mod_php_bzip2: %define with_mod_php_bzip2 no}
  57. %{!?with_mod_php_openssl: %define with_mod_php_openssl no}
  58. %{!?with_mod_php_openldap: %define with_mod_php_openldap no}
  59. %{!?with_mod_php_mm: %define with_mod_php_mm no}
  60. %{!?with_mod_php_pcre: %define with_mod_php_pcre no}
  61. %{!?with_mod_php_ftp: %define with_mod_php_ftp no}
  62. %{!?with_mod_php_java: %define with_mod_php_java no}
  63. %{!?with_mod_php_oci8: %define with_mod_php_oci8 no}
  64. # fixing implicit inter-module dependencies and correlations
  65. %if "%{with_mod_php}" == "yes"
  66. %if "%{with_mod_ssl}" == "yes"
  67. %define with_php_openssl yes
  68. %define with_php_mm yes
  69. %endif
  70. %if "%{with_mod_php_mysql}" == "yes"
  71. %define with_php_zlib yes
  72. %endif
  73. %endif
  74. # package component versions
  75. %define V_apache 1.3.23
  76. %define V_mod_ssl 2.8.7
  77. %define V_mod_perl 1.26
  78. %define V_mod_php 4.1.2
  79. %define V_mod_dav 1.0.3-1.3.6
  80. %define V_mod_layout 3.1.4
  81. %define V_mod_macro 1.1.2
  82. %define V_mod_auth_pam 1.0a
  83. %define V_mod_gzip 1.3.19.1a
  84. %define V_mod_zmod 2_3
  85. %define V_mod_fastcgi 2.2.12
  86. %define V_mod_throttle 312
  87. %define V_mod_access_referer 1.0.2
  88. %define V_mod_roaming 1.0.2
  89. %define V_mod_relocate 1.0
  90. # package information
  91. Name: apache
  92. Summary: Apache HTTP Server
  93. URL: http://httpd.apache.org/
  94. Vendor: Apache Software Foundation
  95. Packager: The OpenPKG Project
  96. Distribution: OpenPKG [REL]
  97. Group: Web
  98. License: ASF
  99. Version: %{V_apache}
  100. Release: 20020320
  101. # list of sources
  102. Source0: http://httpd.apache.org/dist/httpd/apache_%{V_apache}.tar.gz
  103. Source1: http://www.modssl.org/source/mod_ssl-%{V_mod_ssl}-%{V_apache}.tar.gz
  104. Source2: http://perl.apache.org/dist/mod_perl-%{V_mod_perl}.tar.gz
  105. Source3: http://www.php.net/distributions/php-%{V_mod_php}.tar.gz
  106. Source4: http://www.webdav.org/mod_dav/mod_dav-%{V_mod_dav}.tar.gz
  107. Source5: ftp://ftp.tangent.org/pub/apache/mod_layout-%{V_mod_layout}.tar.gz
  108. Source6: http://www.cri.ensmp.fr/~coelho/mod_macro/mod_macro-%{V_mod_macro}.tar.gz
  109. Source7: http://pam.sourceforge.net/mod_auth_pam/mod_auth_pam.tar.gz
  110. Source8: http://www.remotecommunications.com/apache/mod_gzip/src/%{V_mod_gzip}/mod_gzip.c
  111. Source9: http://www.ivw.de/???/src.apapi.FIN%{V_mod_zmod}.tar.gz
  112. Source10: http://www.fastcgi.com/dist/mod_fastcgi-%{V_mod_fastcgi}.tar.gz
  113. Source11: http://www.snert.com/Software/mod_throttle/mod_throttle%{V_mod_throttle}.tgz
  114. Source12: http://download.sourceforge.net/accessreferer/mod_access_referer-%{V_mod_access_referer}.tar.gz
  115. Source13: http://www.klomp.org/mod_roaming/mod_roaming-%{V_mod_roaming}.tar.gz
  116. Source14: http://www.tangent.org/mod_relocate/mod_relocate-%{V_mod_relocate}.tar.gz
  117. Source20: apache.conf
  118. Source21: apache.base
  119. Source22: apache.vhost
  120. Source23: rc.apache
  121. # build information
  122. Prefix: %{l_prefix}
  123. BuildRoot: %{l_buildroot}
  124. BuildPreReq: openpkg >= 20020222
  125. PreReq: openpkg >= 20020222
  126. %if "%{with_mod_ssl}" == "yes"
  127. BuildPreReq: openssl, mm
  128. %endif
  129. %if "%{with_mod_perl}" == "yes"
  130. BuildPreReq: perl
  131. PreReq: perl
  132. %endif
  133. %if "%{with_mod_php}" == "yes"
  134. BuildPreReq: make, bison, flex
  135. %if "%{with_mod_php_mysql}" == "yes"
  136. BuildPreReq: mysql
  137. %endif
  138. %if "%{with_mod_php_gd}" == "yes"
  139. BuildPreReq: gd
  140. %endif
  141. %if "%{with_mod_php_db}" == "yes"
  142. BuildPreReq: db
  143. %endif
  144. %if "%{with_mod_php_pdflib}" == "yes"
  145. BuildPreReq: pdflib, zlib
  146. %endif
  147. %if "%{with_mod_php_zlib}" == "yes"
  148. BuildPreReq: zlib
  149. %endif
  150. %if "%{with_mod_php_bzip2}" == "yes"
  151. BuildPreReq: bzip2
  152. %endif
  153. %if "%{with_mod_php_openssl}" == "yes"
  154. BuildPreReq: openssl
  155. %endif
  156. %if "%{with_mod_php_openldap}" == "yes"
  157. BuildPreReq: openldap, openssl
  158. %endif
  159. %if "%{with_mod_php_mm}" == "yes"
  160. BuildPreReq: mm
  161. %endif
  162. %if "%{with_mod_php_pcre}" == "yes"
  163. BuildPreReq: pcre
  164. %endif
  165. %if "%{with_mod_php_java}" == "yes"
  166. BuildPreReq: jdk-sun
  167. %endif
  168. %endif
  169. %if "%{with_mod_auth_pam}" == "yes"
  170. BuildPreReq: PAM
  171. PreReq: PAM
  172. %endif
  173. AutoReq: no
  174. AutoReqProv: no
  175. %description
  176. The Apache Project is a collaborative software development effort
  177. aimed at creating a robust, commercial-grade, featureful, and
  178. freely-available source code implementation of an HTTP (Web) server.
  179. The project is jointly managed by a group of volunteers located
  180. around the world, using the Internet and the Web to communicate,
  181. plan, and develop the server and its related documentation. These
  182. volunteers are known as the Apache Group. In addition, hundreds
  183. of users have contributed ideas, code, and documentation to the
  184. project.
  185. Options (additional modules I):
  186. with_mod_ssl=%{with_mod_ssl} with_mod_perl=%{with_mod_perl} with_mod_php=%{with_mod_php}
  187. with_mod_dav=%{with_mod_dav} with_mod_layout=%{with_mod_layout} with_mod_macro=%{with_mod_macro}
  188. Options (additional modules II):
  189. with_mod_auth_pam=%{with_mod_auth_pam} with_mod_gzip=%{with_mod_gzip} with_mod_zmod=%{with_mod_zmod}
  190. with_mod_fastcgi=%{with_mod_fastcgi} with_mod_throttle=%{with_mod_throttle} with_mod_access_referer=%{with_mod_access_referer}
  191. with_mod_roaming=%{with_mod_roaming} with_mod_relocate=%{with_mod_relocate}
  192. Options (additional extensions for mod_php):
  193. with_mod_php_mysql=%{with_mod_php_mysql} with_mod_php_gd=%{with_mod_php_gd} with_mod_php_db=%{with_mod_php_db}
  194. with_mod_php_pdflib=%{with_mod_php_pdflib} with_mod_php_zlib=%{with_mod_php_zlib} with_mod_php_bzip2=%{with_mod_php_bzip2}
  195. with_mod_php_openssl=%{with_mod_php_openssl} with_mod_php_openldap=%{with_mod_php_openldap} with_mod_php_mm=%{with_mod_php_mm}
  196. with_mod_php_pcre=%{with_mod_php_pcre} with_mod_php_ftp=%{with_mod_php_ftp} with_mod_php_java=%{with_mod_php_java}
  197. with_mod_php_oci8=%{with_mod_php_oci8}
  198. %prep
  199. # unpack Apache distribution
  200. %setup0 -q -c
  201. # unpack optional extension modules
  202. %if "%{with_mod_ssl}" == "yes"
  203. %setup1 -q -T -D -a 1
  204. %endif
  205. %if "%{with_mod_perl}" == "yes"
  206. %setup2 -q -T -D -a 2
  207. %endif
  208. %if "%{with_mod_php}" == "yes"
  209. %setup3 -q -T -D -a 3
  210. %endif
  211. %if "%{with_mod_dav}" == "yes"
  212. %setup4 -q -T -D -a 4
  213. %endif
  214. %if "%{with_mod_layout}" == "yes"
  215. %setup5 -q -T -D -a 5
  216. %endif
  217. %if "%{with_mod_macro}" == "yes"
  218. %setup6 -q -T -D -a 6
  219. %endif
  220. %if "%{with_mod_auth_pam}" == "yes"
  221. %setup7 -q -T -D -a 7
  222. %endif
  223. %if "%{with_mod_zmod}" == "yes"
  224. %setup9 -q -T -D -a 9
  225. %endif
  226. %if "%{with_mod_fastcgi}" == "yes"
  227. %setup10 -q -T -D -a 10
  228. %endif
  229. %if "%{with_mod_throttle}" == "yes"
  230. %setup11 -q -T -D -a 11
  231. %endif
  232. %if "%{with_mod_access_referer}" == "yes"
  233. %setup12 -q -T -D -a 12
  234. %endif
  235. %if "%{with_mod_roaming}" == "yes"
  236. %setup13 -q -T -D -a 13
  237. %endif
  238. %if "%{with_mod_relocate}" == "yes"
  239. %setup14 -q -T -D -a 14
  240. %endif
  241. %build
  242. # prepare environment
  243. PATH="%{l_prefix}/bin:%{l_prefix}/sbin:$PATH"; export PATH
  244. rm -rf $RPM_BUILD_ROOT
  245. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}
  246. # optionally prepare mod_ssl
  247. %if "%{with_mod_ssl}" == "yes"
  248. ( cd mod_ssl-%{V_mod_ssl}-%{V_apache}
  249. ./configure \
  250. --with-apache=../apache_%{V_apache} \
  251. --expert
  252. )
  253. %endif
  254. # optionally pre-configure Apache for mod_php and mod_dav
  255. %if "%{with_mod_php}" == "yes" || "%{with_mod_dav}" == "yes"
  256. ( cd apache_%{V_apache}
  257. CC="%{l_cc}" \
  258. CFLAGS="%{l_cflags -O}" \
  259. ./configure \
  260. %if "%{with_mod_ssl}" == "yes"
  261. --enable-rule=EAPI \
  262. %endif
  263. --target=apache \
  264. --with-layout=GNU \
  265. --prefix=%{l_prefix} \
  266. --sbindir=%{l_prefix}/sbin \
  267. --sysconfdir=%{l_prefix}/etc/apache \
  268. --libexecdir=%{l_prefix}/lib/apache \
  269. --datadir=%{l_prefix}/share/apache \
  270. --localstatedir=%{l_prefix}/var/apache
  271. )
  272. %endif
  273. # optionally prepare mod_perl
  274. %if "%{with_mod_perl}" == "yes"
  275. ( cd mod_perl-%{V_mod_perl}
  276. eval `%{l_prefix}/bin/perl -V:archname`
  277. eval `%{l_prefix}/bin/perl -V:version`
  278. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/bin
  279. perl=$RPM_BUILD_ROOT%{l_prefix}/bin/perl
  280. echo "#!/bin/sh" >$perl
  281. echo "exec %{l_prefix}/bin/perl \\" >>$perl
  282. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/${version} \\" >>$perl
  283. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/${version}/${archname} \\" >>$perl
  284. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/site_perl \\" >>$perl
  285. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/site_perl/${version} \\" >>$perl
  286. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/site_perl/${version}/${archname} \\" >>$perl
  287. echo " \"\$@\"" >>$perl
  288. chmod a+x $perl
  289. $perl Makefile.PL \
  290. PREFIX=$RPM_BUILD_ROOT%{l_prefix} \
  291. APACHE_SRC=../apache_%{V_apache}/src \
  292. DO_HTTPD=1 \
  293. USE_APACI=1 \
  294. PREP_HTTPD=1 \
  295. EVERYTHING=1 \
  296. PERL_TIE_TABLES=1 \
  297. PERL_DIRECTIVE_HANDLERS=1
  298. %{l_make} %{l_mflags}
  299. %{l_make} %{l_mflags} install
  300. mkdir $RPM_BUILD_ROOT%{l_prefix}/perl5
  301. mv $RPM_BUILD_ROOT%{l_prefix}/lib/* $RPM_BUILD_ROOT%{l_prefix}/perl5/
  302. mv $RPM_BUILD_ROOT%{l_prefix}/perl5 $RPM_BUILD_ROOT%{l_prefix}/lib/
  303. %{l_shtool} subst -e "s;^\\(PERL = \\).*;\\1 $perl;" \
  304. ../apache_%{V_apache}/src/modules/perl/mod_perl.config
  305. )
  306. %endif
  307. # optionally prepare mod_php
  308. %if "%{with_mod_php}" == "yes"
  309. ( cd php-%{V_mod_php}
  310. CC="%{l_cc}" \
  311. %if "%{with_mod_ssl}" == "yes"
  312. CFLAGS="%{l_cflags -O} -I%{l_prefix}/include -DEAPI" \
  313. %else
  314. CFLAGS="%{l_cflags -O} -I%{l_prefix}/include" \
  315. %endif
  316. CPPFLAGS="%{l_cflags -O} -I%{l_prefix}/include" \
  317. LDFLAGS="%{l_cflags -O} -L%{l_prefix}/lib" \
  318. %if "%{with_mod_php_gd}" == "yes"
  319. LIBS="-lpng -lz" \
  320. %endif
  321. ./configure \
  322. --prefix=%{l_prefix} \
  323. --with-apache=../apache_%{V_apache} \
  324. --with-config-file-path=%{l_prefix}/etc/apache \
  325. %if "%{with_mod_php_mysql}" == "yes"
  326. --with-mysql=%{l_prefix} \
  327. %endif
  328. %if "%{with_mod_php_gd}" == "yes"
  329. --with-gd=%{l_prefix} \
  330. %endif
  331. %if "%{with_mod_php_db}" == "yes"
  332. --with-db3=%{l_prefix} \
  333. %endif
  334. %if "%{with_mod_php_zlib}" == "yes" || "%{with_mod_php_pdflib}" == "yes"
  335. --with-zlib=%{l_prefix} \
  336. %endif
  337. %if "%{with_mod_php_bzip2}" == "yes"
  338. --with-bz2=%{l_prefix} \
  339. %endif
  340. %if "%{with_mod_php_pdflib}" == "yes"
  341. --with-pdflib=%{l_prefix} \
  342. %endif
  343. %if "%{with_mod_php_openssl}" == "yes" || "%{with_mod_php_openldap}" == "yes"
  344. --with-openssl=%{l_prefix} \
  345. %endif
  346. %if "%{with_mod_php_openldap}" == "yes"
  347. --with-ldap=%{l_prefix} \
  348. %endif
  349. %if "%{with_mod_php_mm}" == "yes"
  350. --with-mm=%{l_prefix} \
  351. --enable-session \
  352. %endif
  353. %if "%{with_mod_php_pcre}" == "yes"
  354. --with-pcre=%{l_prefix} \
  355. %endif
  356. %if "%{with_mod_php_ftp}" == "yes"
  357. --enable-ftp \
  358. %endif
  359. %if "%{with_mod_php_java}" == "yes"
  360. --with-java=%{l_prefix}/libexec/jdk-sun \
  361. %endif
  362. %if "%{with_mod_php_oci8}" == "yes"
  363. --with-oci8 \
  364. %endif
  365. --disable-shared \
  366. --enable-track-vars
  367. %{l_make} %{l_mflags}
  368. %{l_shtool} subst \
  369. -e "s;^\\(EXTENSION_DIR = \\)\\(%{l_prefix}\\);\\1$RPM_BUILD_ROOT\\2;" \
  370. -e "s;^\\(PEAR_INSTALLDIR = \\)\\(%{l_prefix}\\);\\1$RPM_BUILD_ROOT\\2;" \
  371. config_vars.mk
  372. %{l_make} %{l_mflags} install \
  373. prefix=$RPM_BUILD_ROOT%{l_prefix}
  374. )
  375. %endif
  376. # optionally prepare mod_dav
  377. %if "%{with_mod_dav}" == "yes"
  378. ( cd mod_dav-%{V_mod_dav}
  379. CC="%{l_cc}" \
  380. %if "%{with_mod_ssl}" == "yes"
  381. CFLAGS="%{l_cflags -O}" \
  382. %else
  383. CFLAGS="%{l_cflags -O} -DEAPI" \
  384. %endif
  385. LDFLAGS="%{l_cflags -O}" \
  386. ./configure \
  387. --with-apache=../apache_%{V_apache}
  388. %{l_make} %{l_mflags}
  389. %{l_make} %{l_mflags} install
  390. )
  391. %endif
  392. # optionally prepare mod_layout
  393. %if "%{with_mod_layout}" == "yes"
  394. ( cd mod_layout-%{V_mod_layout}
  395. mkdir ../apache_%{V_apache}/src/modules/layout
  396. cp * ../apache_%{V_apache}/src/modules/layout/ 2>/dev/null || true
  397. chmod -R u+w ../apache_%{V_apache}/src/modules/layout
  398. )
  399. %endif
  400. # optionally prepare mod_macro
  401. %if "%{with_mod_macro}" == "yes"
  402. ( cd mod_macro-%{V_mod_macro}
  403. cp mod_macro.c ../apache_%{V_apache}/src/modules/extra/
  404. )
  405. %endif
  406. # optionally prepare mod_auth_pam
  407. %if "%{with_mod_auth_pam}" == "yes"
  408. ( cd mod_auth_pam-%{V_mod_auth_pam}
  409. cp mod_auth_pam.c ../apache_%{V_apache}/src/modules/extra/
  410. )
  411. %endif
  412. # optionally prepare mod_gzip
  413. %if "%{with_mod_gzip}" == "yes"
  414. cp %{SOURCE mod_gzip.c} apache_%{V_apache}/src/modules/extra/
  415. %endif
  416. # optionally prepare mod_zmod
  417. %if "%{with_mod_zmod}" == "yes"
  418. ( cd src
  419. mkdir ../apache_%{V_apache}/src/modules/zmod
  420. %{l_shtool} subst -e 's;"compat.h";"ap_compat.h";' modules/zmod/mod_zmod.c
  421. cp modules/zmod/* ../apache_%{V_apache}/src/modules/zmod/
  422. )
  423. %endif
  424. # optionally prepare mod_fastcgi
  425. %if "%{with_mod_fastcgi}" == "yes"
  426. ( cd mod_fastcgi-%{V_mod_fastcgi}
  427. mkdir ../apache_%{V_apache}/src/modules/fastcgi
  428. cp -rp * ../apache_%{V_apache}/src/modules/fastcgi/
  429. )
  430. %endif
  431. # optionally prepare mod_throttle
  432. %if "%{with_mod_throttle}" == "yes"
  433. ( cd mod_throttle-*
  434. cp mod_throttle.c ../apache_%{V_apache}/src/modules/extra/
  435. )
  436. %endif
  437. # optionally prepare mod_access_referer
  438. %if "%{with_mod_access_referer}" == "yes"
  439. ( cd mod_access_referer-%{V_mod_access_referer}
  440. cp mod_access_referer.c ../apache_%{V_apache}/src/modules/extra/
  441. )
  442. %endif
  443. # optionally prepare mod_roaming
  444. %if "%{with_mod_roaming}" == "yes"
  445. ( cd mod_roaming-%{V_mod_roaming}
  446. cp mod_roaming.c ../apache_%{V_apache}/src/modules/extra/
  447. )
  448. %endif
  449. # optionally prepare mod_relocate
  450. %if "%{with_mod_relocate}" == "yes"
  451. ( cd mod_relocate-%{V_mod_relocate}
  452. cp mod_relocate.c ../apache_%{V_apache}/src/modules/extra/
  453. )
  454. %endif
  455. # configure Apache
  456. ( cd apache_%{V_apache}
  457. cflags="%{l_cflags -O}"
  458. ldflags=""
  459. libs=""
  460. %if "%{with_pam}" == "yes"
  461. cflags="$cflags -I`%{l_prefix}/etc/rc --query pam_incdir`"
  462. ldflags="$ldflags -L`%{l_prefix}/etc/rc --query pam_libdir`"
  463. libs="$libs -lpam"
  464. %endif
  465. CC="%{l_cc}" \
  466. CFLAGS="$cflags" \
  467. LDFLAGS="$ldflags" \
  468. LIBS="$libs" \
  469. %if "%{with_mod_ssl}" == "yes"
  470. EAPI_MM="%{l_prefix}" \
  471. SSL_BASE="%{l_prefix}" \
  472. %endif
  473. ./configure \
  474. --target=apache \
  475. --with-layout=GNU \
  476. --prefix=%{l_prefix} \
  477. --sbindir=%{l_prefix}/sbin \
  478. --sysconfdir=%{l_prefix}/etc/apache \
  479. --libexecdir=%{l_prefix}/lib/apache \
  480. --datadir=%{l_prefix}/share/apache \
  481. --localstatedir=%{l_prefix}/var/apache \
  482. --enable-suexec \
  483. --suexec-caller=%{l_musr} \
  484. --suexec-userdir=.www \
  485. --enable-module=most \
  486. --with-perl=%{l_prefix}/bin/perl \
  487. %if "%{with_mod_ssl}" == "yes"
  488. --enable-rule=EAPI \
  489. --enable-module=ssl \
  490. %endif
  491. %if "%{with_mod_perl}" == "yes"
  492. --activate-module=src/modules/perl/libperl.a \
  493. %endif
  494. %if "%{with_mod_php}" == "yes"
  495. --activate-module=src/modules/php4/libphp4.a \
  496. %endif
  497. %if "%{with_mod_dav}" == "yes"
  498. --activate-module=src/modules/dav/libdav.a \
  499. %endif
  500. %if "%{with_mod_layout}" == "yes"
  501. --activate-module=src/modules/layout/liblayout.a \
  502. %endif
  503. %if "%{with_mod_macro}" == "yes"
  504. --activate-module=src/modules/extra/mod_macro.o \
  505. %endif
  506. %if "%{with_mod_auth_pam}" == "yes"
  507. --activate-module=src/modules/extra/mod_auth_pam.o \
  508. %endif
  509. %if "%{with_mod_gzip}" == "yes"
  510. --activate-module=src/modules/extra/mod_gzip.o \
  511. %endif
  512. %if "%{with_mod_zmod}" == "yes"
  513. --activate-module=src/modules/zmod/libzmod.a \
  514. %endif
  515. %if "%{with_mod_fastcgi}" == "yes"
  516. --activate-module=src/modules/fastcgi/libfastcgi.a \
  517. %endif
  518. %if "%{with_mod_throttle}" == "yes"
  519. --activate-module=src/modules/extra/mod_throttle.o \
  520. %endif
  521. %if "%{with_mod_access_referer}" == "yes"
  522. --activate-module=src/modules/extra/mod_access_referer.o \
  523. %endif
  524. %if "%{with_mod_roaming}" == "yes"
  525. --activate-module=src/modules/extra/mod_roaming.o \
  526. %endif
  527. %if "%{with_mod_relocate}" == "yes"
  528. --activate-module=src/modules/extra/mod_relocate.o \
  529. %endif
  530. --enable-module=so
  531. %{l_make} %{l_mflags -O} build-quiet
  532. )
  533. %install
  534. # install Apache
  535. ( cd apache_%{V_apache}
  536. # perform standard Apache installation procedure
  537. %{l_make} %{l_mflags} install root=$RPM_BUILD_ROOT
  538. # post-adjustments to installation tree
  539. mv $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/small/* \
  540. $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/
  541. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/small
  542. rm -f $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/README*
  543. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/apache/*.default
  544. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/apache/srm.conf
  545. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/apache/access.conf
  546. mv $RPM_BUILD_ROOT%{l_prefix}/share/apache/htdocs/index.html.en \
  547. $RPM_BUILD_ROOT%{l_prefix}/share/apache/htdocs/index.html
  548. rm -f $RPM_BUILD_ROOT%{l_prefix}/share/apache/htdocs/index.html.*
  549. chmod a+rx $RPM_BUILD_ROOT%{l_prefix}/share/apache/cgi-bin/*
  550. mv $RPM_BUILD_ROOT%{l_prefix}/share/apache/cgi-bin \
  551. $RPM_BUILD_ROOT%{l_prefix}/cgi/
  552. rm -rf $RPM_BUILD_ROOT%{l_prefix}/cgi/test-cgi
  553. )
  554. # optionally cleanup for mod_perl
  555. %if "%{with_mod_perl}" == "yes"
  556. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/perl
  557. %endif
  558. # create default configuration
  559. l_hostname=`%{l_shtool} echo -e %h`
  560. l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
  561. %{l_shtool} install -c -m 644 \
  562. -e 's;@l_prefix@;%{l_prefix};g' \
  563. -e "s;@l_hostname@;$l_hostname;g" \
  564. -e "s;@l_domainname@;$l_domainname;g" \
  565. -e 's;@l_nusr@;%{l_nusr};g' \
  566. -e 's;@l_ngrp@;%{l_ngrp};g' \
  567. %{SOURCE apache.base} \
  568. %{SOURCE apache.conf} \
  569. %{SOURCE apache.vhost} \
  570. $RPM_BUILD_ROOT%{l_prefix}/etc/apache/
  571. mv $RPM_BUILD_ROOT%{l_prefix}/etc/apache/magic $RPM_BUILD_ROOT%{l_prefix}/etc/apache/mime.magic
  572. find $RPM_BUILD_ROOT%{l_prefix} -name perllocal.pod -print | xargs rm -f
  573. # create run-command script
  574. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  575. %{l_shtool} install -c -m 755 -e 's;@l_prefix@;%{l_prefix};g' \
  576. -e 's;@l_musr@;%{l_musr};g' -e 's;@l_mgrp@;%{l_mgrp};g' \
  577. %{SOURCE rc.apache} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  578. # strip installation binaries
  579. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2> /dev/null || true
  580. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2> /dev/null || true
  581. # determine installation tree files
  582. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  583. %{l_files_std} \
  584. '%attr(4755,root,%{l_mgrp}) %{l_prefix}/sbin/suexec' \
  585. '%config %{l_prefix}/etc/apache/*' \
  586. '%config %attr(444,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/apache/apache.base'
  587. %files -f files
  588. %clean
  589. rm -rf $RPM_BUILD_ROOT
  590. %post
  591. %if "%{with_mod_auth_pam}" == "yes"
  592. # add PAM configuration entry
  593. if [ $1 -eq 1 ]; then
  594. $RPM_INSTALL_PREFIX/sbin/pamtool -a -s -n "apache"
  595. fi
  596. %endif
  597. %preun
  598. %if "%{with_mod_auth_pam}" == "yes"
  599. # remove PAM configuration entry
  600. if [ $1 -eq 0 ]; then
  601. $RPM_INSTALL_PREFIX/sbin/pamtool -r -s -n "apache"
  602. fi
  603. %endif