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