Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/php/
Date: Thu, 29 Aug 2019 16:38:36
Message-Id: 1567095781.8ac62a96ed13e10709fe413315b5a00c4d79b58a.whissi@gentoo
1 commit: 8ac62a96ed13e10709fe413315b5a00c4d79b58a
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Thu Aug 29 16:23:01 2019 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Thu Aug 29 16:23:01 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8ac62a96
7
8 dev-lang/php: bump to v7.4.0_beta4
9
10 Package-Manager: Portage-2.3.73, Repoman-2.3.17
11 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
12
13 dev-lang/php/Manifest | 1 +
14 dev-lang/php/php-7.4.0_beta4.ebuild | 723 ++++++++++++++++++++++++++++++++++++
15 2 files changed, 724 insertions(+)
16
17 diff --git a/dev-lang/php/Manifest b/dev-lang/php/Manifest
18 index ea2180340fb..2af4d8b8e8d 100644
19 --- a/dev-lang/php/Manifest
20 +++ b/dev-lang/php/Manifest
21 @@ -4,4 +4,5 @@ DIST php-7.2.21.tar.xz 12298448 BLAKE2B f82b35fd3cdf45d8c84639d044729602340c2d34
22 DIST php-7.3.8.tar.xz 12064620 BLAKE2B cfe2fde5e48080e13bd21cb2e2ca0c0ae38da03c94d0692e11bfe6722e50bd0b864d629a0ef6aed4ac5d9830ec4b4b214b9abdf917519a0c0cb70a4362fc8390 SHA512 9e9e13845350f3d4a8a80c3e2fe8291996e2749b2c862261b96346c01e5e24640cb81adad5e3b7668b56b2266c1fcbb713e8c38da4f9aa474f5f632f91378a8d
23 DIST php-7.3.9.tar.xz 12064244 BLAKE2B 2837463a74a0ccffc1a2193f9fbce78c98c15dd60214cb5d5d704aed7d74449696c3a516e86f440aed9ff3dc2ed8e7bbebcaf0a1268afa55aca2b642e958abf1 SHA512 017d2ae3cd499a7f6ee30111baf0a119e2f404919575acc5ae91fa6e53a303c9d1b5d165205eec3943c3547ff8759e21fbccc62845e3269176f6fc0f2ba88490
24 DIST php-7.4.0beta1.tar.xz 10200060 BLAKE2B f49c49fcebe0309bbe266dec5c468037499fc96908a4130454403e57caa3ef7da3c46dbc83829bb290c46edfc14921f71fafddb8b0777c23adec35fbb57ad68c SHA512 3e4307201c91cec238c9bc6c27a629a93de8baba0307f2e61cb4bb242720178382dd50b38e7a18fbd65baf25068b358faf571dcb895e7cd6fb292038dee3ed6b
25 +DIST php-7.4.0beta4.tar.xz 10207868 BLAKE2B b7fe60ec6b98c00e58b88e59aeddee7750df4480e505eab78f6ad4268bbcdba53fea36a4a0fb4e2b4e140247adc68946dcdcbc13ae339fe85570b91145025201 SHA512 c87c519453a8ba7f06b921b214b3315938b77c7d6f4f88f173f9c1e48a578937e4aa9bdb4d5a23c922b5cedaafc4d6bc29067dc55103fdecaa3a8ab4b381f203
26 DIST php-patches-7.1.31bp.tar.bz2 37219 BLAKE2B 4f3ead2f69adf00ac1317371172c8adbb823f597cd8e3cafe7044d6a46671437fd2e5eaef4309a6fd5825123394044543284d3cbe892c918353a5b07c12b7401 SHA512 eb52679d035ceb4124c8e9175024f4f753e20d139479af4a57e01de941991716b2ce37f6190242c1bec46fd5305bad1f91613b04ee849a0d94f4a33ce013781e
27
28 diff --git a/dev-lang/php/php-7.4.0_beta4.ebuild b/dev-lang/php/php-7.4.0_beta4.ebuild
29 new file mode 100644
30 index 00000000000..4e86c019721
31 --- /dev/null
32 +++ b/dev-lang/php/php-7.4.0_beta4.ebuild
33 @@ -0,0 +1,723 @@
34 +# Copyright 1999-2019 Gentoo Authors
35 +# Distributed under the terms of the GNU General Public License v2
36 +
37 +EAPI="7"
38 +
39 +WANT_AUTOMAKE="none"
40 +
41 +inherit flag-o-matic systemd autotools
42 +
43 +MY_PV=${PV/_/}
44 +DESCRIPTION="The PHP language runtime engine"
45 +HOMEPAGE="https://php.net/"
46 +SRC_URI="https://downloads.php.net/~derick/${P/_/}.tar.xz"
47 +
48 +LICENSE="PHP-3.01
49 + BSD
50 + Zend-2.0
51 + bcmath? ( LGPL-2.1+ )
52 + fpm? ( BSD-2 )
53 + gd? ( gd )
54 + unicode? ( BSD-2 LGPL-2.1 )"
55 +
56 +SLOT="$(ver_cut 1-2)"
57 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
58 +
59 +S="${WORKDIR}/${PN}-${MY_PV}"
60 +
61 +# We can build the following SAPIs in the given order
62 +SAPIS="embed cli cgi fpm apache2 phpdbg"
63 +
64 +# SAPIs and SAPI-specific USE flags (cli SAPI is default on):
65 +IUSE="${IUSE}
66 + ${SAPIS/cli/+cli}
67 + threads"
68 +
69 +IUSE="${IUSE} acl argon2 bcmath berkdb bzip2 calendar cdb cjk
70 + coverage +ctype curl debug
71 + enchant exif ffi +fileinfo +filter firebird
72 + +flatfile ftp gd gdbm gmp +iconv imap inifile
73 + intl iodbc ipv6 +json kerberos ldap ldap-sasl libedit libressl lmdb
74 + mhash mssql mysql mysqli nls
75 + oci8-instant-client odbc +opcache pcntl pdo +phar +posix postgres qdbm
76 + readline selinux +session session-mm sharedmem
77 + +simplexml snmp soap sockets sodium spell sqlite ssl
78 + sysvipc systemd test tidy +tokenizer tokyocabinet truetype unicode webp
79 + +xml xmlreader xmlwriter xmlrpc xpm xslt zip zlib"
80 +
81 +# The supported (that is, autodetected) versions of BDB are listed in
82 +# the ./configure script. Other versions *work*, but we need to stick to
83 +# the ones that can be detected to avoid a repeat of bug #564824.
84 +COMMON_DEPEND="
85 + >=app-eselect/eselect-php-0.9.1[apache2?,fpm?]
86 + >=dev-libs/libpcre2-10.30[unicode]
87 + fpm? ( acl? ( sys-apps/acl ) )
88 + apache2? ( || ( >=www-servers/apache-2.4[apache2_modules_unixd,threads=]
89 + <www-servers/apache-2.4[threads=] ) )
90 + argon2? ( app-crypt/argon2:= )
91 + berkdb? ( || ( sys-libs/db:5.3
92 + sys-libs/db:5.1
93 + sys-libs/db:4.8
94 + sys-libs/db:4.7
95 + sys-libs/db:4.6
96 + sys-libs/db:4.5 ) )
97 + bzip2? ( app-arch/bzip2:0= )
98 + cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
99 + coverage? ( dev-util/lcov )
100 + curl? ( >=net-misc/curl-7.10.5 )
101 + enchant? ( <app-text/enchant-2.0:0 )
102 + ffi? ( >=virtual/libffi-3.0.11 )
103 + firebird? ( dev-db/firebird )
104 + gd? ( virtual/jpeg:0 media-libs/libpng:0= )
105 + gdbm? ( >=sys-libs/gdbm-1.8.0:0= )
106 + gmp? ( dev-libs/gmp:0= )
107 + iconv? ( virtual/libiconv )
108 + imap? ( virtual/imap-c-client[kerberos=,ssl=] )
109 + intl? ( dev-libs/icu:= )
110 + kerberos? ( virtual/krb5 )
111 + ldap? ( >=net-nds/openldap-1.2.11 )
112 + ldap-sasl? ( dev-libs/cyrus-sasl )
113 + libedit? ( || ( sys-freebsd/freebsd-lib dev-libs/libedit ) )
114 + lmdb? ( dev-db/lmdb:= )
115 + mssql? ( dev-db/freetds[mssql] )
116 + nls? ( sys-devel/gettext )
117 + oci8-instant-client? ( dev-db/oracle-instantclient-basic )
118 + odbc? ( iodbc? ( dev-db/libiodbc ) !iodbc? ( >=dev-db/unixODBC-1.8.13 ) )
119 + postgres? ( dev-db/postgresql:* )
120 + qdbm? ( dev-db/qdbm )
121 + readline? ( sys-libs/readline:0= )
122 + session-mm? ( dev-libs/mm )
123 + snmp? ( >=net-analyzer/net-snmp-5.2 )
124 + sodium? ( dev-libs/libsodium:= )
125 + spell? ( >=app-text/aspell-0.50 )
126 + sqlite? ( >=dev-db/sqlite-3.7.6.3 )
127 + ssl? (
128 + !libressl? ( >=dev-libs/openssl-1.0.1:0= )
129 + libressl? ( dev-libs/libressl:0= )
130 + )
131 + tidy? ( || ( app-text/tidy-html5 app-text/htmltidy ) )
132 + tokyocabinet? ( dev-db/tokyocabinet )
133 + truetype? ( =media-libs/freetype-2* )
134 + unicode? ( dev-libs/oniguruma:= )
135 + webp? ( media-libs/libwebp:0= )
136 + xml? ( >=dev-libs/libxml2-2.7.6 )
137 + xpm? ( x11-libs/libXpm )
138 + xslt? ( dev-libs/libxslt )
139 + zip? ( >=dev-libs/libzip-1.2.0:= )
140 + zlib? ( >=sys-libs/zlib-1.2.0.4:0= )
141 +"
142 +
143 +RDEPEND="${COMMON_DEPEND}
144 + virtual/mta
145 + fpm? (
146 + selinux? ( sec-policy/selinux-phpfpm )
147 + systemd? ( sys-apps/systemd ) )"
148 +
149 +# Bison isn't actually needed when building from a release tarball
150 +# However, the configure script will warn if it's absent or if you
151 +# have an incompatible version installed. See bug 593278.
152 +DEPEND="${COMMON_DEPEND}
153 + app-arch/xz-utils
154 + >=sys-devel/bison-3.0.1"
155 +
156 +BDEPEND="virtual/pkgconfig"
157 +
158 +# Without USE=readline or libedit, the interactive "php -a" CLI will hang.
159 +REQUIRED_USE="
160 + || ( cli cgi fpm apache2 embed phpdbg )
161 + cli? ( ^^ ( readline libedit ) )
162 + !cli? ( ?? ( readline libedit ) )
163 + truetype? ( gd zlib )
164 + webp? ( gd zlib )
165 + cjk? ( gd zlib )
166 + exif? ( gd zlib )
167 + xpm? ( gd zlib )
168 + gd? ( zlib )
169 + simplexml? ( xml )
170 + soap? ( xml )
171 + xmlrpc? ( xml iconv )
172 + xmlreader? ( xml )
173 + xmlwriter? ( xml )
174 + xslt? ( xml )
175 + ldap-sasl? ( ldap )
176 + qdbm? ( !gdbm )
177 + session-mm? ( session !threads )
178 + mysql? ( || ( mysqli pdo ) )
179 + firebird? ( pdo )
180 + mssql? ( pdo )
181 +"
182 +
183 +PHP_MV="$(ver_cut 1)"
184 +
185 +php_install_ini() {
186 + local phpsapi="${1}"
187 +
188 + # work out where we are installing the ini file
189 + php_set_ini_dir "${phpsapi}"
190 +
191 + # Always install the production INI file, bug 611214.
192 + local phpinisrc="php.ini-production-${phpsapi}"
193 + cp php.ini-production "${phpinisrc}" || die
194 +
195 + # default to /tmp for save_path, bug #282768
196 + sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}" || die
197 +
198 + # Set the extension dir
199 + sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" \
200 + -i "${phpinisrc}" || die
201 +
202 + # Set the include path to point to where we want to find PEAR packages
203 + sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}" || die
204 +
205 + dodir "${PHP_INI_DIR#${EPREFIX}}"
206 + insinto "${PHP_INI_DIR#${EPREFIX}}"
207 + newins "${phpinisrc}" php.ini
208 +
209 + elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
210 + elog
211 +
212 + dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
213 + dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
214 +
215 + if use opcache; then
216 + elog "Adding opcache to $PHP_EXT_INI_DIR"
217 + echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> \
218 + "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
219 + dosym "${PHP_EXT_INI_DIR#${EPREFIX}}/opcache.ini" \
220 + "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
221 + fi
222 +
223 + # SAPI-specific handling
224 + if [[ "${sapi}" == "fpm" ]] ; then
225 + einfo "Installing FPM config files php-fpm.conf and www.conf"
226 + insinto "${PHP_INI_DIR#${EPREFIX}}"
227 + doins sapi/fpm/php-fpm.conf
228 + insinto "${PHP_INI_DIR#${EPREFIX}}/fpm.d"
229 + doins sapi/fpm/www.conf
230 + fi
231 +
232 + dodoc php.ini-{development,production}
233 +}
234 +
235 +php_set_ini_dir() {
236 + PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
237 + PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
238 + PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
239 +}
240 +
241 +src_prepare() {
242 + default
243 +
244 + # In php-7.x, the FPM pool configuration files have been split off
245 + # of the main config. By default the pool config files go in
246 + # e.g. /etc/php-fpm.d, which isn't slotted. So here we move the
247 + # include directory to a subdirectory "fpm.d" of $PHP_INI_DIR. Later
248 + # we'll install the pool configuration file "www.conf" there.
249 + php_set_ini_dir fpm
250 + sed -i "s~^include=.*$~include=${PHP_INI_DIR}/fpm.d/*.conf~" \
251 + sapi/fpm/php-fpm.conf.in \
252 + || die 'failed to move the include directory in php-fpm.conf'
253 +
254 + # Bug 669566 - necessary so that build tools are updated for commands like pecl
255 + cp "${BROOT}/usr/share/aclocal/libtool.m4" build/ || die
256 + eautoreconf
257 +}
258 +
259 +src_configure() {
260 + addpredict /usr/share/snmp/mibs/.index #nowarn
261 + addpredict /var/lib/net-snmp/mib_indexes #nowarn
262 +
263 + PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
264 +
265 + # The php-fpm config file wants localstatedir to be ${EPREFIX}/var
266 + # and not the Gentoo default ${EPREFIX}/var/lib. See bug 572002.
267 + local our_conf=(
268 + --prefix="${PHP_DESTDIR}"
269 + --mandir="${PHP_DESTDIR}/man"
270 + --infodir="${PHP_DESTDIR}/info"
271 + --libdir="${PHP_DESTDIR}/lib"
272 + --with-libdir="$(get_libdir)"
273 + --localstatedir="${EPREFIX}/var"
274 + --without-pear
275 + $(use_enable threads maintainer-zts)
276 + )
277 +
278 + our_conf+=(
279 + $(use_with argon2 password-argon2 "${EPREFIX}/usr")
280 + $(use_enable bcmath)
281 + $(use_with bzip2 bz2 "${EPREFIX}/usr")
282 + $(use_enable calendar)
283 + $(use_enable coverage gcov)
284 + $(use_enable ctype)
285 + $(use_with curl)
286 + $(use_enable xml dom)
287 + $(use_with enchant)
288 + $(use_enable exif)
289 + $(use_with ffi)
290 + $(use_enable fileinfo)
291 + $(use_enable filter)
292 + $(use_enable ftp)
293 + $(use_with nls gettext "${EPREFIX}/usr")
294 + $(use_with gmp gmp "${EPREFIX}/usr")
295 + $(use_with mhash mhash "${EPREFIX}/usr")
296 + $(use_with iconv iconv \
297 + $(use elibc_glibc || use elibc_musl || use elibc_FreeBSD || echo "${EPREFIX}/usr"))
298 + $(use_enable intl)
299 + $(use_enable ipv6)
300 + $(use_enable json)
301 + $(use_with kerberos)
302 + $(use_with xml libxml)
303 + $(use_enable unicode mbstring)
304 + $(use_with ssl openssl)
305 + $(use_enable pcntl)
306 + $(use_enable phar)
307 + $(use_enable pdo)
308 + $(use_enable opcache)
309 + $(use_with postgres pgsql "${EPREFIX}/usr")
310 + $(use_enable posix)
311 + $(use_with spell pspell "${EPREFIX}/usr")
312 + $(use_enable simplexml)
313 + $(use_enable sharedmem shmop)
314 + $(use_with snmp snmp "${EPREFIX}/usr")
315 + $(use_enable soap)
316 + $(use_enable sockets)
317 + $(use_with sodium)
318 + $(use_with sqlite sqlite3)
319 + $(use_enable sysvipc sysvmsg)
320 + $(use_enable sysvipc sysvsem)
321 + $(use_enable sysvipc sysvshm)
322 + $(use_with tidy tidy "${EPREFIX}/usr")
323 + $(use_enable tokenizer)
324 + $(use_enable xml)
325 + $(use_enable xmlreader)
326 + $(use_enable xmlwriter)
327 + $(use_with xmlrpc)
328 + $(use_with xslt xsl)
329 + $(use_with zip)
330 + $(use_with zlib zlib "${EPREFIX}/usr")
331 + $(use_enable debug)
332 + )
333 +
334 + # DBA support
335 + if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
336 + || use qdbm || use lmdb || use tokyocabinet ; then
337 + our_conf+=( "--enable-dba" )
338 + fi
339 +
340 + # DBA drivers support
341 + our_conf+=(
342 + $(use_with cdb)
343 + $(use_with berkdb db4 "${EPREFIX}/usr")
344 + $(use_enable flatfile)
345 + $(use_with gdbm gdbm "${EPREFIX}/usr")
346 + $(use_enable inifile)
347 + $(use_with qdbm qdbm "${EPREFIX}/usr")
348 + $(use_with tokyocabinet tcadb "${EPREFIX}/usr")
349 + $(use_with lmdb lmdb "${EPREFIX}/usr")
350 + )
351 +
352 + # Support for the GD graphics library
353 + our_conf+=(
354 + $(use_with truetype freetype)
355 + $(use_enable cjk gd-jis-conv)
356 + $(use_with gd jpeg)
357 + $(use_with xpm)
358 + $(use_with webp)
359 + )
360 + # enable gd last, so configure can pick up the previous settings
361 + our_conf+=( $(use_enable gd) )
362 +
363 + # IMAP support
364 + if use imap ; then
365 + our_conf+=(
366 + $(use_with imap imap "${EPREFIX}/usr")
367 + $(use_with ssl imap-ssl "${EPREFIX}/usr")
368 + )
369 + fi
370 +
371 + # LDAP support
372 + if use ldap ; then
373 + our_conf+=(
374 + $(use_with ldap ldap "${EPREFIX}/usr")
375 + $(use_with ldap-sasl)
376 + )
377 + fi
378 +
379 + # MySQL support
380 + local mysqllib="mysqlnd"
381 + local mysqlilib="mysqlnd"
382 +
383 + our_conf+=( $(use_with mysqli mysqli "${mysqlilib}") )
384 +
385 + local mysqlsock="${EPREFIX}/var/run/mysqld/mysqld.sock"
386 + if use mysql || use mysqli ; then
387 + our_conf+=( $(use_with mysql mysql-sock "${mysqlsock}") )
388 + fi
389 +
390 + # ODBC support
391 + our_conf+=(
392 + $(use_with odbc unixODBC "${EPREFIX}/usr")
393 + $(use_with iodbc)
394 + )
395 +
396 + # Oracle support
397 + our_conf+=( $(use_with oci8-instant-client oci8) )
398 +
399 + # PDO support
400 + if use pdo ; then
401 + our_conf+=(
402 + $(use_with mssql pdo-dblib "${EPREFIX}/usr")
403 + $(use_with mysql pdo-mysql "${mysqllib}")
404 + $(use_with postgres pdo-pgsql)
405 + $(use_with sqlite pdo-sqlite)
406 + $(use_with firebird pdo-firebird "${EPREFIX}/usr")
407 + $(use_with odbc pdo-odbc "unixODBC,${EPREFIX}/usr")
408 + $(use_with oci8-instant-client pdo-oci)
409 + )
410 + fi
411 +
412 + # readline/libedit support
413 + our_conf+=(
414 + $(use_with readline readline "${EPREFIX}/usr")
415 + $(use_with libedit)
416 + )
417 +
418 + # Session support
419 + if use session ; then
420 + our_conf+=( $(use_with session-mm mm "${EPREFIX}/usr") )
421 + else
422 + our_conf+=( $(use_enable session) )
423 + fi
424 +
425 + # Use pic for shared modules such as apache2's mod_php
426 + our_conf+=( --with-pic )
427 +
428 + # we use the system copy of pcre
429 + # --with-external-pcre affects ext/pcre
430 + # Many arches don't support pcre-jit
431 + our_conf+=(
432 + --with-external-pcre
433 + --without-pcre-jit
434 + )
435 +
436 + # Catch CFLAGS problems
437 + # Fixes bug #14067.
438 + # Changed order to run it in reverse for bug #32022 and #12021.
439 + replace-cpu-flags "k6*" "i586"
440 +
441 + # Cache the ./configure test results between SAPIs.
442 + our_conf+=( --cache-file="${T}/config.cache" )
443 +
444 + # Support user-passed configuration parameters
445 + our_conf+=( ${EXTRA_ECONF:-} )
446 +
447 + # Support the Apache2 extras, they must be set globally for all
448 + # SAPIs to work correctly, especially for external PHP extensions
449 +
450 + mkdir -p "${WORKDIR}/sapis-build" || die
451 + for one_sapi in $SAPIS ; do
452 + use "${one_sapi}" || continue
453 + php_set_ini_dir "${one_sapi}"
454 +
455 + # The BUILD_DIR variable is used to determine where to output
456 + # the files that autotools creates. This was all originally
457 + # based on the autotools-utils eclass.
458 + BUILD_DIR="${WORKDIR}/sapis-build/${one_sapi}"
459 + cp -a "${S}" "${BUILD_DIR}" || die
460 + cd "${BUILD_DIR}" || die
461 +
462 + local sapi_conf=(
463 + --with-config-file-path="${PHP_INI_DIR}"
464 + --with-config-file-scan-dir="${PHP_EXT_INI_DIR_ACTIVE}"
465 + )
466 +
467 + for sapi in $SAPIS ; do
468 + case "$sapi" in
469 + cli|cgi|embed|fpm|phpdbg)
470 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
471 + sapi_conf+=( "--enable-${sapi}" )
472 + if [[ "fpm" == "${sapi}" ]] ; then
473 + sapi_conf+=(
474 + $(use_with acl fpm-acl)
475 + $(use_with systemd fpm-systemd)
476 + )
477 + fi
478 + else
479 + sapi_conf+=( "--disable-${sapi}" )
480 + fi
481 + ;;
482 +
483 + apache2)
484 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
485 + sapi_conf+=( --with-apxs2="${EPREFIX}/usr/bin/apxs" )
486 + else
487 + sapi_conf+=( --without-apxs2 )
488 + fi
489 + ;;
490 + esac
491 + done
492 +
493 + # Construct the $myeconfargs array by concatenating $our_conf
494 + # (the common args) and $sapi_conf (the SAPI-specific args).
495 + local myeconfargs=( "${our_conf[@]}" )
496 + myeconfargs+=( "${sapi_conf[@]}" )
497 +
498 + pushd "${BUILD_DIR}" > /dev/null || die
499 + econf "${myeconfargs[@]}"
500 + popd > /dev/null || die
501 + done
502 +}
503 +
504 +src_compile() {
505 + # snmp seems to run during src_compile, too (bug #324739)
506 + addpredict /usr/share/snmp/mibs/.index #nowarn
507 + addpredict /var/lib/net-snmp/mib_indexes #nowarn
508 +
509 + for sapi in ${SAPIS} ; do
510 + if use "${sapi}"; then
511 + cd "${WORKDIR}/sapis-build/$sapi" || \
512 + die "Failed to change dir to ${WORKDIR}/sapis-build/$1"
513 + emake
514 + fi
515 + done
516 +}
517 +
518 +src_install() {
519 + # see bug #324739 for what happens when we don't have that
520 + addpredict /usr/share/snmp/mibs/.index #nowarn
521 +
522 + # grab the first SAPI that got built and install common files from there
523 + local first_sapi=""
524 + for sapi in $SAPIS ; do
525 + if use $sapi ; then
526 + first_sapi=$sapi
527 + break
528 + fi
529 + done
530 +
531 + # Makefile forgets to create this before trying to write to it...
532 + dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
533 +
534 + # Install php environment (without any sapis)
535 + cd "${WORKDIR}/sapis-build/$first_sapi" || die
536 + emake INSTALL_ROOT="${D}" \
537 + install-build install-headers install-programs
538 +
539 + local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
540 +
541 + # Create the directory where we'll put version-specific php scripts
542 + keepdir "/usr/share/php${PHP_MV}"
543 +
544 + local sapi="", file=""
545 + local sapi_list=""
546 +
547 + for sapi in ${SAPIS}; do
548 + if use "${sapi}" ; then
549 + einfo "Installing SAPI: ${sapi}"
550 + cd "${WORKDIR}/sapis-build/${sapi}" || die
551 +
552 + if [[ "${sapi}" == "apache2" ]] ; then
553 + # We're specifically not using emake install-sapi as libtool
554 + # may cause unnecessary relink failures (see bug #351266)
555 + insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
556 + newins ".libs/libphp${PHP_MV}$(get_libname)" \
557 + "libphp${PHP_MV}$(get_libname)"
558 + keepdir "/usr/$(get_libdir)/apache2/modules"
559 + else
560 + # needed each time, php_install_ini would reset it
561 + local dest="${PHP_DESTDIR#${EPREFIX}}"
562 + into "${dest}"
563 + case "$sapi" in
564 + cli)
565 + source="sapi/cli/php"
566 + ;;
567 + cgi)
568 + source="sapi/cgi/php-cgi"
569 + ;;
570 + fpm)
571 + source="sapi/fpm/php-fpm"
572 + ;;
573 + embed)
574 + source="libs/libphp${PHP_MV}$(get_libname)"
575 + ;;
576 + phpdbg)
577 + source="sapi/phpdbg/phpdbg"
578 + ;;
579 + *)
580 + die "unhandled sapi in src_install"
581 + ;;
582 + esac
583 +
584 + if [[ "${source}" == *"$(get_libname)" ]]; then
585 + dolib.so "${source}"
586 + else
587 + dobin "${source}"
588 + local name="$(basename ${source})"
589 + dosym "${dest}/bin/${name}" "/usr/bin/${name}${SLOT}"
590 + fi
591 + fi
592 +
593 + php_install_ini "${sapi}"
594 +
595 + # construct correct SAPI string for php-config
596 + # thanks to ferringb for the bash voodoo
597 + if [[ "${sapi}" == "apache2" ]]; then
598 + sapi_list="${sapi_list:+${sapi_list} }apache2handler"
599 + else
600 + sapi_list="${sapi_list:+${sapi_list} }${sapi}"
601 + fi
602 + fi
603 + done
604 +
605 + # Installing opcache module
606 + if use opcache ; then
607 + into "${PHP_DESTDIR#${EPREFIX}}"
608 + dolib.so "modules/opcache$(get_libname)"
609 + fi
610 +
611 + # Install env.d files
612 + newenvd "${FILESDIR}/20php5-envd" "20php${SLOT}"
613 + sed -e "s|/lib/|/$(get_libdir)/|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
614 + sed -e "s|php5|php${SLOT}|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
615 +
616 + # set php-config variable correctly (bug #278439)
617 + sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
618 + "${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config" || die
619 +
620 + if use fpm ; then
621 + if use systemd; then
622 + systemd_newunit "${FILESDIR}/php-fpm_at.service" \
623 + "php-fpm@${SLOT}.service"
624 + else
625 + systemd_newunit "${FILESDIR}/php-fpm_at-simple.service" \
626 + "php-fpm@${SLOT}.service"
627 + fi
628 + fi
629 +}
630 +
631 +src_test() {
632 + echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
633 + PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php"
634 + if [[ ! -x "${PHP_BIN}" ]] ; then
635 + ewarn "Test phase requires USE=cli, skipping"
636 + return
637 + else
638 + export TEST_PHP_EXECUTABLE="${PHP_BIN}"
639 + fi
640 +
641 + if [[ -x "${WORKDIR}/sapis-build/cgi/sapi/cgi/php-cgi" ]] ; then
642 + export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis-build/cgi/sapi/cgi/php-cgi"
643 + fi
644 +
645 + if [[ -x "${WORKDIR}/sapis-build/phpdbg/sapi/phpdbg/phpdbg" ]] ; then
646 + export TEST_PHPDBG_EXECUTABLE="${WORKDIR}/sapis-build/phpdbg/sapi/phpdbg/phpdbg"
647 + fi
648 +
649 + REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d \
650 + "session.save_path=${T}" \
651 + "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d \
652 + "session.save_path=${T}"
653 +
654 + for name in ${EXPECTED_TEST_FAILURES}; do
655 + mv "${name}.out" "${name}.out.orig" 2>/dev/null || die
656 + done
657 +
658 + local failed="$(find -name '*.out')"
659 + if [[ ${failed} != "" ]] ; then
660 + ewarn "The following test cases failed unexpectedly:"
661 + for name in ${failed}; do
662 + ewarn " ${name/.out/}"
663 + done
664 + else
665 + einfo "No unexpected test failures, all fine"
666 + fi
667 +
668 + if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
669 + local passed=""
670 + for name in ${EXPECTED_TEST_FAILURES}; do
671 + [[ -f "${name}.diff" ]] && continue
672 + passed="${passed} ${name}"
673 + done
674 + if [[ ${passed} != "" ]] ; then
675 + einfo "The following test cases passed unexpectedly:"
676 + for name in ${passed}; do
677 + ewarn " ${passed}"
678 + done
679 + else
680 + einfo "None of the known-to-fail tests passed, all fine"
681 + fi
682 + fi
683 +}
684 +
685 +pkg_postinst() {
686 + # Output some general info to the user
687 + if use apache2 ; then
688 + elog
689 + elog "To enable PHP in apache, you will need to add \"-D PHP\" to"
690 + elog "your apache2 command. OpenRC users can append that string to"
691 + elog "APACHE2_OPTS in /etc/conf.d/apache2."
692 + elog
693 + elog "The apache module configuration file 70_mod_php.conf is"
694 + elog "provided (and maintained) by eselect-php."
695 + elog
696 + fi
697 +
698 + # Create the symlinks for php
699 + for m in ${SAPIS}; do
700 + [[ ${m} == 'embed' ]] && continue;
701 + if use $m ; then
702 + local ci=$(eselect php show $m)
703 + if [[ -z $ci ]]; then
704 + eselect php set $m php${SLOT} || die
705 + einfo "Switched ${m} to use php:${SLOT}"
706 + einfo
707 + elif [[ $ci != "php${SLOT}" ]] ; then
708 + elog "To switch $m to use php:${SLOT}, run"
709 + elog " eselect php set $m php${SLOT}"
710 + elog
711 + fi
712 + fi
713 + done
714 +
715 + # Remove dead symlinks for SAPIs that were just disabled. For
716 + # example, if the user has the cgi SAPI enabled, then he has an
717 + # eselect-php symlink for it. If he later reinstalls PHP with
718 + # USE="-cgi", that symlink will break. This call to eselect is
719 + # supposed to remove that dead link per bug 572436.
720 + eselect php cleanup || die
721 +
722 + if ! has "php${SLOT/./-}" ${PHP_TARGETS}; then
723 + elog "To build extensions for this version of PHP, you will need to"
724 + elog "add php${SLOT/./-} to your PHP_TARGETS USE_EXPAND variable."
725 + elog
726 + fi
727 +
728 + # Warn about the removal of PHP_INI_VERSION if the user has it set.
729 + if [[ -n "${PHP_INI_VERSION}" ]]; then
730 + ewarn 'The PHP_INI_VERSION variable has been phased out. You may'
731 + ewarn 'remove it from your configuration at your convenience. See'
732 + ewarn
733 + ewarn ' https://bugs.gentoo.org/611214'
734 + ewarn
735 + ewarn 'for more information.'
736 + fi
737 +
738 + elog "For details on how version slotting works, please see"
739 + elog "the wiki:"
740 + elog
741 + elog " https://wiki.gentoo.org/wiki/PHP"
742 + elog
743 +}
744 +
745 +pkg_postrm() {
746 + # This serves two purposes. First, if we have just removed the last
747 + # installed version of PHP, then this will remove any dead symlinks
748 + # belonging to eselect-php. Second, if a user upgrades slots from
749 + # (say) 5.6 to 7.0 and depcleans the old slot, then this will update
750 + # his existing symlinks to point to the new 7.0 installation. The
751 + # latter is bug 432962.
752 + #
753 + # Note: the eselect-php package may not be installed at this point,
754 + # so we can't die() if this command fails.
755 + eselect php cleanup
756 +}