php.spec 15 KB

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