apache.spec 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983
  1. ##
  2. ## apache.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2003 Cable & Wireless <http://www.cw.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.28
  35. %define V_mod_ssl 2.8.15-1.3.28
  36. %define V_mod_perl 1.28
  37. %define V_mod_php 4.3.2
  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.1.1
  43. %define V_mod_auth_ldap 2.4.1
  44. %define V_mod_gzip 1.3.19.1a
  45. %define V_mod_fastcgi 2.4.0
  46. %define V_mod_throttle 312
  47. %define V_mod_access_referer 1.0.2
  48. %define V_mod_roaming 1.0.2
  49. %define V_mod_relocate 1.0
  50. # package information
  51. Name: apache
  52. Summary: Apache HTTP Server
  53. URL: http://httpd.apache.org/
  54. Vendor: Apache Software Foundation
  55. Packager: The OpenPKG Project
  56. Distribution: OpenPKG [BASE]
  57. Group: Web
  58. License: ASF
  59. Version: %{V_apache}
  60. Release: 20030812
  61. # package options (suexec related)
  62. %option with_suexec yes
  63. %option with_suexec_caller %{l_nusr}
  64. %option with_suexec_userdir public_html
  65. # package options (additionally used Apache modules; can be enabled without thinking)
  66. %option with_mod_ssl no
  67. %option with_mod_perl no
  68. %option with_mod_php no
  69. %option with_mod_php3 no
  70. %option with_mod_dav no
  71. %option with_mod_layout no
  72. %option with_mod_macro no
  73. # package options (additionally used Apache modules; you have to know what you do)
  74. %option with_mod_auth_ldap no
  75. %option with_mod_auth_pam no
  76. %option with_mod_gzip no
  77. %option with_mod_fastcgi no
  78. %option with_mod_throttle no
  79. %option with_mod_access_referer no
  80. %option with_mod_roaming no
  81. %option with_mod_relocate no
  82. # package options (optional PHP4 specific settings; requires "with_mod_php")
  83. %option with_mod_php_calendar no
  84. %option with_mod_php_mysql no
  85. %option with_mod_php_pgsql no
  86. %option with_mod_php_gd no
  87. %option with_mod_php_db no
  88. %option with_mod_php_debug no
  89. %option with_mod_php_pdflib no
  90. %option with_mod_php_zlib no
  91. %option with_mod_php_bzip2 no
  92. %option with_mod_php_openssl no
  93. %option with_mod_php_openldap no
  94. %option with_mod_php_openldapsasl no
  95. %option with_mod_php_mm no
  96. %option with_mod_php_pcre no
  97. %option with_mod_php_ftp no
  98. %option with_mod_php_java no
  99. %option with_mod_php_oci7 no
  100. %option with_mod_php_oci8 no
  101. %option with_mod_php_freetype no
  102. %option with_mod_php_gettext no
  103. %option with_mod_php_imap no
  104. %option with_mod_php_xml no
  105. %option with_mod_php_dom no
  106. %option with_mod_php_bc no
  107. %option with_mod_php_transsid no
  108. %option with_mod_php_curl no
  109. %option with_mod_php_mhash no
  110. %option with_mod_php_wddx no
  111. %option with_mod_php_gdbm no
  112. %option with_mod_php_versioning no
  113. # package options (optional PHP3 specific settings; requires "with_mod_php3")
  114. %option with_mod_php3_ftp no
  115. %option with_mod_php3_gd no
  116. %option with_mod_php3_jpeg no
  117. %option with_mod_php3_mysql no
  118. %option with_mod_php3_openssl no
  119. %option with_mod_php3_zlib no
  120. # package options (braindead ones only)
  121. %option with_gdbm_ndbm no
  122. %option with_shared_core no
  123. %option with_shared_chain no
  124. # fixing implicit inter-module dependencies and correlations
  125. %if "%{with_mod_php}" == "yes"
  126. %if "%{with_mod_php3}" == "yes"
  127. RPM ERROR: with_mod_php conflicts with with_mod_php3
  128. %endif
  129. %if "%{with_mod_ssl}" == "yes"
  130. %undefine with_mod_php_openssl
  131. %undefine with_mod_php_mm
  132. %define with_mod_php_openssl yes
  133. %define with_mod_php_mm yes
  134. %endif
  135. %if "%{with_mod_php_freetype}" == "yes"
  136. %undefine with_mod_php_gd
  137. %define with_mod_php_gd yes
  138. %endif
  139. %if "%{with_mod_php_mysql}" == "yes" || "%{with_mod_php_pdflib}" == "yes" || "%{with_mod_php_gd}" == "yes" || "%{with_mod_php_dom}" == "yes"
  140. %undefine with_mod_php_zlib
  141. %define with_mod_php_zlib yes
  142. %endif
  143. %if "%{with_mod_php_pgsql}" == "yes"
  144. %undefine with_mod_php_openssl
  145. %define with_mod_php_openssl yes
  146. %endif
  147. %endif
  148. %if "%{with_mod_php3}" == "yes"
  149. %if "%{with_mod_ssl}" == "yes"
  150. %undefine with_mod_php3_openssl
  151. %define with_mod_php3_openssl yes
  152. %endif
  153. %if "%{with_mod_php3_mysql}" == "yes"
  154. %undefine with_mod_php3_zlib
  155. %define with_mod_php3_zlib yes
  156. %endif
  157. %endif
  158. %if "%{with_mod_php_gdbm}" == "yes"
  159. %undefine with_gdbm_ndbm
  160. %define with_gdbm_ndbm yes
  161. %endif
  162. # list of sources
  163. Source0: http://www.apache.org/dist/httpd/apache_%{V_apache}.tar.gz
  164. Source1: http://www.modssl.org/source/mod_ssl-%{V_mod_ssl}.tar.gz
  165. Source2: http://perl.apache.org/dist/mod_perl-%{V_mod_perl}.tar.gz
  166. Source3: http://www.php.net/distributions/php-%{V_mod_php}.tar.gz
  167. Source4: http://www.webdav.org/mod_dav/mod_dav-%{V_mod_dav}.tar.gz
  168. Source5: http://software.tangent.org/download/mod_layout-%{V_mod_layout}.tar.gz
  169. Source6: http://www.cri.ensmp.fr/~coelho/mod_macro/mod_macro-%{V_mod_macro}.tar.gz
  170. Source7: http://pam.sourceforge.net/mod_auth_pam/dist/mod_auth_pam.tar.gz
  171. Source8: http://www.remotecommunications.com/apache/mod_gzip/src/%{V_mod_gzip}/mod_gzip.c
  172. Source9: http://www.fastcgi.com/dist/mod_fastcgi-%{V_mod_fastcgi}.tar.gz
  173. Source10: http://www.snert.com/Software/mod_throttle/mod_throttle%{V_mod_throttle}.tgz
  174. Source11: http://download.sourceforge.net/accessreferer/mod_access_referer-%{V_mod_access_referer}.tar.gz
  175. Source12: http://www.klomp.org/mod_roaming/mod_roaming-%{V_mod_roaming}.tar.gz
  176. Source13: http://software.tangent.org/download/mod_relocate-%{V_mod_relocate}.tar.gz
  177. Source14: http://www.php.net/distributions/php-%{V_mod_php3}.tar.gz
  178. Source15: http://www.muquit.com/muquit/software/mod_auth_ldap/mod_auth_ldap.tar.gz
  179. Source20: apache.conf
  180. Source21: apache.base
  181. Source22: apache.vhost
  182. Source23: apache.pl
  183. Source24: rc.apache
  184. Patch0: apache.patch
  185. Patch1: apache.patch.php
  186. # build information
  187. Prefix: %{l_prefix}
  188. BuildRoot: %{l_buildroot}
  189. BuildPreReq: OpenPKG, openpkg >= 20030718
  190. PreReq: OpenPKG, openpkg >= 20030718
  191. %if "%{with_mod_ssl}" == "yes"
  192. BuildPreReq: openssl, mm
  193. PreReq: openssl, mm
  194. %endif
  195. %if "%{with_mod_perl}" == "yes"
  196. BuildPreReq: perl
  197. PreReq: perl
  198. %endif
  199. %if "%{with_mod_php}" == "yes"
  200. BuildPreReq: gcc, sed, flex, bison
  201. PreReq: MTA
  202. %if "%{with_mod_php_mysql}" == "yes"
  203. BuildPreReq: mysql
  204. PreReq: mysql
  205. %endif
  206. %if "%{with_mod_php_pgsql}" == "yes"
  207. BuildPreReq: postgresql, openssl
  208. PreReq: postgresql, openssl
  209. %endif
  210. %if "%{with_mod_php_gd}" == "yes"
  211. BuildPreReq: gd, jpeg, png
  212. PreReq: gd, jpeg, png
  213. %endif
  214. %if "%{with_mod_php_db}" == "yes"
  215. BuildPreReq: db
  216. PreReq: db
  217. %endif
  218. %if "%{with_mod_php_pdflib}" == "yes"
  219. BuildPreReq: pdflib, jpeg, png
  220. PreReq: pdflib, jpeg, png
  221. %endif
  222. %if "%{with_mod_php_zlib}" == "yes"
  223. BuildPreReq: zlib
  224. PreReq: zlib
  225. %endif
  226. %if "%{with_mod_php_bzip2}" == "yes"
  227. BuildPreReq: bzip2
  228. PreReq: bzip2
  229. %endif
  230. %if "%{with_mod_php_openssl}" == "yes"
  231. BuildPreReq: openssl
  232. PreReq: openssl
  233. %endif
  234. %if "%{with_mod_php_openldap}" == "yes"
  235. BuildPreReq: openldap, openssl
  236. PreReq: openldap, openssl
  237. %if "%{with_mod_php_openldapsasl}" == "yes"
  238. BuildPreReq: openldap::with_sasl = yes
  239. PreReq: openldap::with_sasl = yes
  240. %else
  241. BuildPreReq: openldap::with_sasl = no
  242. PreReq: openldap::with_sasl = no
  243. %endif
  244. %endif
  245. %if "%{with_mod_php_mm}" == "yes"
  246. BuildPreReq: mm
  247. PreReq: mm
  248. %endif
  249. %if "%{with_mod_php_pcre}" == "yes"
  250. BuildPreReq: pcre
  251. PreReq: pcre
  252. %endif
  253. %if "%{with_mod_php_java}" == "yes"
  254. BuildPreReq: j2se
  255. PreReq: j2se
  256. %endif
  257. %if "%{with_mod_php_freetype}" == "yes"
  258. BuildPreReq: freetype
  259. PreReq: freetype
  260. %endif
  261. %if "%{with_mod_php_gettext}" == "yes"
  262. BuildPreReq: gettext, libiconv
  263. PreReq: gettext, libiconv
  264. %endif
  265. %if "%{with_mod_php_imap}" == "yes"
  266. BuildPreReq: imap, openssl
  267. PreReq: imap, openssl
  268. %endif
  269. %if "%{with_mod_php_xml}" == "yes"
  270. BuildPreReq: expat
  271. PreReq: expat
  272. %endif
  273. %if "%{with_mod_php_dom}" == "yes"
  274. BuildPreReq: libxml, libxslt
  275. PreReq: libxml, libxslt
  276. %endif
  277. %if "%{with_mod_php_curl}" == "yes"
  278. BuildPreReq: curl
  279. PreReq: curl
  280. %endif
  281. %if "%{with_mod_php_mhash}" == "yes"
  282. BuildPreReq: mhash
  283. PreReq: mhash
  284. %endif
  285. %if "%{with_mod_php_gdbm}" == "yes"
  286. BuildPreReq: gdbm
  287. PreReq: gdbm
  288. %endif
  289. %if "%{with_mod_php_oci7}" == "yes" || "%{with_mod_php_oci8}" == "yes"
  290. BuildPreReq: ORACLE
  291. %endif
  292. %endif
  293. %if "%{with_mod_php3}" == "yes"
  294. BuildPreReq: make, bison, flex
  295. %if "%{with_mod_php3_gd}" == "yes"
  296. BuildPreReq: gd
  297. PreReq: gd
  298. %endif
  299. %if "%{with_mod_php3_jpeg}" == "yes"
  300. BuildPreReq: jpeg
  301. PreReq: jpeg
  302. %endif
  303. %if "%{with_mod_php3_mysql}" == "yes"
  304. BuildPreReq: mysql
  305. PreReq: mysql
  306. %endif
  307. %if "%{with_mod_php3_openssl}" == "yes"
  308. BuildPreReq: openssl
  309. PreReq: openssl
  310. %endif
  311. %if "%{with_mod_php3_zlib}" == "yes"
  312. BuildPreReq: zlib
  313. PreReq: zlib
  314. %endif
  315. %endif
  316. %if "%{with_mod_auth_ldap}" == "yes"
  317. BuildPreReq: openldap, openssl
  318. PreReq: openldap, openssl
  319. %endif
  320. %if "%{with_mod_auth_pam}" == "yes"
  321. BuildPreReq: PAM
  322. PreReq: PAM
  323. %endif
  324. %if "%{with_gdbm_ndbm}" == "yes"
  325. BuildPreReq: gdbm, gdbm::with_ndbm = yes
  326. PreReq: gdbm, gdbm::with_ndbm = yes
  327. %endif
  328. AutoReq: no
  329. AutoReqProv: no
  330. %description
  331. The Apache Project is a collaborative software development effort
  332. aimed at creating a robust, commercial-grade, featureful, and
  333. freely-available source code implementation of an HTTP (Web) server.
  334. The project is jointly managed by a group of volunteers located
  335. around the world, using the Internet and the Web to communicate,
  336. plan, and develop the server and its related documentation. These
  337. volunteers are known as the Apache Group. In addition, hundreds
  338. of users have contributed ideas, code, and documentation to the
  339. project.
  340. %prep
  341. # unpack Apache distribution
  342. %setup0 -q -c
  343. %patch0 -p0
  344. # unpack optional extension modules
  345. %if "%{with_mod_ssl}" == "yes"
  346. %setup1 -q -T -D -a 1
  347. %endif
  348. %if "%{with_mod_perl}" == "yes"
  349. %setup2 -q -T -D -a 2
  350. %endif
  351. %if "%{with_mod_php}" == "yes"
  352. %setup3 -q -T -D -a 3
  353. %patch1 -p0
  354. %endif
  355. %if "%{with_mod_dav}" == "yes"
  356. %setup4 -q -T -D -a 4
  357. %endif
  358. %if "%{with_mod_layout}" == "yes"
  359. %setup5 -q -T -D -a 5
  360. %endif
  361. %if "%{with_mod_macro}" == "yes"
  362. %setup6 -q -T -D -a 6
  363. %endif
  364. %if "%{with_mod_auth_pam}" == "yes"
  365. %setup7 -q -T -D -a 7
  366. %endif
  367. %if "%{with_mod_fastcgi}" == "yes"
  368. %setup9 -q -T -D -a 9
  369. %endif
  370. %if "%{with_mod_throttle}" == "yes"
  371. %setup10 -q -T -D -a 10
  372. %endif
  373. %if "%{with_mod_access_referer}" == "yes"
  374. %setup11 -q -T -D -a 11
  375. %endif
  376. %if "%{with_mod_roaming}" == "yes"
  377. %setup12 -q -T -D -a 12
  378. %endif
  379. %if "%{with_mod_relocate}" == "yes"
  380. %setup13 -q -T -D -a 13
  381. %endif
  382. %if "%{with_mod_php3}" == "yes"
  383. %setup14 -q -T -D -a 14
  384. %endif
  385. %if "%{with_mod_auth_ldap}" == "yes"
  386. %setup15 -q -T -D -a 15
  387. %endif
  388. %build
  389. # prepare environment
  390. rm -rf $RPM_BUILD_ROOT
  391. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}
  392. # optionally prepare mod_ssl
  393. %if "%{with_mod_ssl}" == "yes"
  394. ( cd mod_ssl-%{V_mod_ssl}
  395. ./configure \
  396. --with-apache=../apache_%{V_apache} \
  397. --expert --force
  398. ) || exit $?
  399. %endif
  400. # optionally pre-configure Apache for mod_php, mod_php3 and mod_dav
  401. %if "%{with_mod_php}" == "yes" || "%{with_mod_php3}" == "yes" || "%{with_mod_dav}" == "yes"
  402. ( cd apache_%{V_apache}
  403. CC="%{l_cc}" \
  404. CFLAGS="%{l_cflags -O}" \
  405. ./configure \
  406. %if "%{with_mod_ssl}" == "yes"
  407. --enable-rule=EAPI \
  408. %endif
  409. %if "%{with_shared_core}" == "yes"
  410. --enable-rule=SHARED_CORE \
  411. %endif
  412. %if "%{with_shared_chain}" == "yes"
  413. --enable-rule=SHARED_CHAIN \
  414. %endif
  415. --target=apache \
  416. --with-layout=GNU \
  417. --prefix=%{l_prefix} \
  418. --sbindir=%{l_prefix}/sbin \
  419. --sysconfdir=%{l_prefix}/etc/apache \
  420. --libexecdir=%{l_prefix}/lib/apache \
  421. --datadir=%{l_prefix}/share/apache \
  422. --localstatedir=%{l_prefix}/var/apache
  423. ) || exit $?
  424. %endif
  425. # optionally prepare mod_perl
  426. %if "%{with_mod_perl}" == "yes"
  427. ( cd mod_perl-%{V_mod_perl}
  428. eval `%{l_prefix}/bin/perl -V:archname`
  429. eval `%{l_prefix}/bin/perl -V:version`
  430. eval `%{l_prefix}/bin/perl -V:installarchlib -V:installprivlib -V:installsitearch -V:installsitelib`
  431. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/bin
  432. perl=$RPM_BUILD_ROOT%{l_prefix}/bin/perl
  433. echo "#!/bin/sh" >$perl
  434. echo "exec %{l_prefix}/bin/perl \\" >>$perl
  435. echo " -I${RPM_BUILD_ROOT}${installarchlib} \\" >>$perl
  436. echo " -I${RPM_BUILD_ROOT}${installprivlib} \\" >>$perl
  437. echo " -I${RPM_BUILD_ROOT}${installsitearch} \\" >>$perl
  438. echo " -I${RPM_BUILD_ROOT}${installsitelib} \\" >>$perl
  439. echo " \"\$@\"" >>$perl
  440. chmod a+x $perl
  441. $perl Makefile.PL \
  442. PREFIX=$RPM_BUILD_ROOT%{l_prefix} \
  443. APACHE_SRC=../apache_%{V_apache}/src \
  444. DO_HTTPD=1 \
  445. USE_APACI=1 \
  446. PREP_HTTPD=1 \
  447. EVERYTHING=1 \
  448. PERL_TIE_TABLES=1 \
  449. PERL_DIRECTIVE_HANDLERS=1
  450. %{l_make} %{l_mflags}
  451. %{l_make} %{l_mflags} install
  452. rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man3
  453. %{l_shtool} subst -e "s;^\\(PERL = \\).*;\\1 $perl;" \
  454. ../apache_%{V_apache}/src/modules/perl/mod_perl.config
  455. ) || exit $?
  456. %endif
  457. # optionally prepare mod_php
  458. %if "%{with_mod_php}" == "yes"
  459. ( cd php-%{V_mod_php}
  460. CC="%{l_cc}"; export CC
  461. CFLAGS="%{l_cflags -O} %{l_cppflags}"; export CFLAGS
  462. CPPFLAGS="%{l_cflags -O} %{l_cppflags}"; export CPPFLAGS
  463. LDFLAGS="%{l_cflags -O} %{l_ldflags}"; export LDFLAGS
  464. LIBS=""; export LIBS
  465. %if "%{with_mod_ssl}" == "yes"
  466. CFLAGS="$CFLAGS -DEAPI"
  467. %endif
  468. %if "%{with_mod_php_gd}" == "yes"
  469. LIBS="$LIBS -lpng -lz"
  470. %endif
  471. %if "%{with_mod_php_gettext}" == "yes"
  472. LIBS="$LIBS -liconv"
  473. %endif
  474. %if "%{with_mod_php_openldap}" == "yes" && "%{with_mod_php_openldapsasl}" == "yes"
  475. LIBS="$LIBS -lsasl2"
  476. %endif
  477. %if "%{with_mod_php_imap}" == "yes"
  478. LIBS="$LIBS -lssl -lcrypto"
  479. %endif
  480. %if "%{with_mod_php_db}" == "yes"
  481. LIBS="$LIBS -ldb"
  482. %endif
  483. %if "%{with_mod_php_oci7}" == "yes" || "%{with_mod_php_oci8}" == "yes"
  484. ORACLE_HOME="`%{l_prefix}/etc/rc --query oracle_home`"
  485. export ORACLE_HOME
  486. %endif
  487. PROG_SENDMAIL="%{l_prefix}/sbin/sendmail"
  488. export PROG_SENDMAIL
  489. ./configure \
  490. --prefix=%{l_prefix} \
  491. --with-apache=../apache_%{V_apache} \
  492. --with-config-file-path=%{l_prefix}/etc/apache \
  493. %if "%{with_mod_php_calendar}" == "yes"
  494. --enable-calendar \
  495. %endif
  496. %if "%{with_mod_php_mysql}" == "yes"
  497. --with-mysql=%{l_prefix} \
  498. %else
  499. --without-mysql \
  500. %endif
  501. %if "%{with_mod_php_pgsql}" == "yes"
  502. --with-pgsql=%{l_prefix} \
  503. %else
  504. --without-pgsql \
  505. %endif
  506. %if "%{with_mod_php_gd}" == "yes"
  507. --with-gd=%{l_prefix} \
  508. --with-jpeg-dir=%{l_prefix} \
  509. --with-png-dir=%{l_prefix} \
  510. %endif
  511. %if "%{with_mod_php_freetype}" == "yes"
  512. --enable-gd-imgstrttf \
  513. --enable-gd-native-ttf \
  514. --with-freetype-dir=%{l_prefix} \
  515. %endif
  516. %if "%{with_mod_php_db}" == "yes"
  517. --with-db4=%{l_prefix} \
  518. %endif
  519. %if "%{with_mod_php_debug}" == "yes"
  520. --with-debug=yes \
  521. %else
  522. --with-debug=no \
  523. %endif
  524. %if "%{with_mod_php_zlib}" == "yes"
  525. --with-zlib=%{l_prefix} \
  526. --with-zlib-dir=%{l_prefix} \
  527. %endif
  528. %if "%{with_mod_php_bzip2}" == "yes"
  529. --with-bz2=%{l_prefix} \
  530. %endif
  531. %if "%{with_mod_php_pdflib}" == "yes"
  532. --with-pdflib=%{l_prefix} \
  533. --with-jpeg-dir=%{l_prefix} \
  534. --with-png-dir=%{l_prefix} \
  535. %endif
  536. %if "%{with_mod_php_openssl}" == "yes" || "%{with_mod_php_openldap}" == "yes"
  537. --with-openssl=%{l_prefix} \
  538. %endif
  539. %if "%{with_mod_php_openldap}" == "yes"
  540. --with-ldap=%{l_prefix} \
  541. %endif
  542. %if "%{with_mod_php_mm}" == "yes"
  543. --with-mm=%{l_prefix} \
  544. --enable-session \
  545. %endif
  546. %if "%{with_mod_php_pcre}" == "yes"
  547. --with-pcre=%{l_prefix} \
  548. %endif
  549. %if "%{with_mod_php_ftp}" == "yes"
  550. --enable-ftp \
  551. %endif
  552. %if "%{with_mod_php_java}" == "yes"
  553. --with-java=%{l_prefix}/libexec/j2se \
  554. %endif
  555. %if "%{with_mod_php_oci7}" == "yes"
  556. --with-oracle \
  557. %endif
  558. %if "%{with_mod_php_oci8}" == "yes"
  559. --with-oci8 \
  560. %endif
  561. %if "%{with_mod_php_gettext}" == "yes"
  562. --with-gettext=%{l_prefix} \
  563. %endif
  564. %if "%{with_mod_php_imap}" == "yes"
  565. --with-imap=%{l_prefix} \
  566. --with-imap-ssl=%{l_prefix} \
  567. %endif
  568. %if "%{with_mod_php_xml}" == "yes"
  569. --with-xml=%{l_prefix} \
  570. %endif
  571. %if "%{with_mod_php_dom}" == "yes"
  572. --with-dom=%{l_prefix} \
  573. --with-dom-xslt=%{l_prefix} \
  574. --with-dom-exslt=%{l_prefix} \
  575. %endif
  576. %if "%{with_mod_php_wddx}" == "yes"
  577. --enable-wddx \
  578. %endif
  579. %if "%{with_mod_php_bc}" == "yes"
  580. --enable-bcmath \
  581. %endif
  582. %if "%{with_mod_php_transsid}" == "yes"
  583. --enable-trans-sid \
  584. %endif
  585. %if "%{with_mod_php_mhash}" == "yes"
  586. --with-mhash=%{l_prefix} \
  587. %endif
  588. %if "%{with_mod_php_curl}" == "yes"
  589. --with-curl=%{l_prefix} \
  590. %endif
  591. %if "%{with_mod_php_gdbm}" == "yes"
  592. --with-gdbm=%{l_prefix} \
  593. %endif
  594. %if "%{with_mod_php_versioning}" == "yes"
  595. --enable-versioning \
  596. %endif
  597. --disable-cli \
  598. --without-pear \
  599. --disable-shared \
  600. --enable-inline-optimization \
  601. --enable-track-vars
  602. %{l_make} %{l_mflags}
  603. %{l_shtool} subst \
  604. -e "s;^\\(EXTENSION_DIR = \\)\\(%{l_prefix}\\);\\1$RPM_BUILD_ROOT\\2;" \
  605. -e "s;^\\(PEAR_INSTALLDIR = \\)\\(%{l_prefix}\\);\\1$RPM_BUILD_ROOT\\2;" \
  606. config_vars.mk
  607. %{l_make} %{l_mflags} install \
  608. prefix=$RPM_BUILD_ROOT%{l_prefix}
  609. ) || exit $?
  610. %endif
  611. # optionally prepare mod_php3
  612. %if "%{with_mod_php3}" == "yes"
  613. ( cd php-%{V_mod_php3}
  614. CC="%{l_cc}" \
  615. %if "%{with_mod_ssl}" == "yes"
  616. CFLAGS="%{l_cflags -O} %{l_cppflags} -DEAPI" \
  617. %else
  618. CFLAGS="%{l_cflags -O} %{l_cppflags}" \
  619. %endif
  620. CPPFLAGS="%{l_cflags -O} %{l_cppflags}" \
  621. LDFLAGS="%{l_cflags -O} %{l_ldflags}" \
  622. ./configure \
  623. --prefix=%{l_prefix} \
  624. --with-apache=../apache_%{V_apache} \
  625. --with-config-file-path=%{l_prefix}/etc/apache \
  626. %if "%{with_mod_php3_ftp}" == "yes"
  627. --with-ftp \
  628. %endif
  629. %if "%{with_mod_php3_mysql}" == "yes"
  630. --with-mysql=%{l_prefix} \
  631. %else
  632. --without-mysql \
  633. %endif
  634. %if "%{with_mod_php3_zlib}" == "yes"
  635. --with-zlib=%{l_prefix} \
  636. %endif
  637. %if "%{with_mod_php3_jpeg}" == "yes"
  638. --with-jpeg=%{l_prefix} \
  639. %endif
  640. %if "%{with_mod_php3_gd}" == "yes"
  641. --with-gd=%{l_prefix} \
  642. %endif
  643. %if "%{with_mod_php3_openssl}" == "yes"
  644. --with-openssl=%{l_prefix} \
  645. %endif
  646. --disable-shared \
  647. --enable-track-vars
  648. %{l_make} %{l_mflags}
  649. %{l_make} %{l_mflags} install \
  650. prefix=$RPM_BUILD_ROOT%{l_prefix}
  651. ) || exit $?
  652. %endif
  653. # optionally prepare mod_dav
  654. %if "%{with_mod_dav}" == "yes"
  655. ( cd mod_dav-%{V_mod_dav}
  656. CC="%{l_cc}" \
  657. %if "%{with_mod_ssl}" == "yes"
  658. CFLAGS="%{l_cflags -O}" \
  659. %else
  660. CFLAGS="%{l_cflags -O} -DEAPI" \
  661. %endif
  662. LDFLAGS="%{l_cflags -O}" \
  663. ./configure \
  664. --with-apache=../apache_%{V_apache}
  665. %{l_make} %{l_mflags}
  666. %{l_make} %{l_mflags} install
  667. ) || exit $?
  668. %endif
  669. # optionally prepare mod_layout
  670. %if "%{with_mod_layout}" == "yes"
  671. ( cd mod_layout-%{V_mod_layout}
  672. mkdir ../apache_%{V_apache}/src/modules/layout
  673. cp * ../apache_%{V_apache}/src/modules/layout/ 2>/dev/null || true
  674. chmod -R u+w ../apache_%{V_apache}/src/modules/layout
  675. ) || exit $?
  676. %endif
  677. # optionally prepare mod_macro
  678. %if "%{with_mod_macro}" == "yes"
  679. ( cd mod_macro-%{V_mod_macro}
  680. cp mod_macro.c ../apache_%{V_apache}/src/modules/extra/
  681. ) || exit $?
  682. %endif
  683. # optionally prepare mod_auth_pam
  684. %if "%{with_mod_auth_pam}" == "yes"
  685. ( cd mod_auth_pam-%{V_mod_auth_pam}
  686. sed -e '234N;s/\n//' -e '239N;s/\n//' <mod_auth_pam.c \
  687. >../apache_%{V_apache}/src/modules/extra/mod_auth_pam.c
  688. ) || exit $?
  689. %endif
  690. # optionally prepare mod_auth_ldap
  691. %if "%{with_mod_auth_ldap}" == "yes"
  692. ( cd modauthldap
  693. cp mod_auth_ldap.c ../apache_%{V_apache}/src/modules/extra/
  694. ) || exit $?
  695. %endif
  696. # optionally prepare mod_gzip
  697. %if "%{with_mod_gzip}" == "yes"
  698. cp %{SOURCE mod_gzip.c} apache_%{V_apache}/src/modules/extra/
  699. %endif
  700. # optionally prepare mod_fastcgi
  701. %if "%{with_mod_fastcgi}" == "yes"
  702. ( cd mod_fastcgi-%{V_mod_fastcgi}
  703. mkdir ../apache_%{V_apache}/src/modules/fastcgi
  704. cp -rp * ../apache_%{V_apache}/src/modules/fastcgi/
  705. ) || exit $?
  706. %endif
  707. # optionally prepare mod_throttle
  708. %if "%{with_mod_throttle}" == "yes"
  709. ( cd mod_throttle-*
  710. cp mod_throttle.c ../apache_%{V_apache}/src/modules/extra/
  711. ) || exit $?
  712. %endif
  713. # optionally prepare mod_access_referer
  714. %if "%{with_mod_access_referer}" == "yes"
  715. ( cd mod_access_referer-%{V_mod_access_referer}
  716. cp mod_access_referer.c ../apache_%{V_apache}/src/modules/extra/
  717. ) || exit $?
  718. %endif
  719. # optionally prepare mod_roaming
  720. %if "%{with_mod_roaming}" == "yes"
  721. ( cd mod_roaming-%{V_mod_roaming}
  722. cp mod_roaming.c ../apache_%{V_apache}/src/modules/extra/
  723. ) || exit $?
  724. %endif
  725. # optionally prepare mod_relocate
  726. %if "%{with_mod_relocate}" == "yes"
  727. ( cd mod_relocate-%{V_mod_relocate}
  728. cp mod_relocate.c ../apache_%{V_apache}/src/modules/extra/
  729. ) || exit $?
  730. %endif
  731. # configure Apache
  732. ( cd apache_%{V_apache}
  733. cflags="%{l_cflags -O}"
  734. ldflags=""
  735. libs=""
  736. %if "%{with_mod_auth_pam}" == "yes"
  737. pam_incdir=`%{l_prefix}/etc/rc --query pam_incdir`
  738. if [ ".$pam_incdir" != "./usr/include" -a ".$pam_incdir" != "./include" ]; then
  739. cflags="$cflags -I$pam_incdir"
  740. fi
  741. pam_libdir=`%{l_prefix}/etc/rc --query pam_libdir`
  742. if [ ".$pam_libdir" != "./usr/lib" -a ".$pam_libdir" != "./lib" ]; then
  743. ldflags="$ldflags -L$pam_libdir"
  744. fi
  745. libs="$libs -lpam"
  746. %endif
  747. %if "%{with_mod_auth_ldap}" == "yes"
  748. cflags="$cflags %{l_cppflags}"
  749. ldflags="$ldflags %{l_ldflags}"
  750. libs="$libs -lldap -llber -lssl -lcrypto"
  751. %endif
  752. %if "%{with_gdbm_ndbm}" == "yes"
  753. cflags="$cflags %{l_cppflags}"
  754. ldflags="$ldflags %{l_ldflags}"
  755. libs="$libs -lndbm -lgdbm"
  756. %endif
  757. CC="%{l_cc}" \
  758. CFLAGS="$cflags" \
  759. LDFLAGS="$ldflags" \
  760. LIBS="$libs" \
  761. LD_SHLIB="%{l_cc}" \
  762. %if "%{with_mod_ssl}" == "yes"
  763. EAPI_MM="%{l_prefix}" \
  764. SSL_BASE="%{l_prefix}" \
  765. %endif
  766. ./configure \
  767. --target=apache \
  768. --with-layout=GNU \
  769. --prefix=%{l_prefix} \
  770. --sbindir=%{l_prefix}/sbin \
  771. --sysconfdir=%{l_prefix}/etc/apache \
  772. --libexecdir=%{l_prefix}/lib/apache \
  773. --datadir=%{l_prefix}/share/apache \
  774. --localstatedir=%{l_prefix}/var/apache \
  775. %if "%{with_suexec}" == "yes"
  776. --enable-suexec \
  777. --suexec-caller=%{with_suexec_caller} \
  778. --suexec-userdir=%{with_suexec_userdir} \
  779. --suexec-logfile=%{l_prefix}/var/apache/log/suexec.log \
  780. %endif
  781. --enable-module=most \
  782. --with-perl=%{l_prefix}/bin/perl \
  783. %if "%{with_mod_ssl}" == "yes"
  784. --enable-rule=EAPI \
  785. --enable-module=ssl \
  786. %endif
  787. %if "%{with_mod_perl}" == "yes"
  788. --activate-module=src/modules/perl/libperl.a \
  789. %endif
  790. %if "%{with_mod_php}" == "yes"
  791. --activate-module=src/modules/php4/libphp4.a \
  792. %endif
  793. %if "%{with_mod_php3}" == "yes"
  794. --activate-module=src/modules/php3/libphp3.a \
  795. %endif
  796. %if "%{with_mod_dav}" == "yes"
  797. --activate-module=src/modules/dav/libdav.a \
  798. --enable-rule=EXPAT \
  799. %else
  800. --disable-rule=EXPAT \
  801. %endif
  802. %if "%{with_shared_core}" == "yes"
  803. --enable-rule=SHARED_CORE \
  804. %endif
  805. %if "%{with_shared_chain}" == "yes"
  806. --enable-rule=SHARED_CHAIN \
  807. %endif
  808. %if "%{with_mod_layout}" == "yes"
  809. --activate-module=src/modules/layout/liblayout.a \
  810. %endif
  811. %if "%{with_mod_macro}" == "yes"
  812. --activate-module=src/modules/extra/mod_macro.o \
  813. %endif
  814. %if "%{with_mod_auth_pam}" == "yes"
  815. --activate-module=src/modules/extra/mod_auth_pam.o \
  816. %endif
  817. %if "%{with_mod_auth_ldap}" == "yes"
  818. --activate-module=src/modules/extra/mod_auth_ldap.c \
  819. %endif
  820. %if "%{with_mod_gzip}" == "yes"
  821. --activate-module=src/modules/extra/mod_gzip.o \
  822. %endif
  823. %if "%{with_mod_fastcgi}" == "yes"
  824. --activate-module=src/modules/fastcgi/libfastcgi.a \
  825. %endif
  826. %if "%{with_mod_throttle}" == "yes"
  827. --activate-module=src/modules/extra/mod_throttle.o \
  828. %endif
  829. %if "%{with_mod_access_referer}" == "yes"
  830. --activate-module=src/modules/extra/mod_access_referer.o \
  831. %endif
  832. %if "%{with_mod_roaming}" == "yes"
  833. --activate-module=src/modules/extra/mod_roaming.o \
  834. %endif
  835. %if "%{with_mod_relocate}" == "yes"
  836. --activate-module=src/modules/extra/mod_relocate.o \
  837. %endif
  838. --enable-module=so
  839. %{l_make} %{l_mflags -O} build-quiet
  840. ) || exit $?
  841. %install
  842. # install Apache
  843. ( cd apache_%{V_apache}
  844. # perform standard Apache installation procedure
  845. %{l_make} %{l_mflags} install root=$RPM_BUILD_ROOT
  846. # post-adjustments to installation tree
  847. mv $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/small/* \
  848. $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/
  849. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/small
  850. rm -f $RPM_BUILD_ROOT%{l_prefix}/share/apache/icons/README*
  851. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/apache/*.default
  852. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/apache/srm.conf
  853. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/apache/access.conf
  854. mv $RPM_BUILD_ROOT%{l_prefix}/share/apache/htdocs/index.html.en \
  855. $RPM_BUILD_ROOT%{l_prefix}/share/apache/htdocs/index.html
  856. rm -f $RPM_BUILD_ROOT%{l_prefix}/share/apache/htdocs/index.html.*
  857. chmod a+rx $RPM_BUILD_ROOT%{l_prefix}/share/apache/cgi-bin/*
  858. mv $RPM_BUILD_ROOT%{l_prefix}/share/apache/cgi-bin \
  859. $RPM_BUILD_ROOT%{l_prefix}/cgi/
  860. rm -rf $RPM_BUILD_ROOT%{l_prefix}/cgi/test-cgi
  861. ) || exit $?
  862. %if "%{with_mod_perl}" == "yes"
  863. # cleanup for mod_perl
  864. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/perl
  865. # provide mod_perl init script
  866. %{l_shtool} install -c -m 644 \
  867. %{SOURCE apache.pl} \
  868. $RPM_BUILD_ROOT%{l_prefix}/etc/apache/
  869. %endif
  870. # optionally make PHP happy
  871. %if "%{with_mod_php}" == "yes"
  872. %{l_shtool} install -c -m 644 /dev/null \
  873. $RPM_BUILD_ROOT%{l_prefix}/etc/apache/php.ini
  874. rm -rf $RPM_BUILD_ROOT%{l_prefix}/include/php
  875. rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/php/build
  876. %endif
  877. # create default configuration
  878. l_hostname=`%{l_shtool} echo -e %h`
  879. l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
  880. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  881. -e "s;@l_hostname@;$l_hostname;g" \
  882. -e "s;@l_domainname@;$l_domainname;g" \
  883. %{SOURCE apache.base} \
  884. %{SOURCE apache.conf} \
  885. %{SOURCE apache.vhost} \
  886. $RPM_BUILD_ROOT%{l_prefix}/etc/apache/
  887. mv $RPM_BUILD_ROOT%{l_prefix}/etc/apache/magic $RPM_BUILD_ROOT%{l_prefix}/etc/apache/mime.magic
  888. find $RPM_BUILD_ROOT%{l_prefix} -name perllocal.pod -print | xargs rm -f
  889. # create run-command script
  890. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  891. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  892. %{SOURCE rc.apache} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  893. # strip installation binaries
  894. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2>/dev/null || true
  895. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2>/dev/null || true
  896. # determine installation tree files
  897. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  898. %{l_files_std} \
  899. %if "%{with_suexec}" == "yes"
  900. '%attr(4755,%{l_susr},%{l_mgrp}) %{l_prefix}/sbin/suexec' \
  901. %endif
  902. '%config %{l_prefix}/etc/apache/*' \
  903. %if "%{with_mod_ssl}" == "yes"
  904. '%config %{l_prefix}/etc/apache/ssl.crl/*.crl' \
  905. '%config %{l_prefix}/etc/apache/ssl.crt/*.crt' \
  906. '%config %{l_prefix}/etc/apache/ssl.csr/*.csr' \
  907. '%config %{l_prefix}/etc/apache/ssl.key/*.key' \
  908. '%config %{l_prefix}/etc/apache/ssl.prm/*.prm' \
  909. %endif
  910. '%config %attr(444,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/apache/apache.base' \
  911. '%config(noreplace) %attr(444,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/apache/apache.vhost'
  912. %files -f files
  913. %clean
  914. rm -rf $RPM_BUILD_ROOT
  915. %post
  916. %if "%{with_mod_auth_pam}" == "yes"
  917. # add PAM configuration entry
  918. if [ $1 -eq 1 ]; then
  919. $RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=apache
  920. fi
  921. %endif
  922. # after upgrade, restart service
  923. [ $1 -eq 2 ] || exit 0
  924. eval `%{l_rc} apache status 2>/dev/null`
  925. [ ".$apache_active" = .yes ] && %{l_rc} apache restart
  926. exit 0
  927. %preun
  928. # before erase, stop service and remove log files
  929. [ $1 -eq 0 ] || exit 0
  930. %{l_rc} apache stop 2>/dev/null
  931. rm -rf $RPM_INSTALL_PREFIX/var/apache/log/ >/dev/null 2>&1 || true
  932. %if "%{with_mod_auth_pam}" == "yes"
  933. # remove PAM configuration entry
  934. $RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=apache
  935. %endif
  936. exit 0