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