apache.spec 29 KB

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