php.spec 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. ##
  2. ## 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.20
  28. %define V_php_hardened 5.1.6-0.4.15
  29. %define V_php_kolab 5.2.4
  30. # package information
  31. Name: php
  32. Summary: Personal HomePage (PHP)
  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: Language
  39. License: PHP
  40. Version: %{V_php}
  41. Release: 20071112
  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: php.ini
  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_kolab}_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. %if "%{with_suhosin}" == "yes"
  126. BuildPreReq: autoconf
  127. %endif
  128. %if "%{with_sqlite}" == "yes"
  129. BuildPreReq: sqlite
  130. PreReq: sqlite
  131. %endif
  132. %if "%{with_mysql}" == "yes"
  133. BuildPreReq: mysql
  134. PreReq: mysql
  135. %endif
  136. %if "%{with_pgsql}" == "yes"
  137. BuildPreReq: postgresql
  138. PreReq: postgresql
  139. %endif
  140. %if "%{with_gd}" == "yes"
  141. BuildPreReq: gd >= 2.0.20, jpeg, png
  142. PreReq: gd >= 2.0.20, jpeg, png
  143. %endif
  144. %if "%{with_bdb}" == "yes"
  145. BuildPreReq: db
  146. PreReq: db
  147. %endif
  148. %if "%{with_zlib}" == "yes"
  149. BuildPreReq: zlib
  150. PreReq: zlib
  151. %endif
  152. %if "%{with_bzip2}" == "yes"
  153. BuildPreReq: bzip2
  154. PreReq: bzip2
  155. %endif
  156. %if "%{with_ssl}" == "yes"
  157. BuildPreReq: openssl
  158. PreReq: openssl
  159. %endif
  160. %if "%{with_openldap}" == "yes"
  161. BuildPreReq: openldap
  162. PreReq: openldap
  163. %if "%{with_openldapsasl}" == "yes"
  164. BuildPreReq: openldap::with_sasl = yes
  165. PreReq: openldap::with_sasl = yes
  166. %else
  167. BuildPreReq: openldap::with_sasl = no
  168. PreReq: openldap::with_sasl = no
  169. %endif
  170. %endif
  171. %if "%{with_mm}" == "yes"
  172. BuildPreReq: mm
  173. PreReq: mm
  174. %endif
  175. %if "%{with_pcre}" == "yes"
  176. BuildPreReq: pcre
  177. PreReq: pcre
  178. %endif
  179. %if "%{with_freetype}" == "yes"
  180. BuildPreReq: freetype
  181. PreReq: freetype
  182. %endif
  183. %if "%{with_gettext}" == "yes"
  184. BuildPreReq: gettext, libiconv
  185. PreReq: gettext, libiconv
  186. %endif
  187. %if "%{with_iconv}" == "yes"
  188. BuildPreReq: libiconv
  189. PreReq: libiconv
  190. %endif
  191. %if "%{with_imap}" == "yes"
  192. BuildPreReq: imap, openssl
  193. PreReq: imap, openssl
  194. %if "%{with_imap_annotate}" == "yes"
  195. BuildPreReq: imap::with_annotate = yes
  196. PreReq: imap::with_annotate = yes
  197. %endif
  198. %endif
  199. %if "%{with_xml}" == "yes"
  200. BuildPreReq: libxml
  201. PreReq: libxml
  202. %endif
  203. %if "%{with_xslt}" == "yes"
  204. BuildPreReq: libxslt
  205. PreReq: libxslt
  206. %endif
  207. %if "%{with_dom}" == "yes"
  208. BuildPreReq: libxml, libxslt
  209. PreReq: libxml, libxslt
  210. %endif
  211. %if "%{with_curl}" == "yes"
  212. BuildPreReq: curl
  213. PreReq: curl
  214. %endif
  215. %if "%{with_mhash}" == "yes"
  216. BuildPreReq: mhash
  217. PreReq: mhash
  218. %endif
  219. %if "%{with_mcrypt}" == "yes"
  220. BuildPreReq: libmcrypt
  221. PreReq: libmcrypt
  222. %endif
  223. %if "%{with_gdbm}" == "yes"
  224. BuildPreReq: gdbm, gdbm::with_ndbm = yes
  225. PreReq: gdbm, gdbm::with_ndbm = yes
  226. %endif
  227. %if "%{with_oci8}" == "yes"
  228. BuildPreReq: oracle
  229. PreReq: oracle
  230. %endif
  231. %if "%{with_snmp}" == "yes"
  232. BuildPreReq: snmp
  233. PreReq: snmp
  234. %endif
  235. %if "%{with_odbc}" == "yes"
  236. BuildPreReq: unixodbc
  237. PreReq: unixodbc
  238. %endif
  239. %if "%{with_sendmail}" == "yes"
  240. BuildPreReq: MTA
  241. PreReq: MTA
  242. %endif
  243. %if "%{with_simplexml}" == "yes"
  244. BuildPreReq: libxml
  245. PreReq: libxml
  246. %endif
  247. AutoReq: no
  248. AutoReqProv: no
  249. %description
  250. PHP is an HTML-embedded scripting language. Much of its syntax is
  251. borrowed from C, Java and Perl with a couple of unique PHP-specific
  252. features thrown in. The goal of the language is to allow web
  253. developers to write dynamically generated pages quickly.
  254. This is the Command Line Interface (CLI) and Common Gateway
  255. Interface (CGI) version of PHP, intended for use in the "shebang"
  256. line ("#!%{l_prefix}/bin/php") of stand-alone PHP based programs
  257. and for use in the "shebang" line ("#!%{l_prefix}/cgi/php") of
  258. stand-alone webserver-independent CGI scripts.
  259. %track
  260. prog php = {
  261. version = %{V_php}
  262. url = http://www.php.net/downloads.php
  263. regex = php-(5.\d+\.\d+)\.tar\.gz
  264. }
  265. prog 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 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 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. prog php:kolab = {
  281. version = %{V_php_kolab}
  282. url = http://kolab.org/cgi-bin/viewcvs-kolab.cgi/*checkout*/server/patches/php/
  283. regex = KOLAB_php_(\d+(\.\d+)+)_Annotations\.patch
  284. }
  285. %prep
  286. %setup -q
  287. %if "%{with_hardened}" == "yes"
  288. %patch -p1 -P 0
  289. %endif
  290. %if "%{with_suhosin}" == "yes"
  291. %setup -q -T -D -a 1
  292. %patch -p1 -P 1
  293. mv suhosin-%{V_php_suhosin_e} ext/suhosin
  294. rm -f package.xml
  295. export PHP_AUTOCONF=autoconf-213
  296. ./buildconf --copy --force
  297. $PHP_AUTOCONF
  298. %endif
  299. %{l_shtool} subst \
  300. -e 's;\(/include\)/freetype2;\1;' \
  301. configure \
  302. ext/gd/config.m4
  303. %if "%{with_imap_annotate}" == "yes"
  304. sed <%{PATCH2} -e '/php-5.2.1\/ext\/imap\/php_imap.c.orig/,/^[^\+]/d' | %{l_patch} -p1
  305. %endif
  306. %build
  307. # configure package
  308. case "%{l_platform -t}" in
  309. *-sunos5.10 ) cflags="%{l_cflags}" ;;
  310. * ) cflags="%{l_cflags -O}" ;;
  311. esac
  312. cppflags="%{l_cppflags}"
  313. ldflags="%{l_ldflags}"
  314. libs=""
  315. %if "%{with_gdbm}" == "yes"
  316. libs="$libs -lndbm -lgdbm"
  317. %endif
  318. %if "%{with_gd}" == "yes"
  319. libs="$libs -lpng -lz"
  320. %endif
  321. %if "%{with_gettext}" == "yes"
  322. libs="$libs -liconv"
  323. %endif
  324. %if "%{with_openldap}" == "yes" && "%{with_openldapsasl}" == "yes"
  325. libs="$libs -lsasl2"
  326. %endif
  327. %if "%{with_imap}" == "yes"
  328. libs="$libs -lssl -lcrypto"
  329. %endif
  330. %if "%{with_bdb}" == "yes"
  331. libs="$libs -ldb"
  332. %endif
  333. %if "%{with_pgsql}" == "yes"
  334. libs="$libs `pg_config --libs`"
  335. %endif
  336. %if "%{with_oci8}" == "yes"
  337. ORACLE_HOME="`%{l_rc} --query oracle_home`"
  338. export ORACLE_HOME
  339. %endif
  340. CC="%{l_cc}" \
  341. CFLAGS="$cflags" \
  342. CPPFLAGS="$cppflags" \
  343. LDFLAGS="$ldflags" \
  344. LIBS="$libs" \
  345. %if "%{with_sendmail}" == "yes"
  346. PROG_SENDMAIL="%{l_prefix}/sbin/sendmail" \
  347. %else
  348. PROG_SENDMAIL="`%{l_shtool} path false`" \
  349. %endif
  350. ./configure \
  351. --prefix=%{l_prefix} \
  352. --sysconfdir=%{l_prefix}/etc/php \
  353. --with-config-file-path=%{l_prefix}/etc/php \
  354. --libdir=%{l_prefix}/lib/php \
  355. --disable-all \
  356. --enable-pdo \
  357. %if "%{with_suhosin}" == "yes"
  358. --enable-suhosin \
  359. %endif
  360. %if "%{with_calendar}" == "yes"
  361. --enable-calendar \
  362. %endif
  363. --without-sqlite \
  364. %if "%{with_sqlite}" == "yes"
  365. --with-pdo-sqlite=%{l_prefix} \
  366. %else
  367. --without-pdo-sqlite \
  368. %endif
  369. %if "%{with_mysql}" == "yes"
  370. --with-mysql=%{l_prefix} \
  371. --with-pdo-mysql=%{l_prefix} \
  372. %else
  373. --without-mysql \
  374. %endif
  375. %if "%{with_pgsql}" == "yes"
  376. --with-pgsql=%{l_prefix} \
  377. --with-pdo-pgsql=%{l_prefix} \
  378. %else
  379. --without-pgsql \
  380. %endif
  381. %if "%{with_gd}" == "yes"
  382. --with-gd=%{l_prefix} \
  383. --with-jpeg-dir=%{l_prefix} \
  384. --with-png-dir=%{l_prefix} \
  385. %endif
  386. %if "%{with_fastcgi}" == "yes"
  387. --enable-fastcgi \
  388. %else
  389. --disable-fastcgi \
  390. %endif
  391. %if "%{with_freetype}" == "yes"
  392. --enable-gd-native-ttf \
  393. --with-freetype-dir=%{l_prefix} \
  394. %endif
  395. %if "%{with_bdb}" == "yes"
  396. --with-db4=%{l_prefix} \
  397. %endif
  398. %if "%{with_debug}" == "yes"
  399. --enable-debug \
  400. %else
  401. --disable-debug \
  402. %endif
  403. %if "%{with_zlib}" == "yes"
  404. --with-zlib=%{l_prefix} \
  405. --with-zlib-dir=%{l_prefix} \
  406. %endif
  407. %if "%{with_bzip2}" == "yes"
  408. --with-bz2=%{l_prefix} \
  409. %endif
  410. %if "%{with_ssl}" == "yes" || "%{with_openldap}" == "yes"
  411. --with-openssl=%{l_prefix} \
  412. %endif
  413. %if "%{with_openldap}" == "yes"
  414. --with-ldap=%{l_prefix} \
  415. %endif
  416. %if "%{with_mm}" == "yes"
  417. --with-mm=%{l_prefix} \
  418. --enable-session \
  419. %endif
  420. %if "%{with_pcre}" == "yes"
  421. --with-pcre-regex=%{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_xml}" == "yes"
  437. --enable-xml \
  438. --enable-libxml \
  439. --with-libxml-dir=%{l_prefix} \
  440. %else
  441. --disable-xml \
  442. %endif
  443. %if "%{with_xslt}" == "yes"
  444. --with-xsl=%{l_prefix} \
  445. %else
  446. --without-xsl \
  447. %endif
  448. %if "%{with_dom}" == "yes"
  449. --enable-dom \
  450. --with-libxml-dir=%{l_prefix} \
  451. %else
  452. --disable-dom \
  453. %endif
  454. %if "%{with_wddx}" == "yes"
  455. --enable-wddx \
  456. %endif
  457. %if "%{with_bc}" == "yes"
  458. --enable-bcmath \
  459. %endif
  460. %if "%{with_mhash}" == "yes"
  461. --with-mhash=%{l_prefix} \
  462. %endif
  463. %if "%{with_mcrypt}" == "yes"
  464. --with-mcrypt=%{l_prefix} \
  465. %endif
  466. %if "%{with_ctype}" == "yes"
  467. --enable-ctype \
  468. %endif
  469. %if "%{with_curl}" == "yes"
  470. --with-curl=%{l_prefix} \
  471. %endif
  472. %if "%{with_gdbm}" == "yes"
  473. --with-gdbm=%{l_prefix} \
  474. %endif
  475. %if "%{with_versioning}" == "yes"
  476. --enable-versioning \
  477. %endif
  478. %if "%{with_pear}" == "yes"
  479. --with-pear=%{l_prefix}/lib/php \
  480. %else
  481. --without-pear \
  482. %endif
  483. %if "%{with_simplexml}" == "yes"
  484. --enable-simplexml \
  485. --enable-libxml \
  486. --with-libxml-dir=%{l_prefix} \
  487. %else
  488. --disable-simplexml \
  489. %endif
  490. %if "%{with_snmp}" == "yes"
  491. --with-snmp=%{l_prefix} \
  492. --with-openssl-dir=%{l_prefix} \
  493. %endif
  494. %if "%{with_odbc}" == "yes"
  495. --with-unixODBC=%{l_prefix} \
  496. --with-pdo-odbc=unixODBC,%{l_prefix} \
  497. %endif
  498. %if "%{with_mbregex}" == "yes"
  499. --enable-mbregex \
  500. %endif
  501. %if "%{with_mbstring}" == "yes"
  502. --enable-mbstring \
  503. %endif
  504. %if "%{with_exif}" == "yes"
  505. --with-exif \
  506. %endif
  507. %if "%{with_iconv}" == "yes"
  508. --with-iconv=%{l_prefix} \
  509. %endif
  510. --enable-cli \
  511. --enable-cgi \
  512. --enable-force-cgi-redirect \
  513. --enable-discard-path
  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 INSTALL_ROOT=$RPM_BUILD_ROOT
  520. # move CGI executale
  521. %{l_shtool} mkdir -f -p -m 755 \
  522. $RPM_BUILD_ROOT%{l_prefix}/cgi
  523. mv $RPM_BUILD_ROOT%{l_prefix}/bin/php-cgi \
  524. $RPM_BUILD_ROOT%{l_prefix}/cgi/php
  525. # install default configuration file
  526. %{l_shtool} mkdir -f -p -m 755 \
  527. $RPM_BUILD_ROOT%{l_prefix}/etc/php
  528. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  529. %{SOURCE php.ini} $RPM_BUILD_ROOT%{l_prefix}/etc/php/
  530. # strip down installation
  531. rmdir $RPM_BUILD_ROOT%{l_prefix}/lib/php >/dev/null 2>&1 || true
  532. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  533. # determine installation files
  534. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
  535. '%config %{l_prefix}/etc/php/*'
  536. %files -f files
  537. %clean
  538. rm -rf $RPM_BUILD_ROOT