apache-php7.spec 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592
  1. ##
  2. ## apache-php7.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2017 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ##
  5. ## Permission to use, copy, modify, and distribute this software for
  6. ## any purpose with or without fee is hereby granted, provided that
  7. ## the above copyright notice and this permission notice appear in all
  8. ## copies.
  9. ##
  10. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  11. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  12. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  13. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  14. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  15. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  16. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  17. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  18. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  19. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  20. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  21. ## SUCH DAMAGE.
  22. ##
  23. # package information
  24. Name: apache-php7
  25. Summary: Apache Extension: PHP Scripting Language (V7)
  26. URL: http://www.php.net/
  27. Vendor: The PHP Project
  28. Packager: OpenPKG Foundation e.V.
  29. Distribution: OpenPKG Community
  30. Class: BASE
  31. Group: Web
  32. License: PHP
  33. Version: 7.1.7
  34. Release: 20170723
  35. # package options
  36. %option with_bc no
  37. %option with_bdb no
  38. %option with_bzip2 no
  39. %option with_calendar no
  40. %option with_ctype no
  41. %option with_curl no
  42. %option with_debug no
  43. %option with_dom no
  44. %option with_exif no
  45. %option with_fileinfo no
  46. %option with_freetype no
  47. %option with_ftp no
  48. %option with_gd no
  49. %option with_gdbm no
  50. %option with_gettext no
  51. %option with_gmp no
  52. %option with_iconv no
  53. %option with_imap no
  54. %option with_intl no
  55. %option with_json no
  56. %option with_tokenizer no
  57. %option with_mbregex no
  58. %option with_mbstring no
  59. %option with_mcrypt no
  60. %option with_mhash no
  61. %option with_mm no
  62. %option with_mysql no
  63. %option with_oci8 no
  64. %option with_odbc no
  65. %option with_opcache no
  66. %option with_openldap no
  67. %option with_openldapsasl no
  68. %option with_pear no
  69. %option with_pgsql no
  70. %option with_phar no
  71. %option with_posix no
  72. %option with_sendmail no
  73. %option with_session no
  74. %option with_simplexml no
  75. %option with_snmp no
  76. %option with_soap no
  77. %option with_sockets no
  78. %option with_sqlite no
  79. %option with_ssl no
  80. %option with_tidy no
  81. %option with_versioning no
  82. %option with_wddx no
  83. %option with_xml no
  84. %option with_xslt no
  85. %option with_zlib no
  86. %option with_zip no
  87. # fixing implicit extension dependencies and correlations
  88. %if "%{with_mm}" == "yes"
  89. %undefine with_session
  90. %define with_session yes
  91. %endif
  92. %if "%{with_pear}" == "yes"
  93. %undefine with_xml
  94. %define with_xml yes
  95. %endif
  96. %if "%{with_freetype}" == "yes"
  97. %undefine with_gd
  98. %define with_gd yes
  99. %endif
  100. %if "%{with_gd}" == "yes" || "%{with_dom}" == "yes" || "%{with_zip}" == "yes"
  101. %undefine with_zlib
  102. %define with_zlib yes
  103. %endif
  104. %if "%{with_xslt}" == "yes"
  105. %undefine with_dom
  106. %define with_dom yes
  107. %endif
  108. %if "%{with_dom}" == "yes"
  109. %undefine with_xml
  110. %define with_xml yes
  111. %endif
  112. %if "%{with_soap}" == "yes"
  113. %undefine with_xml
  114. %define with_xml yes
  115. %endif
  116. %if "%{with_pgsql}" == "yes" || "%{with_mysql}" == "yes"
  117. %undefine with_ssl
  118. %define with_ssl yes
  119. %endif
  120. # list of sources
  121. Source0: http://static.php.net/www.php.net/distributions/php-%{version}.tar.bz2
  122. Source1: apache-php.ini
  123. Source2: apache-php.conf
  124. Patch0: apache-php7.patch
  125. # build information
  126. BuildPreReq: OpenPKG, openpkg >= 20160101, gcc, flex, bison
  127. PreReq: OpenPKG, openpkg >= 20160101
  128. BuildPreReq: apache
  129. PreReq: apache
  130. BuildPreReq: pcre
  131. PreReq: pcre
  132. %if "%{with_sqlite}" == "yes"
  133. BuildPreReq: sqlite
  134. PreReq: sqlite
  135. %endif
  136. %if "%{with_pgsql}" == "yes"
  137. BuildPreReq: postgresql
  138. PreReq: postgresql
  139. %endif
  140. %if "%{with_gd}" == "yes"
  141. BuildPreReq: gd >= 2.0.20, jpeg, png
  142. PreReq: gd >= 2.0.20, jpeg, png
  143. %endif
  144. %if "%{with_bdb}" == "yes"
  145. BuildPreReq: db
  146. PreReq: db
  147. %endif
  148. %if "%{with_zlib}" == "yes"
  149. BuildPreReq: zlib
  150. PreReq: zlib
  151. %endif
  152. %if "%{with_bzip2}" == "yes"
  153. BuildPreReq: bzip2
  154. PreReq: bzip2
  155. %endif
  156. %if "%{with_ssl}" == "yes"
  157. BuildPreReq: openssl
  158. PreReq: openssl
  159. %endif
  160. %if "%{with_openldap}" == "yes"
  161. BuildPreReq: openldap
  162. PreReq: openldap
  163. %if "%{with_openldapsasl}" == "yes"
  164. BuildPreReq: openldap::with_sasl = yes
  165. PreReq: openldap::with_sasl = yes
  166. %else
  167. BuildPreReq: openldap::with_sasl = no
  168. PreReq: openldap::with_sasl = no
  169. %endif
  170. %endif
  171. %if "%{with_mm}" == "yes"
  172. BuildPreReq: mm
  173. PreReq: mm
  174. %endif
  175. %if "%{with_freetype}" == "yes"
  176. BuildPreReq: freetype
  177. PreReq: freetype
  178. %endif
  179. %if "%{with_gettext}" == "yes"
  180. BuildPreReq: gettext, libiconv
  181. PreReq: gettext, libiconv
  182. %endif
  183. %if "%{with_iconv}" == "yes"
  184. BuildPreReq: libiconv
  185. PreReq: libiconv
  186. %endif
  187. %if "%{with_imap}" == "yes"
  188. BuildPreReq: imap, openssl
  189. PreReq: imap, openssl
  190. %endif
  191. %if "%{with_intl}" == "yes"
  192. BuildPreReq: icu
  193. PreReq: icu
  194. %endif
  195. %if "%{with_xml}" == "yes"
  196. BuildPreReq: libxml
  197. PreReq: libxml
  198. %endif
  199. %if "%{with_xslt}" == "yes"
  200. BuildPreReq: libxslt
  201. PreReq: libxslt
  202. %endif
  203. %if "%{with_dom}" == "yes"
  204. BuildPreReq: libxml, libxslt
  205. PreReq: libxml, libxslt
  206. %endif
  207. %if "%{with_curl}" == "yes"
  208. BuildPreReq: curl
  209. PreReq: curl
  210. %endif
  211. %if "%{with_mhash}" == "yes"
  212. BuildPreReq: mhash
  213. PreReq: mhash
  214. %endif
  215. %if "%{with_mcrypt}" == "yes"
  216. BuildPreReq: libmcrypt
  217. PreReq: libmcrypt
  218. %endif
  219. %if "%{with_gdbm}" == "yes"
  220. BuildPreReq: gdbm, gdbm::with_ndbm = yes
  221. PreReq: gdbm, gdbm::with_ndbm = yes
  222. %endif
  223. %if "%{with_oci8}" == "yes"
  224. BuildPreReq: oracle
  225. PreReq: oracle
  226. %endif
  227. %if "%{with_snmp}" == "yes"
  228. BuildPreReq: snmp
  229. PreReq: snmp
  230. %endif
  231. %if "%{with_odbc}" == "yes"
  232. BuildPreReq: unixodbc
  233. PreReq: unixodbc
  234. %endif
  235. %if "%{with_sendmail}" == "yes"
  236. BuildPreReq: MTA
  237. PreReq: MTA
  238. %endif
  239. %if "%{with_simplexml}" == "yes"
  240. BuildPreReq: libxml
  241. PreReq: libxml
  242. %endif
  243. %if "%{with_tidy}" == "yes"
  244. BuildPreReq: tidy
  245. PreReq: tidy
  246. %endif
  247. %if "%{with_gmp}" == "yes"
  248. BuildPreReq: gmp
  249. PreReq: gmp
  250. %endif
  251. Provides: apache-php
  252. %description
  253. PHP is an HTML-embedded scripting language. Much of its syntax is
  254. borrowed from C, Java and Perl with a couple of unique PHP-specific
  255. features thrown in. The goal of the language is to allow web
  256. developers to write dynamically generated pages quickly.
  257. This package provides a Dynamic Shared Object (DSO) for the Apache
  258. HTTP 2.2 web server. In general speaking, this module is also known
  259. as mod_php.
  260. %track
  261. prog apache-php7 = {
  262. version = %{version}
  263. url = http://www.php.net/downloads.php
  264. regex = php-(7\.\d+\.\d+)\.tar\.(bz2|gz)
  265. }
  266. %prep
  267. %setup -q -n php-%{version}
  268. %patch -p0
  269. %{l_shtool} subst \
  270. -e 's;-i -a -n php5;-i -n php5;' \
  271. configure
  272. %{l_shtool} subst \
  273. -e 's;\(/include/freetype\)2;\1;' \
  274. configure \
  275. ext/gd/config.m4
  276. %build
  277. # configure package
  278. case "%{l_platform -t}" in
  279. *-sunos5.10 ) cflags="%{l_cflags}" ;;
  280. * ) cflags="%{l_cflags -O}" ;;
  281. esac
  282. cppflags="%{l_cppflags}"
  283. ldflags="%{l_ldflags}"
  284. libs=""
  285. %if "%{with_freetype}" == "yes"
  286. cppflags="%{l_cppflags freetype .} $cppflags"
  287. %endif
  288. %if "%{with_gdbm}" == "yes"
  289. libs="$libs -lndbm -lgdbm"
  290. %endif
  291. %if "%{with_gd}" == "yes"
  292. libs="$libs -lpng -lz"
  293. %endif
  294. %if "%{with_gettext}" == "yes"
  295. libs="$libs -liconv"
  296. %endif
  297. %if "%{with_openldap}" == "yes" && "%{with_openldapsasl}" == "yes"
  298. libs="$libs -lsasl2"
  299. %endif
  300. %if "%{with_imap}" == "yes"
  301. libs="$libs -lssl -lcrypto"
  302. %endif
  303. %if "%{with_intl}" == "yes"
  304. cppflags="%{l_cppflags icu .} $cppflags"
  305. %endif
  306. %if "%{with_bdb}" == "yes"
  307. libs="$libs -ldb"
  308. %endif
  309. %if "%{with_pgsql}" == "yes"
  310. libs="$libs `pg_config --libs`"
  311. %endif
  312. %if "%{with_oci8}" == "yes"
  313. ORACLE_HOME="`%{l_rc} --query oracle_home`"
  314. export ORACLE_HOME
  315. %endif
  316. CC="%{l_cc}" \
  317. CFLAGS="$cflags" \
  318. CPPFLAGS="$cppflags" \
  319. LDFLAGS="$ldflags" \
  320. LIBS="$libs" \
  321. %if "%{with_sendmail}" == "yes"
  322. PROG_SENDMAIL="%{l_prefix}/sbin/sendmail" \
  323. %else
  324. PROG_SENDMAIL="`%{l_shtool} path false`" \
  325. %endif
  326. ./configure \
  327. --prefix=%{l_prefix} \
  328. --sysconfdir=%{l_prefix}/etc/apache \
  329. --with-config-file-path=%{l_prefix}/etc/apache \
  330. --libdir=%{l_prefix}/lib/php \
  331. --disable-all \
  332. --enable-pdo \
  333. --enable-filter \
  334. --with-pcre-regex=%{l_prefix} \
  335. %if "%{with_fileinfo}" == "yes"
  336. --enable-fileinfo \
  337. %endif
  338. %if "%{with_calendar}" == "yes"
  339. --enable-calendar \
  340. %endif
  341. %if "%{with_sqlite}" == "yes"
  342. --with-sqlite3=%{l_prefix} \
  343. --with-pdo-sqlite=%{l_prefix} \
  344. %else
  345. --without-pdo-sqlite \
  346. %endif
  347. %if "%{with_mysql}" == "yes"
  348. --with-mysqli=mysqlnd \
  349. --with-pdo-mysql=mysqlnd \
  350. --with-mysql-sock=%{l_prefix}/var/mysql/run/mysqld.sock \
  351. %else
  352. --without-mysqli \
  353. --without-pdo-mysql \
  354. %endif
  355. %if "%{with_pgsql}" == "yes"
  356. --with-pgsql=%{l_prefix} \
  357. --with-pdo-pgsql=%{l_prefix} \
  358. %else
  359. --without-pgsql \
  360. %endif
  361. %if "%{with_posix}" == "yes"
  362. --enable-posix \
  363. %endif
  364. %if "%{with_gd}" == "yes"
  365. --with-gd=yes \
  366. --with-jpeg-dir=%{l_prefix} \
  367. --with-png-dir=%{l_prefix} \
  368. %endif
  369. %if "%{with_gmp}" == "yes"
  370. --with-gmp=%{l_prefix} \
  371. %endif
  372. %if "%{with_freetype}" == "yes"
  373. --enable-gd-native-ttf \
  374. --with-freetype-dir=%{l_prefix} \
  375. %endif
  376. %if "%{with_bdb}" == "yes"
  377. --with-db4=%{l_prefix} \
  378. %endif
  379. %if "%{with_debug}" == "yes"
  380. --enable-debug \
  381. %else
  382. --disable-debug \
  383. %endif
  384. %if "%{with_zlib}" == "yes"
  385. --with-zlib=%{l_prefix} \
  386. --with-zlib-dir=%{l_prefix} \
  387. %endif
  388. %if "%{with_bzip2}" == "yes"
  389. --with-bz2=%{l_prefix} \
  390. %endif
  391. %if "%{with_ssl}" == "yes" || "%{with_openldap}" == "yes"
  392. --with-openssl=%{l_prefix} \
  393. %endif
  394. %if "%{with_openldap}" == "yes"
  395. --with-ldap=%{l_prefix} \
  396. %endif
  397. %if "%{with_session}" == "yes"
  398. --enable-session \
  399. %endif
  400. %if "%{with_mm}" == "yes"
  401. --with-mm=%{l_prefix} \
  402. %endif
  403. %if "%{with_ftp}" == "yes"
  404. --enable-ftp \
  405. %endif
  406. %if "%{with_oci8}" == "yes"
  407. --with-oci8 \
  408. %endif
  409. %if "%{with_gettext}" == "yes"
  410. --with-gettext=%{l_prefix} \
  411. %endif
  412. %if "%{with_imap}" == "yes"
  413. --with-imap=%{l_prefix} \
  414. --with-imap-ssl=%{l_prefix} \
  415. %endif
  416. %if "%{with_intl}" == "yes"
  417. --enable-intl \
  418. --with-icu-dir=%{l_prefix} \
  419. %endif
  420. %if "%{with_json}" == "yes"
  421. --enable-json \
  422. %else
  423. --disable-json \
  424. %endif
  425. %if "%{with_tokenizer}" == "yes"
  426. --enable-tokenizer \
  427. %else
  428. --disable-tokenizer \
  429. %endif
  430. %if "%{with_xml}" == "yes"
  431. --enable-xml \
  432. --enable-xmlreader \
  433. --enable-xmlwriter \
  434. --enable-libxml \
  435. --with-libxml-dir=%{l_prefix} \
  436. %else
  437. --disable-xml \
  438. %endif
  439. %if "%{with_xslt}" == "yes"
  440. --with-xsl=%{l_prefix} \
  441. %else
  442. --without-xsl \
  443. %endif
  444. %if "%{with_dom}" == "yes"
  445. --enable-dom \
  446. %else
  447. --disable-dom \
  448. %endif
  449. %if "%{with_wddx}" == "yes"
  450. --enable-wddx \
  451. %endif
  452. %if "%{with_soap}" == "yes"
  453. --enable-soap \
  454. %endif
  455. %if "%{with_bc}" == "yes"
  456. --enable-bcmath \
  457. %endif
  458. %if "%{with_mhash}" == "yes"
  459. --with-mhash=%{l_prefix} \
  460. %endif
  461. %if "%{with_mcrypt}" == "yes"
  462. --with-mcrypt=%{l_prefix} \
  463. %endif
  464. %if "%{with_ctype}" == "yes"
  465. --enable-ctype \
  466. %endif
  467. %if "%{with_curl}" == "yes"
  468. --with-curl=%{l_prefix} \
  469. %endif
  470. %if "%{with_gdbm}" == "yes"
  471. --with-gdbm=%{l_prefix} \
  472. %endif
  473. %if "%{with_versioning}" == "yes"
  474. --enable-versioning \
  475. %endif
  476. %if "%{with_pear}" == "yes"
  477. --with-pear=%{l_prefix}/lib/php \
  478. %else
  479. --without-pear \
  480. %endif
  481. %if "%{with_phar}" == "yes"
  482. --enable-phar \
  483. %else
  484. --disable-phar \
  485. %endif
  486. %if "%{with_sockets}" == "yes"
  487. --enable-sockets \
  488. %endif
  489. %if "%{with_simplexml}" == "yes"
  490. --enable-simplexml \
  491. --enable-libxml \
  492. --with-libxml-dir=%{l_prefix} \
  493. %else
  494. --disable-simplexml \
  495. %endif
  496. %if "%{with_snmp}" == "yes"
  497. --with-snmp=%{l_prefix} \
  498. --with-openssl-dir=%{l_prefix} \
  499. %endif
  500. %if "%{with_odbc}" == "yes"
  501. --with-unixODBC=%{l_prefix} \
  502. --with-pdo-odbc=unixODBC,%{l_prefix} \
  503. %endif
  504. %if "%{with_mbregex}" == "yes"
  505. --enable-mbregex \
  506. %endif
  507. %if "%{with_mbstring}" == "yes"
  508. --enable-mbstring \
  509. %endif
  510. %if "%{with_exif}" == "yes"
  511. --with-exif \
  512. %endif
  513. %if "%{with_iconv}" == "yes"
  514. --with-iconv=%{l_prefix} \
  515. %endif
  516. %if "%{with_tidy}" == "yes"
  517. --with-tidy=%{l_prefix} \
  518. %else
  519. --without-tidy \
  520. %endif
  521. %if "%{with_zip}" == "yes"
  522. --enable-zip \
  523. %endif
  524. %if "%{with_opcache}" == "yes"
  525. --enable-opcache \
  526. %endif
  527. --with-apxs2=%{l_prefix}/sbin/apxs \
  528. --disable-cli \
  529. --disable-cgi
  530. # build package
  531. %{l_make} %{l_mflags}
  532. %install
  533. # install package
  534. %{l_shtool} mkdir -f -p -m 755 \
  535. $RPM_BUILD_ROOT%{l_prefix}/etc/apache
  536. ( echo "#"
  537. echo "LoadModule foo_module modules/bar.so"
  538. echo "#"
  539. ) >$RPM_BUILD_ROOT%{l_prefix}/etc/apache/apache.conf
  540. %{l_make} %{l_mflags} install-sapi INSTALL_ROOT=$RPM_BUILD_ROOT
  541. mv $RPM_BUILD_ROOT%{l_prefix}/libexec/apache/libphp7.so \
  542. $RPM_BUILD_ROOT%{l_prefix}/libexec/apache/mod_php.so
  543. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/apache/apache.conf*
  544. # install default configuration file
  545. %{l_shtool} mkdir -f -p -m 755 \
  546. $RPM_BUILD_ROOT%{l_prefix}/etc/apache/apache.d
  547. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  548. %{SOURCE apache-php.ini} \
  549. $RPM_BUILD_ROOT%{l_prefix}/etc/apache/
  550. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  551. %{SOURCE apache-php.conf} \
  552. $RPM_BUILD_ROOT%{l_prefix}/etc/apache/apache.d/
  553. # create session storage directory
  554. %if "%{with_session}" == "yes"
  555. %{l_shtool} mkdir -f -p -m 755 \
  556. $RPM_BUILD_ROOT%{l_prefix}/var/apache/run/apache-php.session
  557. %endif
  558. # determine installation files
  559. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
  560. %if "%{with_session}" == "yes"
  561. '%attr(0750,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/apache/run/apache-php.session' \
  562. %endif
  563. '%config %{l_prefix}/etc/apache/apache-php.ini' \
  564. '%config %{l_prefix}/etc/apache/apache.d/apache-php.conf'
  565. %files -f files
  566. %clean
  567. %post
  568. # after upgrade, restart service
  569. [ $1 -eq 2 ] || exit 0
  570. eval `%{l_rc} apache status 2>/dev/null`
  571. [ ".$apache_active" = .yes ] && %{l_rc} apache restart
  572. exit 0