php5.spec 13 KB

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