apache.spec 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  1. ##
  2. ## apache.spec -- RPM Specification for Apache
  3. ## Copyright (c) 2000-2002 Cable & Wireless Deutschland GmbH
  4. ## Copyright (c) 2000-2002 The OpenPKG Project <http://www.openpkg.org/>
  5. ## Copyright (c) 2000-2002 Ralf S. Engelschall <rse@engelschall.com>
  6. ##
  7. ## Permission to use, copy, modify, and distribute this software for
  8. ## any purpose with or without fee is hereby granted, provided that
  9. ## the above copyright notice and this permission notice appear in all
  10. ## copies.
  11. ##
  12. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  13. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  15. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  16. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  18. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  19. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  20. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  21. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23. ## SUCH DAMAGE.
  24. ##
  25. ## ATTENTION: This package specification is a cruel one. It allows
  26. ## one to build an Apache package in hundreds of variants with just
  27. ## a single specification through the use of lots of condition
  28. ## variables. The reason for this attempt is that it was born out of
  29. ## the needs from the daily practice at an ISP. So do not treat this
  30. ## specification as a reference example of any kind, except perhaps as
  31. ## a example of what is maximum possible with RPM and how far one can
  32. ## go with the macro mechanism. But do not try to repeat this!
  33. ## ATTENTION: DO NOT EDIT THE FOLLOWING DEFAULTS DIRECTLY IN THIS FILE!
  34. ## INSTEAD USE --define "with_xxx yes" ON THE COMMAND LINE. THE REASON
  35. ## IS THAT RPM'S MACRO MECHANISM HORSES UP HORRIBLY ELSE!
  36. # the additionally used Apache modules (can be enabled without thinking)
  37. %{!?with_mod_ssl: %define with_mod_ssl no}
  38. %{!?with_mod_perl: %define with_mod_perl no}
  39. %{!?with_mod_php: %define with_mod_php no}
  40. %{!?with_mod_dav: %define with_mod_dav no}
  41. %{!?with_mod_layout: %define with_mod_layout no}
  42. %{!?with_mod_macro: %define with_mod_macro no}
  43. # the additionally used Apache modules (you have to know what you do)
  44. %{!?with_mod_auth_pam: %define with_mod_auth_pam no}
  45. %{!?with_mod_gzip: %define with_mod_gzip no}
  46. %{!?with_mod_zmod: %define with_mod_zmod no}
  47. %{!?with_mod_fastcgi: %define with_mod_fastcgi no}
  48. %{!?with_mod_throttle: %define with_mod_throttle no}
  49. %{!?with_mod_access_referer: %define with_mod_access_referer no}
  50. %{!?with_mod_roaming: %define with_mod_roaming no}
  51. %{!?with_mod_relocate: %define with_mod_relocate no}
  52. # more optional settings
  53. # (requires "with_mod_php" set to "yes" above!)
  54. %{!?with_mod_php_mysql: %define with_mod_php_mysql no}
  55. %{!?with_mod_php_gd: %define with_mod_php_gd no}
  56. %{!?with_mod_php_db: %define with_mod_php_db no}
  57. %{!?with_mod_php_pdflib: %define with_mod_php_pdflib no}
  58. %{!?with_mod_php_zlib: %define with_mod_php_zlib no}
  59. %{!?with_mod_php_bzip2: %define with_mod_php_bzip2 no}
  60. %{!?with_mod_php_openssl: %define with_mod_php_openssl no}
  61. %{!?with_mod_php_openldap: %define with_mod_php_openldap no}
  62. %{!?with_mod_php_mm: %define with_mod_php_mm no}
  63. %{!?with_mod_php_pcre: %define with_mod_php_pcre no}
  64. %{!?with_mod_php_ftp: %define with_mod_php_ftp no}
  65. %{!?with_mod_php_java: %define with_mod_php_java no}
  66. %{!?with_mod_php_oci8: %define with_mod_php_oci8 no}
  67. %{!?with_mod_php_freetype: %define with_mod_php_freetype no}
  68. %{!?with_mod_php_gettext: %define with_mod_php_gettext no}
  69. %{!?with_mod_php_imap: %define with_mod_php_imap no}
  70. %{!?with_mod_php_xml: %define with_mod_php_xml no}
  71. %{!?with_mod_php_bc: %define with_mod_php_bc no}
  72. # fixing implicit inter-module dependencies and correlations
  73. %if "%{with_mod_php}" == "yes"
  74. %if "%{with_mod_ssl}" == "yes"
  75. %define with_mod_php_openssl yes
  76. %define with_mod_php_mm yes
  77. %endif
  78. %if "%{with_mod_php_mysql}" == "yes"
  79. %define with_mod_php_zlib yes
  80. %endif
  81. %if "%{with_mod_php_freetype}" == "yes"
  82. %define with_mod_php_gd yes
  83. %endif
  84. %endif
  85. # package component versions
  86. %define V_apache 1.3.26
  87. %define V_mod_ssl 2.8.9-1.3.26
  88. %define V_mod_perl 1.27
  89. %define V_mod_php 4.2.1
  90. %define V_mod_dav 1.0.3-1.3.6
  91. %define V_mod_layout 3.2
  92. %define V_mod_macro 1.1.2
  93. %define V_mod_auth_pam 1.0a
  94. %define V_mod_gzip 1.3.19.1a
  95. %define V_mod_zmod 2_3
  96. %define V_mod_fastcgi 2.2.12
  97. %define V_mod_throttle 312
  98. %define V_mod_access_referer 1.0.2
  99. %define V_mod_roaming 1.0.2
  100. %define V_mod_relocate 1.0
  101. # package information
  102. Name: apache
  103. Summary: Apache HTTP Server
  104. URL: http://httpd.apache.org/
  105. Vendor: Apache Software Foundation
  106. Packager: The OpenPKG Project
  107. Distribution: OpenPKG [REL]
  108. Group: Web
  109. License: ASF
  110. Version: %{V_apache}
  111. Release: 20020620
  112. # list of sources
  113. Source0: http://www.apache.org/dist/httpd/apache_%{V_apache}.tar.gz
  114. Source1: http://www.modssl.org/source/mod_ssl-%{V_mod_ssl}.tar.gz
  115. Source2: http://perl.apache.org/dist/mod_perl-%{V_mod_perl}.tar.gz
  116. Source3: http://www.php.net/distributions/php-%{V_mod_php}.tar.gz
  117. Source4: http://www.webdav.org/mod_dav/mod_dav-%{V_mod_dav}.tar.gz
  118. Source5: http://software.tangent.org/download/mod_layout-%{V_mod_layout}.tar.gz
  119. Source6: http://www.cri.ensmp.fr/~coelho/mod_macro/mod_macro-%{V_mod_macro}.tar.gz
  120. Source7: http://pam.sourceforge.net/mod_auth_pam/dist/mod_auth_pam.tar.gz
  121. Source8: http://www.remotecommunications.com/apache/mod_gzip/src/%{V_mod_gzip}/mod_gzip.c
  122. Source9: http://www.ivw.de/???/src.apapi.FIN%{V_mod_zmod}.tar.gz
  123. Source10: http://www.fastcgi.com/dist/mod_fastcgi-%{V_mod_fastcgi}.tar.gz
  124. Source11: http://www.snert.com/Software/mod_throttle/mod_throttle%{V_mod_throttle}.tgz
  125. Source12: http://download.sourceforge.net/accessreferer/mod_access_referer-%{V_mod_access_referer}.tar.gz
  126. Source13: http://www.klomp.org/mod_roaming/mod_roaming-%{V_mod_roaming}.tar.gz
  127. Source14: http://software.tangent.org/download/mod_relocate-%{V_mod_relocate}.tar.gz
  128. Source20: apache.conf
  129. Source21: apache.base
  130. Source22: apache.vhost
  131. Source23: rc.apache
  132. # build information
  133. Prefix: %{l_prefix}
  134. BuildRoot: %{l_buildroot}
  135. BuildPreReq: openpkg >= 20020222
  136. PreReq: openpkg >= 20020222
  137. %if "%{with_mod_ssl}" == "yes"
  138. BuildPreReq: openssl, mm
  139. %endif
  140. %if "%{with_mod_perl}" == "yes"
  141. BuildPreReq: perl
  142. PreReq: perl
  143. %endif
  144. %if "%{with_mod_php}" == "yes"
  145. BuildPreReq: make, bison, flex
  146. %if "%{with_mod_php_mysql}" == "yes"
  147. BuildPreReq: mysql
  148. %endif
  149. %if "%{with_mod_php_gd}" == "yes"
  150. BuildPreReq: gd
  151. %endif
  152. %if "%{with_mod_php_db}" == "yes"
  153. BuildPreReq: db
  154. %endif
  155. %if "%{with_mod_php_pdflib}" == "yes"
  156. BuildPreReq: pdflib, zlib
  157. %endif
  158. %if "%{with_mod_php_zlib}" == "yes"
  159. BuildPreReq: zlib
  160. %endif
  161. %if "%{with_mod_php_bzip2}" == "yes"
  162. BuildPreReq: bzip2
  163. %endif
  164. %if "%{with_mod_php_openssl}" == "yes"
  165. BuildPreReq: openssl
  166. %endif
  167. %if "%{with_mod_php_openldap}" == "yes"
  168. BuildPreReq: openldap, openssl
  169. %endif
  170. %if "%{with_mod_php_mm}" == "yes"
  171. BuildPreReq: mm
  172. %endif
  173. %if "%{with_mod_php_pcre}" == "yes"
  174. BuildPreReq: pcre
  175. %endif
  176. %if "%{with_mod_php_java}" == "yes"
  177. BuildPreReq: jdk-sun
  178. %endif
  179. %if "%{with_mod_php_freetype}" == "yes"
  180. BuildPreReq: freetype
  181. %endif
  182. %if "%{with_mod_php_gettext}" == "yes"
  183. BuildPreReq: gettext, libiconv
  184. %endif
  185. %if "%{with_mod_php_imap}" == "yes"
  186. BuildPreReq: c-client
  187. %endif
  188. %if "%{with_mod_php_xml}" == "yes"
  189. BuildPreReq: expat
  190. %endif
  191. %endif
  192. %if "%{with_mod_auth_pam}" == "yes"
  193. BuildPreReq: PAM
  194. PreReq: PAM
  195. %endif
  196. AutoReq: no
  197. AutoReqProv: no
  198. %description
  199. The Apache Project is a collaborative software development effort
  200. aimed at creating a robust, commercial-grade, featureful, and
  201. freely-available source code implementation of an HTTP (Web) server.
  202. The project is jointly managed by a group of volunteers located
  203. around the world, using the Internet and the Web to communicate,
  204. plan, and develop the server and its related documentation. These
  205. volunteers are known as the Apache Group. In addition, hundreds
  206. of users have contributed ideas, code, and documentation to the
  207. project.
  208. Options (additional modules I):
  209. with_mod_ssl=%{with_mod_ssl} with_mod_perl=%{with_mod_perl} with_mod_php=%{with_mod_php}
  210. with_mod_dav=%{with_mod_dav} with_mod_layout=%{with_mod_layout} with_mod_macro=%{with_mod_macro}
  211. Options (additional modules II):
  212. with_mod_auth_pam=%{with_mod_auth_pam} with_mod_gzip=%{with_mod_gzip} with_mod_zmod=%{with_mod_zmod}
  213. with_mod_fastcgi=%{with_mod_fastcgi} with_mod_throttle=%{with_mod_throttle} with_mod_access_referer=%{with_mod_access_referer}
  214. with_mod_roaming=%{with_mod_roaming} with_mod_relocate=%{with_mod_relocate}
  215. Options (additional extensions for mod_php):
  216. with_mod_php_mysql=%{with_mod_php_mysql} with_mod_php_gd=%{with_mod_php_gd} with_mod_php_db=%{with_mod_php_db}
  217. with_mod_php_pdflib=%{with_mod_php_pdflib} with_mod_php_zlib=%{with_mod_php_zlib} with_mod_php_bzip2=%{with_mod_php_bzip2}
  218. with_mod_php_openssl=%{with_mod_php_openssl} with_mod_php_openldap=%{with_mod_php_openldap} with_mod_php_mm=%{with_mod_php_mm}
  219. with_mod_php_pcre=%{with_mod_php_pcre} with_mod_php_ftp=%{with_mod_php_ftp} with_mod_php_java=%{with_mod_php_java}
  220. with_mod_php_oci8=%{with_mod_php_oci8} with_mod_php_gettext=%{with_mod_php_gettext}
  221. with_mod_php_imap=%{with_mod_php_imap} with_mod_php_xml=%{with_mod_php_xml}
  222. with_mod_php_bc=%{with_mod_php_bc}
  223. %prep
  224. # unpack Apache distribution
  225. %setup0 -q -c
  226. # unpack optional extension modules
  227. %if "%{with_mod_ssl}" == "yes"
  228. %setup1 -q -T -D -a 1
  229. %endif
  230. %if "%{with_mod_perl}" == "yes"
  231. %setup2 -q -T -D -a 2
  232. %endif
  233. %if "%{with_mod_php}" == "yes"
  234. %setup3 -q -T -D -a 3
  235. %endif
  236. %if "%{with_mod_dav}" == "yes"
  237. %setup4 -q -T -D -a 4
  238. %endif
  239. %if "%{with_mod_layout}" == "yes"
  240. %setup5 -q -T -D -a 5
  241. %endif
  242. %if "%{with_mod_macro}" == "yes"
  243. %setup6 -q -T -D -a 6
  244. %endif
  245. %if "%{with_mod_auth_pam}" == "yes"
  246. %setup7 -q -T -D -a 7
  247. %endif
  248. %if "%{with_mod_zmod}" == "yes"
  249. %setup9 -q -T -D -a 9
  250. %endif
  251. %if "%{with_mod_fastcgi}" == "yes"
  252. %setup10 -q -T -D -a 10
  253. %endif
  254. %if "%{with_mod_throttle}" == "yes"
  255. %setup11 -q -T -D -a 11
  256. %endif
  257. %if "%{with_mod_access_referer}" == "yes"
  258. %setup12 -q -T -D -a 12
  259. %endif
  260. %if "%{with_mod_roaming}" == "yes"
  261. %setup13 -q -T -D -a 13
  262. %endif
  263. %if "%{with_mod_relocate}" == "yes"
  264. %setup14 -q -T -D -a 14
  265. %endif
  266. %build
  267. # prepare environment
  268. PATH="%{l_prefix}/bin:%{l_prefix}/sbin:$PATH"; export PATH
  269. rm -rf $RPM_BUILD_ROOT
  270. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}
  271. # optionally prepare mod_ssl
  272. %if "%{with_mod_ssl}" == "yes"
  273. ( cd mod_ssl-%{V_mod_ssl}
  274. ./configure \
  275. --with-apache=../apache_%{V_apache} \
  276. --expert --force
  277. )
  278. %endif
  279. # optionally pre-configure Apache for mod_php and mod_dav
  280. %if "%{with_mod_php}" == "yes" || "%{with_mod_dav}" == "yes"
  281. ( cd apache_%{V_apache}
  282. CC="%{l_cc}" \
  283. CFLAGS="%{l_cflags -O}" \
  284. ./configure \
  285. %if "%{with_mod_ssl}" == "yes"
  286. --enable-rule=EAPI \
  287. %endif
  288. --target=apache \
  289. --with-layout=GNU \
  290. --prefix=%{l_prefix} \
  291. --sbindir=%{l_prefix}/sbin \
  292. --sysconfdir=%{l_prefix}/etc/apache \
  293. --libexecdir=%{l_prefix}/lib/apache \
  294. --datadir=%{l_prefix}/share/apache \
  295. --localstatedir=%{l_prefix}/var/apache
  296. )
  297. %endif
  298. # optionally prepare mod_perl
  299. %if "%{with_mod_perl}" == "yes"
  300. ( cd mod_perl-%{V_mod_perl}
  301. eval `%{l_prefix}/bin/perl -V:archname`
  302. eval `%{l_prefix}/bin/perl -V:version`
  303. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/bin
  304. perl=$RPM_BUILD_ROOT%{l_prefix}/bin/perl
  305. echo "#!/bin/sh" >$perl
  306. echo "exec %{l_prefix}/bin/perl \\" >>$perl
  307. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/${version} \\" >>$perl
  308. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/${version}/${archname} \\" >>$perl
  309. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/site_perl \\" >>$perl
  310. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/site_perl/${version} \\" >>$perl
  311. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/site_perl/${version}/${archname} \\" >>$perl
  312. echo " \"\$@\"" >>$perl
  313. chmod a+x $perl
  314. $perl Makefile.PL \
  315. PREFIX=$RPM_BUILD_ROOT%{l_prefix} \
  316. APACHE_SRC=../apache_%{V_apache}/src \
  317. DO_HTTPD=1 \
  318. USE_APACI=1 \
  319. PREP_HTTPD=1 \
  320. EVERYTHING=1 \
  321. PERL_TIE_TABLES=1 \
  322. PERL_DIRECTIVE_HANDLERS=1
  323. %{l_make} %{l_mflags}
  324. %{l_make} %{l_mflags} install
  325. mkdir $RPM_BUILD_ROOT%{l_prefix}/perl5
  326. mv $RPM_BUILD_ROOT%{l_prefix}/lib/* $RPM_BUILD_ROOT%{l_prefix}/perl5/
  327. mv $RPM_BUILD_ROOT%{l_prefix}/perl5 $RPM_BUILD_ROOT%{l_prefix}/lib/
  328. %{l_shtool} subst -e "s;^\\(PERL = \\).*;\\1 $perl;" \
  329. ../apache_%{V_apache}/src/modules/perl/mod_perl.config
  330. )
  331. %endif
  332. # optionally prepare mod_php
  333. %if "%{with_mod_php}" == "yes"
  334. ( cd php-%{V_mod_php}
  335. CC="%{l_cc}" \
  336. %if "%{with_mod_ssl}" == "yes"
  337. CFLAGS="%{l_cflags -O} -I%{l_prefix}/include -DEAPI" \
  338. %else
  339. CFLAGS="%{l_cflags -O} -I%{l_prefix}/include" \
  340. %endif
  341. CPPFLAGS="%{l_cflags -O} -I%{l_prefix}/include" \
  342. LDFLAGS="%{l_cflags -O} -L%{l_prefix}/lib" \
  343. %if "%{with_mod_php_gd}" == "yes" && "%{with_mod_php_gettext}" == "yes"
  344. LIBS="-lpng -lz -liconv" \
  345. %else
  346. %if "%{with_mod_php_gd}" == "yes"
  347. LIBS="-lpng -lz" \
  348. %endif
  349. %if "%{with_mod_php_gettext}" == "yes"
  350. LIBS="-liconv" \
  351. %endif
  352. %endif
  353. ./configure \
  354. --prefix=%{l_prefix} \
  355. --with-apache=../apache_%{V_apache} \
  356. --with-config-file-path=%{l_prefix}/etc/apache \
  357. %if "%{with_mod_php_mysql}" == "yes"
  358. --with-mysql=%{l_prefix} \
  359. %endif
  360. %if "%{with_mod_php_gd}" == "yes"
  361. --with-gd=%{l_prefix} \
  362. %endif
  363. %if "%{with_mod_php_freetype}" == "yes"
  364. --enable-gd-native-ttf \
  365. --with-freetype-dir=%{l_prefix} \
  366. %endif
  367. %if "%{with_mod_php_db}" == "yes"
  368. --with-db3=%{l_prefix} \
  369. %endif
  370. %if "%{with_mod_php_zlib}" == "yes" || "%{with_mod_php_pdflib}" == "yes"
  371. --with-zlib=%{l_prefix} \
  372. %endif
  373. %if "%{with_mod_php_bzip2}" == "yes"
  374. --with-bz2=%{l_prefix} \
  375. %endif
  376. %if "%{with_mod_php_pdflib}" == "yes"
  377. --with-pdflib=%{l_prefix} \
  378. %endif
  379. %if "%{with_mod_php_openssl}" == "yes" || "%{with_mod_php_openldap}" == "yes"
  380. --with-openssl=%{l_prefix} \
  381. %endif
  382. %if "%{with_mod_php_openldap}" == "yes"
  383. --with-ldap=%{l_prefix} \
  384. %endif
  385. %if "%{with_mod_php_mm}" == "yes"
  386. --with-mm=%{l_prefix} \
  387. --enable-session \
  388. %endif
  389. %if "%{with_mod_php_pcre}" == "yes"
  390. --with-pcre=%{l_prefix} \
  391. %endif
  392. %if "%{with_mod_php_ftp}" == "yes"
  393. --enable-ftp \
  394. %endif
  395. %if "%{with_mod_php_java}" == "yes"
  396. --with-java=%{l_prefix}/libexec/jdk-sun \
  397. %endif
  398. %if "%{with_mod_php_oci8}" == "yes"
  399. --with-oci8 \
  400. %endif
  401. %if "%{with_mod_php_gettext}" == "yes"
  402. --with-gettext=%{l_prefix} \
  403. %endif
  404. %if "%{with_mod_php_imap}" == "yes"
  405. --with-imap=%{l_prefix} \
  406. %endif
  407. %if "%{with_mod_php_xml}" == "yes"
  408. --with-xml=%{l_prefix} \
  409. %endif
  410. %if "%{with_mod_php_bc}" == "yes"
  411. --enable-bcmath \
  412. %endif
  413. --disable-shared \
  414. --enable-track-vars
  415. %{l_make} %{l_mflags}
  416. %{l_shtool} subst \
  417. -e "s;^\\(EXTENSION_DIR = \\)\\(%{l_prefix}\\);\\1$RPM_BUILD_ROOT\\2;" \
  418. -e "s;^\\(PEAR_INSTALLDIR = \\)\\(%{l_prefix}\\);\\1$RPM_BUILD_ROOT\\2;" \
  419. config_vars.mk
  420. %{l_make} %{l_mflags} install \
  421. prefix=$RPM_BUILD_ROOT%{l_prefix}
  422. )
  423. %endif
  424. # optionally prepare mod_dav
  425. %if "%{with_mod_dav}" == "yes"
  426. ( cd mod_dav-%{V_mod_dav}
  427. CC="%{l_cc}" \
  428. %if "%{with_mod_ssl}" == "yes"
  429. CFLAGS="%{l_cflags -O}" \
  430. %else
  431. CFLAGS="%{l_cflags -O} -DEAPI" \
  432. %endif
  433. LDFLAGS="%{l_cflags -O}" \
  434. ./configure \
  435. --with-apache=../apache_%{V_apache}
  436. %{l_make} %{l_mflags}
  437. %{l_make} %{l_mflags} install
  438. )
  439. %endif
  440. # optionally prepare mod_layout
  441. %if "%{with_mod_layout}" == "yes"
  442. ( cd mod_layout-%{V_mod_layout}
  443. mkdir ../apache_%{V_apache}/src/modules/layout
  444. cp * ../apache_%{V_apache}/src/modules/layout/ 2>/dev/null || true
  445. chmod -R u+w ../apache_%{V_apache}/src/modules/layout
  446. )
  447. %endif
  448. # optionally prepare mod_macro
  449. %if "%{with_mod_macro}" == "yes"
  450. ( cd mod_macro-%{V_mod_macro}
  451. cp mod_macro.c ../apache_%{V_apache}/src/modules/extra/
  452. )
  453. %endif
  454. # optionally prepare mod_auth_pam
  455. %if "%{with_mod_auth_pam}" == "yes"
  456. ( cd mod_auth_pam-%{V_mod_auth_pam}
  457. cp mod_auth_pam.c ../apache_%{V_apache}/src/modules/extra/
  458. )
  459. %endif
  460. # optionally prepare mod_gzip
  461. %if "%{with_mod_gzip}" == "yes"
  462. cp %{SOURCE mod_gzip.c} apache_%{V_apache}/src/modules/extra/
  463. %endif
  464. # optionally prepare mod_zmod
  465. %if "%{with_mod_zmod}" == "yes"
  466. ( cd src
  467. mkdir ../apache_%{V_apache}/src/modules/zmod
  468. %{l_shtool} subst -e 's;"compat.h";"ap_compat.h";' modules/zmod/mod_zmod.c
  469. cp modules/zmod/* ../apache_%{V_apache}/src/modules/zmod/
  470. )
  471. %endif
  472. # optionally prepare mod_fastcgi
  473. %if "%{with_mod_fastcgi}" == "yes"
  474. ( cd mod_fastcgi-%{V_mod_fastcgi}
  475. mkdir ../apache_%{V_apache}/src/modules/fastcgi
  476. cp -rp * ../apache_%{V_apache}/src/modules/fastcgi/
  477. )
  478. %endif
  479. # optionally prepare mod_throttle
  480. %if "%{with_mod_throttle}" == "yes"
  481. ( cd mod_throttle-*
  482. cp mod_throttle.c ../apache_%{V_apache}/src/modules/extra/
  483. )
  484. %endif
  485. # optionally prepare mod_access_referer
  486. %if "%{with_mod_access_referer}" == "yes"
  487. ( cd mod_access_referer-%{V_mod_access_referer}
  488. cp mod_access_referer.c ../apache_%{V_apache}/src/modules/extra/
  489. )
  490. %endif
  491. # optionally prepare mod_roaming
  492. %if "%{with_mod_roaming}" == "yes"
  493. ( cd mod_roaming-%{V_mod_roaming}
  494. cp mod_roaming.c ../apache_%{V_apache}/src/modules/extra/
  495. )
  496. %endif
  497. # optionally prepare mod_relocate
  498. %if "%{with_mod_relocate}" == "yes"
  499. ( cd mod_relocate-%{V_mod_relocate}
  500. cp mod_relocate.c ../apache_%{V_apache}/src/modules/extra/
  501. )
  502. %endif
  503. # configure Apache
  504. ( cd apache_%{V_apache}
  505. cflags="%{l_cflags -O}"
  506. ldflags=""
  507. libs=""
  508. %if "%{with_mod_auth_pam}" == "yes"
  509. cflags="$cflags -I`%{l_prefix}/etc/rc --query pam_incdir`"
  510. ldflags="$ldflags -L`%{l_prefix}/etc/rc --query pam_libdir`"
  511. libs="$libs -lpam"
  512. %endif
  513. CC="%{l_cc}" \
  514. CFLAGS="$cflags" \
  515. LDFLAGS="$ldflags" \
  516. LIBS="$libs" \
  517. %if "%{with_mod_ssl}" == "yes"
  518. EAPI_MM="%{l_prefix}" \
  519. SSL_BASE="%{l_prefix}" \
  520. %endif
  521. ./configure \
  522. --target=apache \
  523. --with-layout=GNU \
  524. --prefix=%{l_prefix} \
  525. --sbindir=%{l_prefix}/sbin \
  526. --sysconfdir=%{l_prefix}/etc/apache \
  527. --libexecdir=%{l_prefix}/lib/apache \
  528. --datadir=%{l_prefix}/share/apache \
  529. --localstatedir=%{l_prefix}/var/apache \
  530. --enable-suexec \
  531. --suexec-caller=%{l_musr} \
  532. --suexec-userdir=.www \
  533. --enable-module=most \
  534. --with-perl=%{l_prefix}/bin/perl \
  535. %if "%{with_mod_ssl}" == "yes"
  536. --enable-rule=EAPI \
  537. --enable-module=ssl \
  538. %endif
  539. %if "%{with_mod_perl}" == "yes"
  540. --activate-module=src/modules/perl/libperl.a \
  541. %endif
  542. %if "%{with_mod_php}" == "yes"
  543. --activate-module=src/modules/php4/libphp4.a \
  544. %endif
  545. %if "%{with_mod_dav}" == "yes"
  546. --activate-module=src/modules/dav/libdav.a \
  547. %endif
  548. %if "%{with_mod_layout}" == "yes"
  549. --activate-module=src/modules/layout/liblayout.a \
  550. %endif
  551. %if "%{with_mod_macro}" == "yes"
  552. --activate-module=src/modules/extra/mod_macro.o \
  553. %endif
  554. %if "%{with_mod_auth_pam}" == "yes"
  555. --activate-module=src/modules/extra/mod_auth_pam.o \
  556. %endif
  557. %if "%{with_mod_gzip}" == "yes"
  558. --activate-module=src/modules/extra/mod_gzip.o \
  559. %endif
  560. %if "%{with_mod_zmod}" == "yes"
  561. --activate-module=src/modules/zmod/libzmod.a \
  562. %endif
  563. %if "%{with_mod_fastcgi}" == "yes"
  564. --activate-module=src/modules/fastcgi/libfastcgi.a \
  565. %endif
  566. %if "%{with_mod_throttle}" == "yes"
  567. --activate-module=src/modules/extra/mod_throttle.o \
  568. %endif
  569. %if "%{with_mod_access_referer}" == "yes"
  570. --activate-module=src/modules/extra/mod_access_referer.o \
  571. %endif
  572. %if "%{with_mod_roaming}" == "yes"
  573. --activate-module=src/modules/extra/mod_roaming.o \
  574. %endif
  575. %if "%{with_mod_relocate}" == "yes"
  576. --activate-module=src/modules/extra/mod_relocate.o \
  577. %endif
  578. --enable-module=so
  579. %{l_make} %{l_mflags -O} build-quiet
  580. )
  581. %install
  582. # install Apache
  583. ( cd apache_%{V_apache}
  584. # perform standard Apache installation procedure
  585. %{l_make} %{l_mflags} install root=$RPM_BUILD_ROOT
  586. # post-adjustments to installation tree
  587. mv $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/small/* \
  588. $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/
  589. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/small
  590. rm -f $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/README*
  591. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/apache/*.default
  592. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/apache/srm.conf
  593. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/apache/access.conf
  594. mv $RPM_BUILD_ROOT%{l_prefix}/share/apache/htdocs/index.html.en \
  595. $RPM_BUILD_ROOT%{l_prefix}/share/apache/htdocs/index.html
  596. rm -f $RPM_BUILD_ROOT%{l_prefix}/share/apache/htdocs/index.html.*
  597. chmod a+rx $RPM_BUILD_ROOT%{l_prefix}/share/apache/cgi-bin/*
  598. mv $RPM_BUILD_ROOT%{l_prefix}/share/apache/cgi-bin \
  599. $RPM_BUILD_ROOT%{l_prefix}/cgi/
  600. rm -rf $RPM_BUILD_ROOT%{l_prefix}/cgi/test-cgi
  601. )
  602. # optionally cleanup for mod_perl
  603. %if "%{with_mod_perl}" == "yes"
  604. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/perl
  605. %endif
  606. # create default configuration
  607. l_hostname=`%{l_shtool} echo -e %h`
  608. l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
  609. %{l_shtool} install -c -m 644 \
  610. -e 's;@l_prefix@;%{l_prefix};g' \
  611. -e "s;@l_hostname@;$l_hostname;g" \
  612. -e "s;@l_domainname@;$l_domainname;g" \
  613. -e 's;@l_nusr@;%{l_nusr};g' \
  614. -e 's;@l_ngrp@;%{l_ngrp};g' \
  615. %{SOURCE apache.base} \
  616. %{SOURCE apache.conf} \
  617. %{SOURCE apache.vhost} \
  618. $RPM_BUILD_ROOT%{l_prefix}/etc/apache/
  619. mv $RPM_BUILD_ROOT%{l_prefix}/etc/apache/magic $RPM_BUILD_ROOT%{l_prefix}/etc/apache/mime.magic
  620. find $RPM_BUILD_ROOT%{l_prefix} -name perllocal.pod -print | xargs rm -f
  621. # create run-command script
  622. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  623. %{l_shtool} install -c -m 755 -e 's;@l_prefix@;%{l_prefix};g' \
  624. -e 's;@l_musr@;%{l_musr};g' -e 's;@l_mgrp@;%{l_mgrp};g' \
  625. %{SOURCE rc.apache} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  626. # strip installation binaries
  627. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2> /dev/null || true
  628. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2> /dev/null || true
  629. # determine installation tree files
  630. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  631. %{l_files_std} \
  632. '%attr(4755,root,%{l_mgrp}) %{l_prefix}/sbin/suexec' \
  633. '%config %{l_prefix}/etc/apache/*' \
  634. %if "%{with_mod_ssl}" == "yes"
  635. '%config %{l_prefix}/etc/apache/ssl.crl/*.crl' \
  636. '%config %{l_prefix}/etc/apache/ssl.crt/*.crt' \
  637. '%config %{l_prefix}/etc/apache/ssl.csr/*.csr' \
  638. '%config %{l_prefix}/etc/apache/ssl.key/*.key' \
  639. '%config %{l_prefix}/etc/apache/ssl.prm/*.prm' \
  640. %endif
  641. '%config %attr(444,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/apache/apache.base'
  642. %files -f files
  643. %clean
  644. rm -rf $RPM_BUILD_ROOT
  645. %post
  646. %if "%{with_mod_auth_pam}" == "yes"
  647. # add PAM configuration entry
  648. if [ $1 -eq 1 ]; then
  649. $RPM_INSTALL_PREFIX/sbin/pamtool -a -s -n "apache"
  650. fi
  651. %endif
  652. %preun
  653. %if "%{with_mod_auth_pam}" == "yes"
  654. # remove PAM configuration entry
  655. if [ $1 -eq 0 ]; then
  656. $RPM_INSTALL_PREFIX/sbin/pamtool -r -s -n "apache"
  657. fi
  658. %endif