Gentoo Archives: gentoo-commits

From: Brian Evans <grknight@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/php/files/, dev-lang/php/
Date: Fri, 27 Apr 2018 02:21:57
Message-Id: 1524795698.86446552c92ba69dbad23b24a1254cf2fb7666f6.grknight@gentoo
1 commit: 86446552c92ba69dbad23b24a1254cf2fb7666f6
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Fri Apr 27 00:48:05 2018 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Fri Apr 27 02:21:38 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=86446552
7
8 dev-lang/php: Version bump for 5.6.36
9
10 Package-Manager: Portage-2.3.31, Repoman-2.3.9
11
12 dev-lang/php/Manifest | 1 +
13 .../php/files/5.6-mbstring-oniguruma-6.8.patch | 12 +
14 dev-lang/php/php-5.6.36.ebuild | 776 +++++++++++++++++++++
15 3 files changed, 789 insertions(+)
16
17 diff --git a/dev-lang/php/Manifest b/dev-lang/php/Manifest
18 index 2606ae4b12b..ee4e17e0877 100644
19 --- a/dev-lang/php/Manifest
20 +++ b/dev-lang/php/Manifest
21 @@ -1,6 +1,7 @@
22 DIST php-5.6.33.tar.xz 12465256 BLAKE2B a33ce429c1565e6304031304168aa63ce82fa6c0968fc5ef09f5955e43c04ebe112db92475a999f39d997e2a3c9724ece60902ef0db84e2599d97d0e42ce57d2 SHA512 c494721594511f79a103ea3c73c5035aa0fcbca626710a0b85d2395693caf6762edefa3347cd0f8567b186f98c0df7f83cd4c698b158f0f72aa62aabbbb4e297
23 DIST php-5.6.34.tar.xz 12465748 BLAKE2B 6b12f52a04d6b645d78f3d00617386a72fafffda24850e10f545464c9d0ca55321e91a292c3eb83409d0a303c4e37c2a686f547d86227c280ec78b428e73a92e SHA512 9aa02f943d6949a28ad96df5e75eec3ecab3731824400d0a0a8ccba9dee95b7af6421b38b86f352a45c778019ebfb1e6161a03256e4ef712341a9e0bad596ae7
24 DIST php-5.6.35.tar.xz 12466396 BLAKE2B 96757fc064c139f238329c51741538fdbdefd04abad59c37565e1882a5a7df7d3755cf496561336b25748a968fb18dbf9d542a54a672f553f4be5ead292141cc SHA512 dd7d891954aa7f8e83eecb265e1bb01dfd357092dad0cfc5a3f441bea069f7181cd79330653b178d4953ac1ee8570d7f4c21acc8fc67975dd7dc1413eaebf0af
25 +DIST php-5.6.36.tar.xz 12467560 BLAKE2B 8badaabc668ff3a4b1129f03605a1570729f8196d2e2539fe85bc42a628f2b24ea76c298b194e8466d9218ae98218243430c8d36d73fbd32b042dd6453510361 SHA512 807c68ab85b6685b19707bd18cfd46f3695b2dc67f9f17f85476634e4a80a036cb413ccae05ed5ba529eafe8df57ebf758dd664ed2942ec44f90a6e8b0172e5e
26 DIST php-7.0.27.tar.xz 11916824 BLAKE2B 9d2881a611435b3f9607e04d1f271ca497b8543792608f3690f00aa767fe8cc1f442822ae702076d21df0b56005d7b4e8e88b11ec6dd50d0bc198197b48cafda SHA512 1987ad5573fdcbd5c8d92fdbf5ba8dca6e9621d89d30f66a003338467e31f09f9e8ceb5cdcb2ddf24ec7aa5acf0c8e33c3774e586e7682667eb3ed148237d1bb
27 DIST php-7.0.28.tar.xz 11917836 BLAKE2B 8110b0486b0556abf2249d7cbdbd245249f32e230d8197e493edfdf8df38d8eac61b79b90983fa8a2918f67a5d80fefd9a213adff4c3eb760b3844e555614650 SHA512 054c765011d2ad5bb1ef2fd2d66df05f374032015869e69112b309a13b79f437de25e9692719110efbd79f33c677add36430dab21ae12231a7730207c9e877aa
28 DIST php-7.0.29.tar.xz 12400192 BLAKE2B 0bd1bd9450b87437e539ec5131cb4f7e4dbf76d5fd5212bdf34c4f022dd8f2d357e9a845d83b485d89469e20675c031bcf382a8ca348161dfd082d7a389ffcb2 SHA512 ea5a2fbcfc875dd2621e3f67038c1e00f43b53bc7079ae2127fcefbf116db0f32e34d4435f8211305402a4eccdaa5dfd6b96cf9416e68700f2c1f438d74a0af8
29
30 diff --git a/dev-lang/php/files/5.6-mbstring-oniguruma-6.8.patch b/dev-lang/php/files/5.6-mbstring-oniguruma-6.8.patch
31 new file mode 100644
32 index 00000000000..642b261950f
33 --- /dev/null
34 +++ b/dev-lang/php/files/5.6-mbstring-oniguruma-6.8.patch
35 @@ -0,0 +1,12 @@
36 +diff -aurN a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c
37 +--- a/ext/mbstring/php_mbregex.c 2018-03-28 17:28:58.000000000 -0400
38 ++++ b/ext/mbstring/php_mbregex.c 2018-04-04 12:53:23.268296387 -0400
39 +@@ -454,7 +454,7 @@
40 + OnigUChar err_str[ONIG_MAX_ERROR_MESSAGE_LEN];
41 +
42 + found = zend_hash_find(&MBREX(ht_rc), (char *)pattern, patlen+1, (void **) &rc);
43 +- if (found == FAILURE || (*rc)->options != options || (*rc)->enc != enc || (*rc)->syntax != syntax) {
44 ++ if (found == FAILURE || onig_get_options(*rc) != options || onig_get_encoding(*rc) != enc || onig_get_syntax(*rc) != syntax) {
45 + if ((err_code = onig_new(&retval, (OnigUChar *)pattern, (OnigUChar *)(pattern + patlen), options, enc, syntax, &err_info)) != ONIG_NORMAL) {
46 + onig_error_code_to_str(err_str, err_code, &err_info);
47 + php_error_docref(NULL TSRMLS_CC, E_WARNING, "mbregex compile err: %s", err_str);
48
49 diff --git a/dev-lang/php/php-5.6.36.ebuild b/dev-lang/php/php-5.6.36.ebuild
50 new file mode 100644
51 index 00000000000..97094f855af
52 --- /dev/null
53 +++ b/dev-lang/php/php-5.6.36.ebuild
54 @@ -0,0 +1,776 @@
55 +# Copyright 1999-2018 Gentoo Foundation
56 +# Distributed under the terms of the GNU General Public License v2
57 +
58 +EAPI=6
59 +
60 +inherit autotools flag-o-matic versionator systemd
61 +
62 +DESCRIPTION="The PHP language runtime engine"
63 +HOMEPAGE="https://secure.php.net/"
64 +SRC_URI="https://php.net/distributions/${P}.tar.xz"
65 +
66 +LICENSE="PHP-3.01
67 + BSD
68 + Zend-2.0
69 + bcmath? ( LGPL-2.1+ )
70 + fpm? ( BSD-2 )
71 + gd? ( gd )
72 + unicode? ( BSD-2 LGPL-2.1 )"
73 +
74 +SLOT="$(get_version_component_range 1-2)"
75 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
76 +
77 +# We can build the following SAPIs in the given order
78 +SAPIS="embed cli cgi fpm apache2"
79 +
80 +# SAPIs and SAPI-specific USE flags (cli SAPI is default on):
81 +IUSE="${IUSE}
82 + ${SAPIS/cli/+cli}
83 + threads"
84 +
85 +IUSE="${IUSE} acl bcmath berkdb bzip2 calendar cdb cjk
86 + coverage crypt +ctype curl debug
87 + enchant exif +fileinfo +filter firebird
88 + flatfile ftp gd gdbm gmp +hash +iconv imap inifile
89 + intl iodbc ipv6 +json kerberos ldap ldap-sasl libedit libressl
90 + mhash mssql mysql libmysqlclient mysqli nls
91 + oci8-instant-client odbc +opcache pcntl pdo +phar +posix postgres qdbm
92 + readline recode selinux +session sharedmem
93 + +simplexml snmp soap sockets spell sqlite ssl
94 + sybase-ct sysvipc systemd tidy +tokenizer truetype unicode vpx wddx
95 + +xml xmlreader xmlwriter xmlrpc xpm xslt zip zlib"
96 +
97 +# The supported (that is, autodetected) versions of BDB are listed in
98 +# the ./configure script. Other versions *work*, but we need to stick to
99 +# the ones that can be detected to avoid a repeat of bug #564824.
100 +COMMON_DEPEND="
101 + >=app-eselect/eselect-php-0.9.1[apache2?,fpm?]
102 + >=dev-libs/libpcre-8.32[unicode]
103 + fpm? ( acl? ( sys-apps/acl ) )
104 + apache2? ( || ( >=www-servers/apache-2.4[apache2_modules_unixd,threads=]
105 + <www-servers/apache-2.4[threads=] ) )
106 + berkdb? ( || ( sys-libs/db:5.3
107 + sys-libs/db:5.1
108 + sys-libs/db:4.8
109 + sys-libs/db:4.7
110 + sys-libs/db:4.6
111 + sys-libs/db:4.5 ) )
112 + bzip2? ( app-arch/bzip2:0= )
113 + cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
114 + cjk? ( !gd? (
115 + virtual/jpeg:0
116 + media-libs/libpng:0=
117 + sys-libs/zlib:0=
118 + ) )
119 + coverage? ( dev-util/lcov )
120 + crypt? ( >=dev-libs/libmcrypt-2.4 )
121 + curl? ( >=net-misc/curl-7.10.5 )
122 + enchant? ( app-text/enchant )
123 + exif? ( !gd? (
124 + virtual/jpeg:0
125 + media-libs/libpng:0=
126 + sys-libs/zlib:0=
127 + ) )
128 + firebird? ( dev-db/firebird )
129 + gd? ( virtual/jpeg:0 media-libs/libpng:0= sys-libs/zlib:0= )
130 + gdbm? ( >=sys-libs/gdbm-1.8.0:0= )
131 + gmp? ( dev-libs/gmp:0= )
132 + iconv? ( virtual/libiconv )
133 + imap? ( virtual/imap-c-client[kerberos=,ssl=] )
134 + intl? ( dev-libs/icu:= )
135 + iodbc? ( dev-db/libiodbc )
136 + kerberos? ( virtual/krb5 )
137 + ldap? ( >=net-nds/openldap-1.2.11 )
138 + ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 )
139 + libedit? ( || ( sys-freebsd/freebsd-lib dev-libs/libedit ) )
140 + mssql? ( dev-db/freetds[mssql] )
141 + libmysqlclient? (
142 + mysql? ( virtual/libmysqlclient:= )
143 + mysqli? ( virtual/libmysqlclient:= )
144 + )
145 + nls? ( sys-devel/gettext )
146 + oci8-instant-client? ( dev-db/oracle-instantclient-basic )
147 + odbc? ( >=dev-db/unixODBC-1.8.13 )
148 + postgres? ( dev-db/postgresql:* )
149 + qdbm? ( dev-db/qdbm )
150 + readline? ( sys-libs/readline:0= )
151 + recode? ( app-text/recode )
152 + sharedmem? ( dev-libs/mm )
153 + simplexml? ( >=dev-libs/libxml2-2.6.8 )
154 + snmp? ( >=net-analyzer/net-snmp-5.2 )
155 + soap? ( >=dev-libs/libxml2-2.6.8 )
156 + spell? ( >=app-text/aspell-0.50 )
157 + sqlite? ( >=dev-db/sqlite-3.7.6.3 )
158 + ssl? (
159 + !libressl? ( dev-libs/openssl:0= )
160 + libressl? ( dev-libs/libressl:0= )
161 + )
162 + sybase-ct? ( dev-db/freetds )
163 + tidy? ( app-text/htmltidy )
164 + truetype? (
165 + =media-libs/freetype-2*
166 + >=media-libs/t1lib-5.0.0
167 + !gd? (
168 + virtual/jpeg:0 media-libs/libpng:0= sys-libs/zlib:0= )
169 + )
170 + unicode? ( dev-libs/oniguruma:= )
171 + vpx? ( media-libs/libvpx:0= )
172 + wddx? ( >=dev-libs/libxml2-2.6.8 )
173 + xml? ( >=dev-libs/libxml2-2.6.8 )
174 + xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv )
175 + xmlreader? ( >=dev-libs/libxml2-2.6.8 )
176 + xmlwriter? ( >=dev-libs/libxml2-2.6.8 )
177 + xpm? (
178 + x11-libs/libXpm
179 + virtual/jpeg:0
180 + media-libs/libpng:0= sys-libs/zlib:0=
181 + )
182 + xslt? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
183 + zip? ( sys-libs/zlib:0= )
184 + zlib? ( sys-libs/zlib:0= )
185 +"
186 +
187 +RDEPEND="${COMMON_DEPEND}
188 + virtual/mta
189 + fpm? (
190 + selinux? ( sec-policy/selinux-phpfpm )
191 + systemd? ( sys-apps/systemd ) )"
192 +
193 +DEPEND="${COMMON_DEPEND}
194 + app-arch/xz-utils
195 + >=sys-devel/bison-3.0.1
196 + sys-devel/flex
197 + >=sys-devel/m4-1.4.3
198 + >=sys-devel/libtool-1.5.18"
199 +
200 +# Without USE=readline or libedit, the interactive "php -a" CLI will hang.
201 +REQUIRED_USE="
202 + || ( cli cgi fpm apache2 embed )
203 + cli? ( ^^ ( readline libedit ) )
204 + truetype? ( gd )
205 + vpx? ( gd )
206 + cjk? ( gd )
207 + exif? ( gd )
208 + xpm? ( gd )
209 + gd? ( zlib )
210 + simplexml? ( xml )
211 + soap? ( xml )
212 + wddx? ( xml )
213 + xmlrpc? ( || ( xml iconv ) )
214 + xmlreader? ( xml )
215 + xslt? ( xml )
216 + ldap-sasl? ( ldap )
217 + mhash? ( hash )
218 + phar? ( hash )
219 + recode? ( !imap !mysql !mysqli !libmysqlclient )
220 + libmysqlclient? ( || (
221 + mysql
222 + mysqli
223 + pdo
224 + ) )
225 +
226 + qdbm? ( !gdbm )
227 + readline? ( !libedit )
228 + sharedmem? ( !threads )
229 +"
230 +
231 +PHP_MV="$(get_major_version)"
232 +
233 +php_install_ini() {
234 + local phpsapi="${1}"
235 +
236 + # work out where we are installing the ini file
237 + php_set_ini_dir "${phpsapi}"
238 +
239 + # Always install the production INI file, bug 611214.
240 + local phpinisrc="php.ini-production-${phpsapi}"
241 + cp php.ini-production "${phpinisrc}" || die
242 +
243 + # default to /tmp for save_path, bug #282768
244 + sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}" || die
245 +
246 + # Set the extension dir
247 + sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" \
248 + -i "${phpinisrc}" || die
249 +
250 + # Set the include path to point to where we want to find PEAR packages
251 + sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}" || die
252 +
253 + dodir "${PHP_INI_DIR#${EPREFIX}}"
254 + insinto "${PHP_INI_DIR#${EPREFIX}}"
255 + newins "${phpinisrc}" php.ini
256 +
257 + elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
258 + elog
259 +
260 + dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
261 + dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
262 +
263 + if use opcache; then
264 + elog "Adding opcache to $PHP_EXT_INI_DIR"
265 + echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> \
266 + "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
267 + dosym "${PHP_EXT_INI_DIR#${EPREFIX}}/opcache.ini" \
268 + "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
269 + fi
270 +
271 + # SAPI-specific handling
272 + if [[ "${sapi}" == "fpm" ]] ; then
273 + einfo "Installing FPM config file php-fpm.conf"
274 + insinto "${PHP_INI_DIR#${EPREFIX}}"
275 + doins sapi/fpm/php-fpm.conf
276 + fi
277 +
278 + dodoc php.ini-{development,production}
279 +}
280 +
281 +php_set_ini_dir() {
282 + PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
283 + PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
284 + PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
285 +}
286 +
287 +src_prepare() {
288 + eapply "${FILESDIR}/php-${SLOT}-no-bison-warnings.patch"
289 + eapply "${FILESDIR}/5.6-mbstring-oniguruma-6.8.patch"
290 +
291 + # Change PHP branding
292 + # Get the alpha/beta/rc version
293 + sed -re "s|^(PHP_EXTRA_VERSION=\").*(\")|\1-pl${PR/r/}-gentoo\2|g" \
294 + -i configure.in || die "Unable to change PHP branding"
295 +
296 + # Patch PHP to show Gentoo as the server platform
297 + sed -e 's/PHP_UNAME=`uname -a | xargs`/PHP_UNAME=`uname -s -n -r -v | xargs`/g' \
298 + -i configure.in || die "Failed to fix server platform name"
299 +
300 + # Prevent PHP from activating the Apache config,
301 + # as we will do that ourselves
302 + sed -i \
303 + -e "s,-i -a -n php${PHP_MV},-i -n php${PHP_MV},g" \
304 + -e "s,-i -A -n php${PHP_MV},-i -n php${PHP_MV},g" \
305 + configure sapi/apache2filter/config.m4 sapi/apache2handler/config.m4 \
306 + || die
307 +
308 + # Patch PHP to support heimdal instead of mit-krb5
309 + if has_version "app-crypt/heimdal" ; then
310 + sed -e 's|gssapi_krb5|gssapi|g' -i acinclude.m4 \
311 + || die "Failed to fix heimdal libname"
312 + sed -e 's|PHP_ADD_LIBRARY(k5crypto, 1, $1)||g' -i acinclude.m4 \
313 + || die "Failed to fix heimdal crypt library reference"
314 + fi
315 +
316 + eapply_user
317 +
318 + # Force rebuilding aclocal.m4
319 + rm -f aclocal.m4 || die "failed to remove aclocal.m4 in src_prepare"
320 + eautoreconf
321 +
322 + if [[ ${CHOST} == *-darwin* ]] ; then
323 + # http://bugs.php.net/bug.php?id=48795, bug #343481
324 + sed -i -e '/BUILD_CGI="\\$(CC)/s/CC/CXX/' configure || die
325 + fi
326 +}
327 +
328 +src_configure() {
329 + addpredict /usr/share/snmp/mibs/.index
330 + addpredict /var/lib/net-snmp/mib_indexes
331 +
332 + PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
333 +
334 + # The php-fpm config file wants localstatedir to be ${EPREFIX}/var
335 + # and not the Gentoo default ${EPREFIX}/var/lib. See bug 572002.
336 + local our_conf=(
337 + --prefix="${PHP_DESTDIR}"
338 + --mandir="${PHP_DESTDIR}/man"
339 + --infodir="${PHP_DESTDIR}/info"
340 + --libdir="${PHP_DESTDIR}/lib"
341 + --with-libdir="$(get_libdir)"
342 + --localstatedir="${EPREFIX}/var"
343 + --without-pear
344 + $(use_enable threads maintainer-zts)
345 + )
346 +
347 + our_conf+=(
348 + $(use_enable bcmath bcmath)
349 + $(use_with bzip2 bz2 "${EPREFIX}/usr")
350 + $(use_enable calendar calendar)
351 + $(use_enable coverage gcov)
352 + $(use_enable ctype ctype)
353 + $(use_with curl curl "${EPREFIX}/usr")
354 + $(use_enable xml dom)
355 + $(use_with enchant enchant "${EPREFIX}/usr")
356 + $(use_enable exif exif)
357 + $(use_enable fileinfo fileinfo)
358 + $(use_enable filter filter)
359 + $(use_enable ftp ftp)
360 + $(use_with nls gettext "${EPREFIX}/usr")
361 + $(use_with gmp gmp "${EPREFIX}/usr")
362 + $(use_enable hash hash)
363 + $(use_with mhash mhash "${EPREFIX}/usr")
364 + $(use_with iconv iconv \
365 + $(use elibc_glibc || use elibc_musl || use elibc_FreeBSD || echo "${EPREFIX}/usr"))
366 + $(use_enable intl intl)
367 + $(use_enable ipv6 ipv6)
368 + $(use_enable json json)
369 + $(use_with kerberos kerberos "${EPREFIX}/usr")
370 + $(use_enable xml libxml)
371 + $(use_with xml libxml-dir "${EPREFIX}/usr")
372 + $(use_enable unicode mbstring)
373 + $(use_with crypt mcrypt "${EPREFIX}/usr")
374 + $(use_with mssql mssql "${EPREFIX}/usr")
375 + $(use_with unicode onig "${EPREFIX}/usr")
376 + $(use_with ssl openssl "${EPREFIX}/usr")
377 + $(use_with ssl openssl-dir "${EPREFIX}/usr")
378 + $(use_enable pcntl pcntl)
379 + $(use_enable phar phar)
380 + $(use_enable pdo pdo)
381 + $(use_enable opcache opcache)
382 + $(use_with postgres pgsql "${EPREFIX}/usr")
383 + $(use_enable posix posix)
384 + $(use_with spell pspell "${EPREFIX}/usr")
385 + $(use_with recode recode "${EPREFIX}/usr")
386 + $(use_enable simplexml simplexml)
387 + $(use_enable sharedmem shmop)
388 + $(use_with snmp snmp "${EPREFIX}/usr")
389 + $(use_enable soap soap)
390 + $(use_enable sockets sockets)
391 + $(use_with sqlite sqlite3 "${EPREFIX}/usr")
392 + $(use_with sybase-ct sybase-ct "${EPREFIX}/usr")
393 + $(use_enable sysvipc sysvmsg)
394 + $(use_enable sysvipc sysvsem)
395 + $(use_enable sysvipc sysvshm)
396 + $(use_with tidy tidy "${EPREFIX}/usr")
397 + $(use_enable tokenizer tokenizer)
398 + $(use_enable wddx wddx)
399 + $(use_enable xml xml)
400 + $(use_enable xmlreader xmlreader)
401 + $(use_enable xmlwriter xmlwriter)
402 + $(use_with xmlrpc xmlrpc)
403 + $(use_with xslt xsl "${EPREFIX}/usr")
404 + $(use_enable zip zip)
405 + $(use_with zlib zlib "${EPREFIX}/usr")
406 + $(use_enable debug debug)
407 + )
408 +
409 + # DBA support
410 + if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
411 + || use qdbm ; then
412 + our_conf+=( "--enable-dba${shared}" )
413 + fi
414 +
415 + # DBA drivers support
416 + our_conf+=(
417 + $(use_with cdb cdb)
418 + $(use_with berkdb db4 "${EPREFIX}/usr")
419 + $(use_enable flatfile flatfile)
420 + $(use_with gdbm gdbm "${EPREFIX}/usr")
421 + $(use_enable inifile inifile)
422 + $(use_with qdbm qdbm "${EPREFIX}/usr")
423 + )
424 +
425 + # Support for the GD graphics library
426 + our_conf+=(
427 + $(use_with truetype freetype-dir "${EPREFIX}/usr")
428 + $(use_with truetype t1lib "${EPREFIX}/usr")
429 + $(use_enable cjk gd-jis-conv)
430 + $(use_with gd jpeg-dir "${EPREFIX}/usr")
431 + $(use_with gd png-dir "${EPREFIX}/usr")
432 + $(use_with xpm xpm-dir "${EPREFIX}/usr")
433 + $(use_with vpx vpx-dir "${EPREFIX}/usr")
434 + )
435 + # enable gd last, so configure can pick up the previous settings
436 + our_conf+=( $(use_with gd gd) )
437 +
438 + # IMAP support
439 + if use imap ; then
440 + our_conf+=(
441 + $(use_with imap imap "${EPREFIX}/usr")
442 + $(use_with ssl imap-ssl "${EPREFIX}/usr")
443 + )
444 + fi
445 +
446 + # Interbase/firebird support
447 + our_conf+=( $(use_with firebird interbase "${EPREFIX}/usr") )
448 +
449 + # LDAP support
450 + if use ldap ; then
451 + our_conf+=(
452 + $(use_with ldap ldap "${EPREFIX}/usr")
453 + $(use_with ldap-sasl ldap-sasl "${EPREFIX}/usr")
454 + )
455 + fi
456 +
457 + # MySQL support
458 + local mysqllib="mysqlnd"
459 + local mysqlilib="mysqlnd"
460 + use libmysqlclient && mysqllib="${EPREFIX}/usr"
461 + use libmysqlclient && mysqlilib="${EPREFIX}/usr/bin/mysql_config"
462 +
463 + our_conf+=( $(use_with mysql mysql "${mysqllib}") )
464 + our_conf+=( $(use_with mysqli mysqli "${mysqlilib}") )
465 +
466 + local mysqlsock="${EPREFIX}/var/run/mysqld/mysqld.sock"
467 + if use mysql || use mysqli ; then
468 + our_conf+=( $(use_with mysql mysql-sock "${mysqlsock}") )
469 + fi
470 +
471 + # ODBC support
472 + our_conf+=(
473 + $(use_with odbc unixODBC "${EPREFIX}/usr")
474 + $(use_with iodbc iodbc "${EPREFIX}/usr")
475 + )
476 +
477 + # Oracle support
478 + our_conf+=( $(use_with oci8-instant-client oci8) )
479 +
480 + # PDO support
481 + if use pdo ; then
482 + our_conf+=(
483 + $(use_with mssql pdo-dblib)
484 + $(use_with mysql pdo-mysql "${mysqllib}")
485 + $(use_with postgres pdo-pgsql)
486 + $(use_with sqlite pdo-sqlite "${EPREFIX}/usr")
487 + $(use_with firebird pdo-firebird "${EPREFIX}/usr")
488 + $(use_with odbc pdo-odbc "unixODBC,${EPREFIX}/usr")
489 + $(use_with oci8-instant-client pdo-oci)
490 + )
491 + fi
492 +
493 + # readline/libedit support
494 + our_conf+=(
495 + $(use_with readline readline "${EPREFIX}/usr")
496 + $(use_with libedit libedit "${EPREFIX}/usr")
497 + )
498 +
499 + # Session support
500 + if use session ; then
501 + our_conf+=( $(use_with sharedmem mm "${EPREFIX}/usr") )
502 + else
503 + our_conf+=( $(use_enable session session) )
504 + fi
505 +
506 + # Use pic for shared modules such as apache2's mod_php
507 + our_conf+=( --with-pic )
508 +
509 + # we use the system copy of pcre
510 + # --with-pcre-regex affects ext/pcre
511 + # --with-pcre-dir affects ext/filter and ext/zip
512 + our_conf+=(
513 + --with-pcre-regex="${EPREFIX}/usr"
514 + --with-pcre-dir="${EPREFIX}/usr"
515 + )
516 +
517 + # Catch CFLAGS problems
518 + # Fixes bug #14067.
519 + # Changed order to run it in reverse for bug #32022 and #12021.
520 + replace-cpu-flags "k6*" "i586"
521 +
522 + # Cache the ./configure test results between SAPIs.
523 + our_conf+=( --cache-file="${T}/config.cache" )
524 +
525 + # Support user-passed configuration parameters
526 + our_conf+=( ${EXTRA_ECONF:-} )
527 +
528 + # Support the Apache2 extras, they must be set globally for all
529 + # SAPIs to work correctly, especially for external PHP extensions
530 +
531 + mkdir -p "${WORKDIR}/sapis-build" || die
532 + for one_sapi in $SAPIS ; do
533 + use "${one_sapi}" || continue
534 + php_set_ini_dir "${one_sapi}"
535 +
536 + # The BUILD_DIR variable is used to determine where to output
537 + # the files that autotools creates. This was all originally
538 + # based on the autotools-utils eclass.
539 + BUILD_DIR="${WORKDIR}/sapis-build/${one_sapi}"
540 + cp -a "${S}" "${BUILD_DIR}" || die
541 + cd "${BUILD_DIR}" || die
542 +
543 + local sapi_conf=(
544 + --with-config-file-path="${PHP_INI_DIR}"
545 + --with-config-file-scan-dir="${PHP_EXT_INI_DIR_ACTIVE}"
546 + )
547 +
548 + for sapi in $SAPIS ; do
549 + case "$sapi" in
550 + cli|cgi|embed|fpm)
551 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
552 + sapi_conf+=( "--enable-${sapi}" )
553 + if [[ "fpm" == "${sapi}" ]] ; then
554 + sapi_conf+=(
555 + $(use_with acl fpm-acl)
556 + $(use_with systemd fpm-systemd)
557 + )
558 + fi
559 + else
560 + sapi_conf+=( "--disable-${sapi}" )
561 + fi
562 + ;;
563 +
564 + apache2)
565 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
566 + sapi_conf+=( --with-apxs2="${EPREFIX}/usr/bin/apxs" )
567 + else
568 + sapi_conf+=( --without-apxs2 )
569 + fi
570 + ;;
571 + esac
572 + done
573 +
574 + # Construct the $myeconfargs array by concatenating $our_conf
575 + # (the common args) and $sapi_conf (the SAPI-specific args).
576 + local myeconfargs=( "${our_conf[@]}" )
577 + myeconfargs+=( "${sapi_conf[@]}" )
578 +
579 + pushd "${BUILD_DIR}" > /dev/null || die
580 + econf "${myeconfargs[@]}"
581 + popd > /dev/null || die
582 + done
583 +}
584 +
585 +src_compile() {
586 + # snmp seems to run during src_compile, too (bug #324739)
587 + addpredict /usr/share/snmp/mibs/.index
588 + addpredict /var/lib/net-snmp/mib_indexes
589 +
590 + for sapi in ${SAPIS} ; do
591 + if use "${sapi}"; then
592 + cd "${WORKDIR}/sapis-build/$sapi" || \
593 + die "Failed to change dir to ${WORKDIR}/sapis-build/$1"
594 + emake
595 + fi
596 + done
597 +}
598 +
599 +src_install() {
600 + # see bug #324739 for what happens when we don't have that
601 + addpredict /usr/share/snmp/mibs/.index
602 +
603 + # grab the first SAPI that got built and install common files from there
604 + local first_sapi=""
605 + for sapi in $SAPIS ; do
606 + if use $sapi ; then
607 + first_sapi=$sapi
608 + break
609 + fi
610 + done
611 +
612 + # Makefile forgets to create this before trying to write to it...
613 + dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
614 +
615 + # Install php environment (without any sapis)
616 + cd "${WORKDIR}/sapis-build/$first_sapi" || die
617 + emake INSTALL_ROOT="${D}" \
618 + install-build install-headers install-programs
619 +
620 + local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
621 +
622 + # Create the directory where we'll put version-specific php scripts
623 + keepdir "/usr/share/php${PHP_MV}"
624 +
625 + local sapi="", file=""
626 + local sapi_list=""
627 +
628 + for sapi in ${SAPIS}; do
629 + if use "${sapi}" ; then
630 + einfo "Installing SAPI: ${sapi}"
631 + cd "${WORKDIR}/sapis-build/${sapi}" || die
632 +
633 + if [[ "${sapi}" == "apache2" ]] ; then
634 + # We're specifically not using emake install-sapi as libtool
635 + # may cause unnecessary relink failures (see bug #351266)
636 + insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
637 + newins ".libs/libphp5$(get_libname)" \
638 + "libphp${PHP_MV}$(get_libname)"
639 + keepdir "/usr/$(get_libdir)/apache2/modules"
640 + else
641 + # needed each time, php_install_ini would reset it
642 + local dest="${PHP_DESTDIR#${EPREFIX}}"
643 + into "${dest}"
644 + case "$sapi" in
645 + cli)
646 + source="sapi/cli/php"
647 + ;;
648 + cgi)
649 + source="sapi/cgi/php-cgi"
650 + ;;
651 + fpm)
652 + source="sapi/fpm/php-fpm"
653 + ;;
654 + embed)
655 + source="libs/libphp${PHP_MV}$(get_libname)"
656 + ;;
657 + *)
658 + die "unhandled sapi in src_install"
659 + ;;
660 + esac
661 +
662 + if [[ "${source}" == *"$(get_libname)" ]]; then
663 + dolib.so "${source}"
664 + else
665 + dobin "${source}"
666 + local name="$(basename ${source})"
667 + dosym "${dest}/bin/${name}" "/usr/bin/${name}${SLOT}"
668 + fi
669 + fi
670 +
671 + php_install_ini "${sapi}"
672 +
673 + # construct correct SAPI string for php-config
674 + # thanks to ferringb for the bash voodoo
675 + if [[ "${sapi}" == "apache2" ]]; then
676 + sapi_list="${sapi_list:+${sapi_list} }apache2handler"
677 + else
678 + sapi_list="${sapi_list:+${sapi_list} }${sapi}"
679 + fi
680 + fi
681 + done
682 +
683 + # Installing opcache module
684 + if use opcache ; then
685 + into "${PHP_DESTDIR#${EPREFIX}}"
686 + dolib.so "modules/opcache$(get_libname)"
687 + fi
688 +
689 + # Install env.d files
690 + newenvd "${FILESDIR}/20php5-envd" "20php${SLOT}"
691 + sed -e "s|/lib/|/$(get_libdir)/|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
692 + sed -e "s|php5|php${SLOT}|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
693 +
694 + # set php-config variable correctly (bug #278439)
695 + sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
696 + "${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config" || die
697 +
698 + if use fpm ; then
699 + if use systemd; then
700 + systemd_newunit "${FILESDIR}/php-fpm_at.service" \
701 + "php-fpm@${SLOT}.service"
702 + else
703 + systemd_newunit "${FILESDIR}/php-fpm_at-simple.service" \
704 + "php-fpm@${SLOT}.service"
705 + fi
706 + fi
707 +}
708 +
709 +src_test() {
710 + echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
711 + PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php"
712 + if [[ ! -x "${PHP_BIN}" ]] ; then
713 + ewarn "Test phase requires USE=cli, skipping"
714 + return
715 + else
716 + export TEST_PHP_EXECUTABLE="${PHP_BIN}"
717 + fi
718 +
719 + if [[ -x "${WORKDIR}/sapis/cgi/php-cgi" ]] ; then
720 + export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis/cgi/php-cgi"
721 + fi
722 +
723 + REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d \
724 + "session.save_path=${T}" \
725 + "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d \
726 + "session.save_path=${T}"
727 +
728 + for name in ${EXPECTED_TEST_FAILURES}; do
729 + mv "${name}.out" "${name}.out.orig" 2>/dev/null || die
730 + done
731 +
732 + local failed="$(find -name '*.out')"
733 + if [[ ${failed} != "" ]] ; then
734 + ewarn "The following test cases failed unexpectedly:"
735 + for name in ${failed}; do
736 + ewarn " ${name/.out/}"
737 + done
738 + else
739 + einfo "No unexpected test failures, all fine"
740 + fi
741 +
742 + if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
743 + local passed=""
744 + for name in ${EXPECTED_TEST_FAILURES}; do
745 + [[ -f "${name}.diff" ]] && continue
746 + passed="${passed} ${name}"
747 + done
748 + if [[ ${passed} != "" ]] ; then
749 + einfo "The following test cases passed unexpectedly:"
750 + for name in ${passed}; do
751 + ewarn " ${passed}"
752 + done
753 + else
754 + einfo "None of the known-to-fail tests passed, all fine"
755 + fi
756 + fi
757 +}
758 +
759 +pkg_postinst() {
760 + # Output some general info to the user
761 + if use apache2 ; then
762 + elog
763 + elog "To enable PHP in apache, you will need to add \"-D PHP\" to"
764 + elog "your apache2 command. OpenRC users can append that string to"
765 + elog "APACHE2_OPTS in /etc/conf.d/apache2."
766 + elog
767 + elog "The apache module configuration file 70_mod_php.conf is"
768 + elog "provided (and maintained) by eselect-php."
769 + elog
770 + fi
771 +
772 + # Create the symlinks for php
773 + for m in ${SAPIS}; do
774 + [[ ${m} == 'embed' ]] && continue;
775 + if use $m ; then
776 + local ci=$(eselect php show $m)
777 + if [[ -z $ci ]]; then
778 + eselect php set $m php${SLOT} || die
779 + einfo "Switched ${m} to use php:${SLOT}"
780 + einfo
781 + elif [[ $ci != "php${SLOT}" ]] ; then
782 + elog "To switch $m to use php:${SLOT}, run"
783 + elog " eselect php set $m php${SLOT}"
784 + elog
785 + fi
786 + fi
787 + done
788 +
789 + # Remove dead symlinks for SAPIs that were just disabled. For
790 + # example, if the user has the cgi SAPI enabled, then he has an
791 + # eselect-php symlink for it. If he later reinstalls PHP with
792 + # USE="-cgi", that symlink will break. This call to eselect is
793 + # supposed to remove that dead link per bug 572436.
794 + eselect php cleanup || die
795 +
796 + if ! has "php${SLOT/./-}" ${PHP_TARGETS}; then
797 + elog "To build extensions for this version of PHP, you will need to"
798 + elog "add php${SLOT/./-} to your PHP_TARGETS USE_EXPAND variable."
799 + elog
800 + fi
801 +
802 + # Warn about the removal of PHP_INI_VERSION if the user has it set.
803 + if [[ -n "${PHP_INI_VERSION}" ]]; then
804 + ewarn 'The PHP_INI_VERSION variable has been phased out. You may'
805 + ewarn 'remove it from your configuration at your convenience. See'
806 + ewarn
807 + ewarn ' https://bugs.gentoo.org/611214'
808 + ewarn
809 + ewarn 'for more information.'
810 + fi
811 +
812 + elog "For details on how version slotting works, please see"
813 + elog "the wiki:"
814 + elog
815 + elog " https://wiki.gentoo.org/wiki/PHP"
816 + elog
817 +}
818 +
819 +pkg_postrm() {
820 + # This serves two purposes. First, if we have just removed the last
821 + # installed version of PHP, then this will remove any dead symlinks
822 + # belonging to eselect-php. Second, if a user upgrades slots from
823 + # (say) 5.6 to 7.0 and depcleans the old slot, then this will update
824 + # his existing symlinks to point to the new 7.0 installation. The
825 + # latter is bug 432962.
826 + #
827 + # Note: the eselect-php package may not be installed at this point,
828 + # so we can't die() if this command fails.
829 + eselect php cleanup
830 +}