apache-php.spec 16 KB

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