php.spec 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  1. ##
  2. ## php.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2004 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2004 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2004 Cable & Wireless <http://www.cw.com/>
  6. ##
  7. ## Permission to use, copy, modify, and distribute this software for
  8. ## any purpose with or without fee is hereby granted, provided that
  9. ## the above copyright notice and this permission notice appear in all
  10. ## copies.
  11. ##
  12. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  13. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  15. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  16. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  18. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  19. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  20. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  21. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23. ## SUCH DAMAGE.
  24. ##
  25. # package component versions
  26. %define V_php 4.3.9
  27. %define V_php_hardened 4.3.9-0.2.3
  28. # package information
  29. Name: php
  30. Summary: Personal HomePage (PHP)
  31. URL: http://www.php.net/
  32. Vendor: The PHP Project
  33. Packager: The OpenPKG Project
  34. Distribution: OpenPKG
  35. Class: BASE
  36. Group: Language
  37. License: PHP
  38. Version: %{V_php}
  39. Release: 20041026
  40. # package options
  41. %option with_bc no
  42. %option with_bdb no
  43. %option with_bzip2 no
  44. %option with_calendar no
  45. %option with_curl no
  46. %option with_debug no
  47. %option with_dom no
  48. %option with_exif no
  49. %option with_freetype no
  50. %option with_ftp no
  51. %option with_gdbm no
  52. %option with_gd no
  53. %option with_gettext no
  54. %option with_hardened no
  55. %option with_iconv no
  56. %option with_imap no
  57. %option with_java no
  58. %option with_mbregex no
  59. %option with_mbstring no
  60. %option with_mcrypt no
  61. %option with_mhash no
  62. %option with_mm no
  63. %option with_mysql no
  64. %option with_oci7 no
  65. %option with_oci8 no
  66. %option with_odbc no
  67. %option with_openldap no
  68. %option with_openldapsasl no
  69. %option with_pcre no
  70. %option with_pdflib no
  71. %option with_pear no
  72. %option with_pgsql no
  73. %option with_sendmail no
  74. %option with_snmp no
  75. %option with_ssl no
  76. %option with_transsid no
  77. %option with_versioning no
  78. %option with_wddx no
  79. %option with_xml no
  80. %option with_zlib no
  81. # fixing implicit extension dependencies and correlations
  82. %if "%{with_pear}" == "yes"
  83. %undefine with_xml
  84. %define with_xml yes
  85. %endif
  86. %if "%{with_freetype}" == "yes"
  87. %undefine with_gd
  88. %define with_gd yes
  89. %endif
  90. %if "%{with_mysql}" == "yes" || "%{with_gd}" == "yes" || "%{with_dom}" == "yes"
  91. %undefine with_zlib
  92. %define with_zlib yes
  93. %endif
  94. %if "%{with_pgsql}" == "yes"
  95. %undefine with_ssl
  96. %define with_ssl yes
  97. %endif
  98. # list of sources
  99. Source0: http://static.php.net/www.php.net/distributions/php-%{V_php}.tar.gz
  100. Source1: php.ini
  101. Patch0: http://www.hardened-php.net/hardened-php-%{V_php_hardened}.patch.gz
  102. Patch1: php.patch
  103. # build information
  104. Prefix: %{l_prefix}
  105. BuildRoot: %{l_buildroot}
  106. BuildPreReq: OpenPKG, openpkg >= 20040130, gcc, sed, flex, bison
  107. PreReq: OpenPKG, openpkg >= 20040130
  108. %if "%{with_mysql}" == "yes"
  109. BuildPreReq: mysql
  110. PreReq: mysql
  111. %endif
  112. %if "%{with_pgsql}" == "yes"
  113. BuildPreReq: postgresql
  114. PreReq: postgresql
  115. %endif
  116. %if "%{with_gd}" == "yes"
  117. BuildPreReq: gd >= 2.0.20, jpeg, png
  118. PreReq: gd >= 2.0.20, jpeg, png
  119. %endif
  120. %if "%{with_bdb}" == "yes"
  121. BuildPreReq: db
  122. PreReq: db
  123. %endif
  124. %if "%{with_pdflib}" == "yes"
  125. BuildPreReq: pdflib
  126. PreReq: pdflib
  127. %endif
  128. %if "%{with_zlib}" == "yes"
  129. BuildPreReq: zlib
  130. PreReq: zlib
  131. %endif
  132. %if "%{with_bzip2}" == "yes"
  133. BuildPreReq: bzip2
  134. PreReq: bzip2
  135. %endif
  136. %if "%{with_ssl}" == "yes"
  137. BuildPreReq: openssl
  138. PreReq: openssl
  139. %endif
  140. %if "%{with_openldap}" == "yes"
  141. BuildPreReq: openldap
  142. PreReq: openldap
  143. %if "%{with_openldapsasl}" == "yes"
  144. BuildPreReq: openldap::with_sasl = yes
  145. PreReq: openldap::with_sasl = yes
  146. %else
  147. BuildPreReq: openldap::with_sasl = no
  148. PreReq: openldap::with_sasl = no
  149. %endif
  150. %endif
  151. %if "%{with_mm}" == "yes"
  152. BuildPreReq: mm
  153. PreReq: mm
  154. %endif
  155. %if "%{with_pcre}" == "yes"
  156. BuildPreReq: pcre
  157. PreReq: pcre
  158. %endif
  159. %if "%{with_java}" == "yes"
  160. BuildPreReq: j2se
  161. PreReq: j2se
  162. %endif
  163. %if "%{with_freetype}" == "yes"
  164. BuildPreReq: freetype
  165. PreReq: freetype
  166. %endif
  167. %if "%{with_gettext}" == "yes"
  168. BuildPreReq: gettext, libiconv
  169. PreReq: gettext, libiconv
  170. %endif
  171. %if "%{with_iconv}" == "yes"
  172. BuildPreReq: libiconv
  173. PreReq: libiconv
  174. %endif
  175. %if "%{with_imap}" == "yes"
  176. BuildPreReq: imap, openssl
  177. PreReq: imap, openssl
  178. %endif
  179. %if "%{with_xml}" == "yes"
  180. BuildPreReq: expat
  181. PreReq: expat
  182. %endif
  183. %if "%{with_dom}" == "yes"
  184. BuildPreReq: libxml, libxslt
  185. PreReq: libxml, libxslt
  186. %endif
  187. %if "%{with_curl}" == "yes"
  188. BuildPreReq: curl
  189. PreReq: curl
  190. %endif
  191. %if "%{with_mhash}" == "yes"
  192. BuildPreReq: mhash
  193. PreReq: mhash
  194. %endif
  195. %if "%{with_mcrypt}" == "yes"
  196. BuildPreReq: libmcrypt
  197. PreReq: libmcrypt
  198. %endif
  199. %if "%{with_gdbm}" == "yes"
  200. BuildPreReq: gdbm, gdbm::with_ndbm = yes
  201. PreReq: gdbm, gdbm::with_ndbm = yes
  202. %endif
  203. %if "%{with_oci7}" == "yes" || "%{with_oci8}" == "yes"
  204. BuildPreReq: ORACLE
  205. %endif
  206. %if "%{with_snmp}" == "yes"
  207. BuildPreReq: snmp
  208. PreReq: snmp
  209. %endif
  210. %if "%{with_odbc}" == "yes"
  211. BuildPreReq: unixodbc
  212. PreReq: unixodbc
  213. %endif
  214. %if "%{with_sendmail}" == "yes"
  215. BuildPreReq: MTA
  216. PreReq: MTA
  217. %endif
  218. AutoReq: no
  219. AutoReqProv: no
  220. %description
  221. PHP is an HTML-embedded scripting language. Much of its syntax is
  222. borrowed from C, Java and Perl with a couple of unique PHP-specific
  223. features thrown in. The goal of the language is to allow web
  224. developers to write dynamically generated pages quickly.
  225. This is the Command Line Interface (CLI) and Common Gateway
  226. Interface (CGI) version of PHP, intended for use in the "shebang"
  227. line ("#!%{l_prefix}/bin/php") of stand-alone PHP based programs
  228. and for use in the "shebang" line ("#!%{l_prefix}/cgi/php") of
  229. stand-alone webserver-independent CGI scripts.
  230. %track
  231. prog php = {
  232. version = %{V_php}
  233. url = http://www.php.net/downloads.php
  234. regex = php-(4\.\d+\.\d+)\.tar\.gz
  235. }
  236. prog php:hardened = {
  237. version = %{V_php_hardened}
  238. url = http://www.hardened-php.net/download.php
  239. regex = hardened-php-(4\.\d+\.\d+-\d+(\.\d+)+)\.patch\.gz
  240. }
  241. %prep
  242. %setup -q
  243. %{l_shtool} subst \
  244. -e 's;\(/include\)/freetype2;\1;' \
  245. configure \
  246. ext/gd/config.m4
  247. %if "%{with_hardened}" == "yes"
  248. %patch -p1 -P 0
  249. %endif
  250. %patch -p0 -P 1
  251. %{l_shtool} subst \
  252. %{l_value -s l_prefix l_rpm l_rpmtool} \
  253. scripts/phpize.in
  254. %build
  255. # configure package
  256. cflags="%{l_cflags -O}"
  257. cppflags="%{l_cppflags}"
  258. ldflags="%{l_ldflags}"
  259. libs=""
  260. %if "%{with_gdbm}" == "yes"
  261. libs="$libs -lndbm -lgdbm"
  262. %endif
  263. %if "%{with_gd}" == "yes" && "%{with_pdflib}" != "yes"
  264. libs="$libs -lpng -lz"
  265. %endif
  266. %if "%{with_gettext}" == "yes"
  267. libs="$libs -liconv"
  268. %endif
  269. %if "%{with_openldap}" == "yes" && "%{with_openldapsasl}" == "yes"
  270. libs="$libs -lsasl2"
  271. %endif
  272. %if "%{with_imap}" == "yes"
  273. libs="$libs -lssl -lcrypto"
  274. %endif
  275. %if "%{with_bdb}" == "yes"
  276. libs="$libs -ldb"
  277. %endif
  278. %if "%{with_oci7}" == "yes" || "%{with_oci8}" == "yes"
  279. ORACLE_HOME="`%{l_rc} --query oracle_home`"
  280. export ORACLE_HOME
  281. oracle_libdir="`%{l_rc} --query oracle_libdir`"
  282. case "$oracle_libdir" in
  283. */lib32 )
  284. %{l_shtool} subst \
  285. -e 's;OCI8_DIR/lib;OCI8_DIR/lib32;' \
  286. configure
  287. ;;
  288. esac
  289. %endif
  290. CC="%{l_cc}" \
  291. CFLAGS="$cflags" \
  292. CPPFLAGS="$cppflags" \
  293. LDFLAGS="$ldflags" \
  294. LIBS="$libs" \
  295. %if "%{with_sendmail}" == "yes"
  296. PROG_SENDMAIL="%{l_prefix}/sbin/sendmail" \
  297. %else
  298. PROG_SENDMAIL="`%{l_shtool} path false`" \
  299. %endif
  300. ./configure \
  301. --prefix=%{l_prefix} \
  302. --sysconfdir=%{l_prefix}/etc/php \
  303. --with-config-file-path=%{l_prefix}/etc/php \
  304. %if "%{with_calendar}" == "yes"
  305. --enable-calendar \
  306. %endif
  307. %if "%{with_mysql}" == "yes"
  308. --with-mysql=%{l_prefix} \
  309. %else
  310. --without-mysql \
  311. %endif
  312. %if "%{with_pgsql}" == "yes"
  313. --with-pgsql=%{l_prefix} \
  314. %else
  315. --without-pgsql \
  316. %endif
  317. %if "%{with_gd}" == "yes"
  318. --with-gd=%{l_prefix} \
  319. %if "%{with_pdflib}" != "yes"
  320. --with-jpeg-dir=%{l_prefix} \
  321. --with-png-dir=%{l_prefix} \
  322. %endif
  323. %endif
  324. %if "%{with_freetype}" == "yes"
  325. --enable-gd-imgstrttf \
  326. --enable-gd-native-ttf \
  327. --with-freetype-dir=%{l_prefix} \
  328. %endif
  329. %if "%{with_bdb}" == "yes"
  330. --with-db4=%{l_prefix} \
  331. %endif
  332. %if "%{with_debug}" == "yes"
  333. --with-debug=yes \
  334. %else
  335. --with-debug=no \
  336. %endif
  337. %if "%{with_zlib}" == "yes"
  338. --with-zlib=%{l_prefix} \
  339. --with-zlib-dir=%{l_prefix} \
  340. %endif
  341. %if "%{with_bzip2}" == "yes"
  342. --with-bz2=%{l_prefix} \
  343. %endif
  344. %if "%{with_pdflib}" == "yes"
  345. --with-pdflib=%{l_prefix} \
  346. %endif
  347. %if "%{with_ssl}" == "yes" || "%{with_openldap}" == "yes"
  348. --with-openssl=%{l_prefix} \
  349. %endif
  350. %if "%{with_openldap}" == "yes"
  351. --with-ldap=%{l_prefix} \
  352. %endif
  353. %if "%{with_mm}" == "yes"
  354. --with-mm=%{l_prefix} \
  355. --enable-session \
  356. %endif
  357. %if "%{with_pcre}" == "yes"
  358. --with-pcre=%{l_prefix} \
  359. %endif
  360. %if "%{with_ftp}" == "yes"
  361. --enable-ftp \
  362. %endif
  363. %if "%{with_java}" == "yes"
  364. --with-java=%{l_prefix}/libexec/j2se \
  365. %endif
  366. %if "%{with_oci7}" == "yes"
  367. --with-oracle \
  368. %endif
  369. %if "%{with_oci8}" == "yes"
  370. --with-oci8 \
  371. --enable-sigchld \
  372. %endif
  373. %if "%{with_gettext}" == "yes"
  374. --with-gettext=%{l_prefix} \
  375. %endif
  376. %if "%{with_imap}" == "yes"
  377. --with-imap=%{l_prefix} \
  378. --with-imap-ssl=%{l_prefix} \
  379. %endif
  380. %if "%{with_xml}" == "yes"
  381. --enable-xml \
  382. --with-expat-dir=%{l_prefix} \
  383. %else
  384. --disable-xml \
  385. %endif
  386. %if "%{with_dom}" == "yes"
  387. --with-dom=%{l_prefix} \
  388. --with-dom-xslt=%{l_prefix} \
  389. --with-dom-exslt=%{l_prefix} \
  390. %endif
  391. %if "%{with_wddx}" == "yes"
  392. --enable-wddx \
  393. %endif
  394. %if "%{with_bc}" == "yes"
  395. --enable-bcmath \
  396. %endif
  397. %if "%{with_transsid}" == "yes"
  398. --enable-trans-sid \
  399. %endif
  400. %if "%{with_mhash}" == "yes"
  401. --with-mhash=%{l_prefix} \
  402. %endif
  403. %if "%{with_mcrypt}" == "yes"
  404. --with-mcrypt=%{l_prefix} \
  405. %endif
  406. %if "%{with_curl}" == "yes"
  407. --with-curl=%{l_prefix} \
  408. %endif
  409. %if "%{with_gdbm}" == "yes"
  410. --with-gdbm=%{l_prefix} \
  411. %endif
  412. %if "%{with_versioning}" == "yes"
  413. --enable-versioning \
  414. %endif
  415. %if "%{with_pear}" == "yes"
  416. --with-pear \
  417. %else
  418. --without-pear \
  419. %endif
  420. %if "%{with_snmp}" == "yes"
  421. --with-snmp=%{l_prefix} \
  422. %endif
  423. %if "%{with_odbc}" == "yes"
  424. --with-unixODBC=%{l_prefix} \
  425. %endif
  426. %if "%{with_mbregex}" == "yes"
  427. --enable-mbregex \
  428. %endif
  429. %if "%{with_mbstring}" == "yes"
  430. --enable-mbstring \
  431. %endif
  432. %if "%{with_exif}" == "yes"
  433. --with-exif \
  434. %endif
  435. %if "%{with_iconv}" == "yes"
  436. --with-iconv=%{l_prefix} \
  437. %endif
  438. --enable-cli \
  439. --enable-cgi \
  440. --enable-force-cgi-redirect \
  441. --enable-discard-path \
  442. --enable-track-vars \
  443. --enable-memory-limit
  444. # build package
  445. %{l_make} %{l_mflags}
  446. %install
  447. # install package
  448. rm -rf $RPM_BUILD_ROOT
  449. %{l_make} %{l_mflags} install INSTALL_ROOT=$RPM_BUILD_ROOT
  450. # install CLI version
  451. # ("make install" incorrectly installs the CGI version into bin/php!)
  452. %{l_shtool} mkdir -f -p -m 755 \
  453. $RPM_BUILD_ROOT%{l_prefix}/bin \
  454. $RPM_BUILD_ROOT%{l_prefix}/man/man1
  455. %{l_shtool} install -c -s -m 755 \
  456. sapi/cli/php $RPM_BUILD_ROOT%{l_prefix}/bin/
  457. %{l_shtool} install -c -m 644 \
  458. sapi/cli/php.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/
  459. # (re)install CGI version
  460. %{l_shtool} mkdir -f -p -m 755 \
  461. $RPM_BUILD_ROOT%{l_prefix}/cgi
  462. %{l_shtool} install -c -s -m 755 \
  463. sapi/cgi/php $RPM_BUILD_ROOT%{l_prefix}/cgi/
  464. # install default configuration file
  465. %{l_shtool} mkdir -f -p -m 755 \
  466. $RPM_BUILD_ROOT%{l_prefix}/etc/php
  467. %{l_shtool} install -c -m 644 \
  468. %{SOURCE php.ini} $RPM_BUILD_ROOT%{l_prefix}/etc/php/
  469. # strip down installation
  470. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  471. # determine installation files
  472. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
  473. '%config %{l_prefix}/etc/php/*'
  474. %files -f files
  475. %clean
  476. rm -rf $RPM_BUILD_ROOT