apache.spec 25 KB

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