Gentoo Archives: gentoo-commits

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