apache.spec 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820
  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_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_pdflib: %define with_mod_php_pdflib no}
  59. %{!?with_mod_php_zlib: %define with_mod_php_zlib no}
  60. %{!?with_mod_php_bzip2: %define with_mod_php_bzip2 no}
  61. %{!?with_mod_php_openssl: %define with_mod_php_openssl no}
  62. %{!?with_mod_php_openldap: %define with_mod_php_openldap no}
  63. %{!?with_mod_php_mm: %define with_mod_php_mm no}
  64. %{!?with_mod_php_pcre: %define with_mod_php_pcre no}
  65. %{!?with_mod_php_ftp: %define with_mod_php_ftp no}
  66. %{!?with_mod_php_java: %define with_mod_php_java no}
  67. %{!?with_mod_php_oci8: %define with_mod_php_oci8 no}
  68. %{!?with_mod_php_freetype: %define with_mod_php_freetype no}
  69. %{!?with_mod_php_gettext: %define with_mod_php_gettext no}
  70. %{!?with_mod_php_imap: %define with_mod_php_imap no}
  71. %{!?with_mod_php_xml: %define with_mod_php_xml no}
  72. %{!?with_mod_php_bc: %define with_mod_php_bc no}
  73. %{!?with_mod_php_transsid: %define with_mod_php_transsid no}
  74. # more optional PHP3 specific settings
  75. # (requires "with_mod_php3" set to "yes" above!)
  76. %{!?with_mod_php3_ftp: %define with_mod_php3_ftp no}
  77. %{!?with_mod_php3_gd: %define with_mod_php3_gd no}
  78. %{!?with_mod_php3_jpeg: %define with_mod_php3_jpeg no}
  79. %{!?with_mod_php3_mysql: %define with_mod_php3_mysql no}
  80. %{!?with_mod_php3_openssl: %define with_mod_php3_openssl no}
  81. %{!?with_mod_php3_zlib: %define with_mod_php3_zlib no}
  82. # fixing implicit inter-module dependencies and correlations
  83. %if "%{with_mod_php}" == "yes"
  84. %if "%{with_mod_php3}" == "yes"
  85. %{error: with_mod_php conflicts with with_mod_php3}
  86. # FIXME: error macro does not terminate execution
  87. exit 1
  88. %endif
  89. %if "%{with_mod_ssl}" == "yes"
  90. %define with_mod_php_openssl yes
  91. %define with_mod_php_mm yes
  92. %endif
  93. %if "%{with_mod_php_mysql}" == "yes" || "%{with_mod_php_pdflib}" == "yes"
  94. %define with_mod_php_zlib yes
  95. %endif
  96. %if "%{with_mod_php_freetype}" == "yes"
  97. %define with_mod_php_gd yes
  98. %endif
  99. %endif
  100. %if "%{with_mod_php3}" == "yes"
  101. %if "%{with_mod_ssl}" == "yes"
  102. %define with_mod_php3_openssl yes
  103. %endif
  104. %if "%{with_mod_php3_mysql}" == "yes"
  105. %define with_mod_php3_zlib yes
  106. %endif
  107. %endif
  108. # package component versions
  109. %define V_apache 1.3.26
  110. %define V_mod_ssl 2.8.10-1.3.26
  111. %define V_mod_perl 1.27
  112. %define V_mod_php 4.2.2
  113. %define V_mod_php3 3.0.18
  114. %define V_mod_dav 1.0.3-1.3.6
  115. %define V_mod_layout 3.2
  116. %define V_mod_macro 1.1.2
  117. %define V_mod_auth_pam 1.0a
  118. %define V_mod_gzip 1.3.19.1a
  119. %define V_mod_zmod 2_3
  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 [REL]
  132. Group: Web
  133. License: ASF
  134. Version: %{V_apache}
  135. Release: 20020731
  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.ivw.de/???/src.apapi.FIN%{V_mod_zmod}.tar.gz
  147. Source10: http://www.fastcgi.com/dist/mod_fastcgi-%{V_mod_fastcgi}.tar.gz
  148. Source11: http://www.snert.com/Software/mod_throttle/mod_throttle%{V_mod_throttle}.tgz
  149. Source12: http://download.sourceforge.net/accessreferer/mod_access_referer-%{V_mod_access_referer}.tar.gz
  150. Source13: http://www.klomp.org/mod_roaming/mod_roaming-%{V_mod_roaming}.tar.gz
  151. Source14: http://software.tangent.org/download/mod_relocate-%{V_mod_relocate}.tar.gz
  152. Source15: http://www.php.net/distributions/php-%{V_mod_php3}.tar.gz
  153. Source20: apache.conf
  154. Source21: apache.base
  155. Source22: apache.vhost
  156. Source23: rc.apache
  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
  176. %endif
  177. %if "%{with_mod_php_db}" == "yes"
  178. BuildPreReq: db
  179. %endif
  180. %if "%{with_mod_php_pdflib}" == "yes"
  181. BuildPreReq: pdflib
  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: jdk-sun
  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. with_mod_ssl=%{with_mod_ssl} with_mod_perl=%{with_mod_perl}
  253. with_mod_php=%{with_mod_php} with_mod_php3=%{with_mod_php3}
  254. with_mod_dav=%{with_mod_dav} with_mod_layout=%{with_mod_layout} with_mod_macro=%{with_mod_macro}
  255. Options (additional modules II):
  256. with_mod_auth_pam=%{with_mod_auth_pam} with_mod_gzip=%{with_mod_gzip} with_mod_zmod=%{with_mod_zmod}
  257. with_mod_fastcgi=%{with_mod_fastcgi} with_mod_throttle=%{with_mod_throttle} with_mod_access_referer=%{with_mod_access_referer}
  258. with_mod_roaming=%{with_mod_roaming} with_mod_relocate=%{with_mod_relocate}
  259. Options (additional extensions for mod_php):
  260. with_mod_php_mysql=%{with_mod_php_mysql} with_mod_php_gd=%{with_mod_php_gd} with_mod_php_db=%{with_mod_php_db}
  261. with_mod_php_pdflib=%{with_mod_php_pdflib} with_mod_php_zlib=%{with_mod_php_zlib} with_mod_php_bzip2=%{with_mod_php_bzip2}
  262. with_mod_php_openssl=%{with_mod_php_openssl} with_mod_php_openldap=%{with_mod_php_openldap} with_mod_php_mm=%{with_mod_php_mm}
  263. with_mod_php_pcre=%{with_mod_php_pcre} with_mod_php_ftp=%{with_mod_php_ftp} with_mod_php_java=%{with_mod_php_java}
  264. with_mod_php_oci8=%{with_mod_php_oci8} with_mod_php_gettext=%{with_mod_php_gettext}
  265. with_mod_php_imap=%{with_mod_php_imap} with_mod_php_xml=%{with_mod_php_xml}
  266. with_mod_php_bc=%{with_mod_php_bc}
  267. Options (additional extensions for mod_php3):
  268. with_mod_php3_ftp %{with_mod_php3_ftp}
  269. with_mod_php3_gd %{with_mod_php3_gd}
  270. with_mod_php3_jpeg %{with_mod_php3_jpeg}
  271. with_mod_php3_mysql %{with_mod_php3_mysql}
  272. with_mod_php3_openssl %{with_mod_php3_openssl}
  273. with_mod_php3_zlib %{with_mod_php3_zlib}
  274. %prep
  275. # unpack Apache distribution
  276. %setup0 -q -c
  277. # unpack optional extension modules
  278. %if "%{with_mod_ssl}" == "yes"
  279. %setup1 -q -T -D -a 1
  280. %endif
  281. %if "%{with_mod_perl}" == "yes"
  282. %setup2 -q -T -D -a 2
  283. %endif
  284. %if "%{with_mod_php}" == "yes"
  285. %setup3 -q -T -D -a 3
  286. %endif
  287. %if "%{with_mod_dav}" == "yes"
  288. %setup4 -q -T -D -a 4
  289. %endif
  290. %if "%{with_mod_layout}" == "yes"
  291. %setup5 -q -T -D -a 5
  292. %endif
  293. %if "%{with_mod_macro}" == "yes"
  294. %setup6 -q -T -D -a 6
  295. %endif
  296. %if "%{with_mod_auth_pam}" == "yes"
  297. %setup7 -q -T -D -a 7
  298. %endif
  299. %if "%{with_mod_zmod}" == "yes"
  300. %setup9 -q -T -D -a 9
  301. %endif
  302. %if "%{with_mod_fastcgi}" == "yes"
  303. %setup10 -q -T -D -a 10
  304. %endif
  305. %if "%{with_mod_throttle}" == "yes"
  306. %setup11 -q -T -D -a 11
  307. %endif
  308. %if "%{with_mod_access_referer}" == "yes"
  309. %setup12 -q -T -D -a 12
  310. %endif
  311. %if "%{with_mod_roaming}" == "yes"
  312. %setup13 -q -T -D -a 13
  313. %endif
  314. %if "%{with_mod_relocate}" == "yes"
  315. %setup14 -q -T -D -a 14
  316. %endif
  317. %if "%{with_mod_php3}" == "yes"
  318. %setup15 -q -T -D -a 15
  319. %endif
  320. %build
  321. # prepare environment
  322. PATH="%{l_prefix}/bin:%{l_prefix}/sbin:$PATH"; export PATH
  323. rm -rf $RPM_BUILD_ROOT
  324. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}
  325. # optionally prepare mod_ssl
  326. %if "%{with_mod_ssl}" == "yes"
  327. ( cd mod_ssl-%{V_mod_ssl}
  328. ./configure \
  329. --with-apache=../apache_%{V_apache} \
  330. --expert --force
  331. )
  332. %endif
  333. # optionally pre-configure Apache for mod_php, mod_php3 and mod_dav
  334. %if "%{with_mod_php}" == "yes" || "%{with_mod_php3}" == "yes" || "%{with_mod_dav}" == "yes"
  335. ( cd apache_%{V_apache}
  336. CC="%{l_cc}" \
  337. CFLAGS="%{l_cflags -O}" \
  338. ./configure \
  339. %if "%{with_mod_ssl}" == "yes"
  340. --enable-rule=EAPI \
  341. %endif
  342. --target=apache \
  343. --with-layout=GNU \
  344. --prefix=%{l_prefix} \
  345. --sbindir=%{l_prefix}/sbin \
  346. --sysconfdir=%{l_prefix}/etc/apache \
  347. --libexecdir=%{l_prefix}/lib/apache \
  348. --datadir=%{l_prefix}/share/apache \
  349. --localstatedir=%{l_prefix}/var/apache
  350. )
  351. %endif
  352. # optionally prepare mod_perl
  353. %if "%{with_mod_perl}" == "yes"
  354. ( cd mod_perl-%{V_mod_perl}
  355. eval `%{l_prefix}/bin/perl -V:archname`
  356. eval `%{l_prefix}/bin/perl -V:version`
  357. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/bin
  358. perl=$RPM_BUILD_ROOT%{l_prefix}/bin/perl
  359. echo "#!/bin/sh" >$perl
  360. echo "exec %{l_prefix}/bin/perl \\" >>$perl
  361. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/${version} \\" >>$perl
  362. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/${version}/${archname} \\" >>$perl
  363. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/site_perl \\" >>$perl
  364. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/site_perl/${version} \\" >>$perl
  365. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/site_perl/${version}/${archname} \\" >>$perl
  366. echo " \"\$@\"" >>$perl
  367. chmod a+x $perl
  368. $perl Makefile.PL \
  369. PREFIX=$RPM_BUILD_ROOT%{l_prefix} \
  370. APACHE_SRC=../apache_%{V_apache}/src \
  371. DO_HTTPD=1 \
  372. USE_APACI=1 \
  373. PREP_HTTPD=1 \
  374. EVERYTHING=1 \
  375. PERL_TIE_TABLES=1 \
  376. PERL_DIRECTIVE_HANDLERS=1
  377. %{l_make} %{l_mflags}
  378. %{l_make} %{l_mflags} install
  379. mkdir $RPM_BUILD_ROOT%{l_prefix}/perl5
  380. mv $RPM_BUILD_ROOT%{l_prefix}/lib/* $RPM_BUILD_ROOT%{l_prefix}/perl5/
  381. mv $RPM_BUILD_ROOT%{l_prefix}/perl5 $RPM_BUILD_ROOT%{l_prefix}/lib/
  382. %{l_shtool} subst -e "s;^\\(PERL = \\).*;\\1 $perl;" \
  383. ../apache_%{V_apache}/src/modules/perl/mod_perl.config
  384. )
  385. %endif
  386. # optionally prepare mod_php
  387. %if "%{with_mod_php}" == "yes"
  388. ( cd php-%{V_mod_php}
  389. CC="%{l_cc}" \
  390. %if "%{with_mod_ssl}" == "yes"
  391. CFLAGS="%{l_cflags -O} -I%{l_prefix}/include -DEAPI" \
  392. %else
  393. CFLAGS="%{l_cflags -O} -I%{l_prefix}/include" \
  394. %endif
  395. CPPFLAGS="%{l_cflags -O} -I%{l_prefix}/include" \
  396. LDFLAGS="%{l_cflags -O} -L%{l_prefix}/lib" \
  397. %if "%{with_mod_php_gd}" == "yes" && "%{with_mod_php_gettext}" == "yes"
  398. LIBS="-lpng -lz -liconv" \
  399. %else
  400. %if "%{with_mod_php_gd}" == "yes"
  401. LIBS="-lpng -lz" \
  402. %endif
  403. %if "%{with_mod_php_gettext}" == "yes"
  404. LIBS="-liconv" \
  405. %endif
  406. %endif
  407. ./configure \
  408. --prefix=%{l_prefix} \
  409. --with-apache=../apache_%{V_apache} \
  410. --with-config-file-path=%{l_prefix}/etc/apache \
  411. %if "%{with_mod_php_mysql}" == "yes"
  412. --with-mysql=%{l_prefix} \
  413. %endif
  414. %if "%{with_mod_php_gd}" == "yes"
  415. --with-gd=%{l_prefix} \
  416. %endif
  417. %if "%{with_mod_php_freetype}" == "yes"
  418. --enable-gd-native-ttf \
  419. --with-freetype-dir=%{l_prefix} \
  420. %endif
  421. %if "%{with_mod_php_db}" == "yes"
  422. --with-db3=%{l_prefix} \
  423. %endif
  424. %if "%{with_mod_php_zlib}" == "yes"
  425. --with-zlib=%{l_prefix} \
  426. %endif
  427. %if "%{with_mod_php_bzip2}" == "yes"
  428. --with-bz2=%{l_prefix} \
  429. %endif
  430. %if "%{with_mod_php_pdflib}" == "yes"
  431. --with-pdflib=%{l_prefix} \
  432. %endif
  433. %if "%{with_mod_php_openssl}" == "yes" || "%{with_mod_php_openldap}" == "yes"
  434. --with-openssl=%{l_prefix} \
  435. %endif
  436. %if "%{with_mod_php_openldap}" == "yes"
  437. --with-ldap=%{l_prefix} \
  438. %endif
  439. %if "%{with_mod_php_mm}" == "yes"
  440. --with-mm=%{l_prefix} \
  441. --enable-session \
  442. %endif
  443. %if "%{with_mod_php_pcre}" == "yes"
  444. --with-pcre=%{l_prefix} \
  445. %endif
  446. %if "%{with_mod_php_ftp}" == "yes"
  447. --enable-ftp \
  448. %endif
  449. %if "%{with_mod_php_java}" == "yes"
  450. --with-java=%{l_prefix}/libexec/jdk-sun \
  451. %endif
  452. %if "%{with_mod_php_oci8}" == "yes"
  453. --with-oci8 \
  454. %endif
  455. %if "%{with_mod_php_gettext}" == "yes"
  456. --with-gettext=%{l_prefix} \
  457. %endif
  458. %if "%{with_mod_php_imap}" == "yes"
  459. --with-imap=%{l_prefix} \
  460. %endif
  461. %if "%{with_mod_php_xml}" == "yes"
  462. --with-xml=%{l_prefix} \
  463. %endif
  464. %if "%{with_mod_php_bc}" == "yes"
  465. --enable-bcmath \
  466. %endif
  467. %if "%{with_mod_php_transsid}" == "yes"
  468. --enable-trans-sid \
  469. %endif
  470. --disable-shared \
  471. --enable-track-vars
  472. %{l_make} %{l_mflags}
  473. %{l_shtool} subst \
  474. -e "s;^\\(EXTENSION_DIR = \\)\\(%{l_prefix}\\);\\1$RPM_BUILD_ROOT\\2;" \
  475. -e "s;^\\(PEAR_INSTALLDIR = \\)\\(%{l_prefix}\\);\\1$RPM_BUILD_ROOT\\2;" \
  476. config_vars.mk
  477. %{l_make} %{l_mflags} install \
  478. prefix=$RPM_BUILD_ROOT%{l_prefix}
  479. )
  480. %endif
  481. # optionally prepare mod_php3
  482. %if "%{with_mod_php3}" == "yes"
  483. ( cd php-%{V_mod_php3}
  484. CC="%{l_cc}" \
  485. %if "%{with_mod_ssl}" == "yes"
  486. CFLAGS="%{l_cflags -O} -I%{l_prefix}/include -DEAPI" \
  487. %else
  488. CFLAGS="%{l_cflags -O} -I%{l_prefix}/include" \
  489. %endif
  490. CPPFLAGS="%{l_cflags -O} -I%{l_prefix}/include" \
  491. LDFLAGS="%{l_cflags -O} -L%{l_prefix}/lib" \
  492. ./configure \
  493. --prefix=%{l_prefix} \
  494. --with-apache=../apache_%{V_apache} \
  495. --with-config-file-path=%{l_prefix}/etc/apache \
  496. %if "%{with_mod_php3_ftp}" == "yes"
  497. --with-ftp \
  498. %endif
  499. %if "%{with_mod_php3_mysql}" == "yes"
  500. --with-mysql=%{l_prefix} \
  501. %endif
  502. %if "%{with_mod_php3_zlib}" == "yes"
  503. --with-zlib=%{l_prefix} \
  504. %endif
  505. %if "%{with_mod_php3_jpeg}" == "yes"
  506. --with-jpeg=${prefix} \
  507. %endif
  508. %if "%{with_mod_php3_gd}" == "yes"
  509. --with-gd=${prefix} \
  510. %endif
  511. %if "%{with_mod_php3_openssl}" == "yes"
  512. --with-openssl=%{l_prefix} \
  513. %endif
  514. --disable-shared \
  515. --enable-track-vars
  516. # FIXME:
  517. # --enable-safe-mode
  518. # --with-exec-dir[=DIR]
  519. # --enable-magic-quotes
  520. # --enable-memory-limit
  521. # --enable-sysvsem
  522. # --enable-sysvshm
  523. %{l_make} %{l_mflags}
  524. %{l_make} %{l_mflags} install \
  525. prefix=$RPM_BUILD_ROOT%{l_prefix}
  526. )
  527. %endif
  528. # optionally prepare mod_dav
  529. %if "%{with_mod_dav}" == "yes"
  530. ( cd mod_dav-%{V_mod_dav}
  531. CC="%{l_cc}" \
  532. %if "%{with_mod_ssl}" == "yes"
  533. CFLAGS="%{l_cflags -O}" \
  534. %else
  535. CFLAGS="%{l_cflags -O} -DEAPI" \
  536. %endif
  537. LDFLAGS="%{l_cflags -O}" \
  538. ./configure \
  539. --with-apache=../apache_%{V_apache}
  540. %{l_make} %{l_mflags}
  541. %{l_make} %{l_mflags} install
  542. )
  543. %endif
  544. # optionally prepare mod_layout
  545. %if "%{with_mod_layout}" == "yes"
  546. ( cd mod_layout-%{V_mod_layout}
  547. mkdir ../apache_%{V_apache}/src/modules/layout
  548. cp * ../apache_%{V_apache}/src/modules/layout/ 2>/dev/null || true
  549. chmod -R u+w ../apache_%{V_apache}/src/modules/layout
  550. )
  551. %endif
  552. # optionally prepare mod_macro
  553. %if "%{with_mod_macro}" == "yes"
  554. ( cd mod_macro-%{V_mod_macro}
  555. cp mod_macro.c ../apache_%{V_apache}/src/modules/extra/
  556. )
  557. %endif
  558. # optionally prepare mod_auth_pam
  559. %if "%{with_mod_auth_pam}" == "yes"
  560. ( cd mod_auth_pam-%{V_mod_auth_pam}
  561. cp mod_auth_pam.c ../apache_%{V_apache}/src/modules/extra/
  562. )
  563. %endif
  564. # optionally prepare mod_gzip
  565. %if "%{with_mod_gzip}" == "yes"
  566. cp %{SOURCE mod_gzip.c} apache_%{V_apache}/src/modules/extra/
  567. %endif
  568. # optionally prepare mod_zmod
  569. %if "%{with_mod_zmod}" == "yes"
  570. ( cd src
  571. mkdir ../apache_%{V_apache}/src/modules/zmod
  572. %{l_shtool} subst -e 's;"compat.h";"ap_compat.h";' modules/zmod/mod_zmod.c
  573. cp modules/zmod/* ../apache_%{V_apache}/src/modules/zmod/
  574. )
  575. %endif
  576. # optionally prepare mod_fastcgi
  577. %if "%{with_mod_fastcgi}" == "yes"
  578. ( cd mod_fastcgi-%{V_mod_fastcgi}
  579. mkdir ../apache_%{V_apache}/src/modules/fastcgi
  580. cp -rp * ../apache_%{V_apache}/src/modules/fastcgi/
  581. )
  582. %endif
  583. # optionally prepare mod_throttle
  584. %if "%{with_mod_throttle}" == "yes"
  585. ( cd mod_throttle-*
  586. cp mod_throttle.c ../apache_%{V_apache}/src/modules/extra/
  587. )
  588. %endif
  589. # optionally prepare mod_access_referer
  590. %if "%{with_mod_access_referer}" == "yes"
  591. ( cd mod_access_referer-%{V_mod_access_referer}
  592. cp mod_access_referer.c ../apache_%{V_apache}/src/modules/extra/
  593. )
  594. %endif
  595. # optionally prepare mod_roaming
  596. %if "%{with_mod_roaming}" == "yes"
  597. ( cd mod_roaming-%{V_mod_roaming}
  598. cp mod_roaming.c ../apache_%{V_apache}/src/modules/extra/
  599. )
  600. %endif
  601. # optionally prepare mod_relocate
  602. %if "%{with_mod_relocate}" == "yes"
  603. ( cd mod_relocate-%{V_mod_relocate}
  604. cp mod_relocate.c ../apache_%{V_apache}/src/modules/extra/
  605. )
  606. %endif
  607. # configure Apache
  608. ( cd apache_%{V_apache}
  609. cflags="%{l_cflags -O}"
  610. ldflags=""
  611. libs=""
  612. %if "%{with_mod_auth_pam}" == "yes"
  613. pam_incdir=`%{l_prefix}/etc/rc --query pam_incdir`
  614. if [ ".$pam_incdir" != "./usr/include" ]; then
  615. cflags="$cflags -I$pam_incdir"
  616. fi
  617. pam_libdir=`%{l_prefix}/etc/rc --query pam_libdir`
  618. if [ ".$pam_libdir" != "./usr/lib" ]; then
  619. ldflags="$ldflags -L$pam_libdir"
  620. fi
  621. libs="$libs -lpam"
  622. %endif
  623. CC="%{l_cc}" \
  624. CFLAGS="$cflags" \
  625. LDFLAGS="$ldflags" \
  626. LIBS="$libs" \
  627. %if "%{with_mod_ssl}" == "yes"
  628. EAPI_MM="%{l_prefix}" \
  629. SSL_BASE="%{l_prefix}" \
  630. %endif
  631. ./configure \
  632. --target=apache \
  633. --with-layout=GNU \
  634. --prefix=%{l_prefix} \
  635. --sbindir=%{l_prefix}/sbin \
  636. --sysconfdir=%{l_prefix}/etc/apache \
  637. --libexecdir=%{l_prefix}/lib/apache \
  638. --datadir=%{l_prefix}/share/apache \
  639. --localstatedir=%{l_prefix}/var/apache \
  640. --enable-suexec \
  641. --suexec-caller=%{l_nusr} \
  642. --suexec-userdir=.www \
  643. --enable-module=most \
  644. --with-perl=%{l_prefix}/bin/perl \
  645. %if "%{with_mod_ssl}" == "yes"
  646. --enable-rule=EAPI \
  647. --enable-module=ssl \
  648. %endif
  649. %if "%{with_mod_perl}" == "yes"
  650. --activate-module=src/modules/perl/libperl.a \
  651. %endif
  652. %if "%{with_mod_php}" == "yes"
  653. --activate-module=src/modules/php4/libphp4.a \
  654. %endif
  655. %if "%{with_mod_php3}" == "yes"
  656. --activate-module=src/modules/php3/libphp3.a \
  657. %endif
  658. %if "%{with_mod_dav}" == "yes"
  659. --activate-module=src/modules/dav/libdav.a \
  660. %endif
  661. %if "%{with_mod_layout}" == "yes"
  662. --activate-module=src/modules/layout/liblayout.a \
  663. %endif
  664. %if "%{with_mod_macro}" == "yes"
  665. --activate-module=src/modules/extra/mod_macro.o \
  666. %endif
  667. %if "%{with_mod_auth_pam}" == "yes"
  668. --activate-module=src/modules/extra/mod_auth_pam.o \
  669. %endif
  670. %if "%{with_mod_gzip}" == "yes"
  671. --activate-module=src/modules/extra/mod_gzip.o \
  672. %endif
  673. %if "%{with_mod_zmod}" == "yes"
  674. --activate-module=src/modules/zmod/libzmod.a \
  675. %endif
  676. %if "%{with_mod_fastcgi}" == "yes"
  677. --activate-module=src/modules/fastcgi/libfastcgi.a \
  678. %endif
  679. %if "%{with_mod_throttle}" == "yes"
  680. --activate-module=src/modules/extra/mod_throttle.o \
  681. %endif
  682. %if "%{with_mod_access_referer}" == "yes"
  683. --activate-module=src/modules/extra/mod_access_referer.o \
  684. %endif
  685. %if "%{with_mod_roaming}" == "yes"
  686. --activate-module=src/modules/extra/mod_roaming.o \
  687. %endif
  688. %if "%{with_mod_relocate}" == "yes"
  689. --activate-module=src/modules/extra/mod_relocate.o \
  690. %endif
  691. --enable-module=so
  692. %{l_make} %{l_mflags -O} build-quiet
  693. )
  694. %install
  695. # install Apache
  696. ( cd apache_%{V_apache}
  697. # perform standard Apache installation procedure
  698. %{l_make} %{l_mflags} install root=$RPM_BUILD_ROOT
  699. # post-adjustments to installation tree
  700. mv $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/small/* \
  701. $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/
  702. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/small
  703. rm -f $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/README*
  704. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/apache/*.default
  705. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/apache/srm.conf
  706. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/apache/access.conf
  707. mv $RPM_BUILD_ROOT%{l_prefix}/share/apache/htdocs/index.html.en \
  708. $RPM_BUILD_ROOT%{l_prefix}/share/apache/htdocs/index.html
  709. rm -f $RPM_BUILD_ROOT%{l_prefix}/share/apache/htdocs/index.html.*
  710. chmod a+rx $RPM_BUILD_ROOT%{l_prefix}/share/apache/cgi-bin/*
  711. mv $RPM_BUILD_ROOT%{l_prefix}/share/apache/cgi-bin \
  712. $RPM_BUILD_ROOT%{l_prefix}/cgi/
  713. rm -rf $RPM_BUILD_ROOT%{l_prefix}/cgi/test-cgi
  714. )
  715. # optionally cleanup for mod_perl
  716. %if "%{with_mod_perl}" == "yes"
  717. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/perl
  718. %endif
  719. # create default configuration
  720. l_hostname=`%{l_shtool} echo -e %h`
  721. l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
  722. %{l_shtool} install -c -m 644 \
  723. -e 's;@l_prefix@;%{l_prefix};g' \
  724. -e "s;@l_hostname@;$l_hostname;g" \
  725. -e "s;@l_domainname@;$l_domainname;g" \
  726. -e 's;@l_nusr@;%{l_nusr};g' \
  727. -e 's;@l_ngrp@;%{l_ngrp};g' \
  728. %{SOURCE apache.base} \
  729. %{SOURCE apache.conf} \
  730. %{SOURCE apache.vhost} \
  731. $RPM_BUILD_ROOT%{l_prefix}/etc/apache/
  732. mv $RPM_BUILD_ROOT%{l_prefix}/etc/apache/magic $RPM_BUILD_ROOT%{l_prefix}/etc/apache/mime.magic
  733. find $RPM_BUILD_ROOT%{l_prefix} -name perllocal.pod -print | xargs rm -f
  734. # create run-command script
  735. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  736. %{l_shtool} install -c -m 755 -e 's;@l_prefix@;%{l_prefix};g' \
  737. -e 's;@l_musr@;%{l_musr};g' -e 's;@l_mgrp@;%{l_mgrp};g' \
  738. %{SOURCE rc.apache} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  739. # strip installation binaries
  740. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2> /dev/null || true
  741. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2> /dev/null || true
  742. # determine installation tree files
  743. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  744. %{l_files_std} \
  745. '%attr(4755,root,%{l_mgrp}) %{l_prefix}/sbin/suexec' \
  746. '%config %{l_prefix}/etc/apache/*' \
  747. %if "%{with_mod_ssl}" == "yes"
  748. '%config %{l_prefix}/etc/apache/ssl.crl/*.crl' \
  749. '%config %{l_prefix}/etc/apache/ssl.crt/*.crt' \
  750. '%config %{l_prefix}/etc/apache/ssl.csr/*.csr' \
  751. '%config %{l_prefix}/etc/apache/ssl.key/*.key' \
  752. '%config %{l_prefix}/etc/apache/ssl.prm/*.prm' \
  753. %endif
  754. '%config %attr(444,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/apache/apache.base'
  755. %files -f files
  756. %clean
  757. rm -rf $RPM_BUILD_ROOT
  758. %post
  759. %if "%{with_mod_auth_pam}" == "yes"
  760. # add PAM configuration entry
  761. if [ $1 -eq 1 ]; then
  762. $RPM_INSTALL_PREFIX/sbin/pamtool -a -s -n "apache"
  763. fi
  764. %endif
  765. %preun
  766. %if "%{with_mod_auth_pam}" == "yes"
  767. # remove PAM configuration entry
  768. if [ $1 -eq 0 ]; then
  769. $RPM_INSTALL_PREFIX/sbin/pamtool -r -s -n "apache"
  770. fi
  771. %endif