apache.spec 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855
  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_mysql}" == "yes" || "%{with_mod_php_pdflib}" == "yes"
  96. %define with_mod_php_zlib yes
  97. %endif
  98. %if "%{with_mod_php_freetype}" == "yes"
  99. %define with_mod_php_gd 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.2
  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 [REL]
  134. Group: Web
  135. License: ASF
  136. Version: %{V_apache}
  137. Release: 20020801
  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
  178. %endif
  179. %if "%{with_mod_php_db}" == "yes"
  180. BuildPreReq: db
  181. %endif
  182. %if "%{with_mod_php_pdflib}" == "yes"
  183. BuildPreReq: pdflib
  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. PATH="%{l_prefix}/bin:%{l_prefix}/sbin:$PATH"; export PATH
  348. rm -rf $RPM_BUILD_ROOT
  349. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}
  350. # optionally prepare mod_ssl
  351. %if "%{with_mod_ssl}" == "yes"
  352. ( cd mod_ssl-%{V_mod_ssl}
  353. ./configure \
  354. --with-apache=../apache_%{V_apache} \
  355. --expert --force
  356. )
  357. %endif
  358. # optionally pre-configure Apache for mod_php, mod_php3 and mod_dav
  359. %if "%{with_mod_php}" == "yes" || "%{with_mod_php3}" == "yes" || "%{with_mod_dav}" == "yes"
  360. ( cd apache_%{V_apache}
  361. CC="%{l_cc}" \
  362. CFLAGS="%{l_cflags -O}" \
  363. ./configure \
  364. %if "%{with_mod_ssl}" == "yes"
  365. --enable-rule=EAPI \
  366. %endif
  367. --target=apache \
  368. --with-layout=GNU \
  369. --prefix=%{l_prefix} \
  370. --sbindir=%{l_prefix}/sbin \
  371. --sysconfdir=%{l_prefix}/etc/apache \
  372. --libexecdir=%{l_prefix}/lib/apache \
  373. --datadir=%{l_prefix}/share/apache \
  374. --localstatedir=%{l_prefix}/var/apache
  375. )
  376. %endif
  377. # optionally prepare mod_perl
  378. %if "%{with_mod_perl}" == "yes"
  379. ( cd mod_perl-%{V_mod_perl}
  380. eval `%{l_prefix}/bin/perl -V:archname`
  381. eval `%{l_prefix}/bin/perl -V:version`
  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%{l_prefix}/lib/perl5/${version} \\" >>$perl
  387. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/${version}/${archname} \\" >>$perl
  388. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/site_perl \\" >>$perl
  389. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/site_perl/${version} \\" >>$perl
  390. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/site_perl/${version}/${archname} \\" >>$perl
  391. echo " \"\$@\"" >>$perl
  392. chmod a+x $perl
  393. $perl Makefile.PL \
  394. PREFIX=$RPM_BUILD_ROOT%{l_prefix} \
  395. APACHE_SRC=../apache_%{V_apache}/src \
  396. DO_HTTPD=1 \
  397. USE_APACI=1 \
  398. PREP_HTTPD=1 \
  399. EVERYTHING=1 \
  400. PERL_TIE_TABLES=1 \
  401. PERL_DIRECTIVE_HANDLERS=1
  402. %{l_make} %{l_mflags}
  403. %{l_make} %{l_mflags} install
  404. mkdir $RPM_BUILD_ROOT%{l_prefix}/perl5
  405. mv $RPM_BUILD_ROOT%{l_prefix}/lib/* $RPM_BUILD_ROOT%{l_prefix}/perl5/
  406. mv $RPM_BUILD_ROOT%{l_prefix}/perl5 $RPM_BUILD_ROOT%{l_prefix}/lib/
  407. %{l_shtool} subst -e "s;^\\(PERL = \\).*;\\1 $perl;" \
  408. ../apache_%{V_apache}/src/modules/perl/mod_perl.config
  409. )
  410. %endif
  411. # optionally prepare mod_php
  412. %if "%{with_mod_php}" == "yes"
  413. ( cd php-%{V_mod_php}
  414. CC="%{l_cc}" \
  415. %if "%{with_mod_ssl}" == "yes"
  416. CFLAGS="%{l_cflags -O} -I%{l_prefix}/include -DEAPI" \
  417. %else
  418. CFLAGS="%{l_cflags -O} -I%{l_prefix}/include" \
  419. %endif
  420. CPPFLAGS="%{l_cflags -O} -I%{l_prefix}/include" \
  421. LDFLAGS="%{l_cflags -O} -L%{l_prefix}/lib" \
  422. %if "%{with_mod_php_gd}" == "yes" && "%{with_mod_php_gettext}" == "yes"
  423. LIBS="-lpng -lz -liconv" \
  424. %else
  425. %if "%{with_mod_php_gd}" == "yes"
  426. LIBS="-lpng -lz" \
  427. %endif
  428. %if "%{with_mod_php_gettext}" == "yes"
  429. LIBS="-liconv" \
  430. %endif
  431. %endif
  432. ./configure \
  433. --prefix=%{l_prefix} \
  434. --with-apache=../apache_%{V_apache} \
  435. --with-config-file-path=%{l_prefix}/etc/apache \
  436. %if "%{with_mod_php_calendar}" == "yes"
  437. --enable-calendar \
  438. %endif
  439. %if "%{with_mod_php_mysql}" == "yes"
  440. --with-mysql=%{l_prefix} \
  441. %endif
  442. %if "%{with_mod_php_gd}" == "yes"
  443. --with-gd=%{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. %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/jdk-sun \
  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. --disable-shared \
  505. --enable-inline-optimization \
  506. --enable-track-vars
  507. %{l_make} %{l_mflags}
  508. %{l_shtool} subst \
  509. -e "s;^\\(EXTENSION_DIR = \\)\\(%{l_prefix}\\);\\1$RPM_BUILD_ROOT\\2;" \
  510. -e "s;^\\(PEAR_INSTALLDIR = \\)\\(%{l_prefix}\\);\\1$RPM_BUILD_ROOT\\2;" \
  511. config_vars.mk
  512. %{l_make} %{l_mflags} install \
  513. prefix=$RPM_BUILD_ROOT%{l_prefix}
  514. )
  515. %endif
  516. # optionally prepare mod_php3
  517. %if "%{with_mod_php3}" == "yes"
  518. ( cd php-%{V_mod_php3}
  519. CC="%{l_cc}" \
  520. %if "%{with_mod_ssl}" == "yes"
  521. CFLAGS="%{l_cflags -O} -I%{l_prefix}/include -DEAPI" \
  522. %else
  523. CFLAGS="%{l_cflags -O} -I%{l_prefix}/include" \
  524. %endif
  525. CPPFLAGS="%{l_cflags -O} -I%{l_prefix}/include" \
  526. LDFLAGS="%{l_cflags -O} -L%{l_prefix}/lib" \
  527. ./configure \
  528. --prefix=%{l_prefix} \
  529. --with-apache=../apache_%{V_apache} \
  530. --with-config-file-path=%{l_prefix}/etc/apache \
  531. %if "%{with_mod_php3_ftp}" == "yes"
  532. --with-ftp \
  533. %endif
  534. %if "%{with_mod_php3_mysql}" == "yes"
  535. --with-mysql=%{l_prefix} \
  536. %endif
  537. %if "%{with_mod_php3_zlib}" == "yes"
  538. --with-zlib=%{l_prefix} \
  539. %endif
  540. %if "%{with_mod_php3_jpeg}" == "yes"
  541. --with-jpeg=${prefix} \
  542. %endif
  543. %if "%{with_mod_php3_gd}" == "yes"
  544. --with-gd=${prefix} \
  545. %endif
  546. %if "%{with_mod_php3_openssl}" == "yes"
  547. --with-openssl=%{l_prefix} \
  548. %endif
  549. --disable-shared \
  550. --enable-track-vars
  551. # FIXME:
  552. # --enable-safe-mode
  553. # --with-exec-dir[=DIR]
  554. # --enable-magic-quotes
  555. # --enable-memory-limit
  556. # --enable-sysvsem
  557. # --enable-sysvshm
  558. %{l_make} %{l_mflags}
  559. %{l_make} %{l_mflags} install \
  560. prefix=$RPM_BUILD_ROOT%{l_prefix}
  561. )
  562. %endif
  563. # optionally prepare mod_dav
  564. %if "%{with_mod_dav}" == "yes"
  565. ( cd mod_dav-%{V_mod_dav}
  566. CC="%{l_cc}" \
  567. %if "%{with_mod_ssl}" == "yes"
  568. CFLAGS="%{l_cflags -O}" \
  569. %else
  570. CFLAGS="%{l_cflags -O} -DEAPI" \
  571. %endif
  572. LDFLAGS="%{l_cflags -O}" \
  573. ./configure \
  574. --with-apache=../apache_%{V_apache}
  575. %{l_make} %{l_mflags}
  576. %{l_make} %{l_mflags} install
  577. )
  578. %endif
  579. # optionally prepare mod_layout
  580. %if "%{with_mod_layout}" == "yes"
  581. ( cd mod_layout-%{V_mod_layout}
  582. mkdir ../apache_%{V_apache}/src/modules/layout
  583. cp * ../apache_%{V_apache}/src/modules/layout/ 2>/dev/null || true
  584. chmod -R u+w ../apache_%{V_apache}/src/modules/layout
  585. )
  586. %endif
  587. # optionally prepare mod_macro
  588. %if "%{with_mod_macro}" == "yes"
  589. ( cd mod_macro-%{V_mod_macro}
  590. cp mod_macro.c ../apache_%{V_apache}/src/modules/extra/
  591. )
  592. %endif
  593. # optionally prepare mod_auth_pam
  594. %if "%{with_mod_auth_pam}" == "yes"
  595. ( cd mod_auth_pam-%{V_mod_auth_pam}
  596. cp mod_auth_pam.c ../apache_%{V_apache}/src/modules/extra/
  597. )
  598. %endif
  599. # optionally prepare mod_gzip
  600. %if "%{with_mod_gzip}" == "yes"
  601. cp %{SOURCE mod_gzip.c} apache_%{V_apache}/src/modules/extra/
  602. %endif
  603. # optionally prepare mod_zmod
  604. %if "%{with_mod_zmod}" == "yes"
  605. ( cd src
  606. mkdir ../apache_%{V_apache}/src/modules/zmod
  607. %{l_shtool} subst -e 's;"compat.h";"ap_compat.h";' modules/zmod/mod_zmod.c
  608. cp modules/zmod/* ../apache_%{V_apache}/src/modules/zmod/
  609. )
  610. %endif
  611. # optionally prepare mod_fastcgi
  612. %if "%{with_mod_fastcgi}" == "yes"
  613. ( cd mod_fastcgi-%{V_mod_fastcgi}
  614. mkdir ../apache_%{V_apache}/src/modules/fastcgi
  615. cp -rp * ../apache_%{V_apache}/src/modules/fastcgi/
  616. )
  617. %endif
  618. # optionally prepare mod_throttle
  619. %if "%{with_mod_throttle}" == "yes"
  620. ( cd mod_throttle-*
  621. cp mod_throttle.c ../apache_%{V_apache}/src/modules/extra/
  622. )
  623. %endif
  624. # optionally prepare mod_access_referer
  625. %if "%{with_mod_access_referer}" == "yes"
  626. ( cd mod_access_referer-%{V_mod_access_referer}
  627. cp mod_access_referer.c ../apache_%{V_apache}/src/modules/extra/
  628. )
  629. %endif
  630. # optionally prepare mod_roaming
  631. %if "%{with_mod_roaming}" == "yes"
  632. ( cd mod_roaming-%{V_mod_roaming}
  633. cp mod_roaming.c ../apache_%{V_apache}/src/modules/extra/
  634. )
  635. %endif
  636. # optionally prepare mod_relocate
  637. %if "%{with_mod_relocate}" == "yes"
  638. ( cd mod_relocate-%{V_mod_relocate}
  639. cp mod_relocate.c ../apache_%{V_apache}/src/modules/extra/
  640. )
  641. %endif
  642. # configure Apache
  643. ( cd apache_%{V_apache}
  644. cflags="%{l_cflags -O}"
  645. ldflags=""
  646. libs=""
  647. %if "%{with_mod_auth_pam}" == "yes"
  648. pam_incdir=`%{l_prefix}/etc/rc --query pam_incdir`
  649. if [ ".$pam_incdir" != "./usr/include" ]; then
  650. cflags="$cflags -I$pam_incdir"
  651. fi
  652. pam_libdir=`%{l_prefix}/etc/rc --query pam_libdir`
  653. if [ ".$pam_libdir" != "./usr/lib" ]; then
  654. ldflags="$ldflags -L$pam_libdir"
  655. fi
  656. libs="$libs -lpam"
  657. %endif
  658. CC="%{l_cc}" \
  659. CFLAGS="$cflags" \
  660. LDFLAGS="$ldflags" \
  661. LIBS="$libs" \
  662. %if "%{with_mod_ssl}" == "yes"
  663. EAPI_MM="%{l_prefix}" \
  664. SSL_BASE="%{l_prefix}" \
  665. %endif
  666. ./configure \
  667. --target=apache \
  668. --with-layout=GNU \
  669. --prefix=%{l_prefix} \
  670. --sbindir=%{l_prefix}/sbin \
  671. --sysconfdir=%{l_prefix}/etc/apache \
  672. --libexecdir=%{l_prefix}/lib/apache \
  673. --datadir=%{l_prefix}/share/apache \
  674. --localstatedir=%{l_prefix}/var/apache \
  675. --enable-suexec \
  676. --suexec-caller=%{l_nusr} \
  677. --suexec-userdir=.www \
  678. --enable-module=most \
  679. --with-perl=%{l_prefix}/bin/perl \
  680. %if "%{with_mod_ssl}" == "yes"
  681. --enable-rule=EAPI \
  682. --enable-module=ssl \
  683. %endif
  684. %if "%{with_mod_perl}" == "yes"
  685. --activate-module=src/modules/perl/libperl.a \
  686. %endif
  687. %if "%{with_mod_php}" == "yes"
  688. --activate-module=src/modules/php4/libphp4.a \
  689. %endif
  690. %if "%{with_mod_php3}" == "yes"
  691. --activate-module=src/modules/php3/libphp3.a \
  692. %endif
  693. %if "%{with_mod_dav}" == "yes"
  694. --activate-module=src/modules/dav/libdav.a \
  695. %endif
  696. %if "%{with_mod_layout}" == "yes"
  697. --activate-module=src/modules/layout/liblayout.a \
  698. %endif
  699. %if "%{with_mod_macro}" == "yes"
  700. --activate-module=src/modules/extra/mod_macro.o \
  701. %endif
  702. %if "%{with_mod_auth_pam}" == "yes"
  703. --activate-module=src/modules/extra/mod_auth_pam.o \
  704. %endif
  705. %if "%{with_mod_gzip}" == "yes"
  706. --activate-module=src/modules/extra/mod_gzip.o \
  707. %endif
  708. %if "%{with_mod_zmod}" == "yes"
  709. --activate-module=src/modules/zmod/libzmod.a \
  710. %endif
  711. %if "%{with_mod_fastcgi}" == "yes"
  712. --activate-module=src/modules/fastcgi/libfastcgi.a \
  713. %endif
  714. %if "%{with_mod_throttle}" == "yes"
  715. --activate-module=src/modules/extra/mod_throttle.o \
  716. %endif
  717. %if "%{with_mod_access_referer}" == "yes"
  718. --activate-module=src/modules/extra/mod_access_referer.o \
  719. %endif
  720. %if "%{with_mod_roaming}" == "yes"
  721. --activate-module=src/modules/extra/mod_roaming.o \
  722. %endif
  723. %if "%{with_mod_relocate}" == "yes"
  724. --activate-module=src/modules/extra/mod_relocate.o \
  725. %endif
  726. --enable-module=so
  727. %{l_make} %{l_mflags -O} build-quiet
  728. )
  729. %install
  730. # install Apache
  731. ( cd apache_%{V_apache}
  732. # perform standard Apache installation procedure
  733. %{l_make} %{l_mflags} install root=$RPM_BUILD_ROOT
  734. # post-adjustments to installation tree
  735. mv $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/small/* \
  736. $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/
  737. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/small
  738. rm -f $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/README*
  739. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/apache/*.default
  740. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/apache/srm.conf
  741. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/apache/access.conf
  742. mv $RPM_BUILD_ROOT%{l_prefix}/share/apache/htdocs/index.html.en \
  743. $RPM_BUILD_ROOT%{l_prefix}/share/apache/htdocs/index.html
  744. rm -f $RPM_BUILD_ROOT%{l_prefix}/share/apache/htdocs/index.html.*
  745. chmod a+rx $RPM_BUILD_ROOT%{l_prefix}/share/apache/cgi-bin/*
  746. mv $RPM_BUILD_ROOT%{l_prefix}/share/apache/cgi-bin \
  747. $RPM_BUILD_ROOT%{l_prefix}/cgi/
  748. rm -rf $RPM_BUILD_ROOT%{l_prefix}/cgi/test-cgi
  749. )
  750. # optionally cleanup for mod_perl
  751. %if "%{with_mod_perl}" == "yes"
  752. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/perl
  753. %endif
  754. # create default configuration
  755. l_hostname=`%{l_shtool} echo -e %h`
  756. l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
  757. %{l_shtool} install -c -m 644 \
  758. -e 's;@l_prefix@;%{l_prefix};g' \
  759. -e "s;@l_hostname@;$l_hostname;g" \
  760. -e "s;@l_domainname@;$l_domainname;g" \
  761. -e 's;@l_nusr@;%{l_nusr};g' \
  762. -e 's;@l_ngrp@;%{l_ngrp};g' \
  763. %{SOURCE apache.base} \
  764. %{SOURCE apache.conf} \
  765. %{SOURCE apache.vhost} \
  766. $RPM_BUILD_ROOT%{l_prefix}/etc/apache/
  767. mv $RPM_BUILD_ROOT%{l_prefix}/etc/apache/magic $RPM_BUILD_ROOT%{l_prefix}/etc/apache/mime.magic
  768. find $RPM_BUILD_ROOT%{l_prefix} -name perllocal.pod -print | xargs rm -f
  769. # create run-command script
  770. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  771. %{l_shtool} install -c -m 755 -e 's;@l_prefix@;%{l_prefix};g' \
  772. -e 's;@l_musr@;%{l_musr};g' -e 's;@l_mgrp@;%{l_mgrp};g' \
  773. %{SOURCE rc.apache} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  774. # strip installation binaries
  775. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2> /dev/null || true
  776. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2> /dev/null || true
  777. # determine installation tree files
  778. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  779. %{l_files_std} \
  780. '%attr(4755,root,%{l_mgrp}) %{l_prefix}/sbin/suexec' \
  781. '%config %{l_prefix}/etc/apache/*' \
  782. %if "%{with_mod_ssl}" == "yes"
  783. '%config %{l_prefix}/etc/apache/ssl.crl/*.crl' \
  784. '%config %{l_prefix}/etc/apache/ssl.crt/*.crt' \
  785. '%config %{l_prefix}/etc/apache/ssl.csr/*.csr' \
  786. '%config %{l_prefix}/etc/apache/ssl.key/*.key' \
  787. '%config %{l_prefix}/etc/apache/ssl.prm/*.prm' \
  788. %endif
  789. '%config %attr(444,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/apache/apache.base'
  790. %files -f files
  791. %clean
  792. rm -rf $RPM_BUILD_ROOT
  793. %post
  794. %if "%{with_mod_auth_pam}" == "yes"
  795. # add PAM configuration entry
  796. if [ $1 -eq 1 ]; then
  797. $RPM_INSTALL_PREFIX/sbin/pamtool -a -s -n "apache"
  798. fi
  799. %endif
  800. %preun
  801. %if "%{with_mod_auth_pam}" == "yes"
  802. # remove PAM configuration entry
  803. if [ $1 -eq 0 ]; then
  804. $RPM_INSTALL_PREFIX/sbin/pamtool -r -s -n "apache"
  805. fi
  806. %endif