apache-php.spec 16 KB

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