apache.spec 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860
  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. ## ATTENTION: DO NOT EDIT THE FOLLOWING DEFAULTS DIRECTLY IN THIS FILE!
  34. ## INSTEAD USE --define "with_xxx yes" ON THE COMMAND LINE. THE REASON
  35. ## IS THAT RPM'S MACRO MECHANISM HORSES UP HORRIBLY ELSE!
  36. # the additionally used Apache modules (can be enabled without thinking)
  37. %{!?with_mod_ssl: %define with_mod_ssl no}
  38. %{!?with_mod_perl: %define with_mod_perl no}
  39. %{!?with_mod_php: %define with_mod_php no}
  40. %{!?with_mod_php3: %define with_mod_php3 no}
  41. %{!?with_mod_dav: %define with_mod_dav no}
  42. %{!?with_mod_layout: %define with_mod_layout no}
  43. %{!?with_mod_macro: %define with_mod_macro no}
  44. # the additionally used Apache modules (you have to know what you do)
  45. %{!?with_mod_auth_pam: %define with_mod_auth_pam no}
  46. %{!?with_mod_gzip: %define with_mod_gzip no}
  47. %{!?with_mod_zmod: %define with_mod_zmod no}
  48. %{!?with_mod_fastcgi: %define with_mod_fastcgi no}
  49. %{!?with_mod_throttle: %define with_mod_throttle no}
  50. %{!?with_mod_access_referer: %define with_mod_access_referer no}
  51. %{!?with_mod_roaming: %define with_mod_roaming no}
  52. %{!?with_mod_relocate: %define with_mod_relocate no}
  53. # more optional PHP4 specific settings
  54. # (requires "with_mod_php" set to "yes" above!)
  55. %{!?with_mod_php_calendar: %define with_mod_php_calendar no}
  56. %{!?with_mod_php_mysql: %define with_mod_php_mysql no}
  57. %{!?with_mod_php_gd: %define with_mod_php_gd no}
  58. %{!?with_mod_php_db: %define with_mod_php_db no}
  59. %{!?with_mod_php_debug: %define with_mod_php_debug no}
  60. %{!?with_mod_php_pdflib: %define with_mod_php_pdflib no}
  61. %{!?with_mod_php_zlib: %define with_mod_php_zlib no}
  62. %{!?with_mod_php_bzip2: %define with_mod_php_bzip2 no}
  63. %{!?with_mod_php_openssl: %define with_mod_php_openssl no}
  64. %{!?with_mod_php_openldap: %define with_mod_php_openldap no}
  65. %{!?with_mod_php_mm: %define with_mod_php_mm no}
  66. %{!?with_mod_php_pcre: %define with_mod_php_pcre no}
  67. %{!?with_mod_php_ftp: %define with_mod_php_ftp no}
  68. %{!?with_mod_php_java: %define with_mod_php_java no}
  69. %{!?with_mod_php_oci8: %define with_mod_php_oci8 no}
  70. %{!?with_mod_php_freetype: %define with_mod_php_freetype no}
  71. %{!?with_mod_php_gettext: %define with_mod_php_gettext no}
  72. %{!?with_mod_php_imap: %define with_mod_php_imap no}
  73. %{!?with_mod_php_xml: %define with_mod_php_xml no}
  74. %{!?with_mod_php_bc: %define with_mod_php_bc no}
  75. %{!?with_mod_php_transsid: %define with_mod_php_transsid no}
  76. # more optional PHP3 specific settings
  77. # (requires "with_mod_php3" set to "yes" above!)
  78. %{!?with_mod_php3_ftp: %define with_mod_php3_ftp no}
  79. %{!?with_mod_php3_gd: %define with_mod_php3_gd no}
  80. %{!?with_mod_php3_jpeg: %define with_mod_php3_jpeg no}
  81. %{!?with_mod_php3_mysql: %define with_mod_php3_mysql no}
  82. %{!?with_mod_php3_openssl: %define with_mod_php3_openssl no}
  83. %{!?with_mod_php3_zlib: %define with_mod_php3_zlib no}
  84. # fixing implicit inter-module dependencies and correlations
  85. %if "%{with_mod_php}" == "yes"
  86. %if "%{with_mod_php3}" == "yes"
  87. %{error: with_mod_php conflicts with with_mod_php3}
  88. # FIXME: error macro does not terminate execution
  89. exit 1
  90. %endif
  91. %if "%{with_mod_ssl}" == "yes"
  92. %define with_mod_php_openssl yes
  93. %define with_mod_php_mm yes
  94. %endif
  95. %if "%{with_mod_php_freetype}" == "yes"
  96. %define with_mod_php_gd yes
  97. %endif
  98. %if "%{with_mod_php_mysql}" == "yes" || "%{with_mod_php_pdflib}" == "yes" || "%{with_mod_php_gd}" == "yes"
  99. %define with_mod_php_zlib yes
  100. %endif
  101. %endif
  102. %if "%{with_mod_php3}" == "yes"
  103. %if "%{with_mod_ssl}" == "yes"
  104. %define with_mod_php3_openssl yes
  105. %endif
  106. %if "%{with_mod_php3_mysql}" == "yes"
  107. %define with_mod_php3_zlib yes
  108. %endif
  109. %endif
  110. # package component versions
  111. %define V_apache 1.3.27
  112. %define V_mod_ssl 2.8.12-1.3.27
  113. %define V_mod_perl 1.27
  114. %define V_mod_php 4.2.3
  115. %define V_mod_php3 3.0.18
  116. %define V_mod_dav 1.0.3-1.3.6
  117. %define V_mod_layout 3.2
  118. %define V_mod_macro 1.1.2
  119. %define V_mod_auth_pam 1.0a
  120. %define V_mod_gzip 1.3.19.1a
  121. %define V_mod_zmod 2_3
  122. %define V_mod_fastcgi 2.2.12
  123. %define V_mod_throttle 312
  124. %define V_mod_access_referer 1.0.2
  125. %define V_mod_roaming 1.0.2
  126. %define V_mod_relocate 1.0
  127. # package information
  128. Name: apache
  129. Summary: Apache HTTP Server
  130. URL: http://httpd.apache.org/
  131. Vendor: Apache Software Foundation
  132. Packager: The OpenPKG Project
  133. Distribution: OpenPKG [BASE]
  134. Group: Web
  135. License: ASF
  136. Version: %{V_apache}
  137. Release: 20021122
  138. # list of sources
  139. Source0: http://www.apache.org/dist/httpd/apache_%{V_apache}.tar.gz
  140. Source1: http://www.modssl.org/source/mod_ssl-%{V_mod_ssl}.tar.gz
  141. Source2: http://perl.apache.org/dist/mod_perl-%{V_mod_perl}.tar.gz
  142. Source3: http://www.php.net/distributions/php-%{V_mod_php}.tar.gz
  143. Source4: http://www.webdav.org/mod_dav/mod_dav-%{V_mod_dav}.tar.gz
  144. Source5: http://software.tangent.org/download/mod_layout-%{V_mod_layout}.tar.gz
  145. Source6: http://www.cri.ensmp.fr/~coelho/mod_macro/mod_macro-%{V_mod_macro}.tar.gz
  146. Source7: http://pam.sourceforge.net/mod_auth_pam/dist/mod_auth_pam.tar.gz
  147. Source8: http://www.remotecommunications.com/apache/mod_gzip/src/%{V_mod_gzip}/mod_gzip.c
  148. Source9: http://www.ivw.de/???/src.apapi.FIN%{V_mod_zmod}.tar.gz
  149. Source10: http://www.fastcgi.com/dist/mod_fastcgi-%{V_mod_fastcgi}.tar.gz
  150. Source11: http://www.snert.com/Software/mod_throttle/mod_throttle%{V_mod_throttle}.tgz
  151. Source12: http://download.sourceforge.net/accessreferer/mod_access_referer-%{V_mod_access_referer}.tar.gz
  152. Source13: http://www.klomp.org/mod_roaming/mod_roaming-%{V_mod_roaming}.tar.gz
  153. Source14: http://software.tangent.org/download/mod_relocate-%{V_mod_relocate}.tar.gz
  154. Source15: http://www.php.net/distributions/php-%{V_mod_php3}.tar.gz
  155. Source20: apache.conf
  156. Source21: apache.base
  157. Source22: apache.vhost
  158. Source23: rc.apache
  159. Patch0: apache-php-db4.patch
  160. # build information
  161. Prefix: %{l_prefix}
  162. BuildRoot: %{l_buildroot}
  163. BuildPreReq: OpenPKG, openpkg >= 20020222
  164. PreReq: OpenPKG, openpkg >= 20020222
  165. %if "%{with_mod_ssl}" == "yes"
  166. BuildPreReq: openssl, mm
  167. %endif
  168. %if "%{with_mod_perl}" == "yes"
  169. BuildPreReq: perl
  170. PreReq: perl
  171. %endif
  172. %if "%{with_mod_php}" == "yes"
  173. BuildPreReq: make, bison, flex
  174. %if "%{with_mod_php_mysql}" == "yes"
  175. BuildPreReq: mysql
  176. %endif
  177. %if "%{with_mod_php_gd}" == "yes"
  178. BuildPreReq: GD, jpeg, png
  179. %endif
  180. %if "%{with_mod_php_db}" == "yes"
  181. BuildPreReq: db
  182. %endif
  183. %if "%{with_mod_php_pdflib}" == "yes"
  184. BuildPreReq: pdflib, jpeg, png
  185. %endif
  186. %if "%{with_mod_php_zlib}" == "yes"
  187. BuildPreReq: zlib
  188. %endif
  189. %if "%{with_mod_php_bzip2}" == "yes"
  190. BuildPreReq: bzip2
  191. %endif
  192. %if "%{with_mod_php_openssl}" == "yes"
  193. BuildPreReq: openssl
  194. %endif
  195. %if "%{with_mod_php_openldap}" == "yes"
  196. BuildPreReq: openldap, openssl
  197. %endif
  198. %if "%{with_mod_php_mm}" == "yes"
  199. BuildPreReq: mm
  200. %endif
  201. %if "%{with_mod_php_pcre}" == "yes"
  202. BuildPreReq: pcre
  203. %endif
  204. %if "%{with_mod_php_java}" == "yes"
  205. BuildPreReq: j2se
  206. %endif
  207. %if "%{with_mod_php_freetype}" == "yes"
  208. BuildPreReq: freetype
  209. %endif
  210. %if "%{with_mod_php_gettext}" == "yes"
  211. BuildPreReq: gettext, libiconv
  212. %endif
  213. %if "%{with_mod_php_imap}" == "yes"
  214. BuildPreReq: c-client
  215. %endif
  216. %if "%{with_mod_php_xml}" == "yes"
  217. BuildPreReq: expat
  218. %endif
  219. %endif
  220. %if "%{with_mod_php3}" == "yes"
  221. BuildPreReq: make, bison, flex
  222. %if "%{with_mod_php3_gd}" == "yes"
  223. BuildPreReq: GD
  224. %endif
  225. %if "%{with_mod_php3_jpeg}" == "yes"
  226. BuildPreReq: jpeg
  227. %endif
  228. %if "%{with_mod_php3_mysql}" == "yes"
  229. BuildPreReq: mysql
  230. %endif
  231. %if "%{with_mod_php3_openssl}" == "yes"
  232. BuildPreReq: openssl
  233. %endif
  234. %if "%{with_mod_php3_zlib}" == "yes"
  235. BuildPreReq: zlib
  236. %endif
  237. %endif
  238. %if "%{with_mod_auth_pam}" == "yes"
  239. BuildPreReq: PAM
  240. PreReq: PAM
  241. %endif
  242. AutoReq: no
  243. AutoReqProv: no
  244. %description
  245. The Apache Project is a collaborative software development effort
  246. aimed at creating a robust, commercial-grade, featureful, and
  247. freely-available source code implementation of an HTTP (Web) server.
  248. The project is jointly managed by a group of volunteers located
  249. around the world, using the Internet and the Web to communicate,
  250. plan, and develop the server and its related documentation. These
  251. volunteers are known as the Apache Group. In addition, hundreds
  252. of users have contributed ideas, code, and documentation to the
  253. project.
  254. Options (additional modules I):
  255. --define 'with_mod_dav %{with_mod_dav}' \
  256. --define 'with_mod_layout %{with_mod_layout}' \
  257. --define 'with_mod_macro %{with_mod_macro}' \
  258. --define 'with_mod_perl %{with_mod_perl}' \
  259. --define 'with_mod_php %{with_mod_php}' \
  260. --define 'with_mod_php3 %{with_mod_php3}' \
  261. --define 'with_mod_ssl %{with_mod_ssl}' \
  262. Options (additional modules II):
  263. --define 'with_mod_access_referer %{with_mod_access_referer}' \
  264. --define 'with_mod_auth_pam %{with_mod_auth_pam}' \
  265. --define 'with_mod_fastcgi %{with_mod_fastcgi}' \
  266. --define 'with_mod_gzip %{with_mod_gzip}' \
  267. --define 'with_mod_relocate %{with_mod_relocate}' \
  268. --define 'with_mod_roaming %{with_mod_roaming}' \
  269. --define 'with_mod_throttle %{with_mod_throttle}' \
  270. --define 'with_mod_zmod %{with_mod_zmod}' \
  271. Options (additional extensions for mod_php):
  272. --define 'with_mod_php_bzip2 %{with_mod_php_bzip2}' \
  273. --define 'with_mod_php_bc %{with_mod_php_bc}' \
  274. --define 'with_mod_php_calendar %{with_mod_php_calendar}' \
  275. --define 'with_mod_php_db %{with_mod_php_db}' \
  276. --define 'with_mod_php_debug %{with_mod_php_debug}' \
  277. --define 'with_mod_php_ftp %{with_mod_php_ftp}' \
  278. --define 'with_mod_php_freetype %{with_mod_php_freetype}' \
  279. --define 'with_mod_php_gd %{with_mod_php_gd}' \
  280. --define 'with_mod_php_gettext %{with_mod_php_gettext}' \
  281. --define 'with_mod_php_imap %{with_mod_php_imap}' \
  282. --define 'with_mod_php_java %{with_mod_php_java}' \
  283. --define 'with_mod_php_mm %{with_mod_php_mm}' \
  284. --define 'with_mod_php_mysql %{with_mod_php_mysql}' \
  285. --define 'with_mod_php_oci8 %{with_mod_php_oci8}' \
  286. --define 'with_mod_php_openldap %{with_mod_php_openldap}' \
  287. --define 'with_mod_php_openssl %{with_mod_php_openssl}' \
  288. --define 'with_mod_php_pcre %{with_mod_php_pcre}' \
  289. --define 'with_mod_php_pdflib %{with_mod_php_pdflib}' \
  290. --define 'with_mod_php_transsid %{with_mod_php_transsid}' \
  291. --define 'with_mod_php_xml %{with_mod_php_xml}' \
  292. --define 'with_mod_php_zlib %{with_mod_php_zlib}' \
  293. Options (additional extensions for mod_php3):
  294. --define 'with_mod_php3_ftp %{with_mod_php3_ftp}' \
  295. --define 'with_mod_php3_gd %{with_mod_php3_gd}' \
  296. --define 'with_mod_php3_jpeg %{with_mod_php3_jpeg}' \
  297. --define 'with_mod_php3_mysql %{with_mod_php3_mysql}' \
  298. --define 'with_mod_php3_openssl %{with_mod_php3_openssl}' \
  299. --define 'with_mod_php3_zlib %{with_mod_php3_zlib}' \
  300. %prep
  301. # unpack Apache distribution
  302. %setup0 -q -c
  303. # unpack optional extension modules
  304. %if "%{with_mod_ssl}" == "yes"
  305. %setup1 -q -T -D -a 1
  306. %endif
  307. %if "%{with_mod_perl}" == "yes"
  308. %setup2 -q -T -D -a 2
  309. %endif
  310. %if "%{with_mod_php}" == "yes"
  311. %setup3 -q -T -D -a 3
  312. %patch0 -p0
  313. %endif
  314. %if "%{with_mod_dav}" == "yes"
  315. %setup4 -q -T -D -a 4
  316. %endif
  317. %if "%{with_mod_layout}" == "yes"
  318. %setup5 -q -T -D -a 5
  319. %endif
  320. %if "%{with_mod_macro}" == "yes"
  321. %setup6 -q -T -D -a 6
  322. %endif
  323. %if "%{with_mod_auth_pam}" == "yes"
  324. %setup7 -q -T -D -a 7
  325. %endif
  326. %if "%{with_mod_zmod}" == "yes"
  327. %setup9 -q -T -D -a 9
  328. %endif
  329. %if "%{with_mod_fastcgi}" == "yes"
  330. %setup10 -q -T -D -a 10
  331. %endif
  332. %if "%{with_mod_throttle}" == "yes"
  333. %setup11 -q -T -D -a 11
  334. %endif
  335. %if "%{with_mod_access_referer}" == "yes"
  336. %setup12 -q -T -D -a 12
  337. %endif
  338. %if "%{with_mod_roaming}" == "yes"
  339. %setup13 -q -T -D -a 13
  340. %endif
  341. %if "%{with_mod_relocate}" == "yes"
  342. %setup14 -q -T -D -a 14
  343. %endif
  344. %if "%{with_mod_php3}" == "yes"
  345. %setup15 -q -T -D -a 15
  346. %endif
  347. %build
  348. # prepare environment
  349. rm -rf $RPM_BUILD_ROOT
  350. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}
  351. # optionally prepare mod_ssl
  352. %if "%{with_mod_ssl}" == "yes"
  353. ( cd mod_ssl-%{V_mod_ssl}
  354. ./configure \
  355. --with-apache=../apache_%{V_apache} \
  356. --expert --force
  357. )
  358. %endif
  359. # optionally pre-configure Apache for mod_php, mod_php3 and mod_dav
  360. %if "%{with_mod_php}" == "yes" || "%{with_mod_php3}" == "yes" || "%{with_mod_dav}" == "yes"
  361. ( cd apache_%{V_apache}
  362. CC="%{l_cc}" \
  363. CFLAGS="%{l_cflags -O}" \
  364. ./configure \
  365. %if "%{with_mod_ssl}" == "yes"
  366. --enable-rule=EAPI \
  367. %endif
  368. --target=apache \
  369. --with-layout=GNU \
  370. --prefix=%{l_prefix} \
  371. --sbindir=%{l_prefix}/sbin \
  372. --sysconfdir=%{l_prefix}/etc/apache \
  373. --libexecdir=%{l_prefix}/lib/apache \
  374. --datadir=%{l_prefix}/share/apache \
  375. --localstatedir=%{l_prefix}/var/apache
  376. )
  377. %endif
  378. # optionally prepare mod_perl
  379. %if "%{with_mod_perl}" == "yes"
  380. ( cd mod_perl-%{V_mod_perl}
  381. eval `%{l_prefix}/bin/perl -V:archname`
  382. eval `%{l_prefix}/bin/perl -V:version`
  383. eval `%{l_prefix}/bin/perl -V:installarchlib -V:installprivlib -V:installsitearch -V:installsitelib`
  384. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/bin
  385. perl=$RPM_BUILD_ROOT%{l_prefix}/bin/perl
  386. echo "#!/bin/sh" >$perl
  387. echo "exec %{l_prefix}/bin/perl \\" >>$perl
  388. echo " -I${RPM_BUILD_ROOT}${installarchlib} \\" >>$perl
  389. echo " -I${RPM_BUILD_ROOT}${installprivlib} \\" >>$perl
  390. echo " -I${RPM_BUILD_ROOT}${installsitearch} \\" >>$perl
  391. echo " -I${RPM_BUILD_ROOT}${installsitelib} \\" >>$perl
  392. echo " \"\$@\"" >>$perl
  393. chmod a+x $perl
  394. $perl Makefile.PL \
  395. PREFIX=$RPM_BUILD_ROOT%{l_prefix} \
  396. APACHE_SRC=../apache_%{V_apache}/src \
  397. DO_HTTPD=1 \
  398. USE_APACI=1 \
  399. PREP_HTTPD=1 \
  400. EVERYTHING=1 \
  401. PERL_TIE_TABLES=1 \
  402. PERL_DIRECTIVE_HANDLERS=1
  403. %{l_make} %{l_mflags}
  404. %{l_make} %{l_mflags} install
  405. rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man3
  406. %{l_shtool} subst -e "s;^\\(PERL = \\).*;\\1 $perl;" \
  407. ../apache_%{V_apache}/src/modules/perl/mod_perl.config
  408. )
  409. %endif
  410. # optionally prepare mod_php
  411. %if "%{with_mod_php}" == "yes"
  412. ( cd php-%{V_mod_php}
  413. CC="%{l_cc}"; export CC
  414. CFLAGS="%{l_cflags -O} -I%{l_prefix}/include"; export CFLAGS
  415. CPPFLAGS="%{l_cflags -O} -I%{l_prefix}/include"; export CPPFLAGS
  416. LDFLAGS="%{l_cflags -O} -L%{l_prefix}/lib"; export LDFLAGS
  417. LIBS=""; export LIBS
  418. %if "%{with_mod_ssl}" == "yes"
  419. CFLAGS="$CFLAGS -DEAPI"
  420. %endif
  421. %if "%{with_mod_php_gd}" == "yes"
  422. LIBS="$LIBS -lpng -lz"
  423. %endif
  424. %if "%{with_mod_php_gettext}" == "yes"
  425. LIBS="$LIBS -liconv" \
  426. %endif
  427. %if "%{with_mod_php_openldap}" == "yes"
  428. LIBS="$LIBS -lsasl2"
  429. %endif
  430. ./configure \
  431. --prefix=%{l_prefix} \
  432. --with-apache=../apache_%{V_apache} \
  433. --with-config-file-path=%{l_prefix}/etc/apache \
  434. %if "%{with_mod_php_calendar}" == "yes"
  435. --enable-calendar \
  436. %endif
  437. %if "%{with_mod_php_mysql}" == "yes"
  438. --with-mysql=%{l_prefix} \
  439. %endif
  440. %if "%{with_mod_php_gd}" == "yes"
  441. --with-gd=%{l_prefix} \
  442. --with-jpeg-dir=%{l_prefix} \
  443. --with-png-dir=%{l_prefix} \
  444. %endif
  445. %if "%{with_mod_php_freetype}" == "yes"
  446. --enable-gd-imgstrttf \
  447. --enable-gd-native-ttf \
  448. --with-freetype-dir=%{l_prefix} \
  449. %endif
  450. %if "%{with_mod_php_db}" == "yes"
  451. --with-db3=%{l_prefix} \
  452. %endif
  453. %if "%{with_mod_php_debug}" == "yes"
  454. --with-debug=yes \
  455. %else
  456. --with-debug=no \
  457. %endif
  458. %if "%{with_mod_php_zlib}" == "yes"
  459. --with-zlib=%{l_prefix} \
  460. %endif
  461. %if "%{with_mod_php_bzip2}" == "yes"
  462. --with-bz2=%{l_prefix} \
  463. %endif
  464. %if "%{with_mod_php_pdflib}" == "yes"
  465. --with-pdflib=%{l_prefix} \
  466. --with-jpeg-dir=%{l_prefix} \
  467. --with-png-dir=%{l_prefix} \
  468. %endif
  469. %if "%{with_mod_php_openssl}" == "yes" || "%{with_mod_php_openldap}" == "yes"
  470. --with-openssl=%{l_prefix} \
  471. %endif
  472. %if "%{with_mod_php_openldap}" == "yes"
  473. --with-ldap=%{l_prefix} \
  474. %endif
  475. %if "%{with_mod_php_mm}" == "yes"
  476. --with-mm=%{l_prefix} \
  477. --enable-session \
  478. %endif
  479. %if "%{with_mod_php_pcre}" == "yes"
  480. --with-pcre=%{l_prefix} \
  481. %endif
  482. %if "%{with_mod_php_ftp}" == "yes"
  483. --enable-ftp \
  484. %endif
  485. %if "%{with_mod_php_java}" == "yes"
  486. --with-java=%{l_prefix}/libexec/j2se \
  487. %endif
  488. %if "%{with_mod_php_oci8}" == "yes"
  489. --with-oci8 \
  490. %endif
  491. %if "%{with_mod_php_gettext}" == "yes"
  492. --with-gettext=%{l_prefix} \
  493. %endif
  494. %if "%{with_mod_php_imap}" == "yes"
  495. --with-imap=%{l_prefix} \
  496. %endif
  497. %if "%{with_mod_php_xml}" == "yes"
  498. --with-xml=%{l_prefix} \
  499. %endif
  500. %if "%{with_mod_php_bc}" == "yes"
  501. --enable-bcmath \
  502. %endif
  503. %if "%{with_mod_php_transsid}" == "yes"
  504. --enable-trans-sid \
  505. %endif
  506. --without-pear \
  507. --disable-shared \
  508. --enable-inline-optimization \
  509. --enable-track-vars
  510. %{l_make} %{l_mflags}
  511. %{l_shtool} subst \
  512. -e "s;^\\(EXTENSION_DIR = \\)\\(%{l_prefix}\\);\\1$RPM_BUILD_ROOT\\2;" \
  513. -e "s;^\\(PEAR_INSTALLDIR = \\)\\(%{l_prefix}\\);\\1$RPM_BUILD_ROOT\\2;" \
  514. config_vars.mk
  515. %{l_make} %{l_mflags} install \
  516. prefix=$RPM_BUILD_ROOT%{l_prefix}
  517. )
  518. %endif
  519. # optionally prepare mod_php3
  520. %if "%{with_mod_php3}" == "yes"
  521. ( cd php-%{V_mod_php3}
  522. CC="%{l_cc}" \
  523. %if "%{with_mod_ssl}" == "yes"
  524. CFLAGS="%{l_cflags -O} -I%{l_prefix}/include -DEAPI" \
  525. %else
  526. CFLAGS="%{l_cflags -O} -I%{l_prefix}/include" \
  527. %endif
  528. CPPFLAGS="%{l_cflags -O} -I%{l_prefix}/include" \
  529. LDFLAGS="%{l_cflags -O} -L%{l_prefix}/lib" \
  530. ./configure \
  531. --prefix=%{l_prefix} \
  532. --with-apache=../apache_%{V_apache} \
  533. --with-config-file-path=%{l_prefix}/etc/apache \
  534. %if "%{with_mod_php3_ftp}" == "yes"
  535. --with-ftp \
  536. %endif
  537. %if "%{with_mod_php3_mysql}" == "yes"
  538. --with-mysql=%{l_prefix} \
  539. %endif
  540. %if "%{with_mod_php3_zlib}" == "yes"
  541. --with-zlib=%{l_prefix} \
  542. %endif
  543. %if "%{with_mod_php3_jpeg}" == "yes"
  544. --with-jpeg=${prefix} \
  545. %endif
  546. %if "%{with_mod_php3_gd}" == "yes"
  547. --with-gd=${prefix} \
  548. %endif
  549. %if "%{with_mod_php3_openssl}" == "yes"
  550. --with-openssl=%{l_prefix} \
  551. %endif
  552. --disable-shared \
  553. --enable-track-vars
  554. # FIXME: the following options would also be nice to
  555. # be added conditionally, but the RPM 4.0.2 macro processor
  556. # is already at its limit and does not allow more here.
  557. # --enable-safe-mode
  558. # --with-exec-dir[=DIR]
  559. # --enable-magic-quotes
  560. # --enable-memory-limit
  561. # --enable-sysvsem
  562. # --enable-sysvshm
  563. %{l_make} %{l_mflags}
  564. %{l_make} %{l_mflags} install \
  565. prefix=$RPM_BUILD_ROOT%{l_prefix}
  566. )
  567. %endif
  568. # optionally prepare mod_dav
  569. %if "%{with_mod_dav}" == "yes"
  570. ( cd mod_dav-%{V_mod_dav}
  571. CC="%{l_cc}" \
  572. %if "%{with_mod_ssl}" == "yes"
  573. CFLAGS="%{l_cflags -O}" \
  574. %else
  575. CFLAGS="%{l_cflags -O} -DEAPI" \
  576. %endif
  577. LDFLAGS="%{l_cflags -O}" \
  578. ./configure \
  579. --with-apache=../apache_%{V_apache}
  580. %{l_make} %{l_mflags}
  581. %{l_make} %{l_mflags} install
  582. )
  583. %endif
  584. # optionally prepare mod_layout
  585. %if "%{with_mod_layout}" == "yes"
  586. ( cd mod_layout-%{V_mod_layout}
  587. mkdir ../apache_%{V_apache}/src/modules/layout
  588. cp * ../apache_%{V_apache}/src/modules/layout/ 2>/dev/null || true
  589. chmod -R u+w ../apache_%{V_apache}/src/modules/layout
  590. )
  591. %endif
  592. # optionally prepare mod_macro
  593. %if "%{with_mod_macro}" == "yes"
  594. ( cd mod_macro-%{V_mod_macro}
  595. cp mod_macro.c ../apache_%{V_apache}/src/modules/extra/
  596. )
  597. %endif
  598. # optionally prepare mod_auth_pam
  599. %if "%{with_mod_auth_pam}" == "yes"
  600. ( cd mod_auth_pam-%{V_mod_auth_pam}
  601. cp mod_auth_pam.c ../apache_%{V_apache}/src/modules/extra/
  602. )
  603. %endif
  604. # optionally prepare mod_gzip
  605. %if "%{with_mod_gzip}" == "yes"
  606. cp %{SOURCE mod_gzip.c} apache_%{V_apache}/src/modules/extra/
  607. %endif
  608. # optionally prepare mod_zmod
  609. %if "%{with_mod_zmod}" == "yes"
  610. ( cd src
  611. mkdir ../apache_%{V_apache}/src/modules/zmod
  612. %{l_shtool} subst -e 's;"compat.h";"ap_compat.h";' modules/zmod/mod_zmod.c
  613. cp modules/zmod/* ../apache_%{V_apache}/src/modules/zmod/
  614. )
  615. %endif
  616. # optionally prepare mod_fastcgi
  617. %if "%{with_mod_fastcgi}" == "yes"
  618. ( cd mod_fastcgi-%{V_mod_fastcgi}
  619. mkdir ../apache_%{V_apache}/src/modules/fastcgi
  620. cp -rp * ../apache_%{V_apache}/src/modules/fastcgi/
  621. )
  622. %endif
  623. # optionally prepare mod_throttle
  624. %if "%{with_mod_throttle}" == "yes"
  625. ( cd mod_throttle-*
  626. cp mod_throttle.c ../apache_%{V_apache}/src/modules/extra/
  627. )
  628. %endif
  629. # optionally prepare mod_access_referer
  630. %if "%{with_mod_access_referer}" == "yes"
  631. ( cd mod_access_referer-%{V_mod_access_referer}
  632. cp mod_access_referer.c ../apache_%{V_apache}/src/modules/extra/
  633. )
  634. %endif
  635. # optionally prepare mod_roaming
  636. %if "%{with_mod_roaming}" == "yes"
  637. ( cd mod_roaming-%{V_mod_roaming}
  638. cp mod_roaming.c ../apache_%{V_apache}/src/modules/extra/
  639. )
  640. %endif
  641. # optionally prepare mod_relocate
  642. %if "%{with_mod_relocate}" == "yes"
  643. ( cd mod_relocate-%{V_mod_relocate}
  644. cp mod_relocate.c ../apache_%{V_apache}/src/modules/extra/
  645. )
  646. %endif
  647. # configure Apache
  648. ( cd apache_%{V_apache}
  649. cflags="%{l_cflags -O}"
  650. ldflags=""
  651. libs=""
  652. %if "%{with_mod_auth_pam}" == "yes"
  653. pam_incdir=`%{l_prefix}/etc/rc --query pam_incdir`
  654. if [ ".$pam_incdir" != "./usr/include" -a ".$pam_incdir" != "./include" ]; then
  655. cflags="$cflags -I$pam_incdir"
  656. fi
  657. pam_libdir=`%{l_prefix}/etc/rc --query pam_libdir`
  658. if [ ".$pam_libdir" != "./usr/lib" -a ".$pam_libdir" != "./lib" ]; then
  659. ldflags="$ldflags -L$pam_libdir"
  660. fi
  661. libs="$libs -lpam"
  662. %endif
  663. CC="%{l_cc}" \
  664. CFLAGS="$cflags" \
  665. LDFLAGS="$ldflags" \
  666. LIBS="$libs" \
  667. %if "%{with_mod_ssl}" == "yes"
  668. EAPI_MM="%{l_prefix}" \
  669. SSL_BASE="%{l_prefix}" \
  670. %endif
  671. ./configure \
  672. --target=apache \
  673. --with-layout=GNU \
  674. --prefix=%{l_prefix} \
  675. --sbindir=%{l_prefix}/sbin \
  676. --sysconfdir=%{l_prefix}/etc/apache \
  677. --libexecdir=%{l_prefix}/lib/apache \
  678. --datadir=%{l_prefix}/share/apache \
  679. --localstatedir=%{l_prefix}/var/apache \
  680. --enable-suexec \
  681. --suexec-caller=%{l_nusr} \
  682. --suexec-userdir=.www \
  683. --enable-module=most \
  684. --with-perl=%{l_prefix}/bin/perl \
  685. %if "%{with_mod_ssl}" == "yes"
  686. --enable-rule=EAPI \
  687. --enable-module=ssl \
  688. %endif
  689. %if "%{with_mod_perl}" == "yes"
  690. --activate-module=src/modules/perl/libperl.a \
  691. %endif
  692. %if "%{with_mod_php}" == "yes"
  693. --activate-module=src/modules/php4/libphp4.a \
  694. %endif
  695. %if "%{with_mod_php3}" == "yes"
  696. --activate-module=src/modules/php3/libphp3.a \
  697. %endif
  698. %if "%{with_mod_dav}" == "yes"
  699. --activate-module=src/modules/dav/libdav.a \
  700. %endif
  701. %if "%{with_mod_layout}" == "yes"
  702. --activate-module=src/modules/layout/liblayout.a \
  703. %endif
  704. %if "%{with_mod_macro}" == "yes"
  705. --activate-module=src/modules/extra/mod_macro.o \
  706. %endif
  707. %if "%{with_mod_auth_pam}" == "yes"
  708. --activate-module=src/modules/extra/mod_auth_pam.o \
  709. %endif
  710. %if "%{with_mod_gzip}" == "yes"
  711. --activate-module=src/modules/extra/mod_gzip.o \
  712. %endif
  713. %if "%{with_mod_zmod}" == "yes"
  714. --activate-module=src/modules/zmod/libzmod.a \
  715. %endif
  716. %if "%{with_mod_fastcgi}" == "yes"
  717. --activate-module=src/modules/fastcgi/libfastcgi.a \
  718. %endif
  719. %if "%{with_mod_throttle}" == "yes"
  720. --activate-module=src/modules/extra/mod_throttle.o \
  721. %endif
  722. %if "%{with_mod_access_referer}" == "yes"
  723. --activate-module=src/modules/extra/mod_access_referer.o \
  724. %endif
  725. %if "%{with_mod_roaming}" == "yes"
  726. --activate-module=src/modules/extra/mod_roaming.o \
  727. %endif
  728. %if "%{with_mod_relocate}" == "yes"
  729. --activate-module=src/modules/extra/mod_relocate.o \
  730. %endif
  731. --enable-module=so
  732. %{l_make} %{l_mflags -O} build-quiet
  733. )
  734. %install
  735. # install Apache
  736. ( cd apache_%{V_apache}
  737. # perform standard Apache installation procedure
  738. %{l_make} %{l_mflags} install root=$RPM_BUILD_ROOT
  739. # post-adjustments to installation tree
  740. mv $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/small/* \
  741. $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/
  742. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/small
  743. rm -f $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/README*
  744. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/apache/*.default
  745. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/apache/srm.conf
  746. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/apache/access.conf
  747. mv $RPM_BUILD_ROOT%{l_prefix}/share/apache/htdocs/index.html.en \
  748. $RPM_BUILD_ROOT%{l_prefix}/share/apache/htdocs/index.html
  749. rm -f $RPM_BUILD_ROOT%{l_prefix}/share/apache/htdocs/index.html.*
  750. chmod a+rx $RPM_BUILD_ROOT%{l_prefix}/share/apache/cgi-bin/*
  751. mv $RPM_BUILD_ROOT%{l_prefix}/share/apache/cgi-bin \
  752. $RPM_BUILD_ROOT%{l_prefix}/cgi/
  753. rm -rf $RPM_BUILD_ROOT%{l_prefix}/cgi/test-cgi
  754. )
  755. # optionally cleanup for mod_perl
  756. %if "%{with_mod_perl}" == "yes"
  757. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/perl
  758. %endif
  759. # create default configuration
  760. l_hostname=`%{l_shtool} echo -e %h`
  761. l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
  762. %{l_shtool} install -c -m 644 \
  763. -e 's;@l_prefix@;%{l_prefix};g' \
  764. -e "s;@l_hostname@;$l_hostname;g" \
  765. -e "s;@l_domainname@;$l_domainname;g" \
  766. -e 's;@l_nusr@;%{l_nusr};g' \
  767. -e 's;@l_ngrp@;%{l_ngrp};g' \
  768. %{SOURCE apache.base} \
  769. %{SOURCE apache.conf} \
  770. %{SOURCE apache.vhost} \
  771. $RPM_BUILD_ROOT%{l_prefix}/etc/apache/
  772. mv $RPM_BUILD_ROOT%{l_prefix}/etc/apache/magic $RPM_BUILD_ROOT%{l_prefix}/etc/apache/mime.magic
  773. find $RPM_BUILD_ROOT%{l_prefix} -name perllocal.pod -print | xargs rm -f
  774. # create run-command script
  775. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  776. %{l_shtool} install -c -m 755 -e 's;@l_prefix@;%{l_prefix};g' \
  777. -e 's;@l_musr@;%{l_musr};g' -e 's;@l_mgrp@;%{l_mgrp};g' \
  778. %{SOURCE rc.apache} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  779. # strip installation binaries
  780. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2> /dev/null || true
  781. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2> /dev/null || true
  782. # determine installation tree files
  783. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  784. %{l_files_std} \
  785. '%attr(4755,root,%{l_mgrp}) %{l_prefix}/sbin/suexec' \
  786. '%config %{l_prefix}/etc/apache/*' \
  787. %if "%{with_mod_ssl}" == "yes"
  788. '%config %{l_prefix}/etc/apache/ssl.crl/*.crl' \
  789. '%config %{l_prefix}/etc/apache/ssl.crt/*.crt' \
  790. '%config %{l_prefix}/etc/apache/ssl.csr/*.csr' \
  791. '%config %{l_prefix}/etc/apache/ssl.key/*.key' \
  792. '%config %{l_prefix}/etc/apache/ssl.prm/*.prm' \
  793. %endif
  794. '%config %attr(444,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/apache/apache.base'
  795. %files -f files
  796. %clean
  797. rm -rf $RPM_BUILD_ROOT
  798. %post
  799. %if "%{with_mod_auth_pam}" == "yes"
  800. # add PAM configuration entry
  801. if [ $1 -eq 1 ]; then
  802. $RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=apache
  803. fi
  804. %endif
  805. %preun
  806. %if "%{with_mod_auth_pam}" == "yes"
  807. # remove PAM configuration entry
  808. if [ $1 -eq 0 ]; then
  809. $RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=apache
  810. fi
  811. %endif