apache.spec 31 KB

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