1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit eutils autotools flag-o-matic versionator depend.apache apache-module db-use libtool systemd
9 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
11 function php_get_uri ()
15 echo "http://downloads.php.net/dsp/${2}"
18 echo "http://www.php.net/distributions/${2}"
21 echo "http://dev.gentoo.org/~olemarkus/php/${2}"
24 echo "mirror://gentoo/${2}"
27 die "unhandled case in php_get_uri"
32 PHP_MV="$(get_major_version)"
33 SLOT="$(get_version_component_range 1-2)"
35 # alias, so we can handle different types of releases (finals, rcs, alphas,
36 # betas, ...) w/o changing the whole ebuild
38 PHP_PV="${PHP_PV/_alpha/alpha}"
39 PHP_PV="${PHP_PV/_beta/beta}"
41 [[ ${PV} == ${PV/_alpha/} ]] || PHP_RELEASE="php-pre"
42 [[ ${PV} == ${PV/_beta/} ]] || PHP_RELEASE="php-pre"
43 [[ ${PV} == ${PV/_rc/} ]] || PHP_RELEASE="php-pre"
44 PHP_P="${PN}-${PHP_PV}"
46 PHP_SRC_URI="$(php_get_uri "${PHP_RELEASE}" "${PHP_P}.tar.bz2")"
50 SRC_URI="${PHP_SRC_URI}"
52 DESCRIPTION="The PHP language runtime engine: CLI, CGI, FPM/FastCGI, Apache2 and embed SAPIs"
53 HOMEPAGE="http://php.net/"
56 S="${WORKDIR}/${PHP_P}"
58 # We can build the following SAPIs in the given order
59 SAPIS="embed cli cgi fpm apache2"
61 # SAPIs and SAPI-specific USE flags (cli SAPI is default on):
66 IUSE="${IUSE} bcmath berkdb bzip2 calendar cdb cjk
67 crypt +ctype curl debug
68 enchant exif frontbase +fileinfo +filter firebird
69 flatfile ftp gd gdbm gmp +hash +iconv imap inifile
70 intl iodbc ipv6 +json kerberos ldap ldap-sasl libedit mhash
71 mssql mysql libmysqlclient mysqli nls
72 oci8-instant-client odbc +opcache pcntl pdo pdo-dblib pdo-mysql pdo-oci
73 pdo-odbc pdo-pgsql pdo-sqlite +phar +posix postgres qdbm readline recode
74 selinux +session sharedmem +simplexml snmp soap sockets spell sqlite ssl
75 sybase-ct sysvipc systemd tidy +tokenizer truetype unicode vpx wddx
76 +xml xmlreader xmlwriter xmlrpc xpm xslt zip zlib"
79 >=app-admin/eselect-php-0.7.1-r3[apache2?,fpm?]
80 >=dev-libs/libpcre-8.32[unicode]
81 apache2? ( || ( >=www-servers/apache-2.4[apache2_modules_unixd,threads=]
82 <www-servers/apache-2.4[threads=] ) )
83 berkdb? ( =sys-libs/db-4* )
84 bzip2? ( app-arch/bzip2 )
85 cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
91 crypt? ( >=dev-libs/libmcrypt-2.4 )
92 curl? ( >=net-misc/curl-7.10.5 )
93 enchant? ( app-text/enchant )
99 firebird? ( dev-db/firebird )
100 gd? ( virtual/jpeg:0 media-libs/libpng:0= sys-libs/zlib )
101 gdbm? ( >=sys-libs/gdbm-1.8.0 )
102 gmp? ( >=dev-libs/gmp-4.1.2 )
103 iconv? ( virtual/libiconv )
104 imap? ( virtual/imap-c-client[ssl=] )
105 intl? ( dev-libs/icu:= )
106 iodbc? ( dev-db/libiodbc )
107 kerberos? ( virtual/krb5 )
108 ldap? ( >=net-nds/openldap-1.2.11 )
109 ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 )
110 libedit? ( || ( sys-freebsd/freebsd-lib dev-libs/libedit ) )
111 mssql? ( dev-db/freetds[mssql] )
113 mysql? ( virtual/mysql )
114 mysqli? ( >=virtual/mysql-4.1 )
116 nls? ( sys-devel/gettext )
117 oci8-instant-client? ( dev-db/oracle-instantclient-basic )
118 odbc? ( >=dev-db/unixODBC-1.8.13 )
119 postgres? ( dev-db/postgresql )
120 qdbm? ( dev-db/qdbm )
121 readline? ( sys-libs/readline )
122 recode? ( app-text/recode )
123 sharedmem? ( dev-libs/mm )
124 simplexml? ( >=dev-libs/libxml2-2.6.8 )
125 snmp? ( >=net-analyzer/net-snmp-5.2 )
126 soap? ( >=dev-libs/libxml2-2.6.8 )
127 spell? ( >=app-text/aspell-0.50 )
128 sqlite? ( >=dev-db/sqlite-3.7.6.3 )
129 ssl? ( >=dev-libs/openssl-0.9.7 )
130 sybase-ct? ( dev-db/freetds )
131 tidy? ( app-text/htmltidy )
133 =media-libs/freetype-2*
134 >=media-libs/t1lib-5.0.0
136 virtual/jpeg:0 media-libs/libpng:0= sys-libs/zlib )
138 unicode? ( dev-libs/oniguruma )
139 vpx? ( media-libs/libvpx )
140 wddx? ( >=dev-libs/libxml2-2.6.8 )
141 xml? ( >=dev-libs/libxml2-2.6.8 )
142 xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv )
143 xmlreader? ( >=dev-libs/libxml2-2.6.8 )
144 xmlwriter? ( >=dev-libs/libxml2-2.6.8 )
148 media-libs/libpng:0= sys-libs/zlib
150 xslt? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
151 zip? ( sys-libs/zlib )
152 zlib? ( sys-libs/zlib )
156 php="=${CATEGORY}/${PF}"
169 xmlrpc? ( || ( xml iconv ) )
175 libmysqlclient? ( || (
181 pdo-dblib? ( pdo mssql )
182 pdo-oci? ( pdo oci8-instant-client )
183 pdo-odbc? ( pdo odbc )
184 pdo-mysql? ( pdo mysql )
185 pdo-pgsql? ( pdo postgres )
186 pdo-sqlite? ( pdo sqlite )
188 readline? ( !libedit )
189 recode? ( !imap !mysql !mysqli )
190 sharedmem? ( !threads )
192 !cli? ( !cgi? ( !fpm? ( !apache2? ( !embed? ( cli ) ) ) ) )"
198 selinux? ( sec-policy/selinux-phpfpm )
199 systemd? ( sys-apps/systemd ) )"
204 >=sys-devel/libtool-1.5.18"
206 # Allow users to install production version if they want to
208 case "${PHP_INI_VERSION}" in
209 production|development)
212 PHP_INI_VERSION="development"
216 PHP_INI_UPSTREAM="php.ini-${PHP_INI_VERSION}"
217 PHP_INI_FILE="php.ini"
222 depend.apache_pkg_setup
228 # work out where we are installing the ini file
229 php_set_ini_dir "${phpsapi}"
231 local phpinisrc="${PHP_INI_UPSTREAM}-${phpsapi}"
232 cp "${PHP_INI_UPSTREAM}" "${phpinisrc}"
234 # default to /tmp for save_path, bug #282768
235 sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}"
237 # Set the extension dir
238 sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" -i "${phpinisrc}"
240 # Set the include path to point to where we want to find PEAR packages
241 sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}"
243 dodir "${PHP_INI_DIR#${EPREFIX}}"
244 insinto "${PHP_INI_DIR#${EPREFIX}}"
245 newins "${phpinisrc}" "${PHP_INI_FILE}"
247 elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
250 dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
251 dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
253 if use_if_iuse opcache; then
254 elog "Adding opcache to $PHP_EXT_INI_DIR"
255 echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
256 dosym "${PHP_EXT_INI_DIR#${EPREFIX}}/opcache.ini" "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
259 # SAPI-specific handling
261 if [[ "${sapi}" == "fpm" ]] ; then
262 [[ -z ${PHP_FPM_CONF_VER} ]] && PHP_FPM_CONF_VER=0
263 einfo "Installing FPM CGI config file php-fpm.conf"
264 insinto "${PHP_INI_DIR#${EPREFIX}}"
265 newins "${FILESDIR}/php-fpm-r${PHP_FPM_CONF_VER}.conf" php-fpm.conf
267 # Remove bogus /etc/php-fpm.conf.default (bug 359906)
268 [[ -f "${ED}/etc/php-fpm.conf.default" ]] && rm "${ED}/etc/php-fpm.conf.default"
271 # Install PHP ini files into /usr/share/php
273 dodoc php.ini-development
274 dodoc php.ini-production
279 PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
280 PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
281 PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
285 # USE=sharedmem (session/mod_mm to be exact) tries to mmap() this path
286 # ([empty session.save_path]/session_mm_[sapi][gid].sem)
287 # there is no easy way to circumvent that, all php calls during
288 # install use -n, so no php.ini file will be used.
289 # As such, this is the easiest way to get around
290 addpredict /session_mm_cli250.sem
291 addpredict /session_mm_cli0.sem
293 # Change PHP branding
294 # Get the alpha/beta/rc version
295 sed -re "s|^(PHP_EXTRA_VERSION=\").*(\")|\1-pl${PR/r/}-gentoo\2|g" \
296 -i configure.in || die "Unable to change PHP branding"
298 # Patch PHP to show Gentoo as the server platform
299 sed -e 's/PHP_UNAME=`uname -a | xargs`/PHP_UNAME=`uname -s -n -r -v | xargs`/g' \
300 -i configure.in || die "Failed to fix server platform name"
302 # Prevent PHP from activating the Apache config,
303 # as we will do that ourselves
305 -e "s,-i -a -n php${PHP_MV},-i -n php${PHP_MV},g" \
306 -e "s,-i -A -n php${PHP_MV},-i -n php${PHP_MV},g" \
307 configure sapi/apache2filter/config.m4 sapi/apache2handler/config.m4
309 # Patch PHP to support heimdal instead of mit-krb5
310 if has_version "app-crypt/heimdal" ; then
311 sed -e 's|gssapi_krb5|gssapi|g' -i acinclude.m4 \
312 || die "Failed to fix heimdal libname"
313 sed -e 's|PHP_ADD_LIBRARY(k5crypto, 1, $1)||g' -i acinclude.m4 \
314 || die "Failed to fix heimdal crypt library reference"
317 #Add user patches #357637
320 #force rebuilding aclocal.m4
324 if [[ ${CHOST} == *-darwin* ]] ; then
325 # http://bugs.php.net/bug.php?id=48795, bug #343481
326 sed -i -e '/BUILD_CGI="\\$(CC)/s/CC/CXX/' configure || die
331 addpredict /usr/share/snmp/mibs/.index
332 addpredict /var/lib/net-snmp/mib_indexes
334 PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
336 # This is a global variable and should be in caps. It isn't because the
337 # phpconfutils eclass relies on exactly this name...
338 # for --with-libdir see bug #327025
340 --prefix="${PHP_DESTDIR}"
341 --mandir="${PHP_DESTDIR}"/man
342 --infodir="${PHP_DESTDIR}"/info
343 --libdir="${PHP_DESTDIR}"/lib
344 --with-libdir=$(get_libdir)
346 $(use_enable threads maintainer-zts)"
348 # extension USE flag shared
350 $(use_enable bcmath bcmath )
351 $(use_with bzip2 bz2 "${EPREFIX}"/usr)
352 $(use_enable calendar calendar )
353 $(use_with crypt mcrypt "${EPREFIX}"/usr)
354 $(use_enable ctype ctype )
355 $(use_with curl curl "${EPREFIX}"/usr)
356 $(use_enable debug debug )
357 $(use_with enchant enchant "${EPREFIX}"/usr)
358 $(use_enable exif exif )
359 $(use_enable fileinfo fileinfo )
360 $(use_enable filter filter )
361 $(use_with firebird interbase "${EPREFIX}"/usr)
362 $(use_enable ftp ftp )
363 $(use_with gmp gmp "${EPREFIX}"/usr)
364 $(use_enable hash hash )
365 $(use_with iconv iconv $(use elibc_glibc || echo "${EPREFIX}"/usr))
366 $(use_with imap imap "${EPREFIX}"/usr)
367 $(use_enable intl intl )
368 $(use_with iodbc iodbc "${EPREFIX}"/usr)
369 $(use_enable ipv6 ipv6 )
370 $(use_enable json json )
371 $(use_with kerberos kerberos "${EPREFIX}"/usr)
372 $(use_with ldap ldap "${EPREFIX}"/usr)
373 $(use_with ldap-sasl ldap-sasl "${EPREFIX}"/usr)
374 $(use_with libedit libedit "${EPREFIX}"/usr)
375 $(use_with mhash mhash "${EPREFIX}"/usr)
376 $(use_with mssql mssql "${EPREFIX}"/usr)
377 $(use_with nls gettext "${EPREFIX}"/usr)
378 $(use_with oci8-instant-client oci8)
379 $(use_with odbc unixODBC "${EPREFIX}"/usr)
380 $(use_enable opcache opcache )
381 $(use_enable pcntl pcntl )
382 $(use_enable pdo pdo )
383 $(use_with pdo-dblib pdo-dblib )
384 $(use_with pdo-oci pdo-oci )
385 $(use_with pdo-odbc pdo-odbc unixODBC,"${EPREFIX}"/usr)
386 $(use_with pdo-pgsql pdo-pgsql )
387 $(use_with pdo-sqlite pdo-sqlite "${EPREFIX}"/usr)
388 $(use_enable phar phar )
389 $(use_enable posix posix )
390 $(use_with postgres pgsql "${EPREFIX}"/usr)
391 $(use_with spell pspell "${EPREFIX}"/usr)
392 $(use_with readline readline "${EPREFIX}"/usr)
393 $(use_with recode recode "${EPREFIX}"/usr)
394 $(use_enable sharedmem shmop )
395 $(use_enable simplexml simplexml )
396 $(use_with snmp snmp "${EPREFIX}"/usr)
397 $(use_enable soap soap )
398 $(use_enable sockets sockets )
399 $(use_with sqlite sqlite3 "${EPREFIX}"/usr)
400 $(use_with ssl openssl "${EPREFIX}"/usr)
401 $(use_with ssl openssl-dir "${EPREFIX}"/usr)
402 $(use_with sybase-ct sybase-ct "${EPREFIX}"/usr)
403 $(use_with systemd fpm-systemd)
404 $(use_enable sysvipc sysvmsg )
405 $(use_enable sysvipc sysvsem )
406 $(use_enable sysvipc sysvshm )
407 $(use_with tidy tidy "${EPREFIX}"/usr)
408 $(use_enable tokenizer tokenizer )
409 $(use_enable unicode mbstring )
410 $(use_with unicode onig "${EPREFIX}"/usr)
411 $(use_enable wddx wddx )
412 $(use_enable xml dom )
413 $(use_enable xml libxml )
414 $(use_with xml libxml-dir "${EPREFIX}"/usr)
415 $(use_enable xml xml )
416 $(use_enable xmlreader xmlreader )
417 $(use_with xmlrpc xmlrpc)
418 $(use_enable xmlwriter xmlwriter )
419 $(use_with xslt xsl "${EPREFIX}"/usr)
420 $(use_enable zip zip )
421 $(use_with zlib zlib "${EPREFIX}"/usr)"
424 if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
426 my_conf="${my_conf} --enable-dba${shared}"
429 # DBA drivers support
432 $(use_with berkdb db4 ${EPREFIX}/usr)
433 $(use_enable flatfile flatfile )
434 $(use_with gdbm gdbm ${EPREFIX}/usr)
435 $(use_enable inifile inifile )
436 $(use_with qdbm qdbm ${EPREFIX}/usr)"
438 # Support for the GD graphics library
440 $(use_with truetype freetype-dir ${EPREFIX}/usr)
441 $(use_with truetype t1lib ${EPREFIX}/usr)
442 $(use_enable cjk gd-jis-conv )
443 $(use_with gd jpeg-dir ${EPREFIX}/usr)
444 $(use_with gd png-dir ${EPREFIX}/usr)
445 $(use_with xpm xpm-dir ${EPREFIX}/usr)
446 $(use_with vpx vpx-dir ${EPREFIX}/usr)"
447 # enable gd last, so configure can pick up the previous settings
453 my_conf+="$(use_with ssl imap-ssl ${EPREFIX}/usr)"
457 local mysqllib="mysqlnd"
458 local mysqlilib="mysqlnd"
459 use libmysqlclient && mysqllib="${EPREFIX}/usr"
460 use libmysqlclient && mysqlilib="${EPREFIX}/usr/bin/mysql_config"
462 my_conf+=" $(use_with mysql mysql $mysqllib)"
463 my_conf+=" $(use_with mysqli mysqli $mysqlilib)"
465 local mysqlsock=" $(use_with mysql mysql-sock ${EPREFIX}/var/run/mysqld/mysqld.sock)"
467 my_conf+="${mysqlsock}"
468 elif use mysqli ; then
469 my_conf+="${mysqlsock}"
473 my_conf+="$(use_with pdo-mysql pdo-mysql ${mysqllib})"
476 if use session ; then
478 $(use_with sharedmem mm ${EPREFIX}/usr)"
481 $(use_enable session session )"
484 # Use pic for shared modules such as apache2's mod_php
485 my_conf="${my_conf} --with-pic"
487 # we use the system copy of pcre
488 # --with-pcre-regex affects ext/pcre
489 # --with-pcre-dir affects ext/filter and ext/zip
490 my_conf="${my_conf} --with-pcre-regex=${EPREFIX}/usr --with-pcre-dir=${EPREFIX}/usr"
492 # Catch CFLAGS problems
494 # Changed order to run it in reverse for bug #32022 and #12021.
495 replace-cpu-flags "k6*" "i586"
497 # Support user-passed configuration parameters
498 my_conf="${my_conf} ${EXTRA_ECONF:-}"
500 # Support the Apache2 extras, they must be set globally for all
501 # SAPIs to work correctly, especially for external PHP extensions
503 mkdir -p "${WORKDIR}/sapis-build"
504 for one_sapi in $SAPIS ; do
505 use "${one_sapi}" || continue
506 php_set_ini_dir "${one_sapi}"
508 cp -r "${S}" "${WORKDIR}/sapis-build/${one_sapi}"
509 cd "${WORKDIR}/sapis-build/${one_sapi}"
511 sapi_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR}
512 --with-config-file-scan-dir=${PHP_EXT_INI_DIR_ACTIVE}"
514 for sapi in $SAPIS ; do
517 if [[ "${one_sapi}" == "${sapi}" ]] ; then
518 sapi_conf="${sapi_conf} --enable-${sapi}"
520 sapi_conf="${sapi_conf} --disable-${sapi}"
525 if [[ "${one_sapi}" == "${sapi}" ]] ; then
526 sapi_conf="${sapi_conf} --with-apxs2=${EPREFIX}/usr/sbin/apxs"
528 sapi_conf="${sapi_conf} --without-apxs2"
539 # snmp seems to run during src_compile, too (bug #324739)
540 addpredict /usr/share/snmp/mibs/.index
541 addpredict /var/lib/net-snmp/mib_indexes
543 for sapi in ${SAPIS} ; do
544 if use "${sapi}"; then
545 cd "${WORKDIR}/sapis-build/$sapi" || "Failed to change dir to ${WORKDIR}/sapis-build/$1"
546 emake || die "emake failed"
552 # see bug #324739 for what happens when we don't have that
553 addpredict /usr/share/snmp/mibs/.index
555 # grab the first SAPI that got built and install common files from there
557 for sapi in $SAPIS ; do
564 # Makefile forgets to create this before trying to write to it...
565 dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
567 # Install php environment (without any sapis)
568 cd "${WORKDIR}/sapis-build/$first_sapi"
569 emake INSTALL_ROOT="${D}" \
570 install-build install-headers install-programs \
571 || die "emake install failed"
573 local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
575 # Create the directory where we'll put version-specific php scripts
576 keepdir /usr/share/php${PHP_MV}
578 local sapi="", file=""
581 for sapi in ${SAPIS}; do
582 if use "${sapi}" ; then
583 einfo "Installing SAPI: ${sapi}"
584 cd "${WORKDIR}/sapis-build/${sapi}"
586 if [[ "${sapi}" == "apache2" ]] ; then
587 # We're specifically not using emake install-sapi as libtool
588 # may cause unnecessary relink failures (see bug #351266)
589 insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
590 newins ".libs/libphp5$(get_libname)" "libphp${PHP_MV}$(get_libname)"
591 keepdir "/usr/$(get_libdir)/apache2/modules"
593 # needed each time, php_install_ini would reset it
594 local dest="${PHP_DESTDIR#${EPREFIX}}"
598 source="sapi/cli/php"
601 source="sapi/cgi/php-cgi"
604 source="sapi/fpm/php-fpm"
607 source="libs/libphp${PHP_MV}$(get_libname)"
610 die "unhandled sapi in src_install"
614 if [[ "${source}" == *"$(get_libname)" ]]; then
615 dolib.so "${source}" || die "Unable to install ${sapi} sapi"
617 dobin "${source}" || die "Unable to install ${sapi} sapi"
618 local name="$(basename ${source})"
619 dosym "${dest}/bin/${name}" "/usr/bin/${name}${SLOT}"
623 php_install_ini "${sapi}"
625 # construct correct SAPI string for php-config
626 # thanks to ferringb for the bash voodoo
627 if [[ "${sapi}" == "apache2" ]]; then
628 sapi_list="${sapi_list:+${sapi_list} }apache2handler"
630 sapi_list="${sapi_list:+${sapi_list} }${sapi}"
635 # Installing opcache module
636 if use_if_iuse opcache ; then
637 dolib.so "modules/opcache$(get_libname)" || die "Unable to install opcache module"
640 # Install env.d files
641 newenvd "${FILESDIR}/20php5-envd" \
643 sed -e "s|/lib/|/$(get_libdir)/|g" -i \
644 "${ED}/etc/env.d/20php${SLOT}"
645 sed -e "s|php5|php${SLOT}|g" -i \
646 "${ED}/etc/env.d/20php${SLOT}"
648 # set php-config variable correctly (bug #278439)
649 sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
650 "${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config"
654 systemd_newunit "${FILESDIR}/php-fpm_at.service" "php-fpm@${SLOT}.service"
656 systemd_newunit "${FILESDIR}/php-fpm_at-simple.service" "php-fpm@${SLOT}.service"
662 echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
663 PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php"
664 if [[ ! -x "${PHP_BIN}" ]] ; then
665 ewarn "Test phase requires USE=cli, skipping"
668 export TEST_PHP_EXECUTABLE="${PHP_BIN}"
671 if [[ -x "${WORKDIR}/sapis/cgi/php-cgi" ]] ; then
672 export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis/cgi/php-cgi"
675 REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d "session.save_path=${T}" \
676 "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d "session.save_path=${T}"
678 for name in ${EXPECTED_TEST_FAILURES}; do
679 mv "${name}.out" "${name}.out.orig" 2>/dev/null
682 local failed="$(find -name '*.out')"
683 if [[ ${failed} != "" ]] ; then
684 ewarn "The following test cases failed unexpectedly:"
685 for name in ${failed}; do
686 ewarn " ${name/.out/}"
689 einfo "No unexpected test failures, all fine"
692 if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
694 for name in ${EXPECTED_TEST_FAILURES}; do
695 [[ -f "${name}.diff" ]] && continue
696 passed="${passed} ${name}"
698 if [[ ${passed} != "" ]] ; then
699 einfo "The following test cases passed unexpectedly:"
700 for name in ${passed}; do
704 einfo "None of the known-to-fail tests passed, all fine"
710 # Output some general info to the user
711 if use apache2 ; then
712 APACHE2_MOD_DEFINE="PHP5"
713 APACHE2_MOD_CONF="70_mod_php5"
714 apache-module_pkg_postinst
717 # Create the symlinks for php
718 for m in ${SAPIS}; do
719 [[ ${m} == 'embed' ]] && continue;
721 local ci=$(eselect php show $m)
722 if [[ -z $ci ]]; then
723 eselect php set $m php${SLOT}
724 einfo "Switched ${m} to use php:${SLOT}"
726 elif [[ $ci != "php${SLOT}" ]] ; then
727 elog "To switch $m to use php:${SLOT}, run"
728 elog " eselect php set $m php${SLOT}"
734 elog "Make sure that PHP_TARGETS in ${EPREFIX}/etc/make.conf includes php${SLOT/./-} in order"
735 elog "to compile extensions for the ${SLOT} ABI"
737 if ! use readline && use cli ; then
738 ewarn "Note that in order to use php interactivly, you need to enable"
739 ewarn "the readline USE flag or php -a will hang"
742 elog "This ebuild installed a version of php.ini based on php.ini-${PHP_INI_VERSION} version."
743 elog "You can chose which version of php.ini to install by default by setting PHP_INI_VERSION to either"
744 elog "'production' or 'development' in ${EPREFIX}/etc/make.conf"
745 elog "Both versions of php.ini can be found in ${EPREFIX}/usr/share/doc/${PF}"
748 elog "For more details on how minor version slotting works (PHP_TARGETS) please read the upgrade guide:"
749 elog "http://www.gentoo.org/proj/en/php/php-upgrading.xml"