php.spec 13 KB

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