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: Sun, 01 Nov 2020 23:41:18
Message-Id: 1604274067.d32d5488ebe0be8084fa72c878a9b529a8dd81d3.whissi@gentoo
1 commit: d32d5488ebe0be8084fa72c878a9b529a8dd81d3
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Sun Nov 1 23:15:20 2020 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Sun Nov 1 23:41:07 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d32d5488
7
8 dev-lang/php: bump to v7.4.12
9
10 Package-Manager: Portage-3.0.8, Repoman-3.0.2
11 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
12
13 dev-lang/php/Manifest | 1 +
14 dev-lang/php/php-7.4.12.ebuild | 750 +++++++++++++++++++++++++++++++++++++++++
15 2 files changed, 751 insertions(+)
16
17 diff --git a/dev-lang/php/Manifest b/dev-lang/php/Manifest
18 index 0bd0d362383..313c81e8c76 100644
19 --- a/dev-lang/php/Manifest
20 +++ b/dev-lang/php/Manifest
21 @@ -6,4 +6,5 @@ DIST php-7.3.23.tar.xz 12133616 BLAKE2B 6a241443d75a0b404d4d65580208b67a425b91cf
22 DIST php-7.3.24.tar.xz 12138212 BLAKE2B d1a056423d8b88dd042c7e794c4dfe97338e8f397cce65cfeb8b253caabd1108a84a9b6301eccd1c4abc693a78845ba3ba6a2ee37afce81dba82fd116ab78b81 SHA512 0ebc2fb7d58ded231ff5f55e9e033ca5c7865a13cc496884082b126cf2b31fb4486f61ad93ac9fe3592433e43d652cac2add96b2ad276dad937d458fd186d633
23 DIST php-7.4.10.tar.xz 10298480 BLAKE2B ef5e051da37c0bddc6819459c2e2b00b28bbfe6efbdc7ad9651200d2e453c434e59cb91642d775334db86a95afd9255012c4a57d57dac4d6cf7e1692067d0f90 SHA512 c7beb2d821f4e28b0444c8653c360d210a924e0638cc4b4ebc71bf2c22ef83caedfc880275329c3ffa644adc5858ccff59d35bf36255d57218774089d3376a21
24 DIST php-7.4.11.tar.xz 10302076 BLAKE2B e32e77057ddd7b12553766e30366262812d4342742e6dabd0084a261f3d8e82d7c76924e26ead4c9295609f913d34903b9b1c271af76d8d9725f10cd108b7681 SHA512 9bdd29a4a6c1ac55ed75d8fb2203ae5ef41992c518cb7e3b84cf74db62b03cfbe0ef4ea5614a684a37fcd2ae727376022ce49ed3ff32fc3a728e2f1e2474fb92
25 +DIST php-7.4.12.tar.xz 10311980 BLAKE2B 11052d59881f84d4012fa993e5969abf52d4419877bf595ba524b31f5971f623adc382f49d4f7ed75f33dcf85c903a66d88b7c983807ee5f79152314334061c5 SHA512 6c06fb74f8e479ead000b0e2e56602c217d012f1a80e47e151543c033bb5426e56aaa5e8acfcd19fd49ae14c4ca827c8e57a5b56386b20002dbc80fbd07ab04f
26 DIST php-7.4.9.tar.xz 10289560 BLAKE2B 0fd9d82539a46f7ce58857560f5aeb4be6dfe5f5a05f8b8c55c30d6000d19408b4ecc460c9135736298cdb8312ec958ab8358110b2b265bb8c185f80b1522dc6 SHA512 6179c2d867d6775d7f41785003c36d06ce620e7746ea7e6a4d275264e814a66d465776b47b04e2926ed1228cf58f2c15cdda74faf10372435c74ede7aeb79e18
27
28 diff --git a/dev-lang/php/php-7.4.12.ebuild b/dev-lang/php/php-7.4.12.ebuild
29 new file mode 100644
30 index 00000000000..3ac0d8c9ace
31 --- /dev/null
32 +++ b/dev-lang/php/php-7.4.12.ebuild
33 @@ -0,0 +1,750 @@
34 +# Copyright 1999-2020 Gentoo Authors
35 +# Distributed under the terms of the GNU General Public License v2
36 +
37 +EAPI="7"
38 +
39 +WANT_AUTOMAKE="none"
40 +
41 +inherit flag-o-matic systemd autotools
42 +
43 +MY_PV=${PV/_rc/RC}
44 +DESCRIPTION="The PHP language runtime engine"
45 +HOMEPAGE="https://www.php.net/"
46 +SRC_URI="https://www.php.net/distributions/${P}.tar.xz"
47 +
48 +LICENSE="PHP-3.01
49 + BSD
50 + Zend-2.0
51 + bcmath? ( LGPL-2.1+ )
52 + fpm? ( BSD-2 )
53 + gd? ( gd )
54 + unicode? ( BSD-2 LGPL-2.1 )"
55 +
56 +SLOT="$(ver_cut 1-2)"
57 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
58 +
59 +S="${WORKDIR}/${PN}-${MY_PV}"
60 +
61 +# We can build the following SAPIs in the given order
62 +SAPIS="embed cli cgi fpm apache2 phpdbg"
63 +
64 +# SAPIs and SAPI-specific USE flags (cli SAPI is default on):
65 +IUSE="${IUSE}
66 + ${SAPIS/cli/+cli}
67 + threads"
68 +
69 +IUSE="${IUSE} acl argon2 bcmath berkdb bzip2 calendar cdb cjk
70 + coverage +ctype curl debug
71 + enchant exif ffi +fileinfo +filter firebird
72 + +flatfile ftp gd gdbm gmp +iconv imap inifile
73 + intl iodbc ipv6 +json kerberos ldap ldap-sasl libedit libressl lmdb
74 + mhash mssql mysql mysqli nls
75 + oci8-instant-client odbc +opcache pcntl pdo +phar +posix postgres qdbm
76 + readline selinux +session session-mm sharedmem
77 + +simplexml snmp soap sockets sodium spell sqlite ssl
78 + sysvipc systemd test tidy +tokenizer tokyocabinet truetype unicode webp
79 + +xml xmlreader xmlwriter xmlrpc xpm xslt zip zlib"
80 +
81 +# Without USE=readline or libedit, the interactive "php -a" CLI will hang.
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 + xmlrpc? ( xml iconv )
95 + xmlreader? ( xml )
96 + xmlwriter? ( xml )
97 + xslt? ( xml )
98 + ldap-sasl? ( 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.1[apache2?,fpm?]
113 + >=dev-libs/libpcre2-10.30[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.10.5 )
127 + enchant? ( <app-text/enchant-2.0:0 )
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-basic )
144 + odbc? ( iodbc? ( dev-db/libiodbc ) !iodbc? ( >=dev-db/unixODBC-1.8.13 ) )
145 + postgres? ( dev-db/postgresql:* )
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.7.6 )
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=( "${FILESDIR}/php-iodbc-header-location.patch" )
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 maintainer-zts)
280 + )
281 +
282 + our_conf+=(
283 + $(use_with argon2 password-argon2 "${EPREFIX}/usr")
284 + $(use_enable bcmath)
285 + $(use_with bzip2 bz2 "${EPREFIX}/usr")
286 + $(use_enable calendar)
287 + $(use_enable coverage gcov)
288 + $(use_enable ctype)
289 + $(use_with curl)
290 + $(use_enable xml dom)
291 + $(use_with enchant)
292 + $(use_enable exif)
293 + $(use_with ffi)
294 + $(use_enable fileinfo)
295 + $(use_enable filter)
296 + $(use_enable ftp)
297 + $(use_with nls gettext "${EPREFIX}/usr")
298 + $(use_with gmp gmp "${EPREFIX}/usr")
299 + $(use_with mhash mhash "${EPREFIX}/usr")
300 + $(use_with iconv iconv \
301 + $(use elibc_glibc || use elibc_musl || use elibc_FreeBSD || echo "${EPREFIX}/usr"))
302 + $(use_enable intl)
303 + $(use_enable ipv6)
304 + $(use_enable json)
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 xmlrpc)
332 + $(use_with xslt xsl)
333 + $(use_with zip)
334 + $(use_with zlib zlib "${EPREFIX}/usr")
335 + $(use_enable debug)
336 + )
337 +
338 + # DBA support
339 + if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
340 + || use qdbm || use lmdb || use tokyocabinet ; then
341 + our_conf+=( "--enable-dba" )
342 + fi
343 +
344 + # DBA drivers support
345 + our_conf+=(
346 + $(use_with cdb)
347 + $(use_with berkdb db4 "${EPREFIX}/usr")
348 + $(use_enable flatfile)
349 + $(use_with gdbm gdbm "${EPREFIX}/usr")
350 + $(use_enable inifile)
351 + $(use_with qdbm qdbm "${EPREFIX}/usr")
352 + $(use_with tokyocabinet tcadb "${EPREFIX}/usr")
353 + $(use_with lmdb lmdb "${EPREFIX}/usr")
354 + )
355 +
356 + # Support for the GD graphics library
357 + our_conf+=(
358 + $(use_with truetype freetype)
359 + $(use_enable cjk gd-jis-conv)
360 + $(use_with gd jpeg)
361 + $(use_with xpm)
362 + $(use_with webp)
363 + )
364 + # enable gd last, so configure can pick up the previous settings
365 + our_conf+=( $(use_enable gd) )
366 +
367 + # IMAP support
368 + if use imap ; then
369 + our_conf+=(
370 + $(use_with imap imap "${EPREFIX}/usr")
371 + $(use_with ssl imap-ssl "${EPREFIX}/usr")
372 + )
373 + fi
374 +
375 + # LDAP support
376 + if use ldap ; then
377 + our_conf+=(
378 + $(use_with ldap ldap "${EPREFIX}/usr")
379 + $(use_with ldap-sasl)
380 + )
381 + fi
382 +
383 + # MySQL support
384 + local mysqllib="mysqlnd"
385 + local mysqlilib="mysqlnd"
386 +
387 + our_conf+=( $(use_with mysqli mysqli "${mysqlilib}") )
388 +
389 + local mysqlsock="${EPREFIX}/var/run/mysqld/mysqld.sock"
390 + if use mysql || use mysqli ; then
391 + our_conf+=( $(use_with mysql mysql-sock "${mysqlsock}") )
392 + fi
393 +
394 + # ODBC support
395 + if use odbc && use iodbc ; then
396 + our_conf+=(
397 + --without-unixODBC
398 + --with-iodbc
399 + $(use_with pdo pdo-odbc "iODBC,${EPREFIX}/usr")
400 + )
401 + elif use odbc ; then
402 + our_conf+=(
403 + --with-unixODBC="${EPREFIX}/usr"
404 + --without-iodbc
405 + $(use_with pdo pdo-odbc "unixODBC,${EPREFIX}/usr")
406 + )
407 + else
408 + our_conf+=(
409 + --without-unixODBC
410 + --without-iodbc
411 + --without-pdo-odbc
412 + )
413 + fi
414 +
415 + # Oracle support
416 + our_conf+=( $(use_with oci8-instant-client oci8) )
417 +
418 + # PDO support
419 + if use pdo ; then
420 + our_conf+=(
421 + $(use_with mssql pdo-dblib "${EPREFIX}/usr")
422 + $(use_with mysql pdo-mysql "${mysqllib}")
423 + $(use_with postgres pdo-pgsql)
424 + $(use_with sqlite pdo-sqlite)
425 + $(use_with firebird pdo-firebird "${EPREFIX}/usr")
426 + $(use_with oci8-instant-client pdo-oci)
427 + )
428 + fi
429 +
430 + # readline/libedit support
431 + our_conf+=(
432 + $(use_with readline readline "${EPREFIX}/usr")
433 + $(use_with libedit)
434 + )
435 +
436 + # Session support
437 + if use session ; then
438 + our_conf+=( $(use_with session-mm mm "${EPREFIX}/usr") )
439 + else
440 + our_conf+=( $(use_enable session) )
441 + fi
442 +
443 + # Use pic for shared modules such as apache2's mod_php
444 + our_conf+=( --with-pic )
445 +
446 + # we use the system copy of pcre
447 + # --with-external-pcre affects ext/pcre
448 + # Many arches don't support pcre-jit
449 + our_conf+=(
450 + --with-external-pcre
451 + --without-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${PHP_MV}$(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${PHP_MV}$(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 +}