apache.spec 27 KB

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