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"
78 # See REQUIRED_USE for an explanation of why we duplicate dependencies
81 >=app-admin/eselect-php-0.7.1-r3[apache2?,fpm?]
82 >=dev-libs/libpcre-8.32[unicode]
83 apache2? ( || ( >=www-servers/apache-2.4[apache2_modules_unixd,threads=]
84 <www-servers/apache-2.4[threads=] ) )
85 berkdb? ( =sys-libs/db-4* )
86 bzip2? ( app-arch/bzip2 )
87 cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
93 crypt? ( >=dev-libs/libmcrypt-2.4 )
94 curl? ( >=net-misc/curl-7.10.5 )
95 enchant? ( app-text/enchant )
101 firebird? ( dev-db/firebird )
102 gd? ( virtual/jpeg:0 media-libs/libpng:0= sys-libs/zlib )
103 gdbm? ( >=sys-libs/gdbm-1.8.0 )
104 gmp? ( >=dev-libs/gmp-4.1.2 )
105 iconv? ( virtual/libiconv )
106 imap? ( virtual/imap-c-client[ssl=] )
107 intl? ( dev-libs/icu:= )
108 iodbc? ( dev-db/libiodbc )
109 kerberos? ( virtual/krb5 )
110 ldap? ( >=net-nds/openldap-1.2.11 )
111 ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 )
112 libedit? ( || ( sys-freebsd/freebsd-lib dev-libs/libedit ) )
113 mssql? ( dev-db/freetds[mssql] )
115 mysql? ( virtual/mysql )
116 mysqli? ( virtual/mysql )
118 nls? ( sys-devel/gettext )
119 oci8-instant-client? ( dev-db/oracle-instantclient-basic )
120 odbc? ( >=dev-db/unixODBC-1.8.13 )
121 pdo-dblib? ( dev-db/freetds[mssql] )
122 pdo-oci? ( dev-db/oracle-instantclient-basic )
123 pdo-odbc? ( >=dev-db/unixODBC-1.8.13 )
124 pdo-mysql? ( virtual/mysql )
125 pdo-pgsql? ( dev-db/postgresql )
126 pdo-sqlite? ( >=dev-db/sqlite-3.7.6.3 )
127 postgres? ( dev-db/postgresql )
128 qdbm? ( dev-db/qdbm )
129 readline? ( sys-libs/readline )
130 recode? ( app-text/recode )
131 sharedmem? ( dev-libs/mm )
132 simplexml? ( >=dev-libs/libxml2-2.6.8 )
133 snmp? ( >=net-analyzer/net-snmp-5.2 )
134 soap? ( >=dev-libs/libxml2-2.6.8 )
135 spell? ( >=app-text/aspell-0.50 )
136 sqlite? ( >=dev-db/sqlite-3.7.6.3 )
137 ssl? ( >=dev-libs/openssl-0.9.7 )
138 sybase-ct? ( dev-db/freetds )
139 tidy? ( app-text/htmltidy )
141 =media-libs/freetype-2*
142 >=media-libs/t1lib-5.0.0
144 virtual/jpeg:0 media-libs/libpng:0= sys-libs/zlib )
146 unicode? ( dev-libs/oniguruma )
147 vpx? ( media-libs/libvpx )
148 wddx? ( >=dev-libs/libxml2-2.6.8 )
149 xml? ( >=dev-libs/libxml2-2.6.8 )
150 xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv )
151 xmlreader? ( >=dev-libs/libxml2-2.6.8 )
152 xmlwriter? ( >=dev-libs/libxml2-2.6.8 )
156 media-libs/libpng:0= sys-libs/zlib
158 xslt? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
159 zip? ( sys-libs/zlib )
160 zlib? ( sys-libs/zlib )
164 php="=${CATEGORY}/${PF}"
166 # All of the pdo-foo USE flags could require USE=foo, but this has an
167 # unwanted side effect. USE=mysql, for example, also enables the old
168 # deprecated mysql database driver. We would like it to be possible to
169 # install pdo-mysql without the deprecated mysql driver, so we don't
170 # require USE=mysql with USE=pdo-mysql. This means that we have to
171 # reproduce the mysql? (...) dependencies for pdo-mysql in (R)DEPEND
184 xmlrpc? ( || ( xml iconv ) )
190 libmysqlclient? ( || (
203 readline? ( !libedit )
204 recode? ( !imap !mysql !mysqli )
205 sharedmem? ( !threads )
207 !cli? ( !cgi? ( !fpm? ( !apache2? ( !embed? ( cli ) ) ) ) )"
213 selinux? ( sec-policy/selinux-phpfpm )
214 systemd? ( sys-apps/systemd ) )"
219 >=sys-devel/libtool-1.5.18"
221 # Allow users to install production version if they want to
223 case "${PHP_INI_VERSION}" in
224 production|development)
227 PHP_INI_VERSION="development"
231 PHP_INI_UPSTREAM="php.ini-${PHP_INI_VERSION}"
232 PHP_INI_FILE="php.ini"
237 depend.apache_pkg_setup
243 # work out where we are installing the ini file
244 php_set_ini_dir "${phpsapi}"
246 local phpinisrc="${PHP_INI_UPSTREAM}-${phpsapi}"
247 cp "${PHP_INI_UPSTREAM}" "${phpinisrc}"
249 # default to /tmp for save_path, bug #282768
250 sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}"
252 # Set the extension dir
253 sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" -i "${phpinisrc}"
255 # Set the include path to point to where we want to find PEAR packages
256 sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}"
258 dodir "${PHP_INI_DIR#${EPREFIX}}"
259 insinto "${PHP_INI_DIR#${EPREFIX}}"
260 newins "${phpinisrc}" "${PHP_INI_FILE}"
262 elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
265 dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
266 dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
268 if use_if_iuse opcache; then
269 elog "Adding opcache to $PHP_EXT_INI_DIR"
270 echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
271 dosym "${PHP_EXT_INI_DIR#${EPREFIX}}/opcache.ini" "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
274 # SAPI-specific handling
276 if [[ "${sapi}" == "fpm" ]] ; then
277 [[ -z ${PHP_FPM_CONF_VER} ]] && PHP_FPM_CONF_VER=0
278 einfo "Installing FPM CGI config file php-fpm.conf"
279 insinto "${PHP_INI_DIR#${EPREFIX}}"
280 newins "${FILESDIR}/php-fpm-r${PHP_FPM_CONF_VER}.conf" php-fpm.conf
282 # Remove bogus /etc/php-fpm.conf.default (bug 359906)
283 [[ -f "${ED}/etc/php-fpm.conf.default" ]] && rm "${ED}/etc/php-fpm.conf.default"
286 # Install PHP ini files into /usr/share/php
288 dodoc php.ini-development
289 dodoc php.ini-production
294 PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
295 PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
296 PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
300 # USE=sharedmem (session/mod_mm to be exact) tries to mmap() this path
301 # ([empty session.save_path]/session_mm_[sapi][gid].sem)
302 # there is no easy way to circumvent that, all php calls during
303 # install use -n, so no php.ini file will be used.
304 # As such, this is the easiest way to get around
305 addpredict /session_mm_cli250.sem
306 addpredict /session_mm_cli0.sem
308 # Change PHP branding
309 # Get the alpha/beta/rc version
310 sed -re "s|^(PHP_EXTRA_VERSION=\").*(\")|\1-pl${PR/r/}-gentoo\2|g" \
311 -i configure.in || die "Unable to change PHP branding"
313 # Patch PHP to show Gentoo as the server platform
314 sed -e 's/PHP_UNAME=`uname -a | xargs`/PHP_UNAME=`uname -s -n -r -v | xargs`/g' \
315 -i configure.in || die "Failed to fix server platform name"
317 # Prevent PHP from activating the Apache config,
318 # as we will do that ourselves
320 -e "s,-i -a -n php${PHP_MV},-i -n php${PHP_MV},g" \
321 -e "s,-i -A -n php${PHP_MV},-i -n php${PHP_MV},g" \
322 configure sapi/apache2filter/config.m4 sapi/apache2handler/config.m4
324 # Patch PHP to support heimdal instead of mit-krb5
325 if has_version "app-crypt/heimdal" ; then
326 sed -e 's|gssapi_krb5|gssapi|g' -i acinclude.m4 \
327 || die "Failed to fix heimdal libname"
328 sed -e 's|PHP_ADD_LIBRARY(k5crypto, 1, $1)||g' -i acinclude.m4 \
329 || die "Failed to fix heimdal crypt library reference"
332 #Add user patches #357637
335 #force rebuilding aclocal.m4
339 if [[ ${CHOST} == *-darwin* ]] ; then
340 # http://bugs.php.net/bug.php?id=48795, bug #343481
341 sed -i -e '/BUILD_CGI="\\$(CC)/s/CC/CXX/' configure || die
346 addpredict /usr/share/snmp/mibs/.index
347 addpredict /var/lib/net-snmp/mib_indexes
349 PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
351 # This is a global variable and should be in caps. It isn't because the
352 # phpconfutils eclass relies on exactly this name...
353 # for --with-libdir see bug #327025
355 --prefix="${PHP_DESTDIR}"
356 --mandir="${PHP_DESTDIR}"/man
357 --infodir="${PHP_DESTDIR}"/info
358 --libdir="${PHP_DESTDIR}"/lib
359 --with-libdir=$(get_libdir)
361 $(use_enable threads maintainer-zts)"
363 # extension USE flag shared
365 $(use_enable bcmath bcmath )
366 $(use_with bzip2 bz2 "${EPREFIX}"/usr)
367 $(use_enable calendar calendar )
368 $(use_with crypt mcrypt "${EPREFIX}"/usr)
369 $(use_enable ctype ctype )
370 $(use_with curl curl "${EPREFIX}"/usr)
371 $(use_enable debug debug )
372 $(use_with enchant enchant "${EPREFIX}"/usr)
373 $(use_enable exif exif )
374 $(use_enable fileinfo fileinfo )
375 $(use_enable filter filter )
376 $(use_with firebird interbase "${EPREFIX}"/usr)
377 $(use_enable ftp ftp )
378 $(use_with gmp gmp "${EPREFIX}"/usr)
379 $(use_enable hash hash )
380 $(use_with iconv iconv $(use elibc_glibc || echo "${EPREFIX}"/usr))
381 $(use_with imap imap "${EPREFIX}"/usr)
382 $(use_enable intl intl )
383 $(use_with iodbc iodbc "${EPREFIX}"/usr)
384 $(use_enable ipv6 ipv6 )
385 $(use_enable json json )
386 $(use_with kerberos kerberos "${EPREFIX}"/usr)
387 $(use_with ldap ldap "${EPREFIX}"/usr)
388 $(use_with ldap-sasl ldap-sasl "${EPREFIX}"/usr)
389 $(use_with libedit libedit "${EPREFIX}"/usr)
390 $(use_with mhash mhash "${EPREFIX}"/usr)
391 $(use_with mssql mssql "${EPREFIX}"/usr)
392 $(use_with nls gettext "${EPREFIX}"/usr)
393 $(use_with oci8-instant-client oci8)
394 $(use_with odbc unixODBC "${EPREFIX}"/usr)
395 $(use_enable opcache opcache )
396 $(use_enable pcntl pcntl )
397 $(use_enable pdo pdo )
398 $(use_with pdo-dblib pdo-dblib )
399 $(use_with pdo-oci pdo-oci )
400 $(use_with pdo-odbc pdo-odbc unixODBC,"${EPREFIX}"/usr)
401 $(use_with pdo-pgsql pdo-pgsql )
402 $(use_with pdo-sqlite pdo-sqlite "${EPREFIX}"/usr)
403 $(use_enable phar phar )
404 $(use_enable posix posix )
405 $(use_with postgres pgsql "${EPREFIX}"/usr)
406 $(use_with spell pspell "${EPREFIX}"/usr)
407 $(use_with readline readline "${EPREFIX}"/usr)
408 $(use_with recode recode "${EPREFIX}"/usr)
409 $(use_enable sharedmem shmop )
410 $(use_enable simplexml simplexml )
411 $(use_with snmp snmp "${EPREFIX}"/usr)
412 $(use_enable soap soap )
413 $(use_enable sockets sockets )
414 $(use_with sqlite sqlite3 "${EPREFIX}"/usr)
415 $(use_with ssl openssl "${EPREFIX}"/usr)
416 $(use_with ssl openssl-dir "${EPREFIX}"/usr)
417 $(use_with sybase-ct sybase-ct "${EPREFIX}"/usr)
418 $(use_with systemd fpm-systemd)
419 $(use_enable sysvipc sysvmsg )
420 $(use_enable sysvipc sysvsem )
421 $(use_enable sysvipc sysvshm )
422 $(use_with tidy tidy "${EPREFIX}"/usr)
423 $(use_enable tokenizer tokenizer )
424 $(use_enable unicode mbstring )
425 $(use_with unicode onig "${EPREFIX}"/usr)
426 $(use_enable wddx wddx )
427 $(use_enable xml dom )
428 $(use_enable xml libxml )
429 $(use_with xml libxml-dir "${EPREFIX}"/usr)
430 $(use_enable xml xml )
431 $(use_enable xmlreader xmlreader )
432 $(use_with xmlrpc xmlrpc)
433 $(use_enable xmlwriter xmlwriter )
434 $(use_with xslt xsl "${EPREFIX}"/usr)
435 $(use_enable zip zip )
436 $(use_with zlib zlib "${EPREFIX}"/usr)"
439 if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
441 my_conf+=" --enable-dba${shared}"
444 # DBA drivers support
447 $(use_with berkdb db4 ${EPREFIX}/usr)
448 $(use_enable flatfile flatfile )
449 $(use_with gdbm gdbm ${EPREFIX}/usr)
450 $(use_enable inifile inifile )
451 $(use_with qdbm qdbm ${EPREFIX}/usr)"
453 # Support for the GD graphics library
455 $(use_with truetype freetype-dir ${EPREFIX}/usr)
456 $(use_with truetype t1lib ${EPREFIX}/usr)
457 $(use_enable cjk gd-jis-conv )
458 $(use_with gd jpeg-dir ${EPREFIX}/usr)
459 $(use_with gd png-dir ${EPREFIX}/usr)
460 $(use_with xpm xpm-dir ${EPREFIX}/usr)
461 $(use_with vpx vpx-dir ${EPREFIX}/usr)"
462 # enable gd last, so configure can pick up the previous settings
468 my_conf+=" $(use_with ssl imap-ssl ${EPREFIX}/usr)"
472 local mysqllib="mysqlnd"
473 local mysqlilib="mysqlnd"
474 use libmysqlclient && mysqllib="${EPREFIX}/usr"
475 use libmysqlclient && mysqlilib="${EPREFIX}/usr/bin/mysql_config"
477 my_conf+=" $(use_with mysql mysql $mysqllib)"
478 my_conf+=" $(use_with mysqli mysqli $mysqlilib)"
481 my_conf+=" $(use_with pdo-mysql pdo-mysql ${mysqllib})"
483 # If MySQL is enabled in any way, pass --with-mysql-sock to ./configure.
484 if use mysql || use mysqli || use pdo-mysql ; then
485 my_conf+=" --with-mysql-sock=${EPREFIX}/var/run/mysqld/mysqld.sock"
489 if use session ; then
491 $(use_with sharedmem mm ${EPREFIX}/usr)"
494 $(use_enable session session )"
497 # Use pic for shared modules such as apache2's mod_php
498 my_conf+=" --with-pic"
500 # we use the system copy of pcre
501 # --with-pcre-regex affects ext/pcre
502 # --with-pcre-dir affects ext/filter and ext/zip
503 my_conf+=" --with-pcre-regex=${EPREFIX}/usr --with-pcre-dir=${EPREFIX}/usr"
505 # Catch CFLAGS problems
507 # Changed order to run it in reverse for bug #32022 and #12021.
508 replace-cpu-flags "k6*" "i586"
510 # Support user-passed configuration parameters
511 my_conf+=" ${EXTRA_ECONF:-}"
513 # Support the Apache2 extras, they must be set globally for all
514 # SAPIs to work correctly, especially for external PHP extensions
516 mkdir -p "${WORKDIR}/sapis-build"
517 for one_sapi in $SAPIS ; do
518 use "${one_sapi}" || continue
519 php_set_ini_dir "${one_sapi}"
521 cp -r "${S}" "${WORKDIR}/sapis-build/${one_sapi}"
522 cd "${WORKDIR}/sapis-build/${one_sapi}"
524 sapi_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR}
525 --with-config-file-scan-dir=${PHP_EXT_INI_DIR_ACTIVE}"
527 for sapi in $SAPIS ; do
530 if [[ "${one_sapi}" == "${sapi}" ]] ; then
531 sapi_conf="${sapi_conf} --enable-${sapi}"
533 sapi_conf="${sapi_conf} --disable-${sapi}"
538 if [[ "${one_sapi}" == "${sapi}" ]] ; then
539 sapi_conf="${sapi_conf} --with-apxs2=${EPREFIX}/usr/sbin/apxs"
541 sapi_conf="${sapi_conf} --without-apxs2"
552 # snmp seems to run during src_compile, too (bug #324739)
553 addpredict /usr/share/snmp/mibs/.index
554 addpredict /var/lib/net-snmp/mib_indexes
556 for sapi in ${SAPIS} ; do
557 if use "${sapi}"; then
558 cd "${WORKDIR}/sapis-build/$sapi" || "Failed to change dir to ${WORKDIR}/sapis-build/$1"
559 emake || die "emake failed"
565 # see bug #324739 for what happens when we don't have that
566 addpredict /usr/share/snmp/mibs/.index
568 # grab the first SAPI that got built and install common files from there
570 for sapi in $SAPIS ; do
577 # Makefile forgets to create this before trying to write to it...
578 dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
580 # Install php environment (without any sapis)
581 cd "${WORKDIR}/sapis-build/$first_sapi"
582 emake INSTALL_ROOT="${D}" \
583 install-build install-headers install-programs \
584 || die "emake install failed"
586 local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
588 # Create the directory where we'll put version-specific php scripts
589 keepdir /usr/share/php${PHP_MV}
591 local sapi="", file=""
594 for sapi in ${SAPIS}; do
595 if use "${sapi}" ; then
596 einfo "Installing SAPI: ${sapi}"
597 cd "${WORKDIR}/sapis-build/${sapi}"
599 if [[ "${sapi}" == "apache2" ]] ; then
600 # We're specifically not using emake install-sapi as libtool
601 # may cause unnecessary relink failures (see bug #351266)
602 insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
603 newins ".libs/libphp5$(get_libname)" "libphp${PHP_MV}$(get_libname)"
604 keepdir "/usr/$(get_libdir)/apache2/modules"
606 # needed each time, php_install_ini would reset it
607 local dest="${PHP_DESTDIR#${EPREFIX}}"
611 source="sapi/cli/php"
614 source="sapi/cgi/php-cgi"
617 source="sapi/fpm/php-fpm"
620 source="libs/libphp${PHP_MV}$(get_libname)"
623 die "unhandled sapi in src_install"
627 if [[ "${source}" == *"$(get_libname)" ]]; then
628 dolib.so "${source}" || die "Unable to install ${sapi} sapi"
630 dobin "${source}" || die "Unable to install ${sapi} sapi"
631 local name="$(basename ${source})"
632 dosym "${dest}/bin/${name}" "/usr/bin/${name}${SLOT}"
636 php_install_ini "${sapi}"
638 # construct correct SAPI string for php-config
639 # thanks to ferringb for the bash voodoo
640 if [[ "${sapi}" == "apache2" ]]; then
641 sapi_list="${sapi_list:+${sapi_list} }apache2handler"
643 sapi_list="${sapi_list:+${sapi_list} }${sapi}"
648 # Installing opcache module
649 if use_if_iuse opcache ; then
650 dolib.so "modules/opcache$(get_libname)" || die "Unable to install opcache module"
653 # Install env.d files
654 newenvd "${FILESDIR}/20php5-envd" \
656 sed -e "s|/lib/|/$(get_libdir)/|g" -i \
657 "${ED}/etc/env.d/20php${SLOT}"
658 sed -e "s|php5|php${SLOT}|g" -i \
659 "${ED}/etc/env.d/20php${SLOT}"
661 # set php-config variable correctly (bug #278439)
662 sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
663 "${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config"
667 systemd_newunit "${FILESDIR}/php-fpm_at.service" "php-fpm@${SLOT}.service"
669 systemd_newunit "${FILESDIR}/php-fpm_at-simple.service" "php-fpm@${SLOT}.service"
675 echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
676 PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php"
677 if [[ ! -x "${PHP_BIN}" ]] ; then
678 ewarn "Test phase requires USE=cli, skipping"
681 export TEST_PHP_EXECUTABLE="${PHP_BIN}"
684 if [[ -x "${WORKDIR}/sapis/cgi/php-cgi" ]] ; then
685 export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis/cgi/php-cgi"
688 REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d "session.save_path=${T}" \
689 "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d "session.save_path=${T}"
691 for name in ${EXPECTED_TEST_FAILURES}; do
692 mv "${name}.out" "${name}.out.orig" 2>/dev/null
695 local failed="$(find -name '*.out')"
696 if [[ ${failed} != "" ]] ; then
697 ewarn "The following test cases failed unexpectedly:"
698 for name in ${failed}; do
699 ewarn " ${name/.out/}"
702 einfo "No unexpected test failures, all fine"
705 if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
707 for name in ${EXPECTED_TEST_FAILURES}; do
708 [[ -f "${name}.diff" ]] && continue
709 passed="${passed} ${name}"
711 if [[ ${passed} != "" ]] ; then
712 einfo "The following test cases passed unexpectedly:"
713 for name in ${passed}; do
717 einfo "None of the known-to-fail tests passed, all fine"
723 # Output some general info to the user
724 if use apache2 ; then
725 APACHE2_MOD_DEFINE="PHP5"
726 APACHE2_MOD_CONF="70_mod_php5"
727 apache-module_pkg_postinst
730 # Create the symlinks for php
731 for m in ${SAPIS}; do
732 [[ ${m} == 'embed' ]] && continue;
734 local ci=$(eselect php show $m)
735 if [[ -z $ci ]]; then
736 eselect php set $m php${SLOT}
737 einfo "Switched ${m} to use php:${SLOT}"
739 elif [[ $ci != "php${SLOT}" ]] ; then
740 elog "To switch $m to use php:${SLOT}, run"
741 elog " eselect php set $m php${SLOT}"
747 elog "Make sure that PHP_TARGETS in ${EPREFIX}/etc/make.conf includes php${SLOT/./-} in order"
748 elog "to compile extensions for the ${SLOT} ABI"
750 if ! use readline && use cli ; then
751 ewarn "Note that in order to use php interactivly, you need to enable"
752 ewarn "the readline USE flag or php -a will hang"
755 elog "This ebuild installed a version of php.ini based on php.ini-${PHP_INI_VERSION} version."
756 elog "You can chose which version of php.ini to install by default by setting PHP_INI_VERSION to either"
757 elog "'production' or 'development' in ${EPREFIX}/etc/make.conf"
758 elog "Both versions of php.ini can be found in ${EPREFIX}/usr/share/doc/${PF}"
761 elog "For more details on how minor version slotting works (PHP_TARGETS) please read the upgrade guide:"
762 elog "http://www.gentoo.org/proj/en/php/php-upgrading.xml"