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
8 DESCRIPTION="The PHP language runtime engine"
9 HOMEPAGE="https://www.php.net/"
10 SRC_URI="https://www.php.net/distributions/${P}.tar.xz"
18 unicode? ( BSD-2 LGPL-2.1 )"
21 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
23 # We can build the following SAPIs in the given order
24 SAPIS="embed cli cgi fpm apache2 phpdbg"
26 # SAPIs and SAPI-specific USE flags (cli SAPI is default on):
31 IUSE="${IUSE} acl argon2 bcmath berkdb bzip2 calendar cdb cjk
32 coverage +ctype curl debug
33 enchant exif +fileinfo +filter firebird
34 +flatfile ftp gd gdbm gmp +hash +iconv imap inifile
35 intl iodbc ipv6 +json kerberos ldap ldap-sasl libedit libressl lmdb
36 mhash mssql mysql mysqli nls
37 oci8-instant-client odbc +opcache pcntl pdo +phar +posix postgres qdbm
38 readline recode selinux +session session-mm sharedmem
39 +simplexml snmp soap sockets sodium spell sqlite ssl
40 sysvipc systemd test tidy +tokenizer tokyocabinet truetype unicode wddx webp
41 +xml xmlreader xmlwriter xmlrpc xpm xslt zip zip-encryption zlib"
43 # The supported (that is, autodetected) versions of BDB are listed in
44 # the ./configure script. Other versions *work*, but we need to stick to
45 # the ones that can be detected to avoid a repeat of bug #564824.
47 >=app-eselect/eselect-php-0.9.1[apache2?,fpm?]
48 >=dev-libs/libpcre-8.32[unicode]
49 fpm? ( acl? ( sys-apps/acl ) )
50 apache2? ( www-servers/apache[apache2_modules_unixd(+),threads=] )
51 argon2? ( app-crypt/argon2:= )
52 berkdb? ( || ( sys-libs/db:5.3
58 bzip2? ( app-arch/bzip2:0= )
59 cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
60 coverage? ( dev-util/lcov )
61 curl? ( >=net-misc/curl-7.10.5 )
62 enchant? ( <app-text/enchant-2.0:0 )
63 firebird? ( dev-db/firebird )
64 gd? ( >=virtual/jpeg-0-r3:0 media-libs/libpng:0= sys-libs/zlib )
65 gdbm? ( >=sys-libs/gdbm-1.8.0:0= )
66 gmp? ( dev-libs/gmp:0= )
67 iconv? ( virtual/libiconv )
68 imap? ( >=virtual/imap-c-client-2[kerberos=,ssl=] )
69 intl? ( dev-libs/icu:= )
70 iodbc? ( dev-db/libiodbc )
71 kerberos? ( virtual/krb5 )
72 ldap? ( >=net-nds/openldap-1.2.11 )
73 ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 )
74 libedit? ( dev-libs/libedit )
75 lmdb? ( dev-db/lmdb:= )
76 mssql? ( dev-db/freetds[mssql] )
77 nls? ( sys-devel/gettext )
78 oci8-instant-client? ( dev-db/oracle-instantclient-basic )
79 odbc? ( >=dev-db/unixODBC-1.8.13 )
80 postgres? ( dev-db/postgresql:* )
82 readline? ( sys-libs/readline:0= )
83 recode? ( app-text/recode )
84 session-mm? ( dev-libs/mm )
85 simplexml? ( >=dev-libs/libxml2-2.6.8 )
86 snmp? ( >=net-analyzer/net-snmp-5.2 )
87 soap? ( >=dev-libs/libxml2-2.6.8 )
88 sodium? ( dev-libs/libsodium:= )
89 spell? ( >=app-text/aspell-0.50 )
90 sqlite? ( >=dev-db/sqlite-3.7.6.3 )
92 !libressl? ( dev-libs/openssl:0= )
93 libressl? ( dev-libs/libressl:0= )
95 tidy? ( || ( app-text/tidy-html5 app-text/htmltidy ) )
96 tokyocabinet? ( dev-db/tokyocabinet )
97 truetype? ( =media-libs/freetype-2* )
98 unicode? ( dev-libs/oniguruma:= )
99 wddx? ( >=dev-libs/libxml2-2.6.8 )
100 webp? ( media-libs/libwebp:0= )
101 xml? ( >=dev-libs/libxml2-2.6.8 )
102 xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv )
103 xmlreader? ( >=dev-libs/libxml2-2.6.8 )
104 xmlwriter? ( >=dev-libs/libxml2-2.6.8 )
105 xpm? ( x11-libs/libXpm )
106 xslt? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
107 zip? ( sys-libs/zlib:0= )
108 zip-encryption? ( >=dev-libs/libzip-1.2.0:= )
109 zlib? ( sys-libs/zlib:0= )
112 RDEPEND="${COMMON_DEPEND}
115 selinux? ( sec-policy/selinux-phpfpm )
116 systemd? ( sys-apps/systemd ) )"
118 # Bison isn't actually needed when building from a release tarball
119 # However, the configure script will warn if it's absent or if you
120 # have an incompatible version installed. See bug 593278.
121 DEPEND="${COMMON_DEPEND}
123 >=sys-devel/bison-3.0.1"
125 BDEPEND="virtual/pkgconfig"
127 # Without USE=readline or libedit, the interactive "php -a" CLI will hang.
129 || ( cli cgi fpm apache2 embed phpdbg )
130 cli? ( ^^ ( readline libedit ) )
131 truetype? ( gd zlib )
140 xmlrpc? ( || ( xml iconv ) )
147 readline? ( !libedit )
148 recode? ( !imap !mysqli !mysql )
149 session-mm? ( session !threads )
150 mysql? ( hash || ( mysqli pdo ) )
152 zip-encryption? ( zip )
155 RESTRICT="!test? ( test )"
158 "${FILESDIR}/php-freetype-2.9.1.patch"
159 "${FILESDIR}/php-7.2.13-intl-use-icu-namespace.patch"
162 PHP_MV="$(ver_cut 1)"
167 # work out where we are installing the ini file
168 php_set_ini_dir "${phpsapi}"
170 # Always install the production INI file, bug 611214.
171 local phpinisrc="php.ini-production-${phpsapi}"
172 cp php.ini-production "${phpinisrc}" || die
174 # default to /tmp for save_path, bug #282768
175 sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}" || die
177 # Set the extension dir
178 sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" \
179 -i "${phpinisrc}" || die
181 # Set the include path to point to where we want to find PEAR packages
182 sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}" || die
184 insinto "${PHP_INI_DIR#${EPREFIX}}"
185 newins "${phpinisrc}" php.ini
187 elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
190 dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
191 dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
194 elog "Adding opcache to $PHP_EXT_INI_DIR"
195 echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> \
196 "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
197 dosym "../ext/opcache.ini" \
198 "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
201 # SAPI-specific handling
202 if [[ "${sapi}" == "fpm" ]] ; then
203 einfo "Installing FPM config files php-fpm.conf and www.conf"
204 insinto "${PHP_INI_DIR#${EPREFIX}}"
205 doins sapi/fpm/php-fpm.conf
206 insinto "${PHP_INI_DIR#${EPREFIX}}/fpm.d"
207 doins sapi/fpm/www.conf
210 dodoc php.ini-{development,production}
214 PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
215 PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
216 PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
222 # In php-7.x, the FPM pool configuration files have been split off
223 # of the main config. By default the pool config files go in
224 # e.g. /etc/php-fpm.d, which isn't slotted. So here we move the
225 # include directory to a subdirectory "fpm.d" of $PHP_INI_DIR. Later
226 # we'll install the pool configuration file "www.conf" there.
228 sed -i "s~^include=.*$~include=${PHP_INI_DIR}/fpm.d/*.conf~" \
229 sapi/fpm/php-fpm.conf.in \
230 || die 'failed to move the include directory in php-fpm.conf'
232 # Bug 669566 - necessary so that build tools are updated for commands like pecl
233 # Force rebuilding aclocal.m4
234 rm -f aclocal.m4 || die "failed to remove aclocal.m4 in src_prepare"
239 addpredict /usr/share/snmp/mibs/.index #nowarn
240 addpredict /var/lib/net-snmp/mib_indexes #nowarn
242 PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
244 # The php-fpm config file wants localstatedir to be ${EPREFIX}/var
245 # and not the Gentoo default ${EPREFIX}/var/lib. See bug 572002.
247 --prefix="${PHP_DESTDIR}"
248 --mandir="${PHP_DESTDIR}/man"
249 --infodir="${PHP_DESTDIR}/info"
250 --libdir="${PHP_DESTDIR}/lib"
251 --with-libdir="$(get_libdir)"
252 --localstatedir="${EPREFIX}/var"
254 $(use_enable threads maintainer-zts)
258 $(use_with argon2 password-argon2 "${EPREFIX}/usr")
259 $(use_enable bcmath bcmath)
260 $(use_with bzip2 bz2 "${EPREFIX}/usr")
261 $(use_enable calendar calendar)
262 $(use_enable coverage gcov)
263 $(use_enable ctype ctype)
264 $(use_with curl curl "${EPREFIX}/usr")
265 $(use_enable xml dom)
266 $(use_with enchant enchant "${EPREFIX}/usr")
267 $(use_enable exif exif)
268 $(use_enable fileinfo fileinfo)
269 $(use_enable filter filter)
270 $(use_enable ftp ftp)
271 $(use_with nls gettext "${EPREFIX}/usr")
272 $(use_with gmp gmp "${EPREFIX}/usr")
273 $(use_enable hash hash)
274 $(use_with mhash mhash "${EPREFIX}/usr")
275 $(use_with iconv iconv \
276 $(use elibc_glibc || use elibc_musl || use elibc_FreeBSD || echo "${EPREFIX}/usr"))
277 $(use_enable intl intl)
278 $(use_enable ipv6 ipv6)
279 $(use_enable json json)
280 $(use_with kerberos kerberos "${EPREFIX}/usr")
281 $(use_enable xml libxml)
282 $(use_with xml libxml-dir "${EPREFIX}/usr")
283 $(use_enable unicode mbstring)
284 $(use_with unicode onig "${EPREFIX}/usr")
285 $(use_with ssl openssl "${EPREFIX}/usr")
286 $(use_with ssl openssl-dir "${EPREFIX}/usr")
287 $(use_enable pcntl pcntl)
288 $(use_enable phar phar)
289 $(use_enable pdo pdo)
290 $(use_enable opcache opcache)
291 $(use_with postgres pgsql "${EPREFIX}/usr")
292 $(use_enable posix posix)
293 $(use_with spell pspell "${EPREFIX}/usr")
294 $(use_with recode recode "${EPREFIX}/usr")
295 $(use_enable simplexml simplexml)
296 $(use_enable sharedmem shmop)
297 $(use_with snmp snmp "${EPREFIX}/usr")
298 $(use_enable soap soap)
299 $(use_enable sockets sockets)
300 $(use_with sodium sodium "${EPREFIX}/usr")
301 $(use_with sqlite sqlite3 "${EPREFIX}/usr")
302 $(use_enable sysvipc sysvmsg)
303 $(use_enable sysvipc sysvsem)
304 $(use_enable sysvipc sysvshm)
305 $(use_with tidy tidy "${EPREFIX}/usr")
306 $(use_enable tokenizer tokenizer)
307 $(use_enable wddx wddx)
308 $(use_enable xml xml)
309 $(use_enable xmlreader xmlreader)
310 $(use_enable xmlwriter xmlwriter)
311 $(use_with xmlrpc xmlrpc)
312 $(use_with xslt xsl "${EPREFIX}/usr")
313 $(use_enable zip zip)
314 $(use_with zip-encryption libzip "${EPREFIX}/usr")
315 $(use_with zlib zlib "${EPREFIX}/usr")
316 $(use_enable debug debug)
320 if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
321 || use qdbm || use lmdb || use tokyocabinet ; then
322 our_conf+=( "--enable-dba${shared}" )
325 # DBA drivers support
328 $(use_with berkdb db4 "${EPREFIX}/usr")
329 $(use_enable flatfile flatfile)
330 $(use_with gdbm gdbm "${EPREFIX}/usr")
331 $(use_enable inifile inifile)
332 $(use_with qdbm qdbm "${EPREFIX}/usr")
333 $(use_with lmdb lmdb "${EPREFIX}/usr")
336 # Support for the GD graphics library
338 $(use_with truetype freetype-dir "${EPREFIX}/usr")
339 $(use_enable cjk gd-jis-conv)
340 $(use_with gd jpeg-dir "${EPREFIX}/usr")
341 $(use_with gd png-dir "${EPREFIX}/usr")
342 $(use_with xpm xpm-dir "${EPREFIX}/usr")
345 our_conf+=( --with-webp-dir="${EPREFIX}/usr" )
347 # enable gd last, so configure can pick up the previous settings
348 our_conf+=( $(use_with gd gd) )
353 $(use_with imap imap "${EPREFIX}/usr")
354 $(use_with ssl imap-ssl "${EPREFIX}/usr")
358 # Interbase/firebird support
359 our_conf+=( $(use_with firebird interbase "${EPREFIX}/usr") )
364 $(use_with ldap ldap "${EPREFIX}/usr")
365 $(use_with ldap-sasl ldap-sasl "${EPREFIX}/usr")
370 local mysqllib="mysqlnd"
371 local mysqlilib="mysqlnd"
373 our_conf+=( $(use_with mysqli mysqli "${mysqlilib}") )
375 local mysqlsock="${EPREFIX}/var/run/mysqld/mysqld.sock"
376 if use mysql || use mysqli ; then
377 our_conf+=( $(use_with mysql mysql-sock "${mysqlsock}") )
382 $(use_with odbc unixODBC "${EPREFIX}/usr")
383 $(use_with iodbc iodbc "${EPREFIX}/usr")
387 our_conf+=( $(use_with oci8-instant-client oci8) )
392 $(use_with mssql pdo-dblib "${EPREFIX}/usr")
393 $(use_with mysql pdo-mysql "${mysqllib}")
394 $(use_with postgres pdo-pgsql)
395 $(use_with sqlite pdo-sqlite "${EPREFIX}/usr")
396 $(use_with firebird pdo-firebird "${EPREFIX}/usr")
397 $(use_with odbc pdo-odbc "unixODBC,${EPREFIX}/usr")
398 $(use_with oci8-instant-client pdo-oci)
402 # readline/libedit support
404 $(use_with readline readline "${EPREFIX}/usr")
405 $(use_with libedit libedit "${EPREFIX}/usr")
409 if use session ; then
410 our_conf+=( $(use_with session-mm mm "${EPREFIX}/usr") )
412 our_conf+=( $(use_enable session session) )
415 # Use pic for shared modules such as apache2's mod_php
416 our_conf+=( --with-pic )
418 # we use the system copy of pcre
419 # --with-pcre-regex affects ext/pcre
420 # --with-pcre-dir affects ext/filter and ext/zip
421 # --with-pcre-valgrind cannot be enabled with system pcre
422 # Many arches don't support pcre-jit
424 --with-pcre-regex="${EPREFIX}/usr"
425 --with-pcre-dir="${EPREFIX}/usr"
426 --without-pcre-valgrind
430 # Catch CFLAGS problems
432 # Changed order to run it in reverse for bug #32022 and #12021.
433 replace-cpu-flags "k6*" "i586"
435 # Cache the ./configure test results between SAPIs.
436 our_conf+=( --cache-file="${T}/config.cache" )
438 # Support user-passed configuration parameters
439 our_conf+=( ${EXTRA_ECONF:-} )
441 # Support the Apache2 extras, they must be set globally for all
442 # SAPIs to work correctly, especially for external PHP extensions
444 mkdir -p "${WORKDIR}/sapis-build" || die
445 for one_sapi in $SAPIS ; do
446 use "${one_sapi}" || continue
447 php_set_ini_dir "${one_sapi}"
449 # The BUILD_DIR variable is used to determine where to output
450 # the files that autotools creates. This was all originally
451 # based on the autotools-utils eclass.
452 BUILD_DIR="${WORKDIR}/sapis-build/${one_sapi}"
453 cp -a "${S}" "${BUILD_DIR}" || die
454 cd "${BUILD_DIR}" || die
457 --with-config-file-path="${PHP_INI_DIR}"
458 --with-config-file-scan-dir="${PHP_EXT_INI_DIR_ACTIVE}"
461 for sapi in $SAPIS ; do
463 cli|cgi|embed|fpm|phpdbg)
464 if [[ "${one_sapi}" == "${sapi}" ]] ; then
465 sapi_conf+=( "--enable-${sapi}" )
466 if [[ "fpm" == "${sapi}" ]] ; then
468 $(use_with acl fpm-acl)
469 $(use_with systemd fpm-systemd)
473 sapi_conf+=( "--disable-${sapi}" )
478 if [[ "${one_sapi}" == "${sapi}" ]] ; then
479 sapi_conf+=( --with-apxs2="${EPREFIX}/usr/bin/apxs" )
481 sapi_conf+=( --without-apxs2 )
487 # Construct the $myeconfargs array by concatenating $our_conf
488 # (the common args) and $sapi_conf (the SAPI-specific args).
489 local myeconfargs=( "${our_conf[@]}" )
490 myeconfargs+=( "${sapi_conf[@]}" )
492 pushd "${BUILD_DIR}" > /dev/null || die
493 econf "${myeconfargs[@]}"
494 popd > /dev/null || die
499 # snmp seems to run during src_compile, too (bug #324739)
500 addpredict /usr/share/snmp/mibs/.index #nowarn
501 addpredict /var/lib/net-snmp/mib_indexes #nowarn
503 for sapi in ${SAPIS} ; do
504 if use "${sapi}"; then
505 cd "${WORKDIR}/sapis-build/$sapi" || \
506 die "Failed to change dir to ${WORKDIR}/sapis-build/$1"
513 # see bug #324739 for what happens when we don't have that
514 addpredict /usr/share/snmp/mibs/.index #nowarn
516 # grab the first SAPI that got built and install common files from there
518 for sapi in $SAPIS ; do
525 # Makefile forgets to create this before trying to write to it...
526 dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
528 # Install php environment (without any sapis)
529 cd "${WORKDIR}/sapis-build/$first_sapi" || die
530 emake INSTALL_ROOT="${D}" \
531 install-build install-headers install-programs
533 local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
535 # Create the directory where we'll put version-specific php scripts
536 keepdir "/usr/share/php${PHP_MV}"
538 local sapi="", file=""
541 for sapi in ${SAPIS}; do
542 if use "${sapi}" ; then
543 einfo "Installing SAPI: ${sapi}"
544 cd "${WORKDIR}/sapis-build/${sapi}" || die
546 if [[ "${sapi}" == "apache2" ]] ; then
547 # We're specifically not using emake install-sapi as libtool
548 # may cause unnecessary relink failures (see bug #351266)
549 insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
550 newins ".libs/libphp${PHP_MV}$(get_libname)" \
551 "libphp${PHP_MV}$(get_libname)"
552 keepdir "/usr/$(get_libdir)/apache2/modules"
554 # needed each time, php_install_ini would reset it
555 local dest="${PHP_DESTDIR#${EPREFIX}}"
559 source="sapi/cli/php"
560 # Install the "phar" archive utility.
562 emake INSTALL_ROOT="${D}" install-pharcmd
563 dosym "..${dest#/usr}/bin/phar" "/usr/bin/phar${SLOT}"
567 source="sapi/cgi/php-cgi"
570 source="sapi/fpm/php-fpm"
573 source="libs/libphp${PHP_MV}$(get_libname)"
576 source="sapi/phpdbg/phpdbg"
579 die "unhandled sapi in src_install"
583 if [[ "${source}" == *"$(get_libname)" ]]; then
587 local name="$(basename ${source})"
588 dosym "..${dest#/usr}/bin/${name}" "/usr/bin/${name}${SLOT}"
592 php_install_ini "${sapi}"
594 # construct correct SAPI string for php-config
595 # thanks to ferringb for the bash voodoo
596 if [[ "${sapi}" == "apache2" ]]; then
597 sapi_list="${sapi_list:+${sapi_list} }apache2handler"
599 sapi_list="${sapi_list:+${sapi_list} }${sapi}"
604 # Installing opcache module
605 if use opcache ; then
606 into "${PHP_DESTDIR#${EPREFIX}}"
607 dolib.so "modules/opcache$(get_libname)"
610 # Install env.d files
611 newenvd "${FILESDIR}/20php5-envd" "20php${SLOT}"
612 sed -e "s|/lib/|/$(get_libdir)/|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
613 sed -e "s|php5|php${SLOT}|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
615 # set php-config variable correctly (bug #278439)
616 sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
617 "${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config" || die
621 systemd_newunit "${FILESDIR}/php-fpm_at.service" \
622 "php-fpm@${SLOT}.service"
624 systemd_newunit "${FILESDIR}/php-fpm_at-simple.service" \
625 "php-fpm@${SLOT}.service"
631 echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
632 PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php"
633 if [[ ! -x "${PHP_BIN}" ]] ; then
634 ewarn "Test phase requires USE=cli, skipping"
637 export TEST_PHP_EXECUTABLE="${PHP_BIN}"
640 if [[ -x "${WORKDIR}/sapis-build/cgi/sapi/cgi/php-cgi" ]] ; then
641 export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis-build/cgi/sapi/cgi/php-cgi"
644 if [[ -x "${WORKDIR}/sapis-build/phpdbg/sapi/phpdbg/phpdbg" ]] ; then
645 export TEST_PHPDBG_EXECUTABLE="${WORKDIR}/sapis-build/phpdbg/sapi/phpdbg/phpdbg"
648 REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d \
649 "session.save_path=${T}" \
650 "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d \
651 "session.save_path=${T}"
653 for name in ${EXPECTED_TEST_FAILURES}; do
654 mv "${name}.out" "${name}.out.orig" 2>/dev/null || die
657 local failed="$(find -name '*.out')"
658 if [[ ${failed} != "" ]] ; then
659 ewarn "The following test cases failed unexpectedly:"
660 for name in ${failed}; do
661 ewarn " ${name/.out/}"
664 einfo "No unexpected test failures, all fine"
667 if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
669 for name in ${EXPECTED_TEST_FAILURES}; do
670 [[ -f "${name}.diff" ]] && continue
671 passed="${passed} ${name}"
673 if [[ ${passed} != "" ]] ; then
674 einfo "The following test cases passed unexpectedly:"
675 for name in ${passed}; do
679 einfo "None of the known-to-fail tests passed, all fine"
685 # Output some general info to the user
686 if use apache2 ; then
688 elog "To enable PHP in apache, you will need to add \"-D PHP\" to"
689 elog "your apache2 command. OpenRC users can append that string to"
690 elog "APACHE2_OPTS in /etc/conf.d/apache2."
692 elog "The apache module configuration file 70_mod_php.conf is"
693 elog "provided (and maintained) by eselect-php."
697 # Create the symlinks for php
698 for m in ${SAPIS}; do
699 [[ ${m} == 'embed' ]] && continue;
701 local ci=$(eselect php show $m)
702 if [[ -z $ci ]]; then
703 eselect php set $m php${SLOT} || die
704 einfo "Switched ${m} to use php:${SLOT}"
706 elif [[ $ci != "php${SLOT}" ]] ; then
707 elog "To switch $m to use php:${SLOT}, run"
708 elog " eselect php set $m php${SLOT}"
714 # Remove dead symlinks for SAPIs that were just disabled. For
715 # example, if the user has the cgi SAPI enabled, then he has an
716 # eselect-php symlink for it. If he later reinstalls PHP with
717 # USE="-cgi", that symlink will break. This call to eselect is
718 # supposed to remove that dead link per bug 572436.
719 eselect php cleanup || die
721 if ! has "php${SLOT/./-}" ${PHP_TARGETS}; then
722 elog "To build extensions for this version of PHP, you will need to"
723 elog "add php${SLOT/./-} to your PHP_TARGETS USE_EXPAND variable."
727 # Warn about the removal of PHP_INI_VERSION if the user has it set.
728 if [[ -n "${PHP_INI_VERSION}" ]]; then
729 ewarn 'The PHP_INI_VERSION variable has been phased out. You may'
730 ewarn 'remove it from your configuration at your convenience. See'
732 ewarn ' https://bugs.gentoo.org/611214'
734 ewarn 'for more information.'
737 elog "For details on how version slotting works, please see"
740 elog " https://wiki.gentoo.org/wiki/PHP"
745 # This serves two purposes. First, if we have just removed the last
746 # installed version of PHP, then this will remove any dead symlinks
747 # belonging to eselect-php. Second, if a user upgrades slots from
748 # (say) 5.6 to 7.0 and depcleans the old slot, then this will update
749 # his existing symlinks to point to the new 7.0 installation. The
750 # latter is bug 432962.
752 # Note: the eselect-php package may not be installed at this point,
753 # so we can't die() if this command fails.