apache.spec 26 KB

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