Gentoo Archives: gentoo-commits

From: Michael Orlitzky <mjo@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/php/, dev-lang/php/files/
Date: Thu, 04 Aug 2016 19:04:19
Message-Id: 1470337152.36626b1d255da79d9e52bbd907ec579b9efa93c5.mjo@gentoo
1 commit: 36626b1d255da79d9e52bbd907ec579b9efa93c5
2 Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
3 AuthorDate: Thu Aug 4 16:47:29 2016 +0000
4 Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
5 CommitDate: Thu Aug 4 18:59:12 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=36626b1d
7
8 dev-lang/php: new 7.x revision to fix the build on x86.
9
10 There is an upstream bug that causes the build to fail on x86 with
11 gcc-4.9. There was an earlier fix for gcc-4.8, and this new revision
12 has a fix that also works for gcc-4.9.
13
14 And, since we're no longer inheriting depend.apache.eclass, I was
15 finally able to update the ebuild to EAPI=6.
16
17 A redundant earlier ebuild for php-7.0.9 was also removed.
18
19 Gentoo-Bug: 571658
20
21 Package-Manager: portage-2.2.28
22
23 dev-lang/php/files/fix-x86-build-bug_571658.patch | 51 ++
24 .../{php-7.0.9-r1.ebuild => php-7.0.9-r2.ebuild} | 12 +-
25 dev-lang/php/php-7.0.9.ebuild | 808 ---------------------
26 3 files changed, 58 insertions(+), 813 deletions(-)
27
28 diff --git a/dev-lang/php/files/fix-x86-build-bug_571658.patch b/dev-lang/php/files/fix-x86-build-bug_571658.patch
29 new file mode 100644
30 index 0000000..46f68b6
31 --- /dev/null
32 +++ b/dev-lang/php/files/fix-x86-build-bug_571658.patch
33 @@ -0,0 +1,51 @@
34 +From 2fcc388d9bf238673ed84b8f38d7753279aea48c Mon Sep 17 00:00:00 2001
35 +From: Michael Orlitzky <michael@××××××××.com>
36 +Date: Thu, 4 Aug 2016 11:42:56 -0400
37 +Subject: [PATCH 1/1] Zend/zend_operators.h: disable x86 assembly on all newer
38 + GCC-4.x.
39 +
40 +In bug 69896, a fix was committed to work around a build error: 'asm'
41 +operand has impossible constraints, in zend_operators.h, on x86. At
42 +the time, the problem was only visible with gcc-4.8, and the fix was
43 +to disable that chunk of assembly for gcc-4.8. With gcc-4.9, the
44 +problem persists, so we now need to check for gcc-4.9 (at least) in
45 +addition to gcc-4.8.
46 +
47 +This commit modifies the earlier conditional that checks for
48 +gcc-4.8. The existing check was for equality on the minor component of
49 +the gcc version, namely 8. The == operator that performs the
50 +comparison has been changed to <=, so that it catches any gcc-4.x with
51 +x >= 8. This has been tested and fixes the build on x86 hardware with
52 +gcc-4.9.
53 +
54 +PHP-Bug: 69896
55 +Gentoo-Bug: 571658
56 +---
57 + Zend/zend_operators.h | 4 ++--
58 + 1 file changed, 2 insertions(+), 2 deletions(-)
59 +
60 +diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h
61 +index 3705022..dd7c354 100644
62 +--- a/Zend/zend_operators.h
63 ++++ b/Zend/zend_operators.h
64 +@@ -520,7 +520,7 @@ static zend_always_inline void fast_long_decrement_function(zval *op1)
65 +
66 + static zend_always_inline void fast_long_add_function(zval *result, zval *op1, zval *op2)
67 + {
68 +-#if defined(__GNUC__) && defined(__i386__) && !(4 == __GNUC__ && 8 == __GNUC_MINOR__)
69 ++#if defined(__GNUC__) && defined(__i386__) && !(4 == __GNUC__ && 8 <= __GNUC_MINOR__)
70 + __asm__(
71 + "movl (%1), %%eax\n\t"
72 + "addl (%2), %%eax\n\t"
73 +@@ -606,7 +606,7 @@ static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *o
74 +
75 + static zend_always_inline void fast_long_sub_function(zval *result, zval *op1, zval *op2)
76 + {
77 +-#if defined(__GNUC__) && defined(__i386__) && !(4 == __GNUC__ && 8 == __GNUC_MINOR__)
78 ++#if defined(__GNUC__) && defined(__i386__) && !(4 == __GNUC__ && 8 <= __GNUC_MINOR__)
79 + __asm__(
80 + "movl (%1), %%eax\n\t"
81 + "subl (%2), %%eax\n\t"
82 +--
83 +2.7.3
84 +
85
86 diff --git a/dev-lang/php/php-7.0.9-r1.ebuild b/dev-lang/php/php-7.0.9-r2.ebuild
87 similarity index 98%
88 rename from dev-lang/php/php-7.0.9-r1.ebuild
89 rename to dev-lang/php/php-7.0.9-r2.ebuild
90 index 3bb3c0e..1e440f6 100644
91 --- a/dev-lang/php/php-7.0.9-r1.ebuild
92 +++ b/dev-lang/php/php-7.0.9-r2.ebuild
93 @@ -2,9 +2,9 @@
94 # Distributed under the terms of the GNU General Public License v2
95 # $Id$
96
97 -EAPI=5
98 +EAPI=6
99
100 -inherit eutils autotools flag-o-matic versionator libtool systemd
101 +inherit autotools flag-o-matic versionator libtool systemd
102
103 DESCRIPTION="The PHP language runtime engine"
104 HOMEPAGE="http://php.net/"
105 @@ -217,6 +217,9 @@ php_set_ini_dir() {
106 }
107
108 src_prepare() {
109 + # Disable some assembly on x86.
110 + eapply "${FILESDIR}/fix-x86-build-bug_571658.patch"
111 +
112 # Change PHP branding
113 # Get the alpha/beta/rc version
114 sed -re "s|^(PHP_EXTRA_VERSION=\").*(\")|\1-pl${PR/r/}-gentoo\2|g" \
115 @@ -234,11 +237,10 @@ src_prepare() {
116 || die "Failed to fix heimdal crypt library reference"
117 fi
118
119 - # Add user patches #357637
120 - epatch_user
121 + eapply_user
122
123 # Force rebuilding aclocal.m4
124 - rm -f aclocal.m4 || die
125 + rm -f aclocal.m4 || die "failed to remove aclocal.m4 in src_prepare"
126 eautoreconf
127
128 if [[ ${CHOST} == *-darwin* ]] ; then
129
130 diff --git a/dev-lang/php/php-7.0.9.ebuild b/dev-lang/php/php-7.0.9.ebuild
131 deleted file mode 100644
132 index df705ca..0000000
133 --- a/dev-lang/php/php-7.0.9.ebuild
134 +++ /dev/null
135 @@ -1,808 +0,0 @@
136 -# Copyright 1999-2016 Gentoo Foundation
137 -# Distributed under the terms of the GNU General Public License v2
138 -# $Id$
139 -
140 -EAPI=5
141 -
142 -inherit eutils autotools flag-o-matic versionator libtool systemd
143 -
144 -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"
145 -
146 -function php_get_uri ()
147 -{
148 - case "${1}" in
149 - "php-pre")
150 - echo "http://downloads.php.net/ab/${2}"
151 - ;;
152 - "php")
153 - echo "http://www.php.net/distributions/${2}"
154 - ;;
155 - "olemarkus")
156 - echo "https://dev.gentoo.org/~olemarkus/php/${2}"
157 - ;;
158 - "gentoo")
159 - echo "mirror://gentoo/${2}"
160 - ;;
161 - *)
162 - die "unhandled case in php_get_uri"
163 - ;;
164 - esac
165 -}
166 -
167 -PHP_MV="$(get_major_version)"
168 -SLOT="$(get_version_component_range 1-2)"
169 -
170 -# alias, so we can handle different types of releases (finals, rcs, alphas,
171 -# betas, ...) w/o changing the whole ebuild
172 -PHP_PV="${PV/_rc/RC}"
173 -PHP_PV="${PHP_PV/_alpha/alpha}"
174 -PHP_PV="${PHP_PV/_beta/beta}"
175 -PHP_RELEASE="php"
176 -[[ ${PV} == ${PV/_alpha/} ]] || PHP_RELEASE="php-pre"
177 -[[ ${PV} == ${PV/_beta/} ]] || PHP_RELEASE="php-pre"
178 -[[ ${PV} == ${PV/_rc/} ]] || PHP_RELEASE="php-pre"
179 -PHP_P="${PN}-${PHP_PV}"
180 -
181 -PHP_SRC_URI="$(php_get_uri "${PHP_RELEASE}" "${PHP_P}.tar.xz")"
182 -
183 -PHP_FPM_CONF_VER="1"
184 -
185 -SRC_URI="${PHP_SRC_URI}"
186 -
187 -DESCRIPTION="The PHP language runtime engine"
188 -HOMEPAGE="http://php.net/"
189 -LICENSE="PHP-3"
190 -
191 -S="${WORKDIR}/${PHP_P}"
192 -
193 -# We can build the following SAPIs in the given order
194 -SAPIS="embed cli cgi fpm apache2 phpdbg"
195 -
196 -# SAPIs and SAPI-specific USE flags (cli SAPI is default on):
197 -IUSE="${IUSE}
198 - ${SAPIS/cli/+cli}
199 - threads"
200 -
201 -IUSE="${IUSE} bcmath berkdb bzip2 calendar cdb cjk
202 - crypt +ctype curl debug
203 - enchant exif frontbase +fileinfo +filter firebird
204 - flatfile ftp gd gdbm gmp +hash +iconv imap inifile
205 - intl iodbc ipv6 +json kerberos ldap ldap-sasl libedit libressl
206 - mhash mssql mysql mysqli nls
207 - oci8-instant-client odbc +opcache pcntl pdo +phar +posix postgres qdbm
208 - readline recode selinux +session sharedmem
209 - +simplexml snmp soap sockets spell sqlite ssl
210 - sysvipc systemd tidy +tokenizer truetype unicode wddx webp
211 - +xml xmlreader xmlwriter xmlrpc xpm xslt zip zlib"
212 -
213 -DEPEND="
214 - >=app-eselect/eselect-php-0.9.1[apache2?,fpm?]
215 - >=dev-libs/libpcre-8.32[unicode]
216 - apache2? ( || ( >=www-servers/apache-2.4[apache2_modules_unixd,threads=]
217 - <www-servers/apache-2.4[threads=] ) )"
218 -
219 -# The supported (that is, autodetected) versions of BDB are listed in
220 -# the ./configure script. Other versions *work*, but we need to stick to
221 -# the ones that can be detected to avoid a repeat of bug #564824.
222 -DEPEND="${DEPEND}
223 - berkdb? ( || ( sys-libs/db:5.3
224 - sys-libs/db:5.1
225 - sys-libs/db:4.8
226 - sys-libs/db:4.7
227 - sys-libs/db:4.6
228 - sys-libs/db:4.5 ) )
229 - bzip2? ( app-arch/bzip2 )
230 - cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
231 - cjk? ( !gd? (
232 - virtual/jpeg:0
233 - media-libs/libpng:0=
234 - sys-libs/zlib
235 - ) )
236 - crypt? ( >=dev-libs/libmcrypt-2.4 )
237 - curl? ( >=net-misc/curl-7.10.5 )
238 - enchant? ( app-text/enchant )
239 - exif? ( !gd? (
240 - virtual/jpeg:0
241 - media-libs/libpng:0=
242 - sys-libs/zlib
243 - ) )
244 - firebird? ( dev-db/firebird )
245 - gd? ( virtual/jpeg:0 media-libs/libpng:0= sys-libs/zlib )
246 - gdbm? ( >=sys-libs/gdbm-1.8.0 )
247 - gmp? ( dev-libs/gmp:0 )
248 - iconv? ( virtual/libiconv )
249 - imap? ( virtual/imap-c-client[ssl=] )
250 - intl? ( dev-libs/icu:= )
251 - iodbc? ( dev-db/libiodbc )
252 - kerberos? ( virtual/krb5 )
253 - ldap? ( >=net-nds/openldap-1.2.11 )
254 - ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 )
255 - libedit? ( || ( sys-freebsd/freebsd-lib dev-libs/libedit ) )
256 - mssql? ( dev-db/freetds[mssql] )
257 - nls? ( sys-devel/gettext )
258 - oci8-instant-client? ( dev-db/oracle-instantclient-basic )
259 - odbc? ( >=dev-db/unixODBC-1.8.13 )
260 - postgres? ( dev-db/postgresql:* )
261 - qdbm? ( dev-db/qdbm )
262 - readline? ( sys-libs/readline:0 )
263 - recode? ( app-text/recode )
264 - sharedmem? ( dev-libs/mm )
265 - simplexml? ( >=dev-libs/libxml2-2.6.8 )
266 - snmp? ( >=net-analyzer/net-snmp-5.2 )
267 - soap? ( >=dev-libs/libxml2-2.6.8 )
268 - spell? ( >=app-text/aspell-0.50 )
269 - sqlite? ( >=dev-db/sqlite-3.7.6.3 )
270 - ssl? (
271 - !libressl? ( dev-libs/openssl:0 )
272 - libressl? ( dev-libs/libressl )
273 - )
274 - tidy? ( app-text/htmltidy )
275 - truetype? (
276 - =media-libs/freetype-2*
277 - !gd? (
278 - virtual/jpeg:0 media-libs/libpng:0= sys-libs/zlib )
279 - )
280 - unicode? ( dev-libs/oniguruma )
281 - wddx? ( >=dev-libs/libxml2-2.6.8 )
282 - webp? ( media-libs/libwebp )
283 - xml? ( >=dev-libs/libxml2-2.6.8 )
284 - xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv )
285 - xmlreader? ( >=dev-libs/libxml2-2.6.8 )
286 - xmlwriter? ( >=dev-libs/libxml2-2.6.8 )
287 - xpm? (
288 - x11-libs/libXpm
289 - virtual/jpeg:0
290 - media-libs/libpng:0= sys-libs/zlib
291 - )
292 - xslt? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
293 - zip? ( sys-libs/zlib )
294 - zlib? ( sys-libs/zlib )
295 - virtual/mta
296 -"
297 -
298 -php="=${CATEGORY}/${PF}"
299 -
300 -# Without USE=readline or libedit, the interactive "php -a" CLI will hang.
301 -REQUIRED_USE="
302 - cli? ( ^^ ( readline libedit ) )
303 - truetype? ( gd )
304 - webp? ( gd )
305 - cjk? ( gd )
306 - exif? ( gd )
307 -
308 - xpm? ( gd )
309 - gd? ( zlib )
310 - simplexml? ( xml )
311 - soap? ( xml )
312 - wddx? ( xml )
313 - xmlrpc? ( || ( xml iconv ) )
314 - xmlreader? ( xml )
315 - xslt? ( xml )
316 - ldap-sasl? ( ldap )
317 - mhash? ( hash )
318 - phar? ( hash )
319 -
320 - qdbm? ( !gdbm )
321 - readline? ( !libedit )
322 - recode? ( !imap !mysqli )
323 - sharedmem? ( !threads )
324 -
325 - mysql? ( || ( mysqli pdo ) )
326 -
327 - || ( cli cgi fpm apache2 embed phpdbg )"
328 -
329 -RDEPEND="${DEPEND}"
330 -
331 -RDEPEND="${RDEPEND}
332 - fpm? (
333 - selinux? ( sec-policy/selinux-phpfpm )
334 - systemd? ( sys-apps/systemd ) )"
335 -
336 -DEPEND="${DEPEND}
337 - sys-devel/flex
338 - >=sys-devel/m4-1.4.3
339 - >=sys-devel/libtool-1.5.18"
340 -
341 -# Allow users to install production version if they want to
342 -if [[ "${PHP_INI_VERSION}" == "production" ]]; then
343 - PHP_INI_UPSTREAM="php.ini-production"
344 -else
345 - PHP_INI_UPSTREAM="php.ini-development"
346 -fi
347 -
348 -PHP_INI_FILE="php.ini"
349 -
350 -php_install_ini() {
351 - local phpsapi="${1}"
352 -
353 - # work out where we are installing the ini file
354 - php_set_ini_dir "${phpsapi}"
355 -
356 - local phpinisrc="${PHP_INI_UPSTREAM}-${phpsapi}"
357 - cp "${PHP_INI_UPSTREAM}" "${phpinisrc}" || die
358 -
359 - # default to /tmp for save_path, bug #282768
360 - sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}" || die
361 -
362 - # Set the extension dir
363 - sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" -i "${phpinisrc}" || die
364 -
365 - # Set the include path to point to where we want to find PEAR packages
366 - sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}" || die
367 -
368 - dodir "${PHP_INI_DIR#${EPREFIX}}"
369 - insinto "${PHP_INI_DIR#${EPREFIX}}"
370 - newins "${phpinisrc}" "${PHP_INI_FILE}"
371 -
372 - elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
373 - elog
374 -
375 - dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
376 - dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
377 -
378 - if use opcache; then
379 - elog "Adding opcache to $PHP_EXT_INI_DIR"
380 - echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> \
381 - "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
382 - dosym "${PHP_EXT_INI_DIR#${EPREFIX}}/opcache.ini" \
383 - "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
384 - fi
385 -
386 - # SAPI-specific handling
387 - if [[ "${sapi}" == "fpm" ]] ; then
388 - einfo "Installing FPM config files php-fpm.conf and www.conf"
389 - insinto "${PHP_INI_DIR#${EPREFIX}}"
390 - doins sapi/fpm/php-fpm.conf
391 - insinto "${PHP_INI_DIR#${EPREFIX}}/fpm.d"
392 - doins sapi/fpm/www.conf
393 - fi
394 -
395 - dodoc php.ini-development
396 - dodoc php.ini-production
397 -}
398 -
399 -php_set_ini_dir() {
400 - PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
401 - PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
402 - PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
403 -}
404 -
405 -src_prepare() {
406 - # Change PHP branding
407 - # Get the alpha/beta/rc version
408 - sed -re "s|^(PHP_EXTRA_VERSION=\").*(\")|\1-pl${PR/r/}-gentoo\2|g" \
409 - -i configure.in || die "Unable to change PHP branding"
410 -
411 - # Patch PHP to show Gentoo as the server platform
412 - sed -e 's/PHP_UNAME=`uname -a | xargs`/PHP_UNAME=`uname -s -n -r -v | xargs`/g' \
413 - -i configure.in || die "Failed to fix server platform name"
414 -
415 - # Patch PHP to support heimdal instead of mit-krb5
416 - if has_version "app-crypt/heimdal" ; then
417 - sed -e 's|gssapi_krb5|gssapi|g' -i acinclude.m4 \
418 - || die "Failed to fix heimdal libname"
419 - sed -e 's|PHP_ADD_LIBRARY(k5crypto, 1, $1)||g' -i acinclude.m4 \
420 - || die "Failed to fix heimdal crypt library reference"
421 - fi
422 -
423 - # Add user patches #357637
424 - epatch_user
425 -
426 - # Force rebuilding aclocal.m4
427 - rm -f aclocal.m4 || die
428 - eautoreconf
429 -
430 - if [[ ${CHOST} == *-darwin* ]] ; then
431 - # http://bugs.php.net/bug.php?id=48795, bug #343481
432 - sed -i -e '/BUILD_CGI="\\$(CC)/s/CC/CXX/' configure || die
433 - fi
434 -
435 - # In php-7.x, the FPM pool configuration files have been split off
436 - # of the main config. By default the pool config files go in
437 - # e.g. /etc/php-fpm.d, which isn't slotted. So here we move the
438 - # include directory to a subdirectory "fpm.d" of $PHP_INI_DIR. Later
439 - # we'll install the pool configuration file "www.conf" there.
440 - php_set_ini_dir fpm
441 - sed -i "s~^include=.*$~include=${PHP_INI_DIR}/fpm.d/*.conf~" \
442 - sapi/fpm/php-fpm.conf.in \
443 - || die 'failed to move the include directory in php-fpm.conf'
444 -}
445 -
446 -src_configure() {
447 - addpredict /usr/share/snmp/mibs/.index
448 - addpredict /var/lib/net-snmp/mib_indexes
449 -
450 - PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
451 -
452 - # The php-fpm config file wants localstatedir to be ${EPREFIX}/var
453 - # and not the Gentoo default ${EPREFIX}/var/lib. See bug 572002.
454 - local our_conf=(
455 - --prefix="${PHP_DESTDIR}"
456 - --mandir="${PHP_DESTDIR}/man"
457 - --infodir="${PHP_DESTDIR}/info"
458 - --libdir="${PHP_DESTDIR}/lib"
459 - --with-libdir="$(get_libdir)"
460 - --localstatedir="${EPREFIX}/var"
461 - --without-pear
462 - $(use_enable threads maintainer-zts)
463 - )
464 -
465 - our_conf+=(
466 - $(use_enable bcmath bcmath)
467 - $(use_with bzip2 bz2 "${EPREFIX}/usr")
468 - $(use_enable calendar calendar)
469 - $(use_enable ctype ctype)
470 - $(use_with curl curl "${EPREFIX}/usr")
471 - $(use_enable xml dom)
472 - $(use_with enchant enchant "${EPREFIX}/usr")
473 - $(use_enable exif exif)
474 - $(use_enable fileinfo fileinfo)
475 - $(use_enable filter filter)
476 - $(use_enable ftp ftp)
477 - $(use_with nls gettext "${EPREFIX}/usr")
478 - $(use_with gmp gmp "${EPREFIX}/usr")
479 - $(use_enable hash hash)
480 - $(use_with mhash mhash "${EPREFIX}/usr")
481 - $(use_with iconv iconv \
482 - $(use elibc_glibc || use elibc_musl || echo "${EPREFIX}/usr"))
483 - $(use_enable intl intl)
484 - $(use_enable ipv6 ipv6)
485 - $(use_enable json json)
486 - $(use_with kerberos kerberos "${EPREFIX}/usr")
487 - $(use_enable xml libxml)
488 - $(use_with xml libxml-dir "${EPREFIX}/usr")
489 - $(use_enable unicode mbstring)
490 - $(use_with crypt mcrypt "${EPREFIX}/usr")
491 - $(use_with unicode onig "${EPREFIX}/usr")
492 - $(use_with ssl openssl "${EPREFIX}/usr")
493 - $(use_with ssl openssl-dir "${EPREFIX}/usr")
494 - $(use_enable pcntl pcntl)
495 - $(use_enable phar phar)
496 - $(use_enable pdo pdo)
497 - $(use_enable opcache opcache)
498 - $(use_with postgres pgsql "${EPREFIX}/usr")
499 - $(use_enable posix posix)
500 - $(use_with spell pspell "${EPREFIX}/usr")
501 - $(use_with recode recode "${EPREFIX}/usr")
502 - $(use_enable simplexml simplexml)
503 - $(use_enable sharedmem shmop)
504 - $(use_with snmp snmp "${EPREFIX}/usr")
505 - $(use_enable soap soap)
506 - $(use_enable sockets sockets)
507 - $(use_with sqlite sqlite3 "${EPREFIX}/usr")
508 - $(use_enable sysvipc sysvmsg)
509 - $(use_enable sysvipc sysvsem)
510 - $(use_enable sysvipc sysvshm)
511 - $(use_with systemd fpm-systemd)
512 - $(use_with tidy tidy "${EPREFIX}/usr")
513 - $(use_enable tokenizer tokenizer)
514 - $(use_enable wddx wddx)
515 - $(use_enable xml xml)
516 - $(use_enable xmlreader xmlreader)
517 - $(use_enable xmlwriter xmlwriter)
518 - $(use_with xmlrpc xmlrpc)
519 - $(use_with xslt xsl "${EPREFIX}/usr")
520 - $(use_enable zip zip)
521 - $(use_with zlib zlib "${EPREFIX}/usr")
522 - $(use_enable debug debug)
523 - )
524 -
525 - # DBA support
526 - if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
527 - || use qdbm ; then
528 - our_conf+=( "--enable-dba${shared}" )
529 - fi
530 -
531 - # DBA drivers support
532 - our_conf+=(
533 - $(use_with cdb cdb)
534 - $(use_with berkdb db4 "${EPREFIX}/usr")
535 - $(use_enable flatfile flatfile)
536 - $(use_with gdbm gdbm "${EPREFIX}/usr")
537 - $(use_enable inifile inifile)
538 - $(use_with qdbm qdbm "${EPREFIX}/usr")
539 - )
540 -
541 - # Support for the GD graphics library
542 - our_conf+=(
543 - $(use_with truetype freetype-dir "${EPREFIX}/usr")
544 - $(use_enable cjk gd-jis-conv)
545 - $(use_with gd jpeg-dir "${EPREFIX}/usr")
546 - $(use_with gd png-dir "${EPREFIX}/usr")
547 - $(use_with xpm xpm-dir "${EPREFIX}/usr")
548 - )
549 - if use webp; then
550 - our_conf+=( --with-webp-dir="${EPREFIX}/usr" )
551 - fi
552 - # enable gd last, so configure can pick up the previous settings
553 - our_conf+=( $(use_with gd gd) )
554 -
555 - # IMAP support
556 - if use imap ; then
557 - our_conf+=(
558 - $(use_with imap imap "${EPREFIX}/usr")
559 - $(use_with ssl imap-ssl "${EPREFIX}/usr")
560 - )
561 - fi
562 -
563 - # Interbase/firebird support
564 - our_conf+=( $(use_with firebird interbase "${EPREFIX}/usr") )
565 -
566 - # LDAP support
567 - if use ldap ; then
568 - our_conf+=(
569 - $(use_with ldap ldap "${EPREFIX}/usr")
570 - $(use_with ldap-sasl ldap-sasl "${EPREFIX}/usr")
571 - )
572 - fi
573 -
574 - # MySQL support
575 - local mysqllib="mysqlnd"
576 - local mysqlilib="mysqlnd"
577 -
578 - our_conf+=( $(use_with mysqli mysqli "${mysqlilib}") )
579 -
580 - local mysqlsock="${EPREFIX}/var/run/mysqld/mysqld.sock"
581 - if use mysql || use mysqli ; then
582 - our_conf+=( $(use_with mysql mysql-sock "${mysqlsock}") )
583 - fi
584 -
585 - # ODBC support
586 - our_conf+=(
587 - $(use_with odbc unixODBC "${EPREFIX}/usr")
588 - $(use_with iodbc iodbc "${EPREFIX}/usr")
589 - )
590 -
591 - # Oracle support
592 - our_conf+=( $(use_with oci8-instant-client oci8) )
593 -
594 - # PDO support
595 - if use pdo ; then
596 - our_conf+=(
597 - $(use_with mssql pdo-dblib "${EPREFIX}/usr")
598 - $(use_with mysql pdo-mysql "${mysqllib}")
599 - $(use_with postgres pdo-pgsql)
600 - $(use_with sqlite pdo-sqlite "${EPREFIX}/usr")
601 - $(use_with firebird pdo-firebird "${EPREFIX}/usr")
602 - $(use_with odbc pdo-odbc "unixODBC,${EPREFIX}/usr")
603 - $(use_with oci8-instant-client pdo-oci)
604 - )
605 - fi
606 -
607 - # readline/libedit support
608 - our_conf+=(
609 - $(use_with readline readline "${EPREFIX}/usr")
610 - $(use_with libedit libedit "${EPREFIX}/usr")
611 - )
612 -
613 - # Session support
614 - if use session ; then
615 - our_conf+=( $(use_with sharedmem mm "${EPREFIX}/usr") )
616 - else
617 - our_conf+=( $(use_enable session session) )
618 - fi
619 -
620 - # Use pic for shared modules such as apache2's mod_php
621 - our_conf+=( --with-pic )
622 -
623 - # we use the system copy of pcre
624 - # --with-pcre-regex affects ext/pcre
625 - # --with-pcre-dir affects ext/filter and ext/zip
626 - our_conf+=(
627 - --with-pcre-regex="${EPREFIX}/usr"
628 - --with-pcre-dir="${EPREFIX}/usr"
629 - )
630 -
631 - # Catch CFLAGS problems
632 - # Fixes bug #14067.
633 - # Changed order to run it in reverse for bug #32022 and #12021.
634 - replace-cpu-flags "k6*" "i586"
635 -
636 - # Support user-passed configuration parameters
637 - our_conf+=( ${EXTRA_ECONF:-} )
638 -
639 - # Support the Apache2 extras, they must be set globally for all
640 - # SAPIs to work correctly, especially for external PHP extensions
641 -
642 - mkdir -p "${WORKDIR}/sapis-build" || die
643 - for one_sapi in $SAPIS ; do
644 - use "${one_sapi}" || continue
645 - php_set_ini_dir "${one_sapi}"
646 -
647 - # The BUILD_DIR variable is used to determine where to output
648 - # the files that autotools creates. This was all originally
649 - # based on the autotools-utils eclass.
650 - BUILD_DIR="${WORKDIR}/sapis-build/${one_sapi}"
651 - cp -r "${S}" "${BUILD_DIR}" || die
652 - cd "${BUILD_DIR}" || die
653 -
654 - local sapi_conf=(
655 - --with-config-file-path="${PHP_INI_DIR}"
656 - --with-config-file-scan-dir="${PHP_EXT_INI_DIR_ACTIVE}"
657 - )
658 -
659 - for sapi in $SAPIS ; do
660 - case "$sapi" in
661 - cli|cgi|embed|fpm|phpdbg)
662 - if [[ "${one_sapi}" == "${sapi}" ]] ; then
663 - sapi_conf+=( "--enable-${sapi}" )
664 - else
665 - sapi_conf+=( "--disable-${sapi}" )
666 - fi
667 - ;;
668 -
669 - apache2)
670 - if [[ "${one_sapi}" == "${sapi}" ]] ; then
671 - sapi_conf+=( --with-apxs2="${EPREFIX}/usr/sbin/apxs" )
672 - else
673 - sapi_conf+=( --without-apxs2 )
674 - fi
675 - ;;
676 - esac
677 - done
678 -
679 - # Construct the $myeconfargs array by concatenating $our_conf
680 - # (the common args) and $sapi_conf (the SAPI-specific args).
681 - local myeconfargs=( "${our_conf[@]}" )
682 - myeconfargs+=( "${sapi_conf[@]}" )
683 -
684 - pushd "${BUILD_DIR}" > /dev/null || die
685 - econf "${myeconfargs[@]}"
686 - popd > /dev/null || die
687 - done
688 -}
689 -
690 -src_compile() {
691 - # snmp seems to run during src_compile, too (bug #324739)
692 - addpredict /usr/share/snmp/mibs/.index
693 - addpredict /var/lib/net-snmp/mib_indexes
694 -
695 - for sapi in ${SAPIS} ; do
696 - if use "${sapi}"; then
697 - cd "${WORKDIR}/sapis-build/$sapi" || \
698 - die "Failed to change dir to ${WORKDIR}/sapis-build/$1"
699 - emake
700 - fi
701 - done
702 -}
703 -
704 -src_install() {
705 - # see bug #324739 for what happens when we don't have that
706 - addpredict /usr/share/snmp/mibs/.index
707 -
708 - # grab the first SAPI that got built and install common files from there
709 - local first_sapi=""
710 - for sapi in $SAPIS ; do
711 - if use $sapi ; then
712 - first_sapi=$sapi
713 - break
714 - fi
715 - done
716 -
717 - # Makefile forgets to create this before trying to write to it...
718 - dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
719 -
720 - # Install php environment (without any sapis)
721 - cd "${WORKDIR}/sapis-build/$first_sapi" || die
722 - emake INSTALL_ROOT="${D}" \
723 - install-build install-headers install-programs
724 -
725 - local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
726 -
727 - # Create the directory where we'll put version-specific php scripts
728 - keepdir "/usr/share/php${PHP_MV}"
729 -
730 - local sapi="", file=""
731 - local sapi_list=""
732 -
733 - for sapi in ${SAPIS}; do
734 - if use "${sapi}" ; then
735 - einfo "Installing SAPI: ${sapi}"
736 - cd "${WORKDIR}/sapis-build/${sapi}" || die
737 -
738 - if [[ "${sapi}" == "apache2" ]] ; then
739 - # We're specifically not using emake install-sapi as libtool
740 - # may cause unnecessary relink failures (see bug #351266)
741 - insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
742 - newins ".libs/libphp${PHP_MV}$(get_libname)" \
743 - "libphp${PHP_MV}$(get_libname)"
744 - keepdir "/usr/$(get_libdir)/apache2/modules"
745 - else
746 - # needed each time, php_install_ini would reset it
747 - local dest="${PHP_DESTDIR#${EPREFIX}}"
748 - into "${dest}"
749 - case "$sapi" in
750 - cli)
751 - source="sapi/cli/php"
752 - ;;
753 - cgi)
754 - source="sapi/cgi/php-cgi"
755 - ;;
756 - fpm)
757 - source="sapi/fpm/php-fpm"
758 - ;;
759 - embed)
760 - source="libs/libphp${PHP_MV}$(get_libname)"
761 - ;;
762 - phpdbg)
763 - source="sapi/phpdbg/phpdbg"
764 - ;;
765 - *)
766 - die "unhandled sapi in src_install"
767 - ;;
768 - esac
769 -
770 - if [[ "${source}" == *"$(get_libname)" ]]; then
771 - dolib.so "${source}"
772 - else
773 - dobin "${source}"
774 - local name="$(basename ${source})"
775 - dosym "${dest}/bin/${name}" "/usr/bin/${name}${SLOT}"
776 - fi
777 - fi
778 -
779 - php_install_ini "${sapi}"
780 -
781 - # construct correct SAPI string for php-config
782 - # thanks to ferringb for the bash voodoo
783 - if [[ "${sapi}" == "apache2" ]]; then
784 - sapi_list="${sapi_list:+${sapi_list} }apache2handler"
785 - else
786 - sapi_list="${sapi_list:+${sapi_list} }${sapi}"
787 - fi
788 - fi
789 - done
790 -
791 - # Installing opcache module
792 - if use opcache ; then
793 - into "${PHP_DESTDIR#${EPREFIX}}"
794 - dolib.so "modules/opcache$(get_libname)"
795 - fi
796 -
797 - # Install env.d files
798 - newenvd "${FILESDIR}/20php5-envd" "20php${SLOT}"
799 - sed -e "s|/lib/|/$(get_libdir)/|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
800 - sed -e "s|php5|php${SLOT}|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
801 -
802 - # set php-config variable correctly (bug #278439)
803 - sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
804 - "${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config" || die
805 -
806 - if use fpm ; then
807 - if use systemd; then
808 - systemd_newunit "${FILESDIR}/php-fpm_at.service" \
809 - "php-fpm@${SLOT}.service"
810 - else
811 - systemd_newunit "${FILESDIR}/php-fpm_at-simple.service" \
812 - "php-fpm@${SLOT}.service"
813 - fi
814 - fi
815 -}
816 -
817 -src_test() {
818 - echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
819 - PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php"
820 - if [[ ! -x "${PHP_BIN}" ]] ; then
821 - ewarn "Test phase requires USE=cli, skipping"
822 - return
823 - else
824 - export TEST_PHP_EXECUTABLE="${PHP_BIN}"
825 - fi
826 -
827 - if [[ -x "${WORKDIR}/sapis/cgi/php-cgi" ]] ; then
828 - export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis/cgi/php-cgi"
829 - fi
830 -
831 - REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d \
832 - "session.save_path=${T}" \
833 - "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d \
834 - "session.save_path=${T}"
835 -
836 - for name in ${EXPECTED_TEST_FAILURES}; do
837 - mv "${name}.out" "${name}.out.orig" 2>/dev/null || die
838 - done
839 -
840 - local failed="$(find -name '*.out')"
841 - if [[ ${failed} != "" ]] ; then
842 - ewarn "The following test cases failed unexpectedly:"
843 - for name in ${failed}; do
844 - ewarn " ${name/.out/}"
845 - done
846 - else
847 - einfo "No unexpected test failures, all fine"
848 - fi
849 -
850 - if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
851 - local passed=""
852 - for name in ${EXPECTED_TEST_FAILURES}; do
853 - [[ -f "${name}.diff" ]] && continue
854 - passed="${passed} ${name}"
855 - done
856 - if [[ ${passed} != "" ]] ; then
857 - einfo "The following test cases passed unexpectedly:"
858 - for name in ${passed}; do
859 - ewarn " ${passed}"
860 - done
861 - else
862 - einfo "None of the known-to-fail tests passed, all fine"
863 - fi
864 - fi
865 -}
866 -
867 -pkg_postinst() {
868 - # Output some general info to the user
869 - if use apache2 ; then
870 - elog
871 - elog "To enable PHP in apache, you will need to add \"-D PHP\" to"
872 - elog "your apache2 command. OpenRC users can append that string to"
873 - elog "APACHE2_OPTS in /etc/conf.d/apache2."
874 - elog
875 - elog "The apache module configuration file 70_mod_php.conf is"
876 - elog "provided (and maintained) by eselect-php."
877 - elog
878 - fi
879 -
880 - # Create the symlinks for php
881 - for m in ${SAPIS}; do
882 - [[ ${m} == 'embed' ]] && continue;
883 - if use $m ; then
884 - local ci=$(eselect php show $m)
885 - if [[ -z $ci ]]; then
886 - eselect php set $m php${SLOT} || die
887 - einfo "Switched ${m} to use php:${SLOT}"
888 - einfo
889 - elif [[ $ci != "php${SLOT}" ]] ; then
890 - elog "To switch $m to use php:${SLOT}, run"
891 - elog " eselect php set $m php${SLOT}"
892 - elog
893 - fi
894 - fi
895 - done
896 -
897 - # Remove dead symlinks for SAPIs that were just disabled. For
898 - # example, if the user has the cgi SAPI enabled, then he has an
899 - # eselect-php symlink for it. If he later reinstalls PHP with
900 - # USE="-cgi", that symlink will break. This call to eselect is
901 - # supposed to remove that dead link per bug 572436.
902 - eselect php cleanup || die
903 -
904 - if ! has "php${SLOT/./-}" ${PHP_TARGETS}; then
905 - elog "To build extensions for this version of PHP, you will need to"
906 - elog "add php${SLOT/./-} to your PHP_TARGETS USE_EXPAND variable."
907 - elog
908 - fi
909 -
910 - # Only mention PHP_INI_VERSION if the user doesn't have it set.
911 - case "${PHP_INI_VERSION}" in
912 - production|development)
913 - ;;
914 - *)
915 - elog "This ebuild installed a version of php.ini based on"
916 - elog "${PHP_INI_UPSTREAM}. You can choose which version of"
917 - elog "php.ini to install by default by setting PHP_INI_VERSION"
918 - elog "to either 'production' or 'development' in your make.conf."
919 - elog "Both versions of php.ini can be found with the PHP docs in"
920 - elog "${EPREFIX}/usr/share/doc/${PF}"
921 - elog
922 - ;;
923 - esac
924 -
925 - elog "For details on how version slotting works, please see"
926 - elog "the wiki:"
927 - elog
928 - elog " https://wiki.gentoo.org/wiki/PHP"
929 - elog
930 -}
931 -
932 -pkg_postrm() {
933 - # This serves two purposes. First, if we have just removed the last
934 - # installed version of PHP, then this will remove any dead symlinks
935 - # belonging to eselect-php. Second, if a user upgrades slots from
936 - # (say) 5.6 to 7.0 and depcleans the old slot, then this will update
937 - # his existing symlinks to point to the new 7.0 installation. The
938 - # latter is bug 432962.
939 - #
940 - # Note: the eselect-php package may not be installed at this point,
941 - # so we can't die() if this command fails.
942 - eselect php cleanup
943 -}