php.spec 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497
  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.8
  27. %define V_php_hardened 0.2.0
  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: 20040714
  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_pdflib}" == "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. Patch0: http://www.hardened-php.net/hardened-php-%{V_php}-%{V_php_hardened}.patch.gz
  101. Patch1: php.patch
  102. # build information
  103. Prefix: %{l_prefix}
  104. BuildRoot: %{l_buildroot}
  105. BuildPreReq: OpenPKG, openpkg >= 20040130, gcc, sed, flex, bison
  106. PreReq: OpenPKG, openpkg >= 20040130
  107. %if "%{with_mysql}" == "yes"
  108. BuildPreReq: mysql
  109. PreReq: mysql
  110. %endif
  111. %if "%{with_pgsql}" == "yes"
  112. BuildPreReq: postgresql
  113. PreReq: postgresql
  114. %endif
  115. %if "%{with_gd}" == "yes"
  116. BuildPreReq: gd >= 2.0.20, jpeg, png
  117. PreReq: gd >= 2.0.20, jpeg, png
  118. %endif
  119. %if "%{with_bdb}" == "yes"
  120. BuildPreReq: db
  121. PreReq: db
  122. %endif
  123. %if "%{with_pdflib}" == "yes"
  124. BuildPreReq: pdflib, jpeg, png
  125. PreReq: pdflib, jpeg, png
  126. %endif
  127. %if "%{with_zlib}" == "yes"
  128. BuildPreReq: zlib
  129. PreReq: zlib
  130. %endif
  131. %if "%{with_bzip2}" == "yes"
  132. BuildPreReq: bzip2
  133. PreReq: bzip2
  134. %endif
  135. %if "%{with_ssl}" == "yes"
  136. BuildPreReq: openssl
  137. PreReq: openssl
  138. %endif
  139. %if "%{with_openldap}" == "yes"
  140. BuildPreReq: openldap
  141. PreReq: openldap
  142. %if "%{with_openldapsasl}" == "yes"
  143. BuildPreReq: openldap::with_sasl = yes
  144. PreReq: openldap::with_sasl = yes
  145. %else
  146. BuildPreReq: openldap::with_sasl = no
  147. PreReq: openldap::with_sasl = no
  148. %endif
  149. %endif
  150. %if "%{with_mm}" == "yes"
  151. BuildPreReq: mm
  152. PreReq: mm
  153. %endif
  154. %if "%{with_pcre}" == "yes"
  155. BuildPreReq: pcre
  156. PreReq: pcre
  157. %endif
  158. %if "%{with_java}" == "yes"
  159. BuildPreReq: j2se
  160. PreReq: j2se
  161. %endif
  162. %if "%{with_freetype}" == "yes"
  163. BuildPreReq: freetype
  164. PreReq: freetype
  165. %endif
  166. %if "%{with_gettext}" == "yes"
  167. BuildPreReq: gettext, libiconv
  168. PreReq: gettext, libiconv
  169. %endif
  170. %if "%{with_iconv}" == "yes"
  171. BuildPreReq: libiconv
  172. PreReq: libiconv
  173. %endif
  174. %if "%{with_imap}" == "yes"
  175. BuildPreReq: imap, openssl
  176. PreReq: imap, openssl
  177. %endif
  178. %if "%{with_xml}" == "yes"
  179. BuildPreReq: expat
  180. PreReq: expat
  181. %endif
  182. %if "%{with_dom}" == "yes"
  183. BuildPreReq: libxml, libxslt
  184. PreReq: libxml, libxslt
  185. %endif
  186. %if "%{with_curl}" == "yes"
  187. BuildPreReq: curl
  188. PreReq: curl
  189. %endif
  190. %if "%{with_mhash}" == "yes"
  191. BuildPreReq: mhash
  192. PreReq: mhash
  193. %endif
  194. %if "%{with_mcrypt}" == "yes"
  195. BuildPreReq: libmcrypt
  196. PreReq: libmcrypt
  197. %endif
  198. %if "%{with_gdbm}" == "yes"
  199. BuildPreReq: gdbm, gdbm::with_ndbm = yes
  200. PreReq: gdbm, gdbm::with_ndbm = yes
  201. %endif
  202. %if "%{with_oci7}" == "yes" || "%{with_oci8}" == "yes"
  203. BuildPreReq: ORACLE
  204. %endif
  205. %if "%{with_snmp}" == "yes"
  206. BuildPreReq: snmp
  207. PreReq: snmp
  208. %endif
  209. %if "%{with_odbc}" == "yes"
  210. BuildPreReq: unixodbc
  211. PreReq: unixodbc
  212. %endif
  213. %if "%{with_sendmail}" == "yes"
  214. BuildPreReq: MTA
  215. PreReq: MTA
  216. %endif
  217. AutoReq: no
  218. AutoReqProv: no
  219. %description
  220. PHP is an HTML-embedded scripting language. Much of its syntax is
  221. borrowed from C, Java and Perl with a couple of unique PHP-specific
  222. features thrown in. The goal of the language is to allow web
  223. developers to write dynamically generated pages quickly.
  224. This is the Command Line Interface (CLI) and Common Gateway
  225. Interface (CGI) version of PHP, intended for use in the "shebang"
  226. line ("#!%{l_prefix}/bin/php") of stand-alone PHP based programs
  227. and for use in the "shebang" line ("#!%{l_prefix}/cgi/php") of
  228. stand-alone webserver-independent CGI scripts.
  229. %track
  230. prog php = {
  231. version = %{V_php}
  232. url = http://www.php.net/downloads.php
  233. regex = php-(4\.\d+\.\d+)\.tar\.gz
  234. }
  235. prog php:hardened = {
  236. version = %{V_php_hardened}
  237. url = http://www.hardened-php.net/download.php
  238. regex = hardened-php-%{V_php}-(\d+(\.\d+)+).patch.gz
  239. }
  240. %prep
  241. %setup -q
  242. %{l_shtool} subst \
  243. -e 's;\(/include\)/freetype2;\1;' \
  244. configure \
  245. ext/gd/config.m4
  246. %if "%{with_hardened}" == "yes"
  247. %patch -p1 -P 0
  248. %endif
  249. %patch -p1 -P 1
  250. %{l_shtool} subst \
  251. %{l_value -s l_prefix l_rpm l_rpmtool} \
  252. scripts/phpize.in
  253. %build
  254. # configure package
  255. cflags="%{l_cflags -O}"
  256. cppflags="%{l_cppflags}"
  257. ldflags="%{l_ldflags}"
  258. libs=""
  259. %if "%{with_gdbm}" == "yes"
  260. libs="$libs -lndbm -lgdbm"
  261. %endif
  262. %if "%{with_gd}" == "yes"
  263. libs="$libs -lpng -lz"
  264. %endif
  265. %if "%{with_gettext}" == "yes"
  266. libs="$libs -liconv"
  267. %endif
  268. %if "%{with_openldap}" == "yes" && "%{with_openldapsasl}" == "yes"
  269. libs="$libs -lsasl2"
  270. %endif
  271. %if "%{with_imap}" == "yes"
  272. libs="$libs -lssl -lcrypto"
  273. %endif
  274. %if "%{with_bdb}" == "yes"
  275. libs="$libs -ldb"
  276. %endif
  277. %if "%{with_oci7}" == "yes" || "%{with_oci8}" == "yes"
  278. ORACLE_HOME="`%{l_prefix}/etc/rc --query oracle_home`"
  279. export ORACLE_HOME
  280. oracle_libdir="`%{l_prefix}/etc/rc --query oracle_libdir`"
  281. case "$oracle_libdir" in
  282. */lib32 )
  283. %{l_shtool} subst \
  284. -e 's;OCI8_DIR/lib;OCI8_DIR/lib32;' \
  285. configure
  286. ;;
  287. esac
  288. %endif
  289. CC="%{l_cc}" \
  290. CFLAGS="$cflags" \
  291. CPPFLAGS="$cppflags" \
  292. LDFLAGS="$ldflags" \
  293. LIBS="$libs" \
  294. %if "%{with_sendmail}" == "yes"
  295. PROG_SENDMAIL="%{l_prefix}/sbin/sendmail" \
  296. %else
  297. PROG_SENDMAIL="`%{l_shtool} path false`" \
  298. %endif
  299. ./configure \
  300. --prefix=%{l_prefix} \
  301. --sysconfdir=%{l_prefix}/etc/php \
  302. --with-config-file-path=%{l_prefix}/etc/php \
  303. %if "%{with_calendar}" == "yes"
  304. --enable-calendar \
  305. %endif
  306. %if "%{with_mysql}" == "yes"
  307. --with-mysql=%{l_prefix} \
  308. %else
  309. --without-mysql \
  310. %endif
  311. %if "%{with_pgsql}" == "yes"
  312. --with-pgsql=%{l_prefix} \
  313. %else
  314. --without-pgsql \
  315. %endif
  316. %if "%{with_gd}" == "yes"
  317. --with-gd=%{l_prefix} \
  318. --with-jpeg-dir=%{l_prefix} \
  319. --with-png-dir=%{l_prefix} \
  320. %endif
  321. %if "%{with_freetype}" == "yes"
  322. --enable-gd-imgstrttf \
  323. --enable-gd-native-ttf \
  324. --with-freetype-dir=%{l_prefix} \
  325. %endif
  326. %if "%{with_bdb}" == "yes"
  327. --with-db4=%{l_prefix} \
  328. %endif
  329. %if "%{with_debug}" == "yes"
  330. --with-debug=yes \
  331. %else
  332. --with-debug=no \
  333. %endif
  334. %if "%{with_zlib}" == "yes"
  335. --with-zlib=%{l_prefix} \
  336. --with-zlib-dir=%{l_prefix} \
  337. %endif
  338. %if "%{with_bzip2}" == "yes"
  339. --with-bz2=%{l_prefix} \
  340. %endif
  341. %if "%{with_pdflib}" == "yes"
  342. --with-pdflib=%{l_prefix} \
  343. --with-jpeg-dir=%{l_prefix} \
  344. --with-png-dir=%{l_prefix} \
  345. %endif
  346. %if "%{with_ssl}" == "yes" || "%{with_openldap}" == "yes"
  347. --with-openssl=%{l_prefix} \
  348. %endif
  349. %if "%{with_openldap}" == "yes"
  350. --with-ldap=%{l_prefix} \
  351. %endif
  352. %if "%{with_mm}" == "yes"
  353. --with-mm=%{l_prefix} \
  354. --enable-session \
  355. %endif
  356. %if "%{with_pcre}" == "yes"
  357. --with-pcre=%{l_prefix} \
  358. %endif
  359. %if "%{with_ftp}" == "yes"
  360. --enable-ftp \
  361. %endif
  362. %if "%{with_java}" == "yes"
  363. --with-java=%{l_prefix}/libexec/j2se \
  364. %endif
  365. %if "%{with_oci7}" == "yes"
  366. --with-oracle \
  367. %endif
  368. %if "%{with_oci8}" == "yes"
  369. --with-oci8 \
  370. --enable-sigchld \
  371. %endif
  372. %if "%{with_gettext}" == "yes"
  373. --with-gettext=%{l_prefix} \
  374. %endif
  375. %if "%{with_imap}" == "yes"
  376. --with-imap=%{l_prefix} \
  377. --with-imap-ssl=%{l_prefix} \
  378. %endif
  379. %if "%{with_xml}" == "yes"
  380. --enable-xml \
  381. --with-expat-dir=%{l_prefix} \
  382. %else
  383. --disable-xml \
  384. %endif
  385. %if "%{with_dom}" == "yes"
  386. --with-dom=%{l_prefix} \
  387. --with-dom-xslt=%{l_prefix} \
  388. --with-dom-exslt=%{l_prefix} \
  389. %endif
  390. %if "%{with_wddx}" == "yes"
  391. --enable-wddx \
  392. %endif
  393. %if "%{with_bc}" == "yes"
  394. --enable-bcmath \
  395. %endif
  396. %if "%{with_transsid}" == "yes"
  397. --enable-trans-sid \
  398. %endif
  399. %if "%{with_mhash}" == "yes"
  400. --with-mhash=%{l_prefix} \
  401. %endif
  402. %if "%{with_mcrypt}" == "yes"
  403. --with-mcrypt=%{l_prefix} \
  404. %endif
  405. %if "%{with_curl}" == "yes"
  406. --with-curl=%{l_prefix} \
  407. %endif
  408. %if "%{with_gdbm}" == "yes"
  409. --with-gdbm=%{l_prefix} \
  410. %endif
  411. %if "%{with_versioning}" == "yes"
  412. --enable-versioning \
  413. %endif
  414. %if "%{with_pear}" == "yes"
  415. --with-pear \
  416. %else
  417. --without-pear \
  418. %endif
  419. %if "%{with_snmp}" == "yes"
  420. --with-snmp=%{l_prefix} \
  421. %endif
  422. %if "%{with_odbc}" == "yes"
  423. --with-unixODBC=%{l_prefix} \
  424. %endif
  425. %if "%{with_mbregex}" == "yes"
  426. --enable-mbregex \
  427. %endif
  428. %if "%{with_mbstring}" == "yes"
  429. --enable-mbstring \
  430. %endif
  431. %if "%{with_exif}" == "yes"
  432. --with-exif \
  433. %endif
  434. %if "%{with_iconv}" == "yes"
  435. --with-iconv=%{l_prefix} \
  436. %endif
  437. --enable-cli \
  438. --enable-cgi \
  439. --enable-force-cgi-redirect \
  440. --enable-discard-path \
  441. --enable-track-vars \
  442. --enable-memory-limit
  443. # build package
  444. %{l_make} %{l_mflags}
  445. %install
  446. # install package
  447. rm -rf $RPM_BUILD_ROOT
  448. %{l_make} %{l_mflags} install INSTALL_ROOT=$RPM_BUILD_ROOT
  449. # install CLI version
  450. # ("make install" incorrectly installs the CGI version into bin/php!)
  451. %{l_shtool} mkdir -f -p -m 755 \
  452. $RPM_BUILD_ROOT%{l_prefix}/bin \
  453. $RPM_BUILD_ROOT%{l_prefix}/man/man1
  454. %{l_shtool} install -c -s -m 755 \
  455. sapi/cli/php $RPM_BUILD_ROOT%{l_prefix}/bin/
  456. %{l_shtool} install -c -m 644 \
  457. sapi/cli/php.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/
  458. # (re)install CGI version
  459. %{l_shtool} mkdir -f -p -m 755 \
  460. $RPM_BUILD_ROOT%{l_prefix}/cgi
  461. %{l_shtool} install -c -s -m 755 \
  462. sapi/cgi/php $RPM_BUILD_ROOT%{l_prefix}/cgi/
  463. # install default configuration file
  464. %{l_shtool} mkdir -f -p -m 755 \
  465. $RPM_BUILD_ROOT%{l_prefix}/etc/php
  466. %{l_shtool} install -c -m 644 /dev/null \
  467. $RPM_BUILD_ROOT%{l_prefix}/etc/php/php.ini
  468. # strip down installation
  469. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  470. # determine installation files
  471. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
  472. '%config %{l_prefix}/etc/php/*'
  473. %files -f files
  474. %clean
  475. rm -rf $RPM_BUILD_ROOT