php.spec 12 KB

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