php.spec 12 KB

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