apache-php.spec 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  1. ##
  2. ## apache-php.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
  5. ##
  6. ## Permission to use, copy, modify, and distribute this software for
  7. ## any purpose with or without fee is hereby granted, provided that
  8. ## the above copyright notice and this permission notice appear in all
  9. ## copies.
  10. ##
  11. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  12. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  14. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  15. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  17. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  18. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  19. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  20. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  21. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  22. ## SUCH DAMAGE.
  23. ##
  24. # package versions
  25. %define V_php 5.2.5
  26. %define V_php_suhosin_p 5.2.5-0.9.6.2
  27. %define V_php_suhosin_e 0.9.22
  28. %define V_php_hardened 5.1.6-0.4.15
  29. %define V_php_kolab 5.2.5
  30. # package information
  31. Name: apache-php
  32. Summary: Apache Extension: PHP Scripting Language
  33. URL: http://www.php.net/
  34. Vendor: The PHP Project
  35. Packager: OpenPKG Foundation e.V.
  36. Distribution: OpenPKG Community
  37. Class: BASE
  38. Group: Web
  39. License: PHP
  40. Version: %{V_php}
  41. Release: 20071206
  42. # package options
  43. %option with_suhosin no
  44. %option with_hardened no
  45. %option with_bc no
  46. %option with_bdb no
  47. %option with_bzip2 no
  48. %option with_calendar no
  49. %option with_ctype no
  50. %option with_curl no
  51. %option with_debug no
  52. %option with_dom no
  53. %option with_exif no
  54. %option with_fastcgi no
  55. %option with_freetype no
  56. %option with_ftp no
  57. %option with_gd no
  58. %option with_gdbm no
  59. %option with_gettext no
  60. %option with_iconv no
  61. %option with_imap no
  62. %option with_imap_annotate no
  63. %option with_mbregex no
  64. %option with_mbstring no
  65. %option with_mcrypt no
  66. %option with_mhash no
  67. %option with_mm no
  68. %option with_mysql no
  69. %option with_oci8 no
  70. %option with_odbc no
  71. %option with_openldap no
  72. %option with_openldapsasl no
  73. %option with_pcre no
  74. %option with_pear no
  75. %option with_pgsql no
  76. %option with_sendmail no
  77. %option with_simplexml no
  78. %option with_snmp no
  79. %option with_sqlite no
  80. %option with_ssl no
  81. %option with_versioning no
  82. %option with_wddx no
  83. %option with_xml no
  84. %option with_xslt no
  85. %option with_zlib no
  86. # fixing implicit extension dependencies and correlations
  87. %if "%{with_pear}" == "yes"
  88. %undefine with_xml
  89. %define with_xml yes
  90. %undefine with_pcre
  91. %define with_pcre yes
  92. %endif
  93. %if "%{with_freetype}" == "yes"
  94. %undefine with_gd
  95. %define with_gd yes
  96. %endif
  97. %if "%{with_imap_annotate}" == "yes"
  98. %undefine with_imap
  99. %define with_imap yes
  100. %endif
  101. %if "%{with_mysql}" == "yes" || "%{with_gd}" == "yes" || "%{with_dom}" == "yes"
  102. %undefine with_zlib
  103. %define with_zlib yes
  104. %endif
  105. %if "%{with_pgsql}" == "yes"
  106. %undefine with_ssl
  107. %define with_ssl yes
  108. %endif
  109. %if "%{with_suhosin}" == "yes" && "%{with_hardened}" == "yes"
  110. %undefine with_hardened
  111. %define with_hardened no
  112. %endif
  113. # list of sources
  114. Source0: http://static.php.net/www.php.net/distributions/php-%{V_php}.tar.gz
  115. Source1: http://www.hardened-php.net/suhosin/_media/suhosin-%{V_php_suhosin_e}.tgz
  116. Source2: apache-php.ini
  117. Source3: apache-php.conf
  118. Patch0: http://www.hardened-php.net/hardening-patch-%{V_php_hardened}.patch.gz
  119. Patch1: http://www.hardened-php.net/suhosin/_media/suhosin-patch-%{V_php_suhosin_p}.patch.gz
  120. Patch2: http://kolab.org/cgi-bin/viewcvs-kolab.cgi/*checkout*/server/patches/php/php-%{V_php_kolab}/KOLAB_Annotations.patch
  121. # build information
  122. Prefix: %{l_prefix}
  123. BuildRoot: %{l_buildroot}
  124. BuildPreReq: OpenPKG, openpkg >= 20050615, gcc, flex, bison
  125. PreReq: OpenPKG, openpkg >= 20050615
  126. BuildPreReq: apache
  127. PreReq: apache
  128. %if "%{with_suhosin}" == "yes"
  129. BuildPreReq: autoconf
  130. %endif
  131. %if "%{with_sqlite}" == "yes"
  132. BuildPreReq: sqlite
  133. PreReq: sqlite
  134. %endif
  135. %if "%{with_mysql}" == "yes"
  136. BuildPreReq: mysql
  137. PreReq: mysql
  138. %endif
  139. %if "%{with_pgsql}" == "yes"
  140. BuildPreReq: postgresql
  141. PreReq: postgresql
  142. %endif
  143. %if "%{with_gd}" == "yes"
  144. BuildPreReq: gd >= 2.0.20, jpeg, png
  145. PreReq: gd >= 2.0.20, jpeg, png
  146. %endif
  147. %if "%{with_bdb}" == "yes"
  148. BuildPreReq: db
  149. PreReq: db
  150. %endif
  151. %if "%{with_zlib}" == "yes"
  152. BuildPreReq: zlib
  153. PreReq: zlib
  154. %endif
  155. %if "%{with_bzip2}" == "yes"
  156. BuildPreReq: bzip2
  157. PreReq: bzip2
  158. %endif
  159. %if "%{with_ssl}" == "yes"
  160. BuildPreReq: openssl
  161. PreReq: openssl
  162. %endif
  163. %if "%{with_openldap}" == "yes"
  164. BuildPreReq: openldap
  165. PreReq: openldap
  166. %if "%{with_openldapsasl}" == "yes"
  167. BuildPreReq: openldap::with_sasl = yes
  168. PreReq: openldap::with_sasl = yes
  169. %else
  170. BuildPreReq: openldap::with_sasl = no
  171. PreReq: openldap::with_sasl = no
  172. %endif
  173. %endif
  174. %if "%{with_mm}" == "yes"
  175. BuildPreReq: mm
  176. PreReq: mm
  177. %endif
  178. %if "%{with_pcre}" == "yes"
  179. BuildPreReq: pcre
  180. PreReq: pcre
  181. %endif
  182. %if "%{with_freetype}" == "yes"
  183. BuildPreReq: freetype
  184. PreReq: freetype
  185. %endif
  186. %if "%{with_gettext}" == "yes"
  187. BuildPreReq: gettext, libiconv
  188. PreReq: gettext, libiconv
  189. %endif
  190. %if "%{with_iconv}" == "yes"
  191. BuildPreReq: libiconv
  192. PreReq: libiconv
  193. %endif
  194. %if "%{with_imap}" == "yes"
  195. BuildPreReq: imap, openssl
  196. PreReq: imap, openssl
  197. %if "%{with_imap_annotate}" == "yes"
  198. BuildPreReq: imap::with_annotate = yes
  199. PreReq: imap::with_annotate = yes
  200. %endif
  201. %endif
  202. %if "%{with_xml}" == "yes"
  203. BuildPreReq: libxml
  204. PreReq: libxml
  205. %endif
  206. %if "%{with_xslt}" == "yes"
  207. BuildPreReq: libxslt
  208. PreReq: libxslt
  209. %endif
  210. %if "%{with_dom}" == "yes"
  211. BuildPreReq: libxml, libxslt
  212. PreReq: libxml, libxslt
  213. %endif
  214. %if "%{with_curl}" == "yes"
  215. BuildPreReq: curl
  216. PreReq: curl
  217. %endif
  218. %if "%{with_mhash}" == "yes"
  219. BuildPreReq: mhash
  220. PreReq: mhash
  221. %endif
  222. %if "%{with_mcrypt}" == "yes"
  223. BuildPreReq: libmcrypt
  224. PreReq: libmcrypt
  225. %endif
  226. %if "%{with_gdbm}" == "yes"
  227. BuildPreReq: gdbm, gdbm::with_ndbm = yes
  228. PreReq: gdbm, gdbm::with_ndbm = yes
  229. %endif
  230. %if "%{with_oci8}" == "yes"
  231. BuildPreReq: oracle
  232. PreReq: oracle
  233. %endif
  234. %if "%{with_snmp}" == "yes"
  235. BuildPreReq: snmp
  236. PreReq: snmp
  237. %endif
  238. %if "%{with_odbc}" == "yes"
  239. BuildPreReq: unixodbc
  240. PreReq: unixodbc
  241. %endif
  242. %if "%{with_sendmail}" == "yes"
  243. BuildPreReq: MTA
  244. PreReq: MTA
  245. %endif
  246. %if "%{with_simplexml}" == "yes"
  247. BuildPreReq: libxml
  248. PreReq: libxml
  249. %endif
  250. AutoReq: no
  251. AutoReqProv: no
  252. %description
  253. PHP is an HTML-embedded scripting language. Much of its syntax is
  254. borrowed from C, Java and Perl with a couple of unique PHP-specific
  255. features thrown in. The goal of the language is to allow web
  256. developers to write dynamically generated pages quickly.
  257. This package provides a Dynamic Shared Object (DSO) for the Apache
  258. HTTP 2.2 web server. In general speaking, this module is also known
  259. as mod_php.
  260. %track
  261. prog apache-php = {
  262. version = %{V_php}
  263. url = http://www.php.net/downloads.php
  264. regex = php-(5.\d+\.\d+)\.tar\.gz
  265. }
  266. prog apache-php:hardened = {
  267. version = %{V_php_hardened}
  268. url = http://www.hardened-php.net/downloads.13.html
  269. regex = hardening-patch-(5\.\d+\.\d+-\d+(\.\d+)+)\.patch\.gz
  270. }
  271. prog apache-php:suhosin-patch = {
  272. version = %{V_php_suhosin_p}
  273. url = http://www.hardened-php.net/suhosin/download.html
  274. regex = suhosin-patch-(5\.\d+\.\d+-\d+(\.\d+)+)\.patch\.gz
  275. }
  276. prog apache-php:suhosin-ext = {
  277. version = %{V_php_suhosin_e}
  278. url = http://www.hardened-php.net/suhosin/download.html
  279. regex = suhosin-(\d+(\.\d+)+)\.tgz
  280. }
  281. prog apache-php:kolab = {
  282. version = %{V_php_kolab}
  283. url = http://kolab.org/cgi-bin/viewcvs-kolab.cgi/*checkout*/server/patches/php/
  284. regex = KOLAB_php_(\d+(\.\d+)+)_Annotations\.patch
  285. }
  286. %prep
  287. %setup -q -n php-%{V_php}
  288. %if "%{with_hardened}" == "yes"
  289. %patch -p1 -P 0
  290. %endif
  291. %if "%{with_suhosin}" == "yes"
  292. %setup -q -n php-%{V_php} -T -D -a 1
  293. %patch -p1 -P 1
  294. mv suhosin-%{V_php_suhosin_e} ext/suhosin
  295. rm -f package.xml
  296. export PHP_AUTOCONF=autoconf-213
  297. ./buildconf --copy --force
  298. $PHP_AUTOCONF
  299. %endif
  300. %{l_shtool} subst \
  301. -e 's;-i -a -n php5;-i -n php5;' \
  302. configure
  303. %{l_shtool} subst \
  304. -e 's;\(/include\)/freetype2;\1;' \
  305. configure \
  306. ext/gd/config.m4
  307. %if "%{with_imap_annotate}" == "yes"
  308. sed <%{PATCH2} -e '/php-5.2.1\/ext\/imap\/php_imap.c.orig/,/^[^\+]/d' | %{l_patch} -p1
  309. %endif
  310. %build
  311. # configure package
  312. case "%{l_platform -t}" in
  313. *-sunos5.10 ) cflags="%{l_cflags}" ;;
  314. * ) cflags="%{l_cflags -O}" ;;
  315. esac
  316. cppflags="%{l_cppflags}"
  317. ldflags="%{l_ldflags}"
  318. libs=""
  319. %if "%{with_gdbm}" == "yes"
  320. libs="$libs -lndbm -lgdbm"
  321. %endif
  322. %if "%{with_gd}" == "yes"
  323. libs="$libs -lpng -lz"
  324. %endif
  325. %if "%{with_gettext}" == "yes"
  326. libs="$libs -liconv"
  327. %endif
  328. %if "%{with_openldap}" == "yes" && "%{with_openldapsasl}" == "yes"
  329. libs="$libs -lsasl2"
  330. %endif
  331. %if "%{with_imap}" == "yes"
  332. libs="$libs -lssl -lcrypto"
  333. %endif
  334. %if "%{with_bdb}" == "yes"
  335. libs="$libs -ldb"
  336. %endif
  337. %if "%{with_pgsql}" == "yes"
  338. libs="$libs `pg_config --libs`"
  339. %endif
  340. %if "%{with_oci8}" == "yes"
  341. ORACLE_HOME="`%{l_rc} --query oracle_home`"
  342. export ORACLE_HOME
  343. %endif
  344. CC="%{l_cc}" \
  345. CFLAGS="$cflags" \
  346. CPPFLAGS="$cppflags" \
  347. LDFLAGS="$ldflags" \
  348. LIBS="$libs" \
  349. %if "%{with_sendmail}" == "yes"
  350. PROG_SENDMAIL="%{l_prefix}/sbin/sendmail" \
  351. %else
  352. PROG_SENDMAIL="`%{l_shtool} path false`" \
  353. %endif
  354. ./configure \
  355. --prefix=%{l_prefix} \
  356. --sysconfdir=%{l_prefix}/etc/apache \
  357. --with-config-file-path=%{l_prefix}/etc/apache \
  358. --libdir=%{l_prefix}/lib/php \
  359. --disable-all \
  360. --enable-pdo \
  361. %if "%{with_suhosin}" == "yes"
  362. --enable-suhosin \
  363. %endif
  364. %if "%{with_calendar}" == "yes"
  365. --enable-calendar \
  366. %endif
  367. --without-sqlite \
  368. %if "%{with_sqlite}" == "yes"
  369. --with-pdo-sqlite=%{l_prefix} \
  370. %else
  371. --without-pdo-sqlite \
  372. %endif
  373. %if "%{with_mysql}" == "yes"
  374. --with-mysql=%{l_prefix} \
  375. --with-pdo-mysql=%{l_prefix} \
  376. %else
  377. --without-mysql \
  378. %endif
  379. %if "%{with_pgsql}" == "yes"
  380. --with-pgsql=%{l_prefix} \
  381. --with-pdo-pgsql=%{l_prefix} \
  382. %else
  383. --without-pgsql \
  384. %endif
  385. %if "%{with_gd}" == "yes"
  386. --with-gd=%{l_prefix} \
  387. --with-jpeg-dir=%{l_prefix} \
  388. --with-png-dir=%{l_prefix} \
  389. %endif
  390. %if "%{with_fastcgi}" == "yes"
  391. --enable-fastcgi \
  392. %else
  393. --disable-fastcgi \
  394. %endif
  395. %if "%{with_freetype}" == "yes"
  396. --enable-gd-native-ttf \
  397. --with-freetype-dir=%{l_prefix} \
  398. %endif
  399. %if "%{with_bdb}" == "yes"
  400. --with-db4=%{l_prefix} \
  401. %endif
  402. %if "%{with_debug}" == "yes"
  403. --enable-debug \
  404. %else
  405. --disable-debug \
  406. %endif
  407. %if "%{with_zlib}" == "yes"
  408. --with-zlib=%{l_prefix} \
  409. --with-zlib-dir=%{l_prefix} \
  410. %endif
  411. %if "%{with_bzip2}" == "yes"
  412. --with-bz2=%{l_prefix} \
  413. %endif
  414. %if "%{with_ssl}" == "yes" || "%{with_openldap}" == "yes"
  415. --with-openssl=%{l_prefix} \
  416. %endif
  417. %if "%{with_openldap}" == "yes"
  418. --with-ldap=%{l_prefix} \
  419. %endif
  420. %if "%{with_mm}" == "yes"
  421. --with-mm=%{l_prefix} \
  422. --enable-session \
  423. %endif
  424. %if "%{with_pcre}" == "yes"
  425. --with-pcre-regex=%{l_prefix} \
  426. %endif
  427. %if "%{with_ftp}" == "yes"
  428. --enable-ftp \
  429. %endif
  430. %if "%{with_oci8}" == "yes"
  431. --with-oci8 \
  432. %endif
  433. %if "%{with_gettext}" == "yes"
  434. --with-gettext=%{l_prefix} \
  435. %endif
  436. %if "%{with_imap}" == "yes"
  437. --with-imap=%{l_prefix} \
  438. --with-imap-ssl=%{l_prefix} \
  439. %endif
  440. %if "%{with_xml}" == "yes"
  441. --enable-xml \
  442. --enable-libxml \
  443. --with-libxml-dir=%{l_prefix} \
  444. %else
  445. --disable-xml \
  446. %endif
  447. %if "%{with_xslt}" == "yes"
  448. --with-xsl=%{l_prefix} \
  449. %else
  450. --without-xsl \
  451. %endif
  452. %if "%{with_dom}" == "yes"
  453. --enable-dom \
  454. --with-libxml-dir=%{l_prefix} \
  455. %else
  456. --disable-dom \
  457. %endif
  458. %if "%{with_wddx}" == "yes"
  459. --enable-wddx \
  460. %endif
  461. %if "%{with_bc}" == "yes"
  462. --enable-bcmath \
  463. %endif
  464. %if "%{with_mhash}" == "yes"
  465. --with-mhash=%{l_prefix} \
  466. %endif
  467. %if "%{with_mcrypt}" == "yes"
  468. --with-mcrypt=%{l_prefix} \
  469. %endif
  470. %if "%{with_ctype}" == "yes"
  471. --enable-ctype \
  472. %endif
  473. %if "%{with_curl}" == "yes"
  474. --with-curl=%{l_prefix} \
  475. %endif
  476. %if "%{with_gdbm}" == "yes"
  477. --with-gdbm=%{l_prefix} \
  478. %endif
  479. %if "%{with_versioning}" == "yes"
  480. --enable-versioning \
  481. %endif
  482. %if "%{with_pear}" == "yes"
  483. --with-pear=%{l_prefix}/lib/php \
  484. %else
  485. --without-pear \
  486. %endif
  487. %if "%{with_simplexml}" == "yes"
  488. --enable-simplexml \
  489. --enable-libxml \
  490. --with-libxml-dir=%{l_prefix} \
  491. %else
  492. --disable-simplexml \
  493. %endif
  494. %if "%{with_snmp}" == "yes"
  495. --with-snmp=%{l_prefix} \
  496. --with-openssl-dir=%{l_prefix} \
  497. %endif
  498. %if "%{with_odbc}" == "yes"
  499. --with-unixODBC=%{l_prefix} \
  500. --with-pdo-odbc=unixODBC,%{l_prefix} \
  501. %endif
  502. %if "%{with_mbregex}" == "yes"
  503. --enable-mbregex \
  504. %endif
  505. %if "%{with_mbstring}" == "yes"
  506. --enable-mbstring \
  507. %endif
  508. %if "%{with_exif}" == "yes"
  509. --with-exif \
  510. %endif
  511. %if "%{with_iconv}" == "yes"
  512. --with-iconv=%{l_prefix} \
  513. %endif
  514. --with-apxs2=%{l_prefix}/sbin/apxs \
  515. --disable-cli \
  516. --disable-cgi \
  517. --enable-force-cgi-redirect \
  518. --enable-discard-path
  519. # build package
  520. %{l_make} %{l_mflags}
  521. %install
  522. # install package
  523. rm -rf $RPM_BUILD_ROOT
  524. %{l_make} %{l_mflags} install-sapi INSTALL_ROOT=$RPM_BUILD_ROOT
  525. mv $RPM_BUILD_ROOT%{l_prefix}/libexec/apache/libphp5.so \
  526. $RPM_BUILD_ROOT%{l_prefix}/libexec/apache/mod_php.so
  527. # install default configuration file
  528. %{l_shtool} mkdir -f -p -m 755 \
  529. $RPM_BUILD_ROOT%{l_prefix}/etc/apache/apache.d
  530. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  531. %{SOURCE apache-php.ini} $RPM_BUILD_ROOT%{l_prefix}/etc/apache/
  532. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  533. %{SOURCE apache-php.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/apache/apache.d/
  534. # determine installation files
  535. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
  536. '%config %{l_prefix}/etc/apache/apache-php.ini' \
  537. '%config %{l_prefix}/etc/apache/apache.d/apache-php.conf'
  538. %files -f files
  539. %clean
  540. rm -rf $RPM_BUILD_ROOT
  541. %post
  542. # after upgrade, restart service
  543. [ $1 -eq 2 ] || exit 0
  544. eval `%{l_rc} apache status 2>/dev/null`
  545. [ ".$apache_active" = .yes ] && %{l_rc} apache restart
  546. exit 0