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