php.spec 14 KB

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