apache.spec 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857
  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.26
  112. %define V_mod_ssl 2.8.10-1.3.26
  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: 20020916
  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: jdk-sun
  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. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/bin
  382. perl=$RPM_BUILD_ROOT%{l_prefix}/bin/perl
  383. echo "#!/bin/sh" >$perl
  384. echo "exec %{l_prefix}/bin/perl \\" >>$perl
  385. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/${version} \\" >>$perl
  386. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/${version}/${archname} \\" >>$perl
  387. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/site_perl \\" >>$perl
  388. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/site_perl/${version} \\" >>$perl
  389. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/site_perl/${version}/${archname} \\" >>$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. mkdir $RPM_BUILD_ROOT%{l_prefix}/perl5
  404. mv $RPM_BUILD_ROOT%{l_prefix}/lib/* $RPM_BUILD_ROOT%{l_prefix}/perl5/
  405. mv $RPM_BUILD_ROOT%{l_prefix}/perl5 $RPM_BUILD_ROOT%{l_prefix}/lib/
  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/jdk-sun \
  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. --disable-shared \
  507. --enable-inline-optimization \
  508. --enable-track-vars
  509. %{l_make} %{l_mflags}
  510. %{l_shtool} subst \
  511. -e "s;^\\(EXTENSION_DIR = \\)\\(%{l_prefix}\\);\\1$RPM_BUILD_ROOT\\2;" \
  512. -e "s;^\\(PEAR_INSTALLDIR = \\)\\(%{l_prefix}\\);\\1$RPM_BUILD_ROOT\\2;" \
  513. config_vars.mk
  514. %{l_make} %{l_mflags} install \
  515. prefix=$RPM_BUILD_ROOT%{l_prefix}
  516. )
  517. %endif
  518. # optionally prepare mod_php3
  519. %if "%{with_mod_php3}" == "yes"
  520. ( cd php-%{V_mod_php3}
  521. CC="%{l_cc}" \
  522. %if "%{with_mod_ssl}" == "yes"
  523. CFLAGS="%{l_cflags -O} -I%{l_prefix}/include -DEAPI" \
  524. %else
  525. CFLAGS="%{l_cflags -O} -I%{l_prefix}/include" \
  526. %endif
  527. CPPFLAGS="%{l_cflags -O} -I%{l_prefix}/include" \
  528. LDFLAGS="%{l_cflags -O} -L%{l_prefix}/lib" \
  529. ./configure \
  530. --prefix=%{l_prefix} \
  531. --with-apache=../apache_%{V_apache} \
  532. --with-config-file-path=%{l_prefix}/etc/apache \
  533. %if "%{with_mod_php3_ftp}" == "yes"
  534. --with-ftp \
  535. %endif
  536. %if "%{with_mod_php3_mysql}" == "yes"
  537. --with-mysql=%{l_prefix} \
  538. %endif
  539. %if "%{with_mod_php3_zlib}" == "yes"
  540. --with-zlib=%{l_prefix} \
  541. %endif
  542. %if "%{with_mod_php3_jpeg}" == "yes"
  543. --with-jpeg=${prefix} \
  544. %endif
  545. %if "%{with_mod_php3_gd}" == "yes"
  546. --with-gd=${prefix} \
  547. %endif
  548. %if "%{with_mod_php3_openssl}" == "yes"
  549. --with-openssl=%{l_prefix} \
  550. %endif
  551. --disable-shared \
  552. --enable-track-vars
  553. # FIXME:
  554. # --enable-safe-mode
  555. # --with-exec-dir[=DIR]
  556. # --enable-magic-quotes
  557. # --enable-memory-limit
  558. # --enable-sysvsem
  559. # --enable-sysvshm
  560. %{l_make} %{l_mflags}
  561. %{l_make} %{l_mflags} install \
  562. prefix=$RPM_BUILD_ROOT%{l_prefix}
  563. )
  564. %endif
  565. # optionally prepare mod_dav
  566. %if "%{with_mod_dav}" == "yes"
  567. ( cd mod_dav-%{V_mod_dav}
  568. CC="%{l_cc}" \
  569. %if "%{with_mod_ssl}" == "yes"
  570. CFLAGS="%{l_cflags -O}" \
  571. %else
  572. CFLAGS="%{l_cflags -O} -DEAPI" \
  573. %endif
  574. LDFLAGS="%{l_cflags -O}" \
  575. ./configure \
  576. --with-apache=../apache_%{V_apache}
  577. %{l_make} %{l_mflags}
  578. %{l_make} %{l_mflags} install
  579. )
  580. %endif
  581. # optionally prepare mod_layout
  582. %if "%{with_mod_layout}" == "yes"
  583. ( cd mod_layout-%{V_mod_layout}
  584. mkdir ../apache_%{V_apache}/src/modules/layout
  585. cp * ../apache_%{V_apache}/src/modules/layout/ 2>/dev/null || true
  586. chmod -R u+w ../apache_%{V_apache}/src/modules/layout
  587. )
  588. %endif
  589. # optionally prepare mod_macro
  590. %if "%{with_mod_macro}" == "yes"
  591. ( cd mod_macro-%{V_mod_macro}
  592. cp mod_macro.c ../apache_%{V_apache}/src/modules/extra/
  593. )
  594. %endif
  595. # optionally prepare mod_auth_pam
  596. %if "%{with_mod_auth_pam}" == "yes"
  597. ( cd mod_auth_pam-%{V_mod_auth_pam}
  598. cp mod_auth_pam.c ../apache_%{V_apache}/src/modules/extra/
  599. )
  600. %endif
  601. # optionally prepare mod_gzip
  602. %if "%{with_mod_gzip}" == "yes"
  603. cp %{SOURCE mod_gzip.c} apache_%{V_apache}/src/modules/extra/
  604. %endif
  605. # optionally prepare mod_zmod
  606. %if "%{with_mod_zmod}" == "yes"
  607. ( cd src
  608. mkdir ../apache_%{V_apache}/src/modules/zmod
  609. %{l_shtool} subst -e 's;"compat.h";"ap_compat.h";' modules/zmod/mod_zmod.c
  610. cp modules/zmod/* ../apache_%{V_apache}/src/modules/zmod/
  611. )
  612. %endif
  613. # optionally prepare mod_fastcgi
  614. %if "%{with_mod_fastcgi}" == "yes"
  615. ( cd mod_fastcgi-%{V_mod_fastcgi}
  616. mkdir ../apache_%{V_apache}/src/modules/fastcgi
  617. cp -rp * ../apache_%{V_apache}/src/modules/fastcgi/
  618. )
  619. %endif
  620. # optionally prepare mod_throttle
  621. %if "%{with_mod_throttle}" == "yes"
  622. ( cd mod_throttle-*
  623. cp mod_throttle.c ../apache_%{V_apache}/src/modules/extra/
  624. )
  625. %endif
  626. # optionally prepare mod_access_referer
  627. %if "%{with_mod_access_referer}" == "yes"
  628. ( cd mod_access_referer-%{V_mod_access_referer}
  629. cp mod_access_referer.c ../apache_%{V_apache}/src/modules/extra/
  630. )
  631. %endif
  632. # optionally prepare mod_roaming
  633. %if "%{with_mod_roaming}" == "yes"
  634. ( cd mod_roaming-%{V_mod_roaming}
  635. cp mod_roaming.c ../apache_%{V_apache}/src/modules/extra/
  636. )
  637. %endif
  638. # optionally prepare mod_relocate
  639. %if "%{with_mod_relocate}" == "yes"
  640. ( cd mod_relocate-%{V_mod_relocate}
  641. cp mod_relocate.c ../apache_%{V_apache}/src/modules/extra/
  642. )
  643. %endif
  644. # configure Apache
  645. ( cd apache_%{V_apache}
  646. cflags="%{l_cflags -O}"
  647. ldflags=""
  648. libs=""
  649. %if "%{with_mod_auth_pam}" == "yes"
  650. pam_incdir=`%{l_prefix}/etc/rc --query pam_incdir`
  651. if [ ".$pam_incdir" != "./usr/include" ]; then
  652. cflags="$cflags -I$pam_incdir"
  653. fi
  654. pam_libdir=`%{l_prefix}/etc/rc --query pam_libdir`
  655. if [ ".$pam_libdir" != "./usr/lib" ]; then
  656. ldflags="$ldflags -L$pam_libdir"
  657. fi
  658. libs="$libs -lpam"
  659. %endif
  660. CC="%{l_cc}" \
  661. CFLAGS="$cflags" \
  662. LDFLAGS="$ldflags" \
  663. LIBS="$libs" \
  664. %if "%{with_mod_ssl}" == "yes"
  665. EAPI_MM="%{l_prefix}" \
  666. SSL_BASE="%{l_prefix}" \
  667. %endif
  668. ./configure \
  669. --target=apache \
  670. --with-layout=GNU \
  671. --prefix=%{l_prefix} \
  672. --sbindir=%{l_prefix}/sbin \
  673. --sysconfdir=%{l_prefix}/etc/apache \
  674. --libexecdir=%{l_prefix}/lib/apache \
  675. --datadir=%{l_prefix}/share/apache \
  676. --localstatedir=%{l_prefix}/var/apache \
  677. --enable-suexec \
  678. --suexec-caller=%{l_nusr} \
  679. --suexec-userdir=.www \
  680. --enable-module=most \
  681. --with-perl=%{l_prefix}/bin/perl \
  682. %if "%{with_mod_ssl}" == "yes"
  683. --enable-rule=EAPI \
  684. --enable-module=ssl \
  685. %endif
  686. %if "%{with_mod_perl}" == "yes"
  687. --activate-module=src/modules/perl/libperl.a \
  688. %endif
  689. %if "%{with_mod_php}" == "yes"
  690. --activate-module=src/modules/php4/libphp4.a \
  691. %endif
  692. %if "%{with_mod_php3}" == "yes"
  693. --activate-module=src/modules/php3/libphp3.a \
  694. %endif
  695. %if "%{with_mod_dav}" == "yes"
  696. --activate-module=src/modules/dav/libdav.a \
  697. %endif
  698. %if "%{with_mod_layout}" == "yes"
  699. --activate-module=src/modules/layout/liblayout.a \
  700. %endif
  701. %if "%{with_mod_macro}" == "yes"
  702. --activate-module=src/modules/extra/mod_macro.o \
  703. %endif
  704. %if "%{with_mod_auth_pam}" == "yes"
  705. --activate-module=src/modules/extra/mod_auth_pam.o \
  706. %endif
  707. %if "%{with_mod_gzip}" == "yes"
  708. --activate-module=src/modules/extra/mod_gzip.o \
  709. %endif
  710. %if "%{with_mod_zmod}" == "yes"
  711. --activate-module=src/modules/zmod/libzmod.a \
  712. %endif
  713. %if "%{with_mod_fastcgi}" == "yes"
  714. --activate-module=src/modules/fastcgi/libfastcgi.a \
  715. %endif
  716. %if "%{with_mod_throttle}" == "yes"
  717. --activate-module=src/modules/extra/mod_throttle.o \
  718. %endif
  719. %if "%{with_mod_access_referer}" == "yes"
  720. --activate-module=src/modules/extra/mod_access_referer.o \
  721. %endif
  722. %if "%{with_mod_roaming}" == "yes"
  723. --activate-module=src/modules/extra/mod_roaming.o \
  724. %endif
  725. %if "%{with_mod_relocate}" == "yes"
  726. --activate-module=src/modules/extra/mod_relocate.o \
  727. %endif
  728. --enable-module=so
  729. %{l_make} %{l_mflags -O} build-quiet
  730. )
  731. %install
  732. # install Apache
  733. ( cd apache_%{V_apache}
  734. # perform standard Apache installation procedure
  735. %{l_make} %{l_mflags} install root=$RPM_BUILD_ROOT
  736. # post-adjustments to installation tree
  737. mv $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/small/* \
  738. $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/
  739. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/small
  740. rm -f $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/README*
  741. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/apache/*.default
  742. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/apache/srm.conf
  743. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/apache/access.conf
  744. mv $RPM_BUILD_ROOT%{l_prefix}/share/apache/htdocs/index.html.en \
  745. $RPM_BUILD_ROOT%{l_prefix}/share/apache/htdocs/index.html
  746. rm -f $RPM_BUILD_ROOT%{l_prefix}/share/apache/htdocs/index.html.*
  747. chmod a+rx $RPM_BUILD_ROOT%{l_prefix}/share/apache/cgi-bin/*
  748. mv $RPM_BUILD_ROOT%{l_prefix}/share/apache/cgi-bin \
  749. $RPM_BUILD_ROOT%{l_prefix}/cgi/
  750. rm -rf $RPM_BUILD_ROOT%{l_prefix}/cgi/test-cgi
  751. )
  752. # optionally cleanup for mod_perl
  753. %if "%{with_mod_perl}" == "yes"
  754. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/perl
  755. %endif
  756. # create default configuration
  757. l_hostname=`%{l_shtool} echo -e %h`
  758. l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
  759. %{l_shtool} install -c -m 644 \
  760. -e 's;@l_prefix@;%{l_prefix};g' \
  761. -e "s;@l_hostname@;$l_hostname;g" \
  762. -e "s;@l_domainname@;$l_domainname;g" \
  763. -e 's;@l_nusr@;%{l_nusr};g' \
  764. -e 's;@l_ngrp@;%{l_ngrp};g' \
  765. %{SOURCE apache.base} \
  766. %{SOURCE apache.conf} \
  767. %{SOURCE apache.vhost} \
  768. $RPM_BUILD_ROOT%{l_prefix}/etc/apache/
  769. mv $RPM_BUILD_ROOT%{l_prefix}/etc/apache/magic $RPM_BUILD_ROOT%{l_prefix}/etc/apache/mime.magic
  770. find $RPM_BUILD_ROOT%{l_prefix} -name perllocal.pod -print | xargs rm -f
  771. # create run-command script
  772. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  773. %{l_shtool} install -c -m 755 -e 's;@l_prefix@;%{l_prefix};g' \
  774. -e 's;@l_musr@;%{l_musr};g' -e 's;@l_mgrp@;%{l_mgrp};g' \
  775. %{SOURCE rc.apache} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  776. # strip installation binaries
  777. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2> /dev/null || true
  778. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2> /dev/null || true
  779. # determine installation tree files
  780. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  781. %{l_files_std} \
  782. '%attr(4755,root,%{l_mgrp}) %{l_prefix}/sbin/suexec' \
  783. '%config %{l_prefix}/etc/apache/*' \
  784. %if "%{with_mod_ssl}" == "yes"
  785. '%config %{l_prefix}/etc/apache/ssl.crl/*.crl' \
  786. '%config %{l_prefix}/etc/apache/ssl.crt/*.crt' \
  787. '%config %{l_prefix}/etc/apache/ssl.csr/*.csr' \
  788. '%config %{l_prefix}/etc/apache/ssl.key/*.key' \
  789. '%config %{l_prefix}/etc/apache/ssl.prm/*.prm' \
  790. %endif
  791. '%config %attr(444,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/apache/apache.base'
  792. %files -f files
  793. %clean
  794. rm -rf $RPM_BUILD_ROOT
  795. %post
  796. %if "%{with_mod_auth_pam}" == "yes"
  797. # add PAM configuration entry
  798. if [ $1 -eq 1 ]; then
  799. $RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=apache
  800. fi
  801. %endif
  802. %preun
  803. %if "%{with_mod_auth_pam}" == "yes"
  804. # remove PAM configuration entry
  805. if [ $1 -eq 0 ]; then
  806. $RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=apache
  807. fi
  808. %endif