apache.spec 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856
  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: 20021120
  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. # build information
  160. Prefix: %{l_prefix}
  161. BuildRoot: %{l_buildroot}
  162. BuildPreReq: OpenPKG, openpkg >= 20020222
  163. PreReq: OpenPKG, openpkg >= 20020222
  164. %if "%{with_mod_ssl}" == "yes"
  165. BuildPreReq: openssl, mm
  166. %endif
  167. %if "%{with_mod_perl}" == "yes"
  168. BuildPreReq: perl
  169. PreReq: perl
  170. %endif
  171. %if "%{with_mod_php}" == "yes"
  172. BuildPreReq: make, bison, flex
  173. %if "%{with_mod_php_mysql}" == "yes"
  174. BuildPreReq: mysql
  175. %endif
  176. %if "%{with_mod_php_gd}" == "yes"
  177. BuildPreReq: GD, jpeg, png
  178. %endif
  179. %if "%{with_mod_php_db}" == "yes"
  180. BuildPreReq: db
  181. %endif
  182. %if "%{with_mod_php_pdflib}" == "yes"
  183. BuildPreReq: pdflib, jpeg, png
  184. %endif
  185. %if "%{with_mod_php_zlib}" == "yes"
  186. BuildPreReq: zlib
  187. %endif
  188. %if "%{with_mod_php_bzip2}" == "yes"
  189. BuildPreReq: bzip2
  190. %endif
  191. %if "%{with_mod_php_openssl}" == "yes"
  192. BuildPreReq: openssl
  193. %endif
  194. %if "%{with_mod_php_openldap}" == "yes"
  195. BuildPreReq: openldap, openssl
  196. %endif
  197. %if "%{with_mod_php_mm}" == "yes"
  198. BuildPreReq: mm
  199. %endif
  200. %if "%{with_mod_php_pcre}" == "yes"
  201. BuildPreReq: pcre
  202. %endif
  203. %if "%{with_mod_php_java}" == "yes"
  204. BuildPreReq: j2se
  205. %endif
  206. %if "%{with_mod_php_freetype}" == "yes"
  207. BuildPreReq: freetype
  208. %endif
  209. %if "%{with_mod_php_gettext}" == "yes"
  210. BuildPreReq: gettext, libiconv
  211. %endif
  212. %if "%{with_mod_php_imap}" == "yes"
  213. BuildPreReq: c-client
  214. %endif
  215. %if "%{with_mod_php_xml}" == "yes"
  216. BuildPreReq: expat
  217. %endif
  218. %endif
  219. %if "%{with_mod_php3}" == "yes"
  220. BuildPreReq: make, bison, flex
  221. %if "%{with_mod_php3_gd}" == "yes"
  222. BuildPreReq: GD
  223. %endif
  224. %if "%{with_mod_php3_jpeg}" == "yes"
  225. BuildPreReq: jpeg
  226. %endif
  227. %if "%{with_mod_php3_mysql}" == "yes"
  228. BuildPreReq: mysql
  229. %endif
  230. %if "%{with_mod_php3_openssl}" == "yes"
  231. BuildPreReq: openssl
  232. %endif
  233. %if "%{with_mod_php3_zlib}" == "yes"
  234. BuildPreReq: zlib
  235. %endif
  236. %endif
  237. %if "%{with_mod_auth_pam}" == "yes"
  238. BuildPreReq: PAM
  239. PreReq: PAM
  240. %endif
  241. AutoReq: no
  242. AutoReqProv: no
  243. %description
  244. The Apache Project is a collaborative software development effort
  245. aimed at creating a robust, commercial-grade, featureful, and
  246. freely-available source code implementation of an HTTP (Web) server.
  247. The project is jointly managed by a group of volunteers located
  248. around the world, using the Internet and the Web to communicate,
  249. plan, and develop the server and its related documentation. These
  250. volunteers are known as the Apache Group. In addition, hundreds
  251. of users have contributed ideas, code, and documentation to the
  252. project.
  253. Options (additional modules I):
  254. --define 'with_mod_dav %{with_mod_dav}' \
  255. --define 'with_mod_layout %{with_mod_layout}' \
  256. --define 'with_mod_macro %{with_mod_macro}' \
  257. --define 'with_mod_perl %{with_mod_perl}' \
  258. --define 'with_mod_php %{with_mod_php}' \
  259. --define 'with_mod_php3 %{with_mod_php3}' \
  260. --define 'with_mod_ssl %{with_mod_ssl}' \
  261. Options (additional modules II):
  262. --define 'with_mod_access_referer %{with_mod_access_referer}' \
  263. --define 'with_mod_auth_pam %{with_mod_auth_pam}' \
  264. --define 'with_mod_fastcgi %{with_mod_fastcgi}' \
  265. --define 'with_mod_gzip %{with_mod_gzip}' \
  266. --define 'with_mod_relocate %{with_mod_relocate}' \
  267. --define 'with_mod_roaming %{with_mod_roaming}' \
  268. --define 'with_mod_throttle %{with_mod_throttle}' \
  269. --define 'with_mod_zmod %{with_mod_zmod}' \
  270. Options (additional extensions for mod_php):
  271. --define 'with_mod_php_bzip2 %{with_mod_php_bzip2}' \
  272. --define 'with_mod_php_bc %{with_mod_php_bc}' \
  273. --define 'with_mod_php_calendar %{with_mod_php_calendar}' \
  274. --define 'with_mod_php_db %{with_mod_php_db}' \
  275. --define 'with_mod_php_debug %{with_mod_php_debug}' \
  276. --define 'with_mod_php_ftp %{with_mod_php_ftp}' \
  277. --define 'with_mod_php_freetype %{with_mod_php_freetype}' \
  278. --define 'with_mod_php_gd %{with_mod_php_gd}' \
  279. --define 'with_mod_php_gettext %{with_mod_php_gettext}' \
  280. --define 'with_mod_php_imap %{with_mod_php_imap}' \
  281. --define 'with_mod_php_java %{with_mod_php_java}' \
  282. --define 'with_mod_php_mm %{with_mod_php_mm}' \
  283. --define 'with_mod_php_mysql %{with_mod_php_mysql}' \
  284. --define 'with_mod_php_oci8 %{with_mod_php_oci8}' \
  285. --define 'with_mod_php_openldap %{with_mod_php_openldap}' \
  286. --define 'with_mod_php_openssl %{with_mod_php_openssl}' \
  287. --define 'with_mod_php_pcre %{with_mod_php_pcre}' \
  288. --define 'with_mod_php_pdflib %{with_mod_php_pdflib}' \
  289. --define 'with_mod_php_transsid %{with_mod_php_transsid}' \
  290. --define 'with_mod_php_xml %{with_mod_php_xml}' \
  291. --define 'with_mod_php_zlib %{with_mod_php_zlib}' \
  292. Options (additional extensions for mod_php3):
  293. --define 'with_mod_php3_ftp %{with_mod_php3_ftp}' \
  294. --define 'with_mod_php3_gd %{with_mod_php3_gd}' \
  295. --define 'with_mod_php3_jpeg %{with_mod_php3_jpeg}' \
  296. --define 'with_mod_php3_mysql %{with_mod_php3_mysql}' \
  297. --define 'with_mod_php3_openssl %{with_mod_php3_openssl}' \
  298. --define 'with_mod_php3_zlib %{with_mod_php3_zlib}' \
  299. %prep
  300. # unpack Apache distribution
  301. %setup0 -q -c
  302. # unpack optional extension modules
  303. %if "%{with_mod_ssl}" == "yes"
  304. %setup1 -q -T -D -a 1
  305. %endif
  306. %if "%{with_mod_perl}" == "yes"
  307. %setup2 -q -T -D -a 2
  308. %endif
  309. %if "%{with_mod_php}" == "yes"
  310. %setup3 -q -T -D -a 3
  311. %endif
  312. %if "%{with_mod_dav}" == "yes"
  313. %setup4 -q -T -D -a 4
  314. %endif
  315. %if "%{with_mod_layout}" == "yes"
  316. %setup5 -q -T -D -a 5
  317. %endif
  318. %if "%{with_mod_macro}" == "yes"
  319. %setup6 -q -T -D -a 6
  320. %endif
  321. %if "%{with_mod_auth_pam}" == "yes"
  322. %setup7 -q -T -D -a 7
  323. %endif
  324. %if "%{with_mod_zmod}" == "yes"
  325. %setup9 -q -T -D -a 9
  326. %endif
  327. %if "%{with_mod_fastcgi}" == "yes"
  328. %setup10 -q -T -D -a 10
  329. %endif
  330. %if "%{with_mod_throttle}" == "yes"
  331. %setup11 -q -T -D -a 11
  332. %endif
  333. %if "%{with_mod_access_referer}" == "yes"
  334. %setup12 -q -T -D -a 12
  335. %endif
  336. %if "%{with_mod_roaming}" == "yes"
  337. %setup13 -q -T -D -a 13
  338. %endif
  339. %if "%{with_mod_relocate}" == "yes"
  340. %setup14 -q -T -D -a 14
  341. %endif
  342. %if "%{with_mod_php3}" == "yes"
  343. %setup15 -q -T -D -a 15
  344. %endif
  345. %build
  346. # prepare environment
  347. rm -rf $RPM_BUILD_ROOT
  348. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}
  349. # optionally prepare mod_ssl
  350. %if "%{with_mod_ssl}" == "yes"
  351. ( cd mod_ssl-%{V_mod_ssl}
  352. ./configure \
  353. --with-apache=../apache_%{V_apache} \
  354. --expert --force
  355. )
  356. %endif
  357. # optionally pre-configure Apache for mod_php, mod_php3 and mod_dav
  358. %if "%{with_mod_php}" == "yes" || "%{with_mod_php3}" == "yes" || "%{with_mod_dav}" == "yes"
  359. ( cd apache_%{V_apache}
  360. CC="%{l_cc}" \
  361. CFLAGS="%{l_cflags -O}" \
  362. ./configure \
  363. %if "%{with_mod_ssl}" == "yes"
  364. --enable-rule=EAPI \
  365. %endif
  366. --target=apache \
  367. --with-layout=GNU \
  368. --prefix=%{l_prefix} \
  369. --sbindir=%{l_prefix}/sbin \
  370. --sysconfdir=%{l_prefix}/etc/apache \
  371. --libexecdir=%{l_prefix}/lib/apache \
  372. --datadir=%{l_prefix}/share/apache \
  373. --localstatedir=%{l_prefix}/var/apache
  374. )
  375. %endif
  376. # optionally prepare mod_perl
  377. %if "%{with_mod_perl}" == "yes"
  378. ( cd mod_perl-%{V_mod_perl}
  379. eval `%{l_prefix}/bin/perl -V:archname`
  380. eval `%{l_prefix}/bin/perl -V:version`
  381. eval `%{l_prefix}/bin/perl -V:installarchlib -V:installprivlib -V:installsitearch -V:installsitelib`
  382. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/bin
  383. perl=$RPM_BUILD_ROOT%{l_prefix}/bin/perl
  384. echo "#!/bin/sh" >$perl
  385. echo "exec %{l_prefix}/bin/perl \\" >>$perl
  386. echo " -I${RPM_BUILD_ROOT}${installarchlib} \\" >>$perl
  387. echo " -I${RPM_BUILD_ROOT}${installprivlib} \\" >>$perl
  388. echo " -I${RPM_BUILD_ROOT}${installsitearch} \\" >>$perl
  389. echo " -I${RPM_BUILD_ROOT}${installsitelib} \\" >>$perl
  390. echo " \"\$@\"" >>$perl
  391. chmod a+x $perl
  392. $perl Makefile.PL \
  393. PREFIX=$RPM_BUILD_ROOT%{l_prefix} \
  394. APACHE_SRC=../apache_%{V_apache}/src \
  395. DO_HTTPD=1 \
  396. USE_APACI=1 \
  397. PREP_HTTPD=1 \
  398. EVERYTHING=1 \
  399. PERL_TIE_TABLES=1 \
  400. PERL_DIRECTIVE_HANDLERS=1
  401. %{l_make} %{l_mflags}
  402. %{l_make} %{l_mflags} install
  403. rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man3
  404. %{l_shtool} subst -e "s;^\\(PERL = \\).*;\\1 $perl;" \
  405. ../apache_%{V_apache}/src/modules/perl/mod_perl.config
  406. )
  407. %endif
  408. # optionally prepare mod_php
  409. %if "%{with_mod_php}" == "yes"
  410. ( cd php-%{V_mod_php}
  411. CC="%{l_cc}"; export CC
  412. CFLAGS="%{l_cflags -O} -I%{l_prefix}/include"; export CFLAGS
  413. CPPFLAGS="%{l_cflags -O} -I%{l_prefix}/include"; export CPPFLAGS
  414. LDFLAGS="%{l_cflags -O} -L%{l_prefix}/lib"; export LDFLAGS
  415. LIBS=""; export LIBS
  416. %if "%{with_mod_ssl}" == "yes"
  417. CFLAGS="$CFLAGS -DEAPI"
  418. %endif
  419. %if "%{with_mod_php_gd}" == "yes"
  420. LIBS="$LIBS -lpng -lz"
  421. %endif
  422. %if "%{with_mod_php_gettext}" == "yes"
  423. LIBS="$LIBS -liconv" \
  424. %endif
  425. %if "%{with_mod_php_openldap}" == "yes"
  426. LIBS="$LIBS -lsasl2"
  427. %endif
  428. ./configure \
  429. --prefix=%{l_prefix} \
  430. --with-apache=../apache_%{V_apache} \
  431. --with-config-file-path=%{l_prefix}/etc/apache \
  432. %if "%{with_mod_php_calendar}" == "yes"
  433. --enable-calendar \
  434. %endif
  435. %if "%{with_mod_php_mysql}" == "yes"
  436. --with-mysql=%{l_prefix} \
  437. %endif
  438. %if "%{with_mod_php_gd}" == "yes"
  439. --with-gd=%{l_prefix} \
  440. --with-jpeg-dir=%{l_prefix} \
  441. --with-png-dir=%{l_prefix} \
  442. %endif
  443. %if "%{with_mod_php_freetype}" == "yes"
  444. --enable-gd-imgstrttf \
  445. --enable-gd-native-ttf \
  446. --with-freetype-dir=%{l_prefix} \
  447. %endif
  448. %if "%{with_mod_php_db}" == "yes"
  449. --with-db3=%{l_prefix} \
  450. %endif
  451. %if "%{with_mod_php_debug}" == "yes"
  452. --with-debug=yes \
  453. %else
  454. --with-debug=no \
  455. %endif
  456. %if "%{with_mod_php_zlib}" == "yes"
  457. --with-zlib=%{l_prefix} \
  458. %endif
  459. %if "%{with_mod_php_bzip2}" == "yes"
  460. --with-bz2=%{l_prefix} \
  461. %endif
  462. %if "%{with_mod_php_pdflib}" == "yes"
  463. --with-pdflib=%{l_prefix} \
  464. --with-jpeg-dir=%{l_prefix} \
  465. --with-png-dir=%{l_prefix} \
  466. %endif
  467. %if "%{with_mod_php_openssl}" == "yes" || "%{with_mod_php_openldap}" == "yes"
  468. --with-openssl=%{l_prefix} \
  469. %endif
  470. %if "%{with_mod_php_openldap}" == "yes"
  471. --with-ldap=%{l_prefix} \
  472. %endif
  473. %if "%{with_mod_php_mm}" == "yes"
  474. --with-mm=%{l_prefix} \
  475. --enable-session \
  476. %endif
  477. %if "%{with_mod_php_pcre}" == "yes"
  478. --with-pcre=%{l_prefix} \
  479. %endif
  480. %if "%{with_mod_php_ftp}" == "yes"
  481. --enable-ftp \
  482. %endif
  483. %if "%{with_mod_php_java}" == "yes"
  484. --with-java=%{l_prefix}/libexec/j2se \
  485. %endif
  486. %if "%{with_mod_php_oci8}" == "yes"
  487. --with-oci8 \
  488. %endif
  489. %if "%{with_mod_php_gettext}" == "yes"
  490. --with-gettext=%{l_prefix} \
  491. %endif
  492. %if "%{with_mod_php_imap}" == "yes"
  493. --with-imap=%{l_prefix} \
  494. %endif
  495. %if "%{with_mod_php_xml}" == "yes"
  496. --with-xml=%{l_prefix} \
  497. %endif
  498. %if "%{with_mod_php_bc}" == "yes"
  499. --enable-bcmath \
  500. %endif
  501. %if "%{with_mod_php_transsid}" == "yes"
  502. --enable-trans-sid \
  503. %endif
  504. --without-pear \
  505. --disable-shared \
  506. --enable-inline-optimization \
  507. --enable-track-vars
  508. %{l_make} %{l_mflags}
  509. %{l_shtool} subst \
  510. -e "s;^\\(EXTENSION_DIR = \\)\\(%{l_prefix}\\);\\1$RPM_BUILD_ROOT\\2;" \
  511. -e "s;^\\(PEAR_INSTALLDIR = \\)\\(%{l_prefix}\\);\\1$RPM_BUILD_ROOT\\2;" \
  512. config_vars.mk
  513. %{l_make} %{l_mflags} install \
  514. prefix=$RPM_BUILD_ROOT%{l_prefix}
  515. )
  516. %endif
  517. # optionally prepare mod_php3
  518. %if "%{with_mod_php3}" == "yes"
  519. ( cd php-%{V_mod_php3}
  520. CC="%{l_cc}" \
  521. %if "%{with_mod_ssl}" == "yes"
  522. CFLAGS="%{l_cflags -O} -I%{l_prefix}/include -DEAPI" \
  523. %else
  524. CFLAGS="%{l_cflags -O} -I%{l_prefix}/include" \
  525. %endif
  526. CPPFLAGS="%{l_cflags -O} -I%{l_prefix}/include" \
  527. LDFLAGS="%{l_cflags -O} -L%{l_prefix}/lib" \
  528. ./configure \
  529. --prefix=%{l_prefix} \
  530. --with-apache=../apache_%{V_apache} \
  531. --with-config-file-path=%{l_prefix}/etc/apache \
  532. %if "%{with_mod_php3_ftp}" == "yes"
  533. --with-ftp \
  534. %endif
  535. %if "%{with_mod_php3_mysql}" == "yes"
  536. --with-mysql=%{l_prefix} \
  537. %endif
  538. %if "%{with_mod_php3_zlib}" == "yes"
  539. --with-zlib=%{l_prefix} \
  540. %endif
  541. %if "%{with_mod_php3_jpeg}" == "yes"
  542. --with-jpeg=${prefix} \
  543. %endif
  544. %if "%{with_mod_php3_gd}" == "yes"
  545. --with-gd=${prefix} \
  546. %endif
  547. %if "%{with_mod_php3_openssl}" == "yes"
  548. --with-openssl=%{l_prefix} \
  549. %endif
  550. --disable-shared \
  551. --enable-track-vars
  552. # FIXME:
  553. # --enable-safe-mode
  554. # --with-exec-dir[=DIR]
  555. # --enable-magic-quotes
  556. # --enable-memory-limit
  557. # --enable-sysvsem
  558. # --enable-sysvshm
  559. %{l_make} %{l_mflags}
  560. %{l_make} %{l_mflags} install \
  561. prefix=$RPM_BUILD_ROOT%{l_prefix}
  562. )
  563. %endif
  564. # optionally prepare mod_dav
  565. %if "%{with_mod_dav}" == "yes"
  566. ( cd mod_dav-%{V_mod_dav}
  567. CC="%{l_cc}" \
  568. %if "%{with_mod_ssl}" == "yes"
  569. CFLAGS="%{l_cflags -O}" \
  570. %else
  571. CFLAGS="%{l_cflags -O} -DEAPI" \
  572. %endif
  573. LDFLAGS="%{l_cflags -O}" \
  574. ./configure \
  575. --with-apache=../apache_%{V_apache}
  576. %{l_make} %{l_mflags}
  577. %{l_make} %{l_mflags} install
  578. )
  579. %endif
  580. # optionally prepare mod_layout
  581. %if "%{with_mod_layout}" == "yes"
  582. ( cd mod_layout-%{V_mod_layout}
  583. mkdir ../apache_%{V_apache}/src/modules/layout
  584. cp * ../apache_%{V_apache}/src/modules/layout/ 2>/dev/null || true
  585. chmod -R u+w ../apache_%{V_apache}/src/modules/layout
  586. )
  587. %endif
  588. # optionally prepare mod_macro
  589. %if "%{with_mod_macro}" == "yes"
  590. ( cd mod_macro-%{V_mod_macro}
  591. cp mod_macro.c ../apache_%{V_apache}/src/modules/extra/
  592. )
  593. %endif
  594. # optionally prepare mod_auth_pam
  595. %if "%{with_mod_auth_pam}" == "yes"
  596. ( cd mod_auth_pam-%{V_mod_auth_pam}
  597. cp mod_auth_pam.c ../apache_%{V_apache}/src/modules/extra/
  598. )
  599. %endif
  600. # optionally prepare mod_gzip
  601. %if "%{with_mod_gzip}" == "yes"
  602. cp %{SOURCE mod_gzip.c} apache_%{V_apache}/src/modules/extra/
  603. %endif
  604. # optionally prepare mod_zmod
  605. %if "%{with_mod_zmod}" == "yes"
  606. ( cd src
  607. mkdir ../apache_%{V_apache}/src/modules/zmod
  608. %{l_shtool} subst -e 's;"compat.h";"ap_compat.h";' modules/zmod/mod_zmod.c
  609. cp modules/zmod/* ../apache_%{V_apache}/src/modules/zmod/
  610. )
  611. %endif
  612. # optionally prepare mod_fastcgi
  613. %if "%{with_mod_fastcgi}" == "yes"
  614. ( cd mod_fastcgi-%{V_mod_fastcgi}
  615. mkdir ../apache_%{V_apache}/src/modules/fastcgi
  616. cp -rp * ../apache_%{V_apache}/src/modules/fastcgi/
  617. )
  618. %endif
  619. # optionally prepare mod_throttle
  620. %if "%{with_mod_throttle}" == "yes"
  621. ( cd mod_throttle-*
  622. cp mod_throttle.c ../apache_%{V_apache}/src/modules/extra/
  623. )
  624. %endif
  625. # optionally prepare mod_access_referer
  626. %if "%{with_mod_access_referer}" == "yes"
  627. ( cd mod_access_referer-%{V_mod_access_referer}
  628. cp mod_access_referer.c ../apache_%{V_apache}/src/modules/extra/
  629. )
  630. %endif
  631. # optionally prepare mod_roaming
  632. %if "%{with_mod_roaming}" == "yes"
  633. ( cd mod_roaming-%{V_mod_roaming}
  634. cp mod_roaming.c ../apache_%{V_apache}/src/modules/extra/
  635. )
  636. %endif
  637. # optionally prepare mod_relocate
  638. %if "%{with_mod_relocate}" == "yes"
  639. ( cd mod_relocate-%{V_mod_relocate}
  640. cp mod_relocate.c ../apache_%{V_apache}/src/modules/extra/
  641. )
  642. %endif
  643. # configure Apache
  644. ( cd apache_%{V_apache}
  645. cflags="%{l_cflags -O}"
  646. ldflags=""
  647. libs=""
  648. %if "%{with_mod_auth_pam}" == "yes"
  649. pam_incdir=`%{l_prefix}/etc/rc --query pam_incdir`
  650. if [ ".$pam_incdir" != "./usr/include" -a ".$pam_incdir" != "./include" ]; then
  651. cflags="$cflags -I$pam_incdir"
  652. fi
  653. pam_libdir=`%{l_prefix}/etc/rc --query pam_libdir`
  654. if [ ".$pam_libdir" != "./usr/lib" -a ".$pam_libdir" != "./lib" ]; then
  655. ldflags="$ldflags -L$pam_libdir"
  656. fi
  657. libs="$libs -lpam"
  658. %endif
  659. CC="%{l_cc}" \
  660. CFLAGS="$cflags" \
  661. LDFLAGS="$ldflags" \
  662. LIBS="$libs" \
  663. %if "%{with_mod_ssl}" == "yes"
  664. EAPI_MM="%{l_prefix}" \
  665. SSL_BASE="%{l_prefix}" \
  666. %endif
  667. ./configure \
  668. --target=apache \
  669. --with-layout=GNU \
  670. --prefix=%{l_prefix} \
  671. --sbindir=%{l_prefix}/sbin \
  672. --sysconfdir=%{l_prefix}/etc/apache \
  673. --libexecdir=%{l_prefix}/lib/apache \
  674. --datadir=%{l_prefix}/share/apache \
  675. --localstatedir=%{l_prefix}/var/apache \
  676. --enable-suexec \
  677. --suexec-caller=%{l_nusr} \
  678. --suexec-userdir=.www \
  679. --enable-module=most \
  680. --with-perl=%{l_prefix}/bin/perl \
  681. %if "%{with_mod_ssl}" == "yes"
  682. --enable-rule=EAPI \
  683. --enable-module=ssl \
  684. %endif
  685. %if "%{with_mod_perl}" == "yes"
  686. --activate-module=src/modules/perl/libperl.a \
  687. %endif
  688. %if "%{with_mod_php}" == "yes"
  689. --activate-module=src/modules/php4/libphp4.a \
  690. %endif
  691. %if "%{with_mod_php3}" == "yes"
  692. --activate-module=src/modules/php3/libphp3.a \
  693. %endif
  694. %if "%{with_mod_dav}" == "yes"
  695. --activate-module=src/modules/dav/libdav.a \
  696. %endif
  697. %if "%{with_mod_layout}" == "yes"
  698. --activate-module=src/modules/layout/liblayout.a \
  699. %endif
  700. %if "%{with_mod_macro}" == "yes"
  701. --activate-module=src/modules/extra/mod_macro.o \
  702. %endif
  703. %if "%{with_mod_auth_pam}" == "yes"
  704. --activate-module=src/modules/extra/mod_auth_pam.o \
  705. %endif
  706. %if "%{with_mod_gzip}" == "yes"
  707. --activate-module=src/modules/extra/mod_gzip.o \
  708. %endif
  709. %if "%{with_mod_zmod}" == "yes"
  710. --activate-module=src/modules/zmod/libzmod.a \
  711. %endif
  712. %if "%{with_mod_fastcgi}" == "yes"
  713. --activate-module=src/modules/fastcgi/libfastcgi.a \
  714. %endif
  715. %if "%{with_mod_throttle}" == "yes"
  716. --activate-module=src/modules/extra/mod_throttle.o \
  717. %endif
  718. %if "%{with_mod_access_referer}" == "yes"
  719. --activate-module=src/modules/extra/mod_access_referer.o \
  720. %endif
  721. %if "%{with_mod_roaming}" == "yes"
  722. --activate-module=src/modules/extra/mod_roaming.o \
  723. %endif
  724. %if "%{with_mod_relocate}" == "yes"
  725. --activate-module=src/modules/extra/mod_relocate.o \
  726. %endif
  727. --enable-module=so
  728. %{l_make} %{l_mflags -O} build-quiet
  729. )
  730. %install
  731. # install Apache
  732. ( cd apache_%{V_apache}
  733. # perform standard Apache installation procedure
  734. %{l_make} %{l_mflags} install root=$RPM_BUILD_ROOT
  735. # post-adjustments to installation tree
  736. mv $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/small/* \
  737. $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/
  738. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/small
  739. rm -f $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/README*
  740. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/apache/*.default
  741. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/apache/srm.conf
  742. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/apache/access.conf
  743. mv $RPM_BUILD_ROOT%{l_prefix}/share/apache/htdocs/index.html.en \
  744. $RPM_BUILD_ROOT%{l_prefix}/share/apache/htdocs/index.html
  745. rm -f $RPM_BUILD_ROOT%{l_prefix}/share/apache/htdocs/index.html.*
  746. chmod a+rx $RPM_BUILD_ROOT%{l_prefix}/share/apache/cgi-bin/*
  747. mv $RPM_BUILD_ROOT%{l_prefix}/share/apache/cgi-bin \
  748. $RPM_BUILD_ROOT%{l_prefix}/cgi/
  749. rm -rf $RPM_BUILD_ROOT%{l_prefix}/cgi/test-cgi
  750. )
  751. # optionally cleanup for mod_perl
  752. %if "%{with_mod_perl}" == "yes"
  753. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/perl
  754. %endif
  755. # create default configuration
  756. l_hostname=`%{l_shtool} echo -e %h`
  757. l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
  758. %{l_shtool} install -c -m 644 \
  759. -e 's;@l_prefix@;%{l_prefix};g' \
  760. -e "s;@l_hostname@;$l_hostname;g" \
  761. -e "s;@l_domainname@;$l_domainname;g" \
  762. -e 's;@l_nusr@;%{l_nusr};g' \
  763. -e 's;@l_ngrp@;%{l_ngrp};g' \
  764. %{SOURCE apache.base} \
  765. %{SOURCE apache.conf} \
  766. %{SOURCE apache.vhost} \
  767. $RPM_BUILD_ROOT%{l_prefix}/etc/apache/
  768. mv $RPM_BUILD_ROOT%{l_prefix}/etc/apache/magic $RPM_BUILD_ROOT%{l_prefix}/etc/apache/mime.magic
  769. find $RPM_BUILD_ROOT%{l_prefix} -name perllocal.pod -print | xargs rm -f
  770. # create run-command script
  771. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  772. %{l_shtool} install -c -m 755 -e 's;@l_prefix@;%{l_prefix};g' \
  773. -e 's;@l_musr@;%{l_musr};g' -e 's;@l_mgrp@;%{l_mgrp};g' \
  774. %{SOURCE rc.apache} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  775. # strip installation binaries
  776. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2> /dev/null || true
  777. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2> /dev/null || true
  778. # determine installation tree files
  779. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  780. %{l_files_std} \
  781. '%attr(4755,root,%{l_mgrp}) %{l_prefix}/sbin/suexec' \
  782. '%config %{l_prefix}/etc/apache/*' \
  783. %if "%{with_mod_ssl}" == "yes"
  784. '%config %{l_prefix}/etc/apache/ssl.crl/*.crl' \
  785. '%config %{l_prefix}/etc/apache/ssl.crt/*.crt' \
  786. '%config %{l_prefix}/etc/apache/ssl.csr/*.csr' \
  787. '%config %{l_prefix}/etc/apache/ssl.key/*.key' \
  788. '%config %{l_prefix}/etc/apache/ssl.prm/*.prm' \
  789. %endif
  790. '%config %attr(444,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/apache/apache.base'
  791. %files -f files
  792. %clean
  793. rm -rf $RPM_BUILD_ROOT
  794. %post
  795. %if "%{with_mod_auth_pam}" == "yes"
  796. # add PAM configuration entry
  797. if [ $1 -eq 1 ]; then
  798. $RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=apache
  799. fi
  800. %endif
  801. %preun
  802. %if "%{with_mod_auth_pam}" == "yes"
  803. # remove PAM configuration entry
  804. if [ $1 -eq 0 ]; then
  805. $RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=apache
  806. fi
  807. %endif