1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit flag-o-matic systemd autotools
9 DESCRIPTION="The PHP language runtime engine"
10 HOMEPAGE="https://www.php.net/"
11 SRC_URI="https://www.php.net/distributions/${P}.tar.xz"
19 unicode? ( BSD-2 LGPL-2.1 )"
22 KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ppc ppc64 ~s390 ~sh sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
24 S="${WORKDIR}/${PN}-${MY_PV}"
26 # We can build the following SAPIs in the given order
27 SAPIS="embed cli cgi fpm apache2 phpdbg"
29 # SAPIs and SAPI-specific USE flags (cli SAPI is default on):
34 IUSE="${IUSE} acl argon2 bcmath berkdb bzip2 calendar cdb cjk
35 coverage +ctype curl debug
36 enchant exif +fileinfo +filter firebird
37 +flatfile ftp gd gdbm gmp +hash +iconv imap inifile
38 intl iodbc ipv6 +json kerberos ldap ldap-sasl libedit libressl lmdb
39 mhash mssql mysql mysqli nls
40 oci8-instant-client odbc +opcache pcntl pdo +phar +posix postgres qdbm
41 readline recode selinux +session session-mm sharedmem
42 +simplexml snmp soap sockets sodium spell sqlite ssl
43 sysvipc systemd test tidy +tokenizer tokyocabinet truetype unicode wddx webp
44 +xml xmlreader xmlwriter xmlrpc xpm xslt zip zip-encryption zlib"
46 # The supported (that is, autodetected) versions of BDB are listed in
47 # the ./configure script. Other versions *work*, but we need to stick to
48 # the ones that can be detected to avoid a repeat of bug #564824.
50 >=app-eselect/eselect-php-0.9.1[apache2?,fpm?]
51 >=dev-libs/libpcre2-10.30[unicode]
52 fpm? ( acl? ( sys-apps/acl ) )
53 apache2? ( www-servers/apache[apache2_modules_unixd(+),threads=] )
54 argon2? ( app-crypt/argon2:= )
55 berkdb? ( || ( sys-libs/db:5.3
61 bzip2? ( app-arch/bzip2:0= )
62 cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
63 coverage? ( dev-util/lcov )
64 curl? ( >=net-misc/curl-7.10.5 )
65 enchant? ( <app-text/enchant-2.0:0 )
66 firebird? ( dev-db/firebird )
67 gd? ( virtual/jpeg:0 media-libs/libpng:0= >=sys-libs/zlib-1.2.0.4 )
68 gdbm? ( >=sys-libs/gdbm-1.8.0:0= )
69 gmp? ( dev-libs/gmp:0= )
70 iconv? ( virtual/libiconv )
71 imap? ( >=virtual/imap-c-client-2[kerberos=,ssl=] )
72 intl? ( dev-libs/icu:= )
73 iodbc? ( dev-db/libiodbc )
74 kerberos? ( virtual/krb5 )
75 ldap? ( >=net-nds/openldap-1.2.11 )
76 ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 )
77 libedit? ( dev-libs/libedit )
78 lmdb? ( dev-db/lmdb:= )
79 mssql? ( dev-db/freetds[mssql] )
80 nls? ( sys-devel/gettext )
81 oci8-instant-client? ( dev-db/oracle-instantclient-basic )
82 odbc? ( >=dev-db/unixODBC-1.8.13 )
83 postgres? ( dev-db/postgresql:* )
85 readline? ( sys-libs/readline:0= )
86 recode? ( app-text/recode )
87 session-mm? ( dev-libs/mm )
88 simplexml? ( >=dev-libs/libxml2-2.6.8 )
89 snmp? ( >=net-analyzer/net-snmp-5.2 )
90 soap? ( >=dev-libs/libxml2-2.6.8 )
91 sodium? ( dev-libs/libsodium:= )
92 spell? ( >=app-text/aspell-0.50 )
93 sqlite? ( >=dev-db/sqlite-3.7.6.3 )
95 !libressl? ( >=dev-libs/openssl-1.0.1:0= )
96 libressl? ( dev-libs/libressl:0= )
98 tidy? ( || ( app-text/tidy-html5 app-text/htmltidy ) )
99 tokyocabinet? ( dev-db/tokyocabinet )
100 truetype? ( =media-libs/freetype-2* )
101 unicode? ( dev-libs/oniguruma:= )
102 wddx? ( >=dev-libs/libxml2-2.6.8 )
103 webp? ( media-libs/libwebp:0= )
104 xml? ( >=dev-libs/libxml2-2.6.8 )
105 xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv )
106 xmlreader? ( >=dev-libs/libxml2-2.6.8 )
107 xmlwriter? ( >=dev-libs/libxml2-2.6.8 )
108 xpm? ( x11-libs/libXpm )
109 xslt? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
110 zip? ( >=sys-libs/zlib-1.2.0.4:0= )
111 zip-encryption? ( >=dev-libs/libzip-1.2.0:= )
112 zlib? ( >=sys-libs/zlib-1.2.0.4:0= )
115 RDEPEND="${COMMON_DEPEND}
118 selinux? ( sec-policy/selinux-phpfpm )
119 systemd? ( sys-apps/systemd ) )"
121 # Bison isn't actually needed when building from a release tarball
122 # However, the configure script will warn if it's absent or if you
123 # have an incompatible version installed. See bug 593278.
124 DEPEND="${COMMON_DEPEND}
126 >=sys-devel/bison-3.0.1"
128 BDEPEND="virtual/pkgconfig"
130 # Without USE=readline or libedit, the interactive "php -a" CLI will hang.
132 || ( cli cgi fpm apache2 embed phpdbg )
133 cli? ( ^^ ( readline libedit ) )
134 truetype? ( gd zlib )
143 xmlrpc? ( || ( xml iconv ) )
150 readline? ( !libedit )
151 recode? ( !imap !mysqli !mysql )
152 session-mm? ( session !threads )
153 mysql? ( || ( mysqli pdo ) )
154 zip-encryption? ( zip )
157 RESTRICT="!test? ( test )"
160 "${FILESDIR}/php-freetype-2.9.1.patch"
163 PHP_MV="$(ver_cut 1)"
168 # work out where we are installing the ini file
169 php_set_ini_dir "${phpsapi}"
171 # Always install the production INI file, bug 611214.
172 local phpinisrc="php.ini-production-${phpsapi}"
173 cp php.ini-production "${phpinisrc}" || die
175 # default to /tmp for save_path, bug #282768
176 sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}" || die
178 # Set the extension dir
179 sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" \
180 -i "${phpinisrc}" || die
182 # Set the include path to point to where we want to find PEAR packages
183 sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}" || die
185 insinto "${PHP_INI_DIR#${EPREFIX}}"
186 newins "${phpinisrc}" php.ini
188 elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
191 dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
192 dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
195 elog "Adding opcache to $PHP_EXT_INI_DIR"
196 echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> \
197 "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
198 dosym "../ext/opcache.ini" \
199 "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
202 # SAPI-specific handling
203 if [[ "${sapi}" == "fpm" ]] ; then
204 einfo "Installing FPM config files php-fpm.conf and www.conf"
205 insinto "${PHP_INI_DIR#${EPREFIX}}"
206 doins sapi/fpm/php-fpm.conf
207 insinto "${PHP_INI_DIR#${EPREFIX}}/fpm.d"
208 doins sapi/fpm/www.conf
211 dodoc php.ini-{development,production}
215 PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
216 PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
217 PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
223 # In php-7.x, the FPM pool configuration files have been split off
224 # of the main config. By default the pool config files go in
225 # e.g. /etc/php-fpm.d, which isn't slotted. So here we move the
226 # include directory to a subdirectory "fpm.d" of $PHP_INI_DIR. Later
227 # we'll install the pool configuration file "www.conf" there.
229 sed -i "s~^include=.*$~include=${PHP_INI_DIR}/fpm.d/*.conf~" \
230 sapi/fpm/php-fpm.conf.in \
231 || die 'failed to move the include directory in php-fpm.conf'
233 # Bug 669566 - necessary so that build tools are updated for commands like pecl
234 # Force rebuilding aclocal.m4
235 rm -f aclocal.m4 || die "failed to remove aclocal.m4 in src_prepare"
240 addpredict /usr/share/snmp/mibs/.index #nowarn
241 addpredict /var/lib/net-snmp/mib_indexes #nowarn
243 PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
245 # The php-fpm config file wants localstatedir to be ${EPREFIX}/var
246 # and not the Gentoo default ${EPREFIX}/var/lib. See bug 572002.
248 --prefix="${PHP_DESTDIR}"
249 --mandir="${PHP_DESTDIR}/man"
250 --infodir="${PHP_DESTDIR}/info"
251 --libdir="${PHP_DESTDIR}/lib"
252 --with-libdir="$(get_libdir)"
253 --localstatedir="${EPREFIX}/var"
255 $(use_enable threads maintainer-zts)
259 $(use_with argon2 password-argon2 "${EPREFIX}/usr")
260 $(use_enable bcmath bcmath)
261 $(use_with bzip2 bz2 "${EPREFIX}/usr")
262 $(use_enable calendar calendar)
263 $(use_enable coverage gcov)
264 $(use_enable ctype ctype)
265 $(use_with curl curl "${EPREFIX}/usr")
266 $(use_enable xml dom)
267 $(use_with enchant enchant "${EPREFIX}/usr")
268 $(use_enable exif exif)
269 $(use_enable fileinfo fileinfo)
270 $(use_enable filter filter)
271 $(use_enable ftp ftp)
272 $(use_with nls gettext "${EPREFIX}/usr")
273 $(use_with gmp gmp "${EPREFIX}/usr")
274 $(use_enable hash hash)
275 $(use_with mhash mhash "${EPREFIX}/usr")
276 $(use_with iconv iconv \
277 $(use elibc_glibc || use elibc_musl || use elibc_FreeBSD || echo "${EPREFIX}/usr"))
278 $(use_enable intl intl)
279 $(use_enable ipv6 ipv6)
280 $(use_enable json json)
281 $(use_with kerberos kerberos "${EPREFIX}/usr")
282 $(use_enable xml libxml)
283 $(use_with xml libxml-dir "${EPREFIX}/usr")
284 $(use_enable unicode mbstring)
285 $(use_with unicode onig "${EPREFIX}/usr")
286 $(use_with ssl openssl "${EPREFIX}/usr")
287 $(use_with ssl openssl-dir "${EPREFIX}/usr")
288 $(use_enable pcntl pcntl)
289 $(use_enable phar phar)
290 $(use_enable pdo pdo)
291 $(use_enable opcache opcache)
292 $(use_with postgres pgsql "${EPREFIX}/usr")
293 $(use_enable posix posix)
294 $(use_with spell pspell "${EPREFIX}/usr")
295 $(use_with recode recode "${EPREFIX}/usr")
296 $(use_enable simplexml simplexml)
297 $(use_enable sharedmem shmop)
298 $(use_with snmp snmp "${EPREFIX}/usr")
299 $(use_enable soap soap)
300 $(use_enable sockets sockets)
301 $(use_with sodium sodium "${EPREFIX}/usr")
302 $(use_with sqlite sqlite3 "${EPREFIX}/usr")
303 $(use_enable sysvipc sysvmsg)
304 $(use_enable sysvipc sysvsem)
305 $(use_enable sysvipc sysvshm)
306 $(use_with tidy tidy "${EPREFIX}/usr")
307 $(use_enable tokenizer tokenizer)
308 $(use_enable wddx wddx)
309 $(use_enable xml xml)
310 $(use_enable xmlreader xmlreader)
311 $(use_enable xmlwriter xmlwriter)
312 $(use_with xmlrpc xmlrpc)
313 $(use_with xslt xsl "${EPREFIX}/usr")
314 $(use_enable zip zip)
315 $(use_with zip-encryption libzip "${EPREFIX}/usr")
316 $(use_with zlib zlib "${EPREFIX}/usr")
317 $(use_enable debug debug)
321 if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
322 || use qdbm || use lmdb || use tokyocabinet ; then
323 our_conf+=( "--enable-dba${shared}" )
326 # DBA drivers support
329 $(use_with berkdb db4 "${EPREFIX}/usr")
330 $(use_enable flatfile flatfile)
331 $(use_with gdbm gdbm "${EPREFIX}/usr")
332 $(use_enable inifile inifile)
333 $(use_with qdbm qdbm "${EPREFIX}/usr")
334 $(use_with lmdb lmdb "${EPREFIX}/usr")
337 # Support for the GD graphics library
339 $(use_with truetype freetype-dir "${EPREFIX}/usr")
340 $(use_enable cjk gd-jis-conv)
341 $(use_with gd jpeg-dir "${EPREFIX}/usr")
342 $(use_with gd png-dir "${EPREFIX}/usr")
343 $(use_with xpm xpm-dir "${EPREFIX}/usr")
346 our_conf+=( --with-webp-dir="${EPREFIX}/usr" )
348 # enable gd last, so configure can pick up the previous settings
349 our_conf+=( $(use_with gd gd) )
354 $(use_with imap imap "${EPREFIX}/usr")
355 $(use_with ssl imap-ssl "${EPREFIX}/usr")
359 # Interbase/firebird support
360 our_conf+=( $(use_with firebird interbase "${EPREFIX}/usr") )
365 $(use_with ldap ldap "${EPREFIX}/usr")
366 $(use_with ldap-sasl ldap-sasl "${EPREFIX}/usr")
371 local mysqllib="mysqlnd"
372 local mysqlilib="mysqlnd"
374 our_conf+=( $(use_with mysqli mysqli "${mysqlilib}") )
376 local mysqlsock="${EPREFIX}/var/run/mysqld/mysqld.sock"
377 if use mysql || use mysqli ; then
378 our_conf+=( $(use_with mysql mysql-sock "${mysqlsock}") )
383 $(use_with odbc unixODBC "${EPREFIX}/usr")
384 $(use_with iodbc iodbc "${EPREFIX}/usr")
388 our_conf+=( $(use_with oci8-instant-client oci8) )
393 $(use_with mssql pdo-dblib "${EPREFIX}/usr")
394 $(use_with mysql pdo-mysql "${mysqllib}")
395 $(use_with postgres pdo-pgsql)
396 $(use_with sqlite pdo-sqlite "${EPREFIX}/usr")
397 $(use_with firebird pdo-firebird "${EPREFIX}/usr")
398 $(use_with odbc pdo-odbc "unixODBC,${EPREFIX}/usr")
399 $(use_with oci8-instant-client pdo-oci)
403 # readline/libedit support
405 $(use_with readline readline "${EPREFIX}/usr")
406 $(use_with libedit libedit "${EPREFIX}/usr")
410 if use session ; then
411 our_conf+=( $(use_with session-mm mm "${EPREFIX}/usr") )
413 our_conf+=( $(use_enable session session) )
416 # Use pic for shared modules such as apache2's mod_php
417 our_conf+=( --with-pic )
419 # we use the system copy of pcre
420 # --with-pcre-regex affects ext/pcre
421 # --with-pcre-dir affects ext/filter and ext/zip
422 # --with-pcre-valgrind cannot be enabled with system pcre
423 # Many arches don't support pcre-jit
425 --with-pcre-regex="${EPREFIX}/usr"
426 --with-pcre-dir="${EPREFIX}/usr"
427 --without-pcre-valgrind
431 # Catch CFLAGS problems
433 # Changed order to run it in reverse for bug #32022 and #12021.
434 replace-cpu-flags "k6*" "i586"
436 # Cache the ./configure test results between SAPIs.
437 our_conf+=( --cache-file="${T}/config.cache" )
439 # Support user-passed configuration parameters
440 our_conf+=( ${EXTRA_ECONF:-} )
442 # Support the Apache2 extras, they must be set globally for all
443 # SAPIs to work correctly, especially for external PHP extensions
445 mkdir -p "${WORKDIR}/sapis-build" || die
446 for one_sapi in $SAPIS ; do
447 use "${one_sapi}" || continue
448 php_set_ini_dir "${one_sapi}"
450 # The BUILD_DIR variable is used to determine where to output
451 # the files that autotools creates. This was all originally
452 # based on the autotools-utils eclass.
453 BUILD_DIR="${WORKDIR}/sapis-build/${one_sapi}"
454 cp -a "${S}" "${BUILD_DIR}" || die
455 cd "${BUILD_DIR}" || die
458 --with-config-file-path="${PHP_INI_DIR}"
459 --with-config-file-scan-dir="${PHP_EXT_INI_DIR_ACTIVE}"
462 for sapi in $SAPIS ; do
464 cli|cgi|embed|fpm|phpdbg)
465 if [[ "${one_sapi}" == "${sapi}" ]] ; then
466 sapi_conf+=( "--enable-${sapi}" )
467 if [[ "fpm" == "${sapi}" ]] ; then
469 $(use_with acl fpm-acl)
470 $(use_with systemd fpm-systemd)
474 sapi_conf+=( "--disable-${sapi}" )
479 if [[ "${one_sapi}" == "${sapi}" ]] ; then
480 sapi_conf+=( --with-apxs2="${EPREFIX}/usr/bin/apxs" )
482 sapi_conf+=( --without-apxs2 )
488 # Construct the $myeconfargs array by concatenating $our_conf
489 # (the common args) and $sapi_conf (the SAPI-specific args).
490 local myeconfargs=( "${our_conf[@]}" )
491 myeconfargs+=( "${sapi_conf[@]}" )
493 pushd "${BUILD_DIR}" > /dev/null || die
494 econf "${myeconfargs[@]}"
495 popd > /dev/null || die
500 # snmp seems to run during src_compile, too (bug #324739)
501 addpredict /usr/share/snmp/mibs/.index #nowarn
502 addpredict /var/lib/net-snmp/mib_indexes #nowarn
504 for sapi in ${SAPIS} ; do
505 if use "${sapi}"; then
506 cd "${WORKDIR}/sapis-build/$sapi" || \
507 die "Failed to change dir to ${WORKDIR}/sapis-build/$1"
514 # see bug #324739 for what happens when we don't have that
515 addpredict /usr/share/snmp/mibs/.index #nowarn
517 # grab the first SAPI that got built and install common files from there
519 for sapi in $SAPIS ; do
526 # Makefile forgets to create this before trying to write to it...
527 dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
529 # Install php environment (without any sapis)
530 cd "${WORKDIR}/sapis-build/$first_sapi" || die
531 emake INSTALL_ROOT="${D}" \
532 install-build install-headers install-programs
534 local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
536 # Create the directory where we'll put version-specific php scripts
537 keepdir "/usr/share/php${PHP_MV}"
539 local sapi="", file=""
542 for sapi in ${SAPIS}; do
543 if use "${sapi}" ; then
544 einfo "Installing SAPI: ${sapi}"
545 cd "${WORKDIR}/sapis-build/${sapi}" || die
547 if [[ "${sapi}" == "apache2" ]] ; then
548 # We're specifically not using emake install-sapi as libtool
549 # may cause unnecessary relink failures (see bug #351266)
550 insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
551 newins ".libs/libphp${PHP_MV}$(get_libname)" \
552 "libphp${PHP_MV}$(get_libname)"
553 keepdir "/usr/$(get_libdir)/apache2/modules"
555 # needed each time, php_install_ini would reset it
556 local dest="${PHP_DESTDIR#${EPREFIX}}"
560 source="sapi/cli/php"
561 # Install the "phar" archive utility.
563 emake INSTALL_ROOT="${D}" install-pharcmd
564 dosym "..${dest#/usr}/bin/phar" "/usr/bin/phar${SLOT}"
568 source="sapi/cgi/php-cgi"
571 source="sapi/fpm/php-fpm"
574 source="libs/libphp${PHP_MV}$(get_libname)"
577 source="sapi/phpdbg/phpdbg"
580 die "unhandled sapi in src_install"
584 if [[ "${source}" == *"$(get_libname)" ]]; then
588 local name="$(basename ${source})"
589 dosym "..${dest#/usr}/bin/${name}" "/usr/bin/${name}${SLOT}"
593 php_install_ini "${sapi}"
595 # construct correct SAPI string for php-config
596 # thanks to ferringb for the bash voodoo
597 if [[ "${sapi}" == "apache2" ]]; then
598 sapi_list="${sapi_list:+${sapi_list} }apache2handler"
600 sapi_list="${sapi_list:+${sapi_list} }${sapi}"
605 # Installing opcache module
606 if use opcache ; then
607 into "${PHP_DESTDIR#${EPREFIX}}"
608 dolib.so "modules/opcache$(get_libname)"
611 # Install env.d files
612 newenvd "${FILESDIR}/20php5-envd" "20php${SLOT}"
613 sed -e "s|/lib/|/$(get_libdir)/|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
614 sed -e "s|php5|php${SLOT}|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
616 # set php-config variable correctly (bug #278439)
617 sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
618 "${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config" || die
622 systemd_newunit "${FILESDIR}/php-fpm_at.service" \
623 "php-fpm@${SLOT}.service"
625 systemd_newunit "${FILESDIR}/php-fpm_at-simple.service" \
626 "php-fpm@${SLOT}.service"
632 echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
633 PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php"
634 if [[ ! -x "${PHP_BIN}" ]] ; then
635 ewarn "Test phase requires USE=cli, skipping"
638 export TEST_PHP_EXECUTABLE="${PHP_BIN}"
641 if [[ -x "${WORKDIR}/sapis-build/cgi/sapi/cgi/php-cgi" ]] ; then
642 export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis-build/cgi/sapi/cgi/php-cgi"
645 if [[ -x "${WORKDIR}/sapis-build/phpdbg/sapi/phpdbg/phpdbg" ]] ; then
646 export TEST_PHPDBG_EXECUTABLE="${WORKDIR}/sapis-build/phpdbg/sapi/phpdbg/phpdbg"
649 REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d \
650 "session.save_path=${T}" \
651 "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d \
652 "session.save_path=${T}"
654 for name in ${EXPECTED_TEST_FAILURES}; do
655 mv "${name}.out" "${name}.out.orig" 2>/dev/null || die
658 local failed="$(find -name '*.out')"
659 if [[ ${failed} != "" ]] ; then
660 ewarn "The following test cases failed unexpectedly:"
661 for name in ${failed}; do
662 ewarn " ${name/.out/}"
665 einfo "No unexpected test failures, all fine"
668 if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
670 for name in ${EXPECTED_TEST_FAILURES}; do
671 [[ -f "${name}.diff" ]] && continue
672 passed="${passed} ${name}"
674 if [[ ${passed} != "" ]] ; then
675 einfo "The following test cases passed unexpectedly:"
676 for name in ${passed}; do
680 einfo "None of the known-to-fail tests passed, all fine"
686 # Output some general info to the user
687 if use apache2 ; then
689 elog "To enable PHP in apache, you will need to add \"-D PHP\" to"
690 elog "your apache2 command. OpenRC users can append that string to"
691 elog "APACHE2_OPTS in /etc/conf.d/apache2."
693 elog "The apache module configuration file 70_mod_php.conf is"
694 elog "provided (and maintained) by eselect-php."
698 # Create the symlinks for php
699 for m in ${SAPIS}; do
700 [[ ${m} == 'embed' ]] && continue;
702 local ci=$(eselect php show $m)
703 if [[ -z $ci ]]; then
704 eselect php set $m php${SLOT} || die
705 einfo "Switched ${m} to use php:${SLOT}"
707 elif [[ $ci != "php${SLOT}" ]] ; then
708 elog "To switch $m to use php:${SLOT}, run"
709 elog " eselect php set $m php${SLOT}"
715 # Remove dead symlinks for SAPIs that were just disabled. For
716 # example, if the user has the cgi SAPI enabled, then he has an
717 # eselect-php symlink for it. If he later reinstalls PHP with
718 # USE="-cgi", that symlink will break. This call to eselect is
719 # supposed to remove that dead link per bug 572436.
720 eselect php cleanup || die
722 if ! has "php${SLOT/./-}" ${PHP_TARGETS}; then
723 elog "To build extensions for this version of PHP, you will need to"
724 elog "add php${SLOT/./-} to your PHP_TARGETS USE_EXPAND variable."
728 # Warn about the removal of PHP_INI_VERSION if the user has it set.
729 if [[ -n "${PHP_INI_VERSION}" ]]; then
730 ewarn 'The PHP_INI_VERSION variable has been phased out. You may'
731 ewarn 'remove it from your configuration at your convenience. See'
733 ewarn ' https://bugs.gentoo.org/611214'
735 ewarn 'for more information.'
738 elog "For details on how version slotting works, please see"
741 elog " https://wiki.gentoo.org/wiki/PHP"
746 # This serves two purposes. First, if we have just removed the last
747 # installed version of PHP, then this will remove any dead symlinks
748 # belonging to eselect-php. Second, if a user upgrades slots from
749 # (say) 5.6 to 7.0 and depcleans the old slot, then this will update
750 # his existing symlinks to point to the new 7.0 installation. The
751 # latter is bug 432962.
753 # Note: the eselect-php package may not be installed at this point,
754 # so we can't die() if this command fails.