apache.spec 31 KB

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