php.spec 16 KB

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