php.spec 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  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.6
  36. Release: 20040425
  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. %endif
  263. CC="%{l_cc}" \
  264. CFLAGS="$cflags" \
  265. CPPFLAGS="$cppflags" \
  266. LDFLAGS="$ldflags" \
  267. LIBS="$libs" \
  268. %if "%{with_sendmail}" == "yes"
  269. PROG_SENDMAIL="%{l_prefix}/sbin/sendmail" \
  270. %else
  271. PROG_SENDMAIL="`%{l_shtool} path false`" \
  272. %endif
  273. ./configure \
  274. --prefix=%{l_prefix} \
  275. --sysconfdir=%{l_prefix}/etc/php \
  276. --with-config-file-path=%{l_prefix}/etc/php \
  277. %if "%{with_calendar}" == "yes"
  278. --enable-calendar \
  279. %endif
  280. %if "%{with_mysql}" == "yes"
  281. --with-mysql=%{l_prefix} \
  282. %else
  283. --without-mysql \
  284. %endif
  285. %if "%{with_pgsql}" == "yes"
  286. --with-pgsql=%{l_prefix} \
  287. %else
  288. --without-pgsql \
  289. %endif
  290. %if "%{with_gd}" == "yes"
  291. --with-gd=%{l_prefix} \
  292. --with-jpeg-dir=%{l_prefix} \
  293. --with-png-dir=%{l_prefix} \
  294. %endif
  295. %if "%{with_freetype}" == "yes"
  296. --enable-gd-imgstrttf \
  297. --enable-gd-native-ttf \
  298. --with-freetype-dir=%{l_prefix} \
  299. %endif
  300. %if "%{with_bdb}" == "yes"
  301. --with-db4=%{l_prefix} \
  302. %endif
  303. %if "%{with_debug}" == "yes"
  304. --with-debug=yes \
  305. %else
  306. --with-debug=no \
  307. %endif
  308. %if "%{with_zlib}" == "yes"
  309. --with-zlib=%{l_prefix} \
  310. --with-zlib-dir=%{l_prefix} \
  311. %endif
  312. %if "%{with_bzip2}" == "yes"
  313. --with-bz2=%{l_prefix} \
  314. %endif
  315. %if "%{with_pdflib}" == "yes"
  316. --with-pdflib=%{l_prefix} \
  317. --with-jpeg-dir=%{l_prefix} \
  318. --with-png-dir=%{l_prefix} \
  319. %endif
  320. %if "%{with_ssl}" == "yes" || "%{with_openldap}" == "yes"
  321. --with-openssl=%{l_prefix} \
  322. %endif
  323. %if "%{with_openldap}" == "yes"
  324. --with-ldap=%{l_prefix} \
  325. %endif
  326. %if "%{with_mm}" == "yes"
  327. --with-mm=%{l_prefix} \
  328. --enable-session \
  329. %endif
  330. %if "%{with_pcre}" == "yes"
  331. --with-pcre=%{l_prefix} \
  332. %endif
  333. %if "%{with_ftp}" == "yes"
  334. --enable-ftp \
  335. %endif
  336. %if "%{with_java}" == "yes"
  337. --with-java=%{l_prefix}/libexec/j2se \
  338. %endif
  339. %if "%{with_oci7}" == "yes"
  340. --with-oracle \
  341. %endif
  342. %if "%{with_oci8}" == "yes"
  343. --with-oci8 \
  344. %endif
  345. %if "%{with_gettext}" == "yes"
  346. --with-gettext=%{l_prefix} \
  347. %endif
  348. %if "%{with_imap}" == "yes"
  349. --with-imap=%{l_prefix} \
  350. --with-imap-ssl=%{l_prefix} \
  351. %endif
  352. %if "%{with_xml}" == "yes"
  353. --enable-xml \
  354. --with-expat-dir=%{l_prefix} \
  355. %else
  356. --disable-xml \
  357. %endif
  358. %if "%{with_dom}" == "yes"
  359. --with-dom=%{l_prefix} \
  360. --with-dom-xslt=%{l_prefix} \
  361. --with-dom-exslt=%{l_prefix} \
  362. %endif
  363. %if "%{with_wddx}" == "yes"
  364. --enable-wddx \
  365. %endif
  366. %if "%{with_bc}" == "yes"
  367. --enable-bcmath \
  368. %endif
  369. %if "%{with_transsid}" == "yes"
  370. --enable-trans-sid \
  371. %endif
  372. %if "%{with_mhash}" == "yes"
  373. --with-mhash=%{l_prefix} \
  374. %endif
  375. %if "%{with_mcrypt}" == "yes"
  376. --with-mcrypt=%{l_prefix} \
  377. %endif
  378. %if "%{with_curl}" == "yes"
  379. --with-curl=%{l_prefix} \
  380. %endif
  381. %if "%{with_gdbm}" == "yes"
  382. --with-gdbm=%{l_prefix} \
  383. %endif
  384. %if "%{with_versioning}" == "yes"
  385. --enable-versioning \
  386. %endif
  387. %if "%{with_pear}" == "yes"
  388. --with-pear \
  389. %else
  390. --without-pear \
  391. %endif
  392. %if "%{with_snmp}" == "yes"
  393. --with-snmp=%{l_prefix} \
  394. %endif
  395. %if "%{with_odbc}" == "yes"
  396. --with-unixODBC=%{l_prefix} \
  397. %endif
  398. %if "%{with_mbregex}" == "yes"
  399. --enable-mbregex \
  400. %endif
  401. %if "%{with_mbstring}" == "yes"
  402. --enable-mbstring \
  403. %endif
  404. %if "%{with_exif}" == "yes"
  405. --with-exif \
  406. %endif
  407. %if "%{with_iconv}" == "yes"
  408. --with-iconv=%{l_prefix} \
  409. %endif
  410. --enable-cli \
  411. --enable-cgi \
  412. --enable-force-cgi-redirect \
  413. --enable-discard-path \
  414. --enable-track-vars \
  415. --enable-memory-limit
  416. # build package
  417. %{l_make} %{l_mflags}
  418. %install
  419. # install package
  420. rm -rf $RPM_BUILD_ROOT
  421. %{l_make} %{l_mflags} install INSTALL_ROOT=$RPM_BUILD_ROOT
  422. # install CLI version
  423. # ("make install" incorrectly installs the CGI version into bin/php!)
  424. %{l_shtool} mkdir -f -p -m 755 \
  425. $RPM_BUILD_ROOT%{l_prefix}/bin \
  426. $RPM_BUILD_ROOT%{l_prefix}/man/man1
  427. %{l_shtool} install -c -s -m 755 \
  428. sapi/cli/php $RPM_BUILD_ROOT%{l_prefix}/bin/
  429. %{l_shtool} install -c -m 644 \
  430. sapi/cli/php.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/
  431. # (re)install CGI version
  432. %{l_shtool} mkdir -f -p -m 755 \
  433. $RPM_BUILD_ROOT%{l_prefix}/cgi
  434. %{l_shtool} install -c -s -m 755 \
  435. sapi/cgi/php $RPM_BUILD_ROOT%{l_prefix}/cgi/
  436. # install default configuration file
  437. %{l_shtool} mkdir -f -p -m 755 \
  438. $RPM_BUILD_ROOT%{l_prefix}/etc/php
  439. %{l_shtool} install -c -m 644 /dev/null \
  440. $RPM_BUILD_ROOT%{l_prefix}/etc/php/php.ini
  441. # strip down installation
  442. rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/php/build
  443. rmdir $RPM_BUILD_ROOT%{l_prefix}/lib/php >/dev/null 2>&1 || true
  444. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  445. # determine installation files
  446. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
  447. '%config %{l_prefix}/etc/php/*'
  448. %files -f files
  449. %clean
  450. rm -rf $RPM_BUILD_ROOT