apache.spec 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679
  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. %{!?with_mod_php_freetype: %define with_mod_php_freetype no}
  65. %{!?with_mod_php_gettext: %define with_mod_php_gettext no}
  66. %{!?with_mod_php_imap: %define with_mod_php_imap no}
  67. # fixing implicit inter-module dependencies and correlations
  68. %if "%{with_mod_php}" == "yes"
  69. %if "%{with_mod_ssl}" == "yes"
  70. %define with_mod_php_openssl yes
  71. %define with_mod_php_mm yes
  72. %endif
  73. %if "%{with_mod_php_mysql}" == "yes"
  74. %define with_mod_php_zlib yes
  75. %endif
  76. %if "%{with_mod_php_freetype}" == "yes"
  77. %define with_mod_php_gd yes
  78. %endif
  79. %endif
  80. # package component versions
  81. %define V_apache 1.3.24
  82. %define V_mod_ssl 2.8.8-1.3.24
  83. %define V_mod_perl 1.26
  84. %define V_mod_php 4.1.2
  85. %define V_mod_dav 1.0.3-1.3.6
  86. %define V_mod_layout 3.1.7
  87. %define V_mod_macro 1.1.2
  88. %define V_mod_auth_pam 1.0a
  89. %define V_mod_gzip 1.3.19.1a
  90. %define V_mod_zmod 2_3
  91. %define V_mod_fastcgi 2.2.12
  92. %define V_mod_throttle 312
  93. %define V_mod_access_referer 1.0.2
  94. %define V_mod_roaming 1.0.2
  95. %define V_mod_relocate 1.0
  96. # package information
  97. Name: apache
  98. Summary: Apache HTTP Server
  99. URL: http://httpd.apache.org/
  100. Vendor: Apache Software Foundation
  101. Packager: The OpenPKG Project
  102. Distribution: OpenPKG [REL]
  103. Group: Web
  104. License: ASF
  105. Version: %{V_apache}
  106. Release: 20020418
  107. # list of sources
  108. Source0: http://httpd.apache.org/dist/httpd/apache_%{V_apache}.tar.gz
  109. Source1: http://www.modssl.org/source/mod_ssl-%{V_mod_ssl}.tar.gz
  110. Source2: http://perl.apache.org/dist/mod_perl-%{V_mod_perl}.tar.gz
  111. Source3: http://www.php.net/distributions/php-%{V_mod_php}.tar.gz
  112. Source4: http://www.webdav.org/mod_dav/mod_dav-%{V_mod_dav}.tar.gz
  113. Source5: http://software.tangent.org/download/mod_layout-%{V_mod_layout}.tar.gz
  114. Source6: http://www.cri.ensmp.fr/~coelho/mod_macro/mod_macro-%{V_mod_macro}.tar.gz
  115. Source7: http://pam.sourceforge.net/mod_auth_pam/mod_auth_pam.tar.gz
  116. Source8: http://www.remotecommunications.com/apache/mod_gzip/src/%{V_mod_gzip}/mod_gzip.c
  117. Source9: http://www.ivw.de/???/src.apapi.FIN%{V_mod_zmod}.tar.gz
  118. Source10: http://www.fastcgi.com/dist/mod_fastcgi-%{V_mod_fastcgi}.tar.gz
  119. Source11: http://www.snert.com/Software/mod_throttle/mod_throttle%{V_mod_throttle}.tgz
  120. Source12: http://download.sourceforge.net/accessreferer/mod_access_referer-%{V_mod_access_referer}.tar.gz
  121. Source13: http://www.klomp.org/mod_roaming/mod_roaming-%{V_mod_roaming}.tar.gz
  122. Source14: http://www.tangent.org/mod_relocate/mod_relocate-%{V_mod_relocate}.tar.gz
  123. Source20: apache.conf
  124. Source21: apache.base
  125. Source22: apache.vhost
  126. Source23: rc.apache
  127. # build information
  128. Prefix: %{l_prefix}
  129. BuildRoot: %{l_buildroot}
  130. BuildPreReq: openpkg >= 20020222
  131. PreReq: openpkg >= 20020222
  132. %if "%{with_mod_ssl}" == "yes"
  133. BuildPreReq: openssl, mm
  134. %endif
  135. %if "%{with_mod_perl}" == "yes"
  136. BuildPreReq: perl
  137. PreReq: perl
  138. %endif
  139. %if "%{with_mod_php}" == "yes"
  140. BuildPreReq: make, bison, flex
  141. %if "%{with_mod_php_mysql}" == "yes"
  142. BuildPreReq: mysql
  143. %endif
  144. %if "%{with_mod_php_gd}" == "yes"
  145. BuildPreReq: gd
  146. %endif
  147. %if "%{with_mod_php_db}" == "yes"
  148. BuildPreReq: db
  149. %endif
  150. %if "%{with_mod_php_pdflib}" == "yes"
  151. BuildPreReq: pdflib, zlib
  152. %endif
  153. %if "%{with_mod_php_zlib}" == "yes"
  154. BuildPreReq: zlib
  155. %endif
  156. %if "%{with_mod_php_bzip2}" == "yes"
  157. BuildPreReq: bzip2
  158. %endif
  159. %if "%{with_mod_php_openssl}" == "yes"
  160. BuildPreReq: openssl
  161. %endif
  162. %if "%{with_mod_php_openldap}" == "yes"
  163. BuildPreReq: openldap, openssl
  164. %endif
  165. %if "%{with_mod_php_mm}" == "yes"
  166. BuildPreReq: mm
  167. %endif
  168. %if "%{with_mod_php_pcre}" == "yes"
  169. BuildPreReq: pcre
  170. %endif
  171. %if "%{with_mod_php_java}" == "yes"
  172. BuildPreReq: jdk-sun
  173. %endif
  174. %if "%{with_mod_php_freetype}" == "yes"
  175. BuildPreReq: freetype
  176. %endif
  177. %if "%{with_mod_php_gettext}" == "yes"
  178. BuildPreReq: gettext, libiconv
  179. %endif
  180. %if "%{with_mod_php_imap}" == "yes"
  181. BuildPreReq: c-client
  182. %endif
  183. %endif
  184. %if "%{with_mod_auth_pam}" == "yes"
  185. BuildPreReq: PAM
  186. PreReq: PAM
  187. %endif
  188. AutoReq: no
  189. AutoReqProv: no
  190. %description
  191. The Apache Project is a collaborative software development effort
  192. aimed at creating a robust, commercial-grade, featureful, and
  193. freely-available source code implementation of an HTTP (Web) server.
  194. The project is jointly managed by a group of volunteers located
  195. around the world, using the Internet and the Web to communicate,
  196. plan, and develop the server and its related documentation. These
  197. volunteers are known as the Apache Group. In addition, hundreds
  198. of users have contributed ideas, code, and documentation to the
  199. project.
  200. Options (additional modules I):
  201. with_mod_ssl=%{with_mod_ssl} with_mod_perl=%{with_mod_perl} with_mod_php=%{with_mod_php}
  202. with_mod_dav=%{with_mod_dav} with_mod_layout=%{with_mod_layout} with_mod_macro=%{with_mod_macro}
  203. Options (additional modules II):
  204. with_mod_auth_pam=%{with_mod_auth_pam} with_mod_gzip=%{with_mod_gzip} with_mod_zmod=%{with_mod_zmod}
  205. with_mod_fastcgi=%{with_mod_fastcgi} with_mod_throttle=%{with_mod_throttle} with_mod_access_referer=%{with_mod_access_referer}
  206. with_mod_roaming=%{with_mod_roaming} with_mod_relocate=%{with_mod_relocate}
  207. Options (additional extensions for mod_php):
  208. with_mod_php_mysql=%{with_mod_php_mysql} with_mod_php_gd=%{with_mod_php_gd} with_mod_php_db=%{with_mod_php_db}
  209. with_mod_php_pdflib=%{with_mod_php_pdflib} with_mod_php_zlib=%{with_mod_php_zlib} with_mod_php_bzip2=%{with_mod_php_bzip2}
  210. with_mod_php_openssl=%{with_mod_php_openssl} with_mod_php_openldap=%{with_mod_php_openldap} with_mod_php_mm=%{with_mod_php_mm}
  211. with_mod_php_pcre=%{with_mod_php_pcre} with_mod_php_ftp=%{with_mod_php_ftp} with_mod_php_java=%{with_mod_php_java}
  212. with_mod_php_oci8=%{with_mod_php_oci8} with_mod_php_gettext=%{with_mod_php_gettext}
  213. with_mod_php_imap=%{with_mod_php_imap}
  214. %prep
  215. # unpack Apache distribution
  216. %setup0 -q -c
  217. # unpack optional extension modules
  218. %if "%{with_mod_ssl}" == "yes"
  219. %setup1 -q -T -D -a 1
  220. %endif
  221. %if "%{with_mod_perl}" == "yes"
  222. %setup2 -q -T -D -a 2
  223. %endif
  224. %if "%{with_mod_php}" == "yes"
  225. %setup3 -q -T -D -a 3
  226. %endif
  227. %if "%{with_mod_dav}" == "yes"
  228. %setup4 -q -T -D -a 4
  229. %endif
  230. %if "%{with_mod_layout}" == "yes"
  231. %setup5 -q -T -D -a 5
  232. %endif
  233. %if "%{with_mod_macro}" == "yes"
  234. %setup6 -q -T -D -a 6
  235. %endif
  236. %if "%{with_mod_auth_pam}" == "yes"
  237. %setup7 -q -T -D -a 7
  238. %endif
  239. %if "%{with_mod_zmod}" == "yes"
  240. %setup9 -q -T -D -a 9
  241. %endif
  242. %if "%{with_mod_fastcgi}" == "yes"
  243. %setup10 -q -T -D -a 10
  244. %endif
  245. %if "%{with_mod_throttle}" == "yes"
  246. %setup11 -q -T -D -a 11
  247. %endif
  248. %if "%{with_mod_access_referer}" == "yes"
  249. %setup12 -q -T -D -a 12
  250. %endif
  251. %if "%{with_mod_roaming}" == "yes"
  252. %setup13 -q -T -D -a 13
  253. %endif
  254. %if "%{with_mod_relocate}" == "yes"
  255. %setup14 -q -T -D -a 14
  256. %endif
  257. %build
  258. # prepare environment
  259. PATH="%{l_prefix}/bin:%{l_prefix}/sbin:$PATH"; export PATH
  260. rm -rf $RPM_BUILD_ROOT
  261. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}
  262. # optionally prepare mod_ssl
  263. %if "%{with_mod_ssl}" == "yes"
  264. ( cd mod_ssl-%{V_mod_ssl}
  265. ./configure \
  266. --with-apache=../apache_%{V_apache} \
  267. --expert --force
  268. )
  269. %endif
  270. # optionally pre-configure Apache for mod_php and mod_dav
  271. %if "%{with_mod_php}" == "yes" || "%{with_mod_dav}" == "yes"
  272. ( cd apache_%{V_apache}
  273. CC="%{l_cc}" \
  274. CFLAGS="%{l_cflags -O}" \
  275. ./configure \
  276. %if "%{with_mod_ssl}" == "yes"
  277. --enable-rule=EAPI \
  278. %endif
  279. --target=apache \
  280. --with-layout=GNU \
  281. --prefix=%{l_prefix} \
  282. --sbindir=%{l_prefix}/sbin \
  283. --sysconfdir=%{l_prefix}/etc/apache \
  284. --libexecdir=%{l_prefix}/lib/apache \
  285. --datadir=%{l_prefix}/share/apache \
  286. --localstatedir=%{l_prefix}/var/apache
  287. )
  288. %endif
  289. # optionally prepare mod_perl
  290. %if "%{with_mod_perl}" == "yes"
  291. ( cd mod_perl-%{V_mod_perl}
  292. eval `%{l_prefix}/bin/perl -V:archname`
  293. eval `%{l_prefix}/bin/perl -V:version`
  294. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/bin
  295. perl=$RPM_BUILD_ROOT%{l_prefix}/bin/perl
  296. echo "#!/bin/sh" >$perl
  297. echo "exec %{l_prefix}/bin/perl \\" >>$perl
  298. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/${version} \\" >>$perl
  299. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/${version}/${archname} \\" >>$perl
  300. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/site_perl \\" >>$perl
  301. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/site_perl/${version} \\" >>$perl
  302. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/site_perl/${version}/${archname} \\" >>$perl
  303. echo " \"\$@\"" >>$perl
  304. chmod a+x $perl
  305. $perl Makefile.PL \
  306. PREFIX=$RPM_BUILD_ROOT%{l_prefix} \
  307. APACHE_SRC=../apache_%{V_apache}/src \
  308. DO_HTTPD=1 \
  309. USE_APACI=1 \
  310. PREP_HTTPD=1 \
  311. EVERYTHING=1 \
  312. PERL_TIE_TABLES=1 \
  313. PERL_DIRECTIVE_HANDLERS=1
  314. %{l_make} %{l_mflags}
  315. %{l_make} %{l_mflags} install
  316. mkdir $RPM_BUILD_ROOT%{l_prefix}/perl5
  317. mv $RPM_BUILD_ROOT%{l_prefix}/lib/* $RPM_BUILD_ROOT%{l_prefix}/perl5/
  318. mv $RPM_BUILD_ROOT%{l_prefix}/perl5 $RPM_BUILD_ROOT%{l_prefix}/lib/
  319. %{l_shtool} subst -e "s;^\\(PERL = \\).*;\\1 $perl;" \
  320. ../apache_%{V_apache}/src/modules/perl/mod_perl.config
  321. )
  322. %endif
  323. # optionally prepare mod_php
  324. %if "%{with_mod_php}" == "yes"
  325. ( cd php-%{V_mod_php}
  326. CC="%{l_cc}" \
  327. %if "%{with_mod_ssl}" == "yes"
  328. CFLAGS="%{l_cflags -O} -I%{l_prefix}/include -DEAPI" \
  329. %else
  330. CFLAGS="%{l_cflags -O} -I%{l_prefix}/include" \
  331. %endif
  332. CPPFLAGS="%{l_cflags -O} -I%{l_prefix}/include" \
  333. LDFLAGS="%{l_cflags -O} -L%{l_prefix}/lib" \
  334. %if "%{with_mod_php_gd}" == "yes" && "%{with_mod_php_gettext}" == "yes"
  335. LIBS="-lpng -lz -liconv" \
  336. %else
  337. %if "%{with_mod_php_gd}" == "yes"
  338. LIBS="-lpng -lz" \
  339. %endif
  340. %if "%{with_mod_php_gettext}" == "yes"
  341. LIBS="-liconv" \
  342. %endif
  343. %endif
  344. ./configure \
  345. --prefix=%{l_prefix} \
  346. --with-apache=../apache_%{V_apache} \
  347. --with-config-file-path=%{l_prefix}/etc/apache \
  348. %if "%{with_mod_php_mysql}" == "yes"
  349. --with-mysql=%{l_prefix} \
  350. %endif
  351. %if "%{with_mod_php_gd}" == "yes"
  352. --with-gd=%{l_prefix} \
  353. %endif
  354. %if "%{with_mod_php_freetype}" == "yes"
  355. --enable-gd-native-ttf \
  356. --with-freetype-dir=%{l_prefix} \
  357. %endif
  358. %if "%{with_mod_php_db}" == "yes"
  359. --with-db3=%{l_prefix} \
  360. %endif
  361. %if "%{with_mod_php_zlib}" == "yes" || "%{with_mod_php_pdflib}" == "yes"
  362. --with-zlib=%{l_prefix} \
  363. %endif
  364. %if "%{with_mod_php_bzip2}" == "yes"
  365. --with-bz2=%{l_prefix} \
  366. %endif
  367. %if "%{with_mod_php_pdflib}" == "yes"
  368. --with-pdflib=%{l_prefix} \
  369. %endif
  370. %if "%{with_mod_php_openssl}" == "yes" || "%{with_mod_php_openldap}" == "yes"
  371. --with-openssl=%{l_prefix} \
  372. %endif
  373. %if "%{with_mod_php_openldap}" == "yes"
  374. --with-ldap=%{l_prefix} \
  375. %endif
  376. %if "%{with_mod_php_mm}" == "yes"
  377. --with-mm=%{l_prefix} \
  378. --enable-session \
  379. %endif
  380. %if "%{with_mod_php_pcre}" == "yes"
  381. --with-pcre=%{l_prefix} \
  382. %endif
  383. %if "%{with_mod_php_ftp}" == "yes"
  384. --enable-ftp \
  385. %endif
  386. %if "%{with_mod_php_java}" == "yes"
  387. --with-java=%{l_prefix}/libexec/jdk-sun \
  388. %endif
  389. %if "%{with_mod_php_oci8}" == "yes"
  390. --with-oci8 \
  391. %endif
  392. %if "%{with_mod_php_gettext}" == "yes"
  393. --with-gettext=%{l_prefix} \
  394. %endif
  395. %if "%{with_mod_php_imap}" == "yes"
  396. --with-imap=%{l_prefix} \
  397. %endif
  398. --disable-shared \
  399. --enable-track-vars
  400. %{l_make} %{l_mflags}
  401. %{l_shtool} subst \
  402. -e "s;^\\(EXTENSION_DIR = \\)\\(%{l_prefix}\\);\\1$RPM_BUILD_ROOT\\2;" \
  403. -e "s;^\\(PEAR_INSTALLDIR = \\)\\(%{l_prefix}\\);\\1$RPM_BUILD_ROOT\\2;" \
  404. config_vars.mk
  405. %{l_make} %{l_mflags} install \
  406. prefix=$RPM_BUILD_ROOT%{l_prefix}
  407. )
  408. %endif
  409. # optionally prepare mod_dav
  410. %if "%{with_mod_dav}" == "yes"
  411. ( cd mod_dav-%{V_mod_dav}
  412. CC="%{l_cc}" \
  413. %if "%{with_mod_ssl}" == "yes"
  414. CFLAGS="%{l_cflags -O}" \
  415. %else
  416. CFLAGS="%{l_cflags -O} -DEAPI" \
  417. %endif
  418. LDFLAGS="%{l_cflags -O}" \
  419. ./configure \
  420. --with-apache=../apache_%{V_apache}
  421. %{l_make} %{l_mflags}
  422. %{l_make} %{l_mflags} install
  423. )
  424. %endif
  425. # optionally prepare mod_layout
  426. %if "%{with_mod_layout}" == "yes"
  427. ( cd mod_layout-%{V_mod_layout}
  428. mkdir ../apache_%{V_apache}/src/modules/layout
  429. cp * ../apache_%{V_apache}/src/modules/layout/ 2>/dev/null || true
  430. chmod -R u+w ../apache_%{V_apache}/src/modules/layout
  431. )
  432. %endif
  433. # optionally prepare mod_macro
  434. %if "%{with_mod_macro}" == "yes"
  435. ( cd mod_macro-%{V_mod_macro}
  436. cp mod_macro.c ../apache_%{V_apache}/src/modules/extra/
  437. )
  438. %endif
  439. # optionally prepare mod_auth_pam
  440. %if "%{with_mod_auth_pam}" == "yes"
  441. ( cd mod_auth_pam-%{V_mod_auth_pam}
  442. cp mod_auth_pam.c ../apache_%{V_apache}/src/modules/extra/
  443. )
  444. %endif
  445. # optionally prepare mod_gzip
  446. %if "%{with_mod_gzip}" == "yes"
  447. cp %{SOURCE mod_gzip.c} apache_%{V_apache}/src/modules/extra/
  448. %endif
  449. # optionally prepare mod_zmod
  450. %if "%{with_mod_zmod}" == "yes"
  451. ( cd src
  452. mkdir ../apache_%{V_apache}/src/modules/zmod
  453. %{l_shtool} subst -e 's;"compat.h";"ap_compat.h";' modules/zmod/mod_zmod.c
  454. cp modules/zmod/* ../apache_%{V_apache}/src/modules/zmod/
  455. )
  456. %endif
  457. # optionally prepare mod_fastcgi
  458. %if "%{with_mod_fastcgi}" == "yes"
  459. ( cd mod_fastcgi-%{V_mod_fastcgi}
  460. mkdir ../apache_%{V_apache}/src/modules/fastcgi
  461. cp -rp * ../apache_%{V_apache}/src/modules/fastcgi/
  462. )
  463. %endif
  464. # optionally prepare mod_throttle
  465. %if "%{with_mod_throttle}" == "yes"
  466. ( cd mod_throttle-*
  467. cp mod_throttle.c ../apache_%{V_apache}/src/modules/extra/
  468. )
  469. %endif
  470. # optionally prepare mod_access_referer
  471. %if "%{with_mod_access_referer}" == "yes"
  472. ( cd mod_access_referer-%{V_mod_access_referer}
  473. cp mod_access_referer.c ../apache_%{V_apache}/src/modules/extra/
  474. )
  475. %endif
  476. # optionally prepare mod_roaming
  477. %if "%{with_mod_roaming}" == "yes"
  478. ( cd mod_roaming-%{V_mod_roaming}
  479. cp mod_roaming.c ../apache_%{V_apache}/src/modules/extra/
  480. )
  481. %endif
  482. # optionally prepare mod_relocate
  483. %if "%{with_mod_relocate}" == "yes"
  484. ( cd mod_relocate-%{V_mod_relocate}
  485. cp mod_relocate.c ../apache_%{V_apache}/src/modules/extra/
  486. )
  487. %endif
  488. # configure Apache
  489. ( cd apache_%{V_apache}
  490. cflags="%{l_cflags -O}"
  491. ldflags=""
  492. libs=""
  493. %if "%{with_pam}" == "yes"
  494. cflags="$cflags -I`%{l_prefix}/etc/rc --query pam_incdir`"
  495. ldflags="$ldflags -L`%{l_prefix}/etc/rc --query pam_libdir`"
  496. libs="$libs -lpam"
  497. %endif
  498. CC="%{l_cc}" \
  499. CFLAGS="$cflags" \
  500. LDFLAGS="$ldflags" \
  501. LIBS="$libs" \
  502. %if "%{with_mod_ssl}" == "yes"
  503. EAPI_MM="%{l_prefix}" \
  504. SSL_BASE="%{l_prefix}" \
  505. %endif
  506. ./configure \
  507. --target=apache \
  508. --with-layout=GNU \
  509. --prefix=%{l_prefix} \
  510. --sbindir=%{l_prefix}/sbin \
  511. --sysconfdir=%{l_prefix}/etc/apache \
  512. --libexecdir=%{l_prefix}/lib/apache \
  513. --datadir=%{l_prefix}/share/apache \
  514. --localstatedir=%{l_prefix}/var/apache \
  515. --enable-suexec \
  516. --suexec-caller=%{l_musr} \
  517. --suexec-userdir=.www \
  518. --enable-module=most \
  519. --with-perl=%{l_prefix}/bin/perl \
  520. %if "%{with_mod_ssl}" == "yes"
  521. --enable-rule=EAPI \
  522. --enable-module=ssl \
  523. %endif
  524. %if "%{with_mod_perl}" == "yes"
  525. --activate-module=src/modules/perl/libperl.a \
  526. %endif
  527. %if "%{with_mod_php}" == "yes"
  528. --activate-module=src/modules/php4/libphp4.a \
  529. %endif
  530. %if "%{with_mod_dav}" == "yes"
  531. --activate-module=src/modules/dav/libdav.a \
  532. %endif
  533. %if "%{with_mod_layout}" == "yes"
  534. --activate-module=src/modules/layout/liblayout.a \
  535. %endif
  536. %if "%{with_mod_macro}" == "yes"
  537. --activate-module=src/modules/extra/mod_macro.o \
  538. %endif
  539. %if "%{with_mod_auth_pam}" == "yes"
  540. --activate-module=src/modules/extra/mod_auth_pam.o \
  541. %endif
  542. %if "%{with_mod_gzip}" == "yes"
  543. --activate-module=src/modules/extra/mod_gzip.o \
  544. %endif
  545. %if "%{with_mod_zmod}" == "yes"
  546. --activate-module=src/modules/zmod/libzmod.a \
  547. %endif
  548. %if "%{with_mod_fastcgi}" == "yes"
  549. --activate-module=src/modules/fastcgi/libfastcgi.a \
  550. %endif
  551. %if "%{with_mod_throttle}" == "yes"
  552. --activate-module=src/modules/extra/mod_throttle.o \
  553. %endif
  554. %if "%{with_mod_access_referer}" == "yes"
  555. --activate-module=src/modules/extra/mod_access_referer.o \
  556. %endif
  557. %if "%{with_mod_roaming}" == "yes"
  558. --activate-module=src/modules/extra/mod_roaming.o \
  559. %endif
  560. %if "%{with_mod_relocate}" == "yes"
  561. --activate-module=src/modules/extra/mod_relocate.o \
  562. %endif
  563. --enable-module=so
  564. %{l_make} %{l_mflags -O} build-quiet
  565. )
  566. %install
  567. # install Apache
  568. ( cd apache_%{V_apache}
  569. # perform standard Apache installation procedure
  570. %{l_make} %{l_mflags} install root=$RPM_BUILD_ROOT
  571. # post-adjustments to installation tree
  572. mv $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/small/* \
  573. $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/
  574. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/small
  575. rm -f $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/README*
  576. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/apache/*.default
  577. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/apache/srm.conf
  578. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/apache/access.conf
  579. mv $RPM_BUILD_ROOT%{l_prefix}/share/apache/htdocs/index.html.en \
  580. $RPM_BUILD_ROOT%{l_prefix}/share/apache/htdocs/index.html
  581. rm -f $RPM_BUILD_ROOT%{l_prefix}/share/apache/htdocs/index.html.*
  582. chmod a+rx $RPM_BUILD_ROOT%{l_prefix}/share/apache/cgi-bin/*
  583. mv $RPM_BUILD_ROOT%{l_prefix}/share/apache/cgi-bin \
  584. $RPM_BUILD_ROOT%{l_prefix}/cgi/
  585. rm -rf $RPM_BUILD_ROOT%{l_prefix}/cgi/test-cgi
  586. )
  587. # optionally cleanup for mod_perl
  588. %if "%{with_mod_perl}" == "yes"
  589. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/perl
  590. %endif
  591. # create default configuration
  592. l_hostname=`%{l_shtool} echo -e %h`
  593. l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
  594. %{l_shtool} install -c -m 644 \
  595. -e 's;@l_prefix@;%{l_prefix};g' \
  596. -e "s;@l_hostname@;$l_hostname;g" \
  597. -e "s;@l_domainname@;$l_domainname;g" \
  598. -e 's;@l_nusr@;%{l_nusr};g' \
  599. -e 's;@l_ngrp@;%{l_ngrp};g' \
  600. %{SOURCE apache.base} \
  601. %{SOURCE apache.conf} \
  602. %{SOURCE apache.vhost} \
  603. $RPM_BUILD_ROOT%{l_prefix}/etc/apache/
  604. mv $RPM_BUILD_ROOT%{l_prefix}/etc/apache/magic $RPM_BUILD_ROOT%{l_prefix}/etc/apache/mime.magic
  605. find $RPM_BUILD_ROOT%{l_prefix} -name perllocal.pod -print | xargs rm -f
  606. # create run-command script
  607. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  608. %{l_shtool} install -c -m 755 -e 's;@l_prefix@;%{l_prefix};g' \
  609. -e 's;@l_musr@;%{l_musr};g' -e 's;@l_mgrp@;%{l_mgrp};g' \
  610. %{SOURCE rc.apache} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  611. # strip installation binaries
  612. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2> /dev/null || true
  613. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2> /dev/null || true
  614. # determine installation tree files
  615. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  616. %{l_files_std} \
  617. '%attr(4755,root,%{l_mgrp}) %{l_prefix}/sbin/suexec' \
  618. '%config %{l_prefix}/etc/apache/*' \
  619. '%config %attr(444,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/apache/apache.base'
  620. %files -f files
  621. %clean
  622. rm -rf $RPM_BUILD_ROOT
  623. %post
  624. %if "%{with_mod_auth_pam}" == "yes"
  625. # add PAM configuration entry
  626. if [ $1 -eq 1 ]; then
  627. $RPM_INSTALL_PREFIX/sbin/pamtool -a -s -n "apache"
  628. fi
  629. %endif
  630. %preun
  631. %if "%{with_mod_auth_pam}" == "yes"
  632. # remove PAM configuration entry
  633. if [ $1 -eq 0 ]; then
  634. $RPM_INSTALL_PREFIX/sbin/pamtool -r -s -n "apache"
  635. fi
  636. %endif