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