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