apache.spec 26 KB

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