apache.spec 26 KB

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