Gentoo Archives: gentoo-commits

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