apache-php.spec 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  1. ##
  2. ## apache-php.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2012 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ##
  5. ## Permission to use, copy, modify, and distribute this software for
  6. ## any purpose with or without fee is hereby granted, provided that
  7. ## the above copyright notice and this permission notice appear in all
  8. ## copies.
  9. ##
  10. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  11. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  12. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  13. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  14. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  15. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  16. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  17. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  18. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  19. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  20. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  21. ## SUCH DAMAGE.
  22. ##
  23. # package versions
  24. %define V_php 5.3.10
  25. %define V_php_suhosin_p 5.3.9-0.9.10
  26. %define V_php_suhosin_e 0.9.32.1
  27. # package information
  28. Name: apache-php
  29. Summary: Apache Extension: PHP Scripting Language
  30. URL: http://www.php.net/
  31. Vendor: The PHP Project
  32. Packager: OpenPKG Foundation e.V.
  33. Distribution: OpenPKG Community
  34. Class: BASE
  35. Group: Web
  36. License: PHP
  37. Version: %{V_php}
  38. Release: 20120206
  39. # package options
  40. %option with_suhosin no
  41. %option with_bc no
  42. %option with_bdb no
  43. %option with_bzip2 no
  44. %option with_calendar no
  45. %option with_ctype no
  46. %option with_curl no
  47. %option with_debug no
  48. %option with_dom no
  49. %option with_exif no
  50. %option with_freetype no
  51. %option with_ftp no
  52. %option with_gd no
  53. %option with_gdbm no
  54. %option with_gettext no
  55. %option with_iconv no
  56. %option with_imap no
  57. %option with_json no
  58. %option with_tokenizer no
  59. %option with_mbregex no
  60. %option with_mbstring no
  61. %option with_mcrypt no
  62. %option with_mhash no
  63. %option with_mm no
  64. %option with_mysql no
  65. %option with_mysqlnd no
  66. %option with_oci8 no
  67. %option with_odbc no
  68. %option with_openldap no
  69. %option with_openldapsasl no
  70. %option with_pear no
  71. %option with_pgsql no
  72. %option with_posix no
  73. %option with_sendmail no
  74. %option with_session no
  75. %option with_simplexml no
  76. %option with_snmp no
  77. %option with_soap no
  78. %option with_sqlite no
  79. %option with_ssl no
  80. %option with_tidy 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. %option with_zip no
  87. # fixing implicit extension dependencies and correlations
  88. %if "%{with_mm}" == "yes"
  89. %undefine with_session
  90. %define with_session yes
  91. %endif
  92. %if "%{with_pear}" == "yes"
  93. %undefine with_xml
  94. %define with_xml yes
  95. %endif
  96. %if "%{with_freetype}" == "yes"
  97. %undefine with_gd
  98. %define with_gd yes
  99. %endif
  100. %if "%{with_mysql}" == "yes" || "%{with_gd}" == "yes" || "%{with_dom}" == "yes" || "%{with_zip}" == "yes"
  101. %undefine with_zlib
  102. %define with_zlib yes
  103. %endif
  104. %if "%{with_xslt}" == "yes"
  105. %undefine with_dom
  106. %define with_dom yes
  107. %endif
  108. %if "%{with_dom}" == "yes"
  109. %undefine with_xml
  110. %define with_xml yes
  111. %endif
  112. %if "%{with_soap}" == "yes"
  113. %undefine with_xml
  114. %define with_xml yes
  115. %endif
  116. %if "%{with_pgsql}" == "yes"
  117. %undefine with_ssl
  118. %define with_ssl yes
  119. %endif
  120. # list of sources
  121. Source0: http://static.php.net/www.php.net/distributions/php-%{V_php}.tar.bz2
  122. Source1: http://download.suhosin.org/suhosin-%{V_php_suhosin_e}.tar.gz
  123. Source2: apache-php.ini
  124. Source3: apache-php.conf
  125. Patch0: http://download.suhosin.org/suhosin-patch-%{V_php_suhosin_p}.patch.gz
  126. Patch1: apache-php.patch
  127. # build information
  128. BuildPreReq: OpenPKG, openpkg >= 20100101, gcc, flex, bison
  129. PreReq: OpenPKG, openpkg >= 20100101
  130. BuildPreReq: apache
  131. PreReq: apache
  132. BuildPreReq: pcre
  133. PreReq: pcre
  134. %if "%{with_suhosin}" == "yes"
  135. BuildPreReq: autoconf
  136. %endif
  137. %if "%{with_sqlite}" == "yes"
  138. BuildPreReq: sqlite
  139. PreReq: sqlite
  140. %endif
  141. %if "%{with_mysql}" == "yes"
  142. BuildPreReq: mysql
  143. PreReq: mysql
  144. %endif
  145. %if "%{with_pgsql}" == "yes"
  146. BuildPreReq: postgresql
  147. PreReq: postgresql
  148. %endif
  149. %if "%{with_gd}" == "yes"
  150. BuildPreReq: gd >= 2.0.20, jpeg, png
  151. PreReq: gd >= 2.0.20, jpeg, png
  152. %endif
  153. %if "%{with_bdb}" == "yes"
  154. BuildPreReq: db
  155. PreReq: db
  156. %endif
  157. %if "%{with_zlib}" == "yes"
  158. BuildPreReq: zlib
  159. PreReq: zlib
  160. %endif
  161. %if "%{with_bzip2}" == "yes"
  162. BuildPreReq: bzip2
  163. PreReq: bzip2
  164. %endif
  165. %if "%{with_ssl}" == "yes"
  166. BuildPreReq: openssl
  167. PreReq: openssl
  168. %endif
  169. %if "%{with_openldap}" == "yes"
  170. BuildPreReq: openldap
  171. PreReq: openldap
  172. %if "%{with_openldapsasl}" == "yes"
  173. BuildPreReq: openldap::with_sasl = yes
  174. PreReq: openldap::with_sasl = yes
  175. %else
  176. BuildPreReq: openldap::with_sasl = no
  177. PreReq: openldap::with_sasl = no
  178. %endif
  179. %endif
  180. %if "%{with_mm}" == "yes"
  181. BuildPreReq: mm
  182. PreReq: mm
  183. %endif
  184. %if "%{with_freetype}" == "yes"
  185. BuildPreReq: freetype
  186. PreReq: freetype
  187. %endif
  188. %if "%{with_gettext}" == "yes"
  189. BuildPreReq: gettext, libiconv
  190. PreReq: gettext, libiconv
  191. %endif
  192. %if "%{with_iconv}" == "yes"
  193. BuildPreReq: libiconv
  194. PreReq: libiconv
  195. %endif
  196. %if "%{with_imap}" == "yes"
  197. BuildPreReq: imap, openssl
  198. PreReq: imap, openssl
  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. %if "%{with_tidy}" == "yes"
  249. BuildPreReq: tidy
  250. PreReq: tidy
  251. %endif
  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\.(bz2|gz)
  265. }
  266. prog apache-php:suhosin-patch = {
  267. version = %{V_php_suhosin_p}
  268. url = http://www.hardened-php.net/suhosin/download.html
  269. regex = suhosin-patch-(5\.\d+\.\d+-\d+(\.\d+)+)\.patch\.gz
  270. }
  271. prog apache-php:suhosin-ext = {
  272. version = %{V_php_suhosin_e}
  273. url = http://www.hardened-php.net/suhosin/download.html
  274. regex = suhosin-(\d+(\.\d+)+)\.tar\.gz
  275. }
  276. %prep
  277. %setup -q -n php-%{V_php}
  278. %if "%{with_suhosin}" == "yes"
  279. %setup -q -n php-%{V_php} -T -D -a 1
  280. %patch -p1
  281. mv suhosin-%{V_php_suhosin_e} ext/suhosin
  282. rm -f package.xml
  283. %endif
  284. %if "%{with_suhosin}" == "yes"
  285. # in case we add extensions the configure script needs to be newly
  286. # generated
  287. export PHP_AUTOCONF="autoconf-213"
  288. rm -f configure && ./buildconf --copy --force
  289. $PHP_AUTOCONF
  290. %endif
  291. %{l_shtool} subst \
  292. -e 's;-i -a -n php5;-i -n php5;' \
  293. configure
  294. %{l_shtool} subst \
  295. -e 's;\(/include\)/freetype2;\1;' \
  296. configure \
  297. ext/gd/config.m4
  298. %patch -p0 -P 1
  299. %build
  300. # configure package
  301. case "%{l_platform -t}" in
  302. *-sunos5.10 ) cflags="%{l_cflags}" ;;
  303. * ) cflags="%{l_cflags -O}" ;;
  304. esac
  305. cppflags="%{l_cppflags}"
  306. ldflags="%{l_ldflags}"
  307. libs=""
  308. %if "%{with_gdbm}" == "yes"
  309. libs="$libs -lndbm -lgdbm"
  310. %endif
  311. %if "%{with_gd}" == "yes"
  312. libs="$libs -lpng -lz"
  313. %endif
  314. %if "%{with_gettext}" == "yes"
  315. libs="$libs -liconv"
  316. %endif
  317. %if "%{with_openldap}" == "yes" && "%{with_openldapsasl}" == "yes"
  318. libs="$libs -lsasl2"
  319. %endif
  320. %if "%{with_imap}" == "yes"
  321. libs="$libs -lssl -lcrypto"
  322. %endif
  323. %if "%{with_bdb}" == "yes"
  324. libs="$libs -ldb"
  325. %endif
  326. %if "%{with_pgsql}" == "yes"
  327. libs="$libs `pg_config --libs`"
  328. %endif
  329. %if "%{with_oci8}" == "yes"
  330. ORACLE_HOME="`%{l_rc} --query oracle_home`"
  331. export ORACLE_HOME
  332. %endif
  333. CC="%{l_cc}" \
  334. CFLAGS="$cflags" \
  335. CPPFLAGS="$cppflags" \
  336. LDFLAGS="$ldflags" \
  337. LIBS="$libs" \
  338. %if "%{with_sendmail}" == "yes"
  339. PROG_SENDMAIL="%{l_prefix}/sbin/sendmail" \
  340. %else
  341. PROG_SENDMAIL="`%{l_shtool} path false`" \
  342. %endif
  343. ./configure \
  344. --prefix=%{l_prefix} \
  345. --sysconfdir=%{l_prefix}/etc/apache \
  346. --with-config-file-path=%{l_prefix}/etc/apache \
  347. --libdir=%{l_prefix}/lib/php \
  348. --disable-all \
  349. --enable-pdo \
  350. --enable-filter \
  351. --with-pcre-regex=%{l_prefix} \
  352. %if "%{with_suhosin}" == "yes"
  353. --enable-suhosin \
  354. %endif
  355. %if "%{with_calendar}" == "yes"
  356. --enable-calendar \
  357. %endif
  358. --without-sqlite \
  359. %if "%{with_sqlite}" == "yes"
  360. --with-pdo-sqlite=%{l_prefix} \
  361. %else
  362. --without-pdo-sqlite \
  363. %endif
  364. %if "%{with_mysql}" == "yes" || "%{with_mysqlnd}" == "yes"
  365. %if "%{with_mysqlnd}" == "yes"
  366. --with-mysql=mysqlnd \
  367. --with-pdo-mysql=mysqlnd \
  368. %else
  369. --with-mysql=%{l_prefix} \
  370. --with-pdo-mysql=%{l_prefix} \
  371. %endif
  372. --with-mysqli=mysqlnd \
  373. --with-mysql-sock=%{l_prefix}/var/mysql/mysql.sock \
  374. %else
  375. --without-mysql \
  376. --without-pdo-mysql \
  377. %endif
  378. %if "%{with_pgsql}" == "yes"
  379. --with-pgsql=%{l_prefix} \
  380. --with-pdo-pgsql=%{l_prefix} \
  381. %else
  382. --without-pgsql \
  383. %endif
  384. %if "%{with_posix}" == "yes"
  385. --enable-posix \
  386. %endif
  387. %if "%{with_gd}" == "yes"
  388. --with-gd=%{l_prefix} \
  389. --with-jpeg-dir=%{l_prefix} \
  390. --with-png-dir=%{l_prefix} \
  391. %endif
  392. %if "%{with_freetype}" == "yes"
  393. --enable-gd-native-ttf \
  394. --with-freetype-dir=%{l_prefix} \
  395. %endif
  396. %if "%{with_bdb}" == "yes"
  397. --with-db4=%{l_prefix} \
  398. %endif
  399. %if "%{with_debug}" == "yes"
  400. --enable-debug \
  401. %else
  402. --disable-debug \
  403. %endif
  404. %if "%{with_zlib}" == "yes"
  405. --with-zlib=%{l_prefix} \
  406. --with-zlib-dir=%{l_prefix} \
  407. %endif
  408. %if "%{with_bzip2}" == "yes"
  409. --with-bz2=%{l_prefix} \
  410. %endif
  411. %if "%{with_ssl}" == "yes" || "%{with_openldap}" == "yes"
  412. --with-openssl=%{l_prefix} \
  413. %endif
  414. %if "%{with_openldap}" == "yes"
  415. --with-ldap=%{l_prefix} \
  416. %endif
  417. %if "%{with_session}" == "yes"
  418. --enable-session \
  419. %endif
  420. %if "%{with_mm}" == "yes"
  421. --with-mm=%{l_prefix} \
  422. %endif
  423. %if "%{with_ftp}" == "yes"
  424. --enable-ftp \
  425. %endif
  426. %if "%{with_oci8}" == "yes"
  427. --with-oci8 \
  428. %endif
  429. %if "%{with_gettext}" == "yes"
  430. --with-gettext=%{l_prefix} \
  431. %endif
  432. %if "%{with_imap}" == "yes"
  433. --with-imap=%{l_prefix} \
  434. --with-imap-ssl=%{l_prefix} \
  435. %endif
  436. %if "%{with_json}" == "yes"
  437. --enable-json \
  438. %else
  439. --disable-json \
  440. %endif
  441. %if "%{with_tokenizer}" == "yes"
  442. --enable-tokenizer \
  443. %else
  444. --disable-tokenizer \
  445. %endif
  446. %if "%{with_xml}" == "yes"
  447. --enable-xml \
  448. --enable-xmlreader \
  449. --enable-libxml \
  450. --with-libxml-dir=%{l_prefix} \
  451. %else
  452. --disable-xml \
  453. %endif
  454. %if "%{with_xslt}" == "yes"
  455. --with-xsl=%{l_prefix} \
  456. %else
  457. --without-xsl \
  458. %endif
  459. %if "%{with_dom}" == "yes"
  460. --enable-dom \
  461. %else
  462. --disable-dom \
  463. %endif
  464. %if "%{with_wddx}" == "yes"
  465. --enable-wddx \
  466. %endif
  467. %if "%{with_soap}" == "yes"
  468. --enable-soap \
  469. %endif
  470. %if "%{with_bc}" == "yes"
  471. --enable-bcmath \
  472. %endif
  473. %if "%{with_mhash}" == "yes"
  474. --with-mhash=%{l_prefix} \
  475. %endif
  476. %if "%{with_mcrypt}" == "yes"
  477. --with-mcrypt=%{l_prefix} \
  478. %endif
  479. %if "%{with_ctype}" == "yes"
  480. --enable-ctype \
  481. %endif
  482. %if "%{with_curl}" == "yes"
  483. --with-curl=%{l_prefix} \
  484. %endif
  485. %if "%{with_gdbm}" == "yes"
  486. --with-gdbm=%{l_prefix} \
  487. %endif
  488. %if "%{with_versioning}" == "yes"
  489. --enable-versioning \
  490. %endif
  491. %if "%{with_pear}" == "yes"
  492. --with-pear=%{l_prefix}/lib/php \
  493. %else
  494. --without-pear \
  495. %endif
  496. %if "%{with_simplexml}" == "yes"
  497. --enable-simplexml \
  498. --enable-libxml \
  499. --with-libxml-dir=%{l_prefix} \
  500. %else
  501. --disable-simplexml \
  502. %endif
  503. %if "%{with_snmp}" == "yes"
  504. --with-snmp=%{l_prefix} \
  505. --with-openssl-dir=%{l_prefix} \
  506. %endif
  507. %if "%{with_odbc}" == "yes"
  508. --with-unixODBC=%{l_prefix} \
  509. --with-pdo-odbc=unixODBC,%{l_prefix} \
  510. %endif
  511. %if "%{with_mbregex}" == "yes"
  512. --enable-mbregex \
  513. %endif
  514. %if "%{with_mbstring}" == "yes"
  515. --enable-mbstring \
  516. %endif
  517. %if "%{with_exif}" == "yes"
  518. --with-exif \
  519. %endif
  520. %if "%{with_iconv}" == "yes"
  521. --with-iconv=%{l_prefix} \
  522. %endif
  523. %if "%{with_tidy}" == "yes"
  524. --with-tidy=%{l_prefix} \
  525. %else
  526. --without-tidy \
  527. %endif
  528. %if "%{with_zip}" == "yes"
  529. --enable-zip \
  530. %endif
  531. --with-apxs2=%{l_prefix}/sbin/apxs \
  532. --disable-cli \
  533. --disable-cgi
  534. # build package
  535. %{l_make} %{l_mflags}
  536. %install
  537. # install package
  538. %{l_make} %{l_mflags} install-sapi INSTALL_ROOT=$RPM_BUILD_ROOT
  539. mv $RPM_BUILD_ROOT%{l_prefix}/libexec/apache/libphp5.so \
  540. $RPM_BUILD_ROOT%{l_prefix}/libexec/apache/mod_php.so
  541. # install default configuration file
  542. %{l_shtool} mkdir -f -p -m 755 \
  543. $RPM_BUILD_ROOT%{l_prefix}/etc/apache/apache.d
  544. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  545. %{SOURCE apache-php.ini} \
  546. $RPM_BUILD_ROOT%{l_prefix}/etc/apache/
  547. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  548. %{SOURCE apache-php.conf} \
  549. $RPM_BUILD_ROOT%{l_prefix}/etc/apache/apache.d/
  550. # create session storage directory
  551. %if "%{with_session}" == "yes"
  552. %{l_shtool} mkdir -f -p -m 755 \
  553. $RPM_BUILD_ROOT%{l_prefix}/var/apache/run/apache-php.session
  554. %endif
  555. # determine installation files
  556. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
  557. %if "%{with_session}" == "yes"
  558. '%attr(0750,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/apache/run/apache-php.session' \
  559. %endif
  560. '%config %{l_prefix}/etc/apache/apache-php.ini' \
  561. '%config %{l_prefix}/etc/apache/apache.d/apache-php.conf'
  562. %files -f files
  563. %clean
  564. %post
  565. # after upgrade, restart service
  566. [ $1 -eq 2 ] || exit 0
  567. eval `%{l_rc} apache status 2>/dev/null`
  568. [ ".$apache_active" = .yes ] && %{l_rc} apache restart
  569. exit 0