apache.spec 24 KB

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