php5.spec 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503
  1. ##
  2. ## php5.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2006 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ## Copyright (c) 2000-2006 Ralf S. Engelschall <http://engelschall.com/>
  5. ##
  6. ## Permission to use, copy, modify, and distribute this software for
  7. ## any purpose with or without fee is hereby granted, provided that
  8. ## the above copyright notice and this permission notice appear in all
  9. ## copies.
  10. ##
  11. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  12. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  14. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  15. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  17. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  18. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  19. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  20. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  21. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  22. ## SUCH DAMAGE.
  23. ##
  24. # package versions
  25. %define V_php 5.1.4
  26. %define V_php_hardened 5.1.4-0.4.9
  27. # package information
  28. Name: php5
  29. Summary: Personal HomePage (PHP)
  30. URL: http://www.php.net/
  31. Vendor: The PHP Project
  32. Packager: OpenPKG
  33. Distribution: OpenPKG
  34. Class: PLUS
  35. Group: Language
  36. License: PHP
  37. Version: %{V_php}
  38. Release: 20060504
  39. # package options
  40. %option with_calendar no
  41. %option with_sqlite no
  42. %option with_mysql no
  43. %option with_pgsql no
  44. %option with_gd no
  45. %option with_bdb no
  46. %option with_zlib no
  47. %option with_bzip2 no
  48. %option with_ssl no
  49. %option with_openldap no
  50. %option with_openldapsasl no
  51. %option with_mm no
  52. %option with_pcre no
  53. %option with_ftp no
  54. %option with_oci8 no
  55. %option with_fastcgi no
  56. %option with_freetype no
  57. %option with_gettext no
  58. %option with_hardened no
  59. %option with_imap no
  60. %option with_xml no
  61. %option with_xslt no
  62. %option with_dom no
  63. %option with_bc no
  64. %option with_curl no
  65. %option with_mhash no
  66. %option with_mcrypt no
  67. %option with_wddx no
  68. %option with_gdbm no
  69. %option with_versioning no
  70. %option with_snmp no
  71. %option with_odbc no
  72. %option with_mbregex no
  73. %option with_mbstring no
  74. %option with_exif no
  75. %option with_iconv no
  76. %option with_sendmail no
  77. %option with_pear no
  78. # fixing implicit extension dependencies and correlations
  79. %if "%{with_pear}" == "yes"
  80. %undefine with_xml
  81. %define with_xml yes
  82. %undefine with_pcre
  83. %define with_pcre yes
  84. %endif
  85. %if "%{with_freetype}" == "yes"
  86. %undefine with_gd
  87. %define with_gd yes
  88. %endif
  89. %if "%{with_mysql}" == "yes" || "%{with_gd}" == "yes" || "%{with_dom}" == "yes"
  90. %undefine with_zlib
  91. %define with_zlib yes
  92. %endif
  93. %if "%{with_pgsql}" == "yes"
  94. %undefine with_ssl
  95. %define with_ssl yes
  96. %endif
  97. # list of sources
  98. Source0: http://static.php.net/www.php.net/distributions/php-%{V_php}.tar.gz
  99. Source1: php.ini
  100. Patch0: http://www.hardened-php.net/hardening-patch-%{V_php_hardened}.patch.gz
  101. # build information
  102. Prefix: %{l_prefix}
  103. BuildRoot: %{l_buildroot}
  104. BuildPreReq: OpenPKG, openpkg >= 20050615, gcc, flex, bison
  105. PreReq: OpenPKG, openpkg >= 20050615, MTA
  106. %if "%{with_sqlite}" == "yes"
  107. BuildPreReq: sqlite
  108. PreReq: sqlite
  109. %endif
  110. %if "%{with_mysql}" == "yes"
  111. BuildPreReq: mysql
  112. PreReq: mysql
  113. %endif
  114. %if "%{with_pgsql}" == "yes"
  115. BuildPreReq: postgresql
  116. PreReq: postgresql
  117. %endif
  118. %if "%{with_gd}" == "yes"
  119. BuildPreReq: gd >= 2.0.20, jpeg, png
  120. PreReq: gd >= 2.0.20, jpeg, png
  121. %endif
  122. %if "%{with_bdb}" == "yes"
  123. BuildPreReq: db
  124. PreReq: db
  125. %endif
  126. %if "%{with_zlib}" == "yes"
  127. BuildPreReq: zlib
  128. PreReq: zlib
  129. %endif
  130. %if "%{with_bzip2}" == "yes"
  131. BuildPreReq: bzip2
  132. PreReq: bzip2
  133. %endif
  134. %if "%{with_ssl}" == "yes"
  135. BuildPreReq: openssl
  136. PreReq: openssl
  137. %endif
  138. %if "%{with_openldap}" == "yes"
  139. BuildPreReq: openldap
  140. PreReq: openldap
  141. %if "%{with_openldapsasl}" == "yes"
  142. BuildPreReq: openldap::with_sasl = yes
  143. PreReq: openldap::with_sasl = yes
  144. %else
  145. BuildPreReq: openldap::with_sasl = no
  146. PreReq: openldap::with_sasl = no
  147. %endif
  148. %endif
  149. %if "%{with_mm}" == "yes"
  150. BuildPreReq: mm
  151. PreReq: mm
  152. %endif
  153. %if "%{with_pcre}" == "yes"
  154. BuildPreReq: pcre
  155. PreReq: pcre
  156. %endif
  157. %if "%{with_freetype}" == "yes"
  158. BuildPreReq: freetype
  159. PreReq: freetype
  160. %endif
  161. %if "%{with_gettext}" == "yes"
  162. BuildPreReq: gettext, libiconv
  163. PreReq: gettext, libiconv
  164. %endif
  165. %if "%{with_iconv}" == "yes"
  166. BuildPreReq: libiconv
  167. PreReq: libiconv
  168. %endif
  169. %if "%{with_imap}" == "yes"
  170. BuildPreReq: imap, openssl
  171. PreReq: imap, openssl
  172. %endif
  173. %if "%{with_xml}" == "yes"
  174. BuildPreReq: libxml
  175. PreReq: libxml
  176. %endif
  177. %if "%{with_xslt}" == "yes"
  178. BuildPreReq: libxslt
  179. PreReq: libxslt
  180. %endif
  181. %if "%{with_dom}" == "yes"
  182. BuildPreReq: libxml, libxslt
  183. PreReq: libxml, libxslt
  184. %endif
  185. %if "%{with_curl}" == "yes"
  186. BuildPreReq: curl
  187. PreReq: curl
  188. %endif
  189. %if "%{with_mhash}" == "yes"
  190. BuildPreReq: mhash
  191. PreReq: mhash
  192. %endif
  193. %if "%{with_mcrypt}" == "yes"
  194. BuildPreReq: libmcrypt
  195. PreReq: libmcrypt
  196. %endif
  197. %if "%{with_gdbm}" == "yes"
  198. BuildPreReq: gdbm, gdbm::with_ndbm = yes
  199. PreReq: gdbm, gdbm::with_ndbm = yes
  200. %endif
  201. %if "%{with_oci8}" == "yes"
  202. BuildPreReq: oracle
  203. PreReq: oracle
  204. %endif
  205. %if "%{with_snmp}" == "yes"
  206. BuildPreReq: snmp
  207. PreReq: snmp
  208. %endif
  209. %if "%{with_odbc}" == "yes"
  210. BuildPreReq: unixodbc
  211. PreReq: unixodbc
  212. %endif
  213. %if "%{with_sendmail}" == "yes"
  214. BuildPreReq: MTA
  215. PreReq: MTA
  216. %endif
  217. AutoReq: no
  218. AutoReqProv: no
  219. %description
  220. PHP is an HTML-embedded scripting language. Much of its syntax is
  221. borrowed from C, Java and Perl with a couple of unique PHP-specific
  222. features thrown in. The goal of the language is to allow web
  223. developers to write dynamically generated pages quickly.
  224. This is the Command Line Interface (CLI) and Common Gateway
  225. Interface (CGI) version of PHP, intended for use in the "shebang"
  226. line ("#!%{l_prefix}/bin/php") of stand-alone PHP based programs
  227. and for use in the "shebang" line ("#!%{l_prefix}/cgi/php") of
  228. stand-alone webserver-independent CGI scripts.
  229. %track
  230. prog php5 = {
  231. version = %{V_php}
  232. url = http://www.php.net/downloads.php
  233. regex = php-(5.\d+\.\d+)\.tar\.gz
  234. }
  235. prog php5:hardened = {
  236. version = %{V_php_hardened}
  237. url = http://www.hardened-php.net/downloads.13.html
  238. regex = hardening-patch-(5\.\d+\.\d+-\d+(\.\d+)+)\.patch\.gz
  239. }
  240. %prep
  241. %setup -q -n php-%{version}
  242. %if "%{with_hardened}" == "yes"
  243. %patch -p1
  244. %endif
  245. %{l_shtool} subst \
  246. -e 's;\(/include\)/freetype2;\1;' \
  247. configure \
  248. ext/gd/config.m4
  249. %build
  250. # configure package
  251. cflags="%{l_cflags -O}"
  252. cppflags="%{l_cppflags}"
  253. ldflags="%{l_ldflags}"
  254. libs=""
  255. %if "%{with_gdbm}" == "yes"
  256. libs="$libs -lndbm -lgdbm"
  257. %endif
  258. %if "%{with_gd}" == "yes"
  259. libs="$libs -lpng -lz"
  260. %endif
  261. %if "%{with_gettext}" == "yes"
  262. libs="$libs -liconv"
  263. %endif
  264. %if "%{with_openldap}" == "yes" && "%{with_openldapsasl}" == "yes"
  265. libs="$libs -lsasl2"
  266. %endif
  267. %if "%{with_imap}" == "yes"
  268. libs="$libs -lssl -lcrypto"
  269. %endif
  270. %if "%{with_bdb}" == "yes"
  271. libs="$libs -ldb"
  272. %endif
  273. %if "%{with_oci8}" == "yes"
  274. ORACLE_HOME="`%{l_rc} --query oracle_home`"
  275. export ORACLE_HOME
  276. %endif
  277. CC="%{l_cc}" \
  278. CFLAGS="$cflags" \
  279. CPPFLAGS="$cppflags" \
  280. LDFLAGS="$ldflags" \
  281. LIBS="$libs" \
  282. %if "%{with_sendmail}" == "yes"
  283. PROG_SENDMAIL="%{l_prefix}/sbin/sendmail" \
  284. %else
  285. PROG_SENDMAIL="`%{l_shtool} path false`" \
  286. %endif
  287. ./configure \
  288. --prefix=%{l_prefix} \
  289. --sysconfdir=%{l_prefix}/etc/php5 \
  290. --with-config-file-path=%{l_prefix}/etc/php5 \
  291. --libdir=%{l_prefix}/lib/php5 \
  292. --disable-all \
  293. --enable-pdo \
  294. %if "%{with_calendar}" == "yes"
  295. --enable-calendar \
  296. %endif
  297. %if "%{with_sqlite}" == "yes"
  298. --with-sqlite=%{l_prefix} \
  299. --with-pdo-sqlite=%{l_prefix} \
  300. %else
  301. --without-sqlite \
  302. %endif
  303. %if "%{with_mysql}" == "yes"
  304. --with-mysql=%{l_prefix} \
  305. --with-pdo-mysql=%{l_prefix} \
  306. %else
  307. --without-mysql \
  308. %endif
  309. %if "%{with_pgsql}" == "yes"
  310. --with-pgsql=%{l_prefix} \
  311. --with-pdo-pgsql=%{l_prefix} \
  312. %else
  313. --without-pgsql \
  314. %endif
  315. %if "%{with_gd}" == "yes"
  316. --with-gd=%{l_prefix} \
  317. --with-jpeg-dir=%{l_prefix} \
  318. --with-png-dir=%{l_prefix} \
  319. %endif
  320. %if "%{with_fastcgi}" == "yes"
  321. --enable-fastcgi \
  322. %else
  323. --disable-fastcgi \
  324. %endif
  325. %if "%{with_freetype}" == "yes"
  326. --enable-gd-native-ttf \
  327. --with-freetype-dir=%{l_prefix} \
  328. %endif
  329. %if "%{with_bdb}" == "yes"
  330. --with-db4=%{l_prefix} \
  331. %endif
  332. %if "%{with_zlib}" == "yes"
  333. --with-zlib=%{l_prefix} \
  334. --with-zlib-dir=%{l_prefix} \
  335. %endif
  336. %if "%{with_bzip2}" == "yes"
  337. --with-bz2=%{l_prefix} \
  338. %endif
  339. %if "%{with_ssl}" == "yes" || "%{with_openldap}" == "yes"
  340. --with-openssl=%{l_prefix} \
  341. %endif
  342. %if "%{with_openldap}" == "yes"
  343. --with-ldap=%{l_prefix} \
  344. %endif
  345. %if "%{with_mm}" == "yes"
  346. --with-mm=%{l_prefix} \
  347. --enable-session \
  348. %endif
  349. %if "%{with_pcre}" == "yes"
  350. --with-pcre-regex=%{l_prefix} \
  351. %endif
  352. %if "%{with_ftp}" == "yes"
  353. --enable-ftp \
  354. %endif
  355. %if "%{with_oci8}" == "yes"
  356. --with-oci8 \
  357. %endif
  358. %if "%{with_gettext}" == "yes"
  359. --with-gettext=%{l_prefix} \
  360. %endif
  361. %if "%{with_imap}" == "yes"
  362. --with-imap=%{l_prefix} \
  363. --with-imap-ssl=%{l_prefix} \
  364. %endif
  365. %if "%{with_xml}" == "yes"
  366. --enable-xml \
  367. --enable-libxml \
  368. --with-libxml-dir=%{l_prefix} \
  369. %else
  370. --disable-xml \
  371. %endif
  372. %if "%{with_xslt}" == "yes"
  373. --with-xsl=%{l_prefix} \
  374. %else
  375. --without-xsl \
  376. %endif
  377. %if "%{with_dom}" == "yes"
  378. --enable-dom \
  379. --with-libxml-dir=%{l_prefix} \
  380. %else
  381. --disable-dom \
  382. %endif
  383. %if "%{with_wddx}" == "yes"
  384. --enable-wddx \
  385. %endif
  386. %if "%{with_bc}" == "yes"
  387. --enable-bcmath \
  388. %endif
  389. %if "%{with_mhash}" == "yes"
  390. --with-mhash=%{l_prefix} \
  391. %endif
  392. %if "%{with_mcrypt}" == "yes"
  393. --with-mcrypt=%{l_prefix} \
  394. %endif
  395. %if "%{with_curl}" == "yes"
  396. --with-curl=%{l_prefix} \
  397. %endif
  398. %if "%{with_gdbm}" == "yes"
  399. --with-gdbm=%{l_prefix} \
  400. %endif
  401. %if "%{with_versioning}" == "yes"
  402. --enable-versioning \
  403. %endif
  404. %if "%{with_pear}" == "yes"
  405. --with-pear=%{l_prefix}/lib/php \
  406. %else
  407. --without-pear \
  408. %endif
  409. %if "%{with_snmp}" == "yes"
  410. --with-snmp=%{l_prefix} \
  411. --with-openssl-dir=%{l_prefix} \
  412. %endif
  413. %if "%{with_odbc}" == "yes"
  414. --with-unixODBC=%{l_prefix} \
  415. --with-pdo-odbc=unixODBC,%{l_prefix} \
  416. %endif
  417. %if "%{with_mbregex}" == "yes"
  418. --enable-mbregex \
  419. %endif
  420. %if "%{with_mbstring}" == "yes"
  421. --enable-mbstring \
  422. %endif
  423. %if "%{with_exif}" == "yes"
  424. --with-exif \
  425. %endif
  426. %if "%{with_iconv}" == "yes"
  427. --with-iconv=%{l_prefix} \
  428. %endif
  429. --enable-cli \
  430. --enable-cgi \
  431. --enable-force-cgi-redirect \
  432. --enable-discard-path \
  433. --enable-memory-limit
  434. # build package
  435. %{l_make} %{l_mflags}
  436. %install
  437. # install package
  438. rm -rf $RPM_BUILD_ROOT
  439. %{l_make} %{l_mflags} install INSTALL_ROOT=$RPM_BUILD_ROOT
  440. # install CLI version
  441. # ("make install" incorrectly installs the CGI version into bin/php!)
  442. %{l_shtool} mkdir -f -p -m 755 \
  443. $RPM_BUILD_ROOT%{l_prefix}/bin \
  444. $RPM_BUILD_ROOT%{l_prefix}/man/man1
  445. %{l_shtool} install -c -s -m 755 \
  446. sapi/cli/php $RPM_BUILD_ROOT%{l_prefix}/bin/php5
  447. %{l_shtool} install -c -m 644 \
  448. sapi/cli/php.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/php5.1
  449. # (re)install CGI version
  450. %{l_shtool} mkdir -f -p -m 755 \
  451. $RPM_BUILD_ROOT%{l_prefix}/cgi
  452. %{l_shtool} install -c -s -m 755 \
  453. sapi/cgi/php $RPM_BUILD_ROOT%{l_prefix}/cgi/php5
  454. # adjust paths
  455. mv $RPM_BUILD_ROOT%{l_prefix}/include/php \
  456. $RPM_BUILD_ROOT%{l_prefix}/include/php5
  457. %{l_shtool} subst \
  458. -e 's;/include/php;/include/php5;g' \
  459. $RPM_BUILD_ROOT%{l_prefix}/bin/phpize \
  460. $RPM_BUILD_ROOT%{l_prefix}/bin/php-config
  461. for bin in php-config phpize; do
  462. mv $RPM_BUILD_ROOT%{l_prefix}/bin/$bin \
  463. $RPM_BUILD_ROOT%{l_prefix}/bin/`echo $bin | sed -e 's;^php;php5;'`
  464. mv $RPM_BUILD_ROOT%{l_prefix}/man/man1/$bin.1 \
  465. $RPM_BUILD_ROOT%{l_prefix}/man/man1/`echo $bin.1 | sed -e 's;^php;php5;'`
  466. done
  467. # install default configuration file
  468. %{l_shtool} mkdir -f -p -m 755 \
  469. $RPM_BUILD_ROOT%{l_prefix}/etc/php5
  470. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  471. %{SOURCE php.ini} $RPM_BUILD_ROOT%{l_prefix}/etc/php5/
  472. # strip down installation
  473. rmdir $RPM_BUILD_ROOT%{l_prefix}/lib/php >/dev/null 2>&1 || true
  474. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  475. # determine installation files
  476. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
  477. '%config %{l_prefix}/etc/php5/*'
  478. %files -f files
  479. %clean
  480. rm -rf $RPM_BUILD_ROOT