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: Sun, 26 Sep 2021 00:27:51
Message-Id: 1632616063.9007f20ed2d38cb468346e35237ec5133a657675.grknight@gentoo
1 commit: 9007f20ed2d38cb468346e35237ec5133a657675
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Sun Sep 26 00:25:59 2021 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Sun Sep 26 00:27:43 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9007f20e
7
8 dev-lang/php: Add new version and slot for 8.1.0_rc2
9
10 Masked until out of RC. Posted for early testing
11
12 Signed-off-by: Brian Evans <grknight <AT> gentoo.org>
13
14 dev-lang/php/Manifest | 1 +
15 dev-lang/php/php-8.1.0_rc2.ebuild | 749 ++++++++++++++++++++++++++++++++++++++
16 2 files changed, 750 insertions(+)
17
18 diff --git a/dev-lang/php/Manifest b/dev-lang/php/Manifest
19 index 0abf411388d..57f66e4d51f 100644
20 --- a/dev-lang/php/Manifest
21 +++ b/dev-lang/php/Manifest
22 @@ -9,3 +9,4 @@ DIST php-8.0.10.tar.xz 10703088 BLAKE2B c1be482bf0a7cd2392b4febccca8d9f7b32b12ff
23 DIST php-8.0.11.tar.xz 10804388 BLAKE2B 8d32f2bb66b2850c7d8d820cbcf94af5161065612b204f6e30289d9b9fffbae7c45cdf5e31c3d1f774932d7eb7218079f6f0d19774b108d53a81a6c88d3c99fb SHA512 2d346959b2691ea0d5334dc9cad225b7a65ec53d6a6493f3b95c4819a0c088bec36aa1bf4ab3c8044a631bcfefb689d85463ff2259d42000e65dac30badcc59d
24 DIST php-8.0.8.tar.xz 10674548 BLAKE2B d2446ae5b80e692106b89418864e4253e000741addb7526599ec8db96713f91a5ab3bccd5bbd2f536b16cc58afafdf22b19996d424dfdce3218a8083ee2bdf37 SHA512 1f8b94083b64705e24365af57169f8ff08115f31a7471238d9ed7a24b692e46c789f3fc00ff2bef2205243b9cd9c4736831e995a004afc7fc4127f3b74932428
25 DIST php-8.0.9.tar.xz 10678448 BLAKE2B 7d8684a353ccbcd2aaff4c240563cbd9f94b16ad29223d7e00e3d9ca8b564dabe3f1d0ac676e6499af6b95f24ac2104ed9cc0ce30d05c7c565ccb2067a86b355 SHA512 de9923bfa3ca37cd775ff743beb417152d7380fa5622f3fb0055b49e552c6484561f4f503bb11f535aadd12352c92f673f3e3cc86964c767b1f6cec21265d03c
26 +DIST php-8.1.0RC2.tar.xz 11679352 BLAKE2B 0b4eb5b1f8d3f8fb29421b6c72b3279bc7f3c5f6ba684305afdc7b1f5cc0f45a942d5c0f0a681f152ad87f209fa4e464215aef43732180882d523f2badd4596e SHA512 aecd58eb683467df62032208caa545d243ca2574f6683566a489136c84a19da4383c5aaa122dc09cfb44dc951bfaf85e50b0b9659b49ec1c4ae69f5afea9844b
27
28 diff --git a/dev-lang/php/php-8.1.0_rc2.ebuild b/dev-lang/php/php-8.1.0_rc2.ebuild
29 new file mode 100644
30 index 00000000000..c364c281d1f
31 --- /dev/null
32 +++ b/dev-lang/php/php-8.1.0_rc2.ebuild
33 @@ -0,0 +1,749 @@
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 +SRC_URI="https://downloads.php.net/~patrickallaert/${PN}-${MY_PV}.tar.xz"
48 +
49 +LICENSE="PHP-3.01
50 + BSD
51 + Zend-2.0
52 + bcmath? ( LGPL-2.1+ )
53 + fpm? ( BSD-2 )
54 + gd? ( gd )
55 + unicode? ( BSD-2 LGPL-2.1 )"
56 +
57 +SLOT="$(ver_cut 1-2)"
58 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
59 +
60 +S="${WORKDIR}/${PN}-${MY_PV}"
61 +
62 +# We can build the following SAPIs in the given order
63 +SAPIS="embed cli cgi fpm apache2 phpdbg"
64 +
65 +# SAPIs and SAPI-specific USE flags (cli SAPI is default on):
66 +IUSE="${IUSE}
67 + ${SAPIS/cli/+cli}
68 + threads"
69 +
70 +IUSE="${IUSE} acl apparmor argon2 bcmath berkdb bzip2 calendar cdb cjk
71 + coverage +ctype curl debug
72 + enchant exif ffi +fileinfo +filter firebird
73 + +flatfile ftp gd gdbm gmp +iconv imap inifile
74 + intl iodbc ipv6 +jit kerberos ldap ldap-sasl libedit lmdb
75 + mhash mssql mysql mysqli nls
76 + oci8-instant-client odbc +opcache pcntl pdo +phar +posix postgres qdbm
77 + readline selinux +session session-mm sharedmem
78 + +simplexml snmp soap sockets sodium spell sqlite ssl
79 + sysvipc systemd test tidy +tokenizer tokyocabinet truetype unicode webp
80 + +xml xmlreader xmlwriter xpm xslt zip zlib"
81 +
82 +# Without USE=readline or libedit, the interactive "php -a" CLI will hang.
83 +# The Oracle instant client provides its own incompatible ldap library.
84 +REQUIRED_USE="
85 + || ( cli cgi fpm apache2 embed phpdbg )
86 + cli? ( ^^ ( readline libedit ) )
87 + !cli? ( ?? ( readline libedit ) )
88 + truetype? ( gd zlib )
89 + webp? ( gd zlib )
90 + cjk? ( gd zlib )
91 + exif? ( gd zlib )
92 + xpm? ( gd zlib )
93 + gd? ( zlib )
94 + simplexml? ( xml )
95 + soap? ( xml )
96 + xmlreader? ( xml )
97 + xmlwriter? ( xml )
98 + xslt? ( xml )
99 + ldap-sasl? ( ldap )
100 + oci8-instant-client? ( !ldap )
101 + qdbm? ( !gdbm )
102 + session-mm? ( session !threads )
103 + mysql? ( || ( mysqli pdo ) )
104 + firebird? ( pdo )
105 + mssql? ( pdo )
106 +"
107 +
108 +RESTRICT="!test? ( test )"
109 +
110 +# The supported (that is, autodetected) versions of BDB are listed in
111 +# the ./configure script. Other versions *work*, but we need to stick to
112 +# the ones that can be detected to avoid a repeat of bug #564824.
113 +COMMON_DEPEND="
114 + >=app-eselect/eselect-php-0.9.7[apache2?,fpm?]
115 + >=dev-libs/libpcre2-10.30[jit?,unicode]
116 + fpm? ( acl? ( sys-apps/acl ) apparmor? ( sys-libs/libapparmor ) )
117 + apache2? ( www-servers/apache[apache2_modules_unixd(+),threads=] )
118 + argon2? ( app-crypt/argon2:= )
119 + berkdb? ( || ( sys-libs/db:5.3
120 + sys-libs/db:5.1
121 + sys-libs/db:4.8
122 + sys-libs/db:4.7
123 + sys-libs/db:4.6
124 + sys-libs/db:4.5 ) )
125 + bzip2? ( app-arch/bzip2:0= )
126 + cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
127 + coverage? ( dev-util/lcov )
128 + curl? ( >=net-misc/curl-7.29.0 )
129 + enchant? ( app-text/enchant:2 )
130 + ffi? ( >=dev-libs/libffi-3.0.11:= )
131 + firebird? ( dev-db/firebird )
132 + gd? ( >=virtual/jpeg-0-r3:0 media-libs/libpng:0= )
133 + gdbm? ( >=sys-libs/gdbm-1.8.0:0= )
134 + gmp? ( dev-libs/gmp:0= )
135 + iconv? ( virtual/libiconv )
136 + imap? ( >=virtual/imap-c-client-2[kerberos=,ssl=] )
137 + intl? ( dev-libs/icu:= )
138 + kerberos? ( virtual/krb5 )
139 + ldap? ( >=net-nds/openldap-1.2.11 )
140 + ldap-sasl? ( dev-libs/cyrus-sasl )
141 + libedit? ( dev-libs/libedit )
142 + lmdb? ( dev-db/lmdb:= )
143 + mssql? ( dev-db/freetds[mssql] )
144 + nls? ( sys-devel/gettext )
145 + oci8-instant-client? ( dev-db/oracle-instantclient[sdk] )
146 + odbc? ( iodbc? ( dev-db/libiodbc ) !iodbc? ( >=dev-db/unixODBC-1.8.13 ) )
147 + postgres? ( >=dev-db/postgresql-9.1:* )
148 + qdbm? ( dev-db/qdbm )
149 + readline? ( sys-libs/readline:0= )
150 + session-mm? ( dev-libs/mm )
151 + snmp? ( >=net-analyzer/net-snmp-5.2 )
152 + sodium? ( dev-libs/libsodium:=[-minimal] )
153 + spell? ( >=app-text/aspell-0.50 )
154 + sqlite? ( >=dev-db/sqlite-3.7.6.3 )
155 + ssl? ( >=dev-libs/openssl-1.0.2:0= )
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.9.0 )
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=(
186 + "${FILESDIR}/php-iodbc-header-location.patch"
187 +)
188 +
189 +php_install_ini() {
190 + local phpsapi="${1}"
191 +
192 + # work out where we are installing the ini file
193 + php_set_ini_dir "${phpsapi}"
194 +
195 + # Always install the production INI file, bug 611214.
196 + local phpinisrc="php.ini-production-${phpsapi}"
197 + cp php.ini-production "${phpinisrc}" || die
198 +
199 + # default to /tmp for save_path, bug #282768
200 + sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}" || die
201 +
202 + # Set the extension dir
203 + sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" \
204 + -i "${phpinisrc}" || die
205 +
206 + # Set the include path to point to where we want to find PEAR packages
207 + sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}" || die
208 +
209 + insinto "${PHP_INI_DIR#${EPREFIX}}"
210 + newins "${phpinisrc}" php.ini
211 +
212 + elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
213 + elog
214 +
215 + dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
216 + dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
217 +
218 + if use opcache; then
219 + elog "Adding opcache to $PHP_EXT_INI_DIR"
220 + echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> \
221 + "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
222 + dosym "../ext/opcache.ini" \
223 + "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
224 + fi
225 +
226 + # SAPI-specific handling
227 + if [[ "${sapi}" == "fpm" ]] ; then
228 + einfo "Installing FPM config files php-fpm.conf and www.conf"
229 + insinto "${PHP_INI_DIR#${EPREFIX}}"
230 + doins sapi/fpm/php-fpm.conf
231 + insinto "${PHP_INI_DIR#${EPREFIX}}/fpm.d"
232 + doins sapi/fpm/www.conf
233 + fi
234 +
235 + dodoc php.ini-{development,production}
236 +}
237 +
238 +php_set_ini_dir() {
239 + PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
240 + PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
241 + PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
242 +}
243 +
244 +src_prepare() {
245 + default
246 +
247 + # In php-7.x, the FPM pool configuration files have been split off
248 + # of the main config. By default the pool config files go in
249 + # e.g. /etc/php-fpm.d, which isn't slotted. So here we move the
250 + # include directory to a subdirectory "fpm.d" of $PHP_INI_DIR. Later
251 + # we'll install the pool configuration file "www.conf" there.
252 + php_set_ini_dir fpm
253 + sed -i "s~^include=.*$~include=${PHP_INI_DIR}/fpm.d/*.conf~" \
254 + sapi/fpm/php-fpm.conf.in \
255 + || die 'failed to move the include directory in php-fpm.conf'
256 +
257 + # Emulate buildconf to support cross-compilation
258 + rm -fr aclocal.m4 autom4te.cache config.cache \
259 + configure main/php_config.h.in || die
260 + eautoconf --force
261 + eautoheader
262 +}
263 +
264 +src_configure() {
265 + addpredict /usr/share/snmp/mibs/.index #nowarn
266 + addpredict /var/lib/net-snmp/mib_indexes #nowarn
267 +
268 + PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
269 +
270 + # The php-fpm config file wants localstatedir to be ${EPREFIX}/var
271 + # and not the Gentoo default ${EPREFIX}/var/lib. See bug 572002.
272 + local our_conf=(
273 + --prefix="${PHP_DESTDIR}"
274 + --mandir="${PHP_DESTDIR}/man"
275 + --infodir="${PHP_DESTDIR}/info"
276 + --libdir="${PHP_DESTDIR}/lib"
277 + --with-libdir="$(get_libdir)"
278 + --localstatedir="${EPREFIX}/var"
279 + --without-pear
280 + $(use_enable threads zts)
281 + )
282 +
283 + our_conf+=(
284 + $(use_with apparmor fpm-apparmor)
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_with kerberos)
307 + $(use_with xml libxml)
308 + $(use_enable unicode mbstring)
309 + $(use_with ssl openssl)
310 + $(use_enable pcntl)
311 + $(use_enable phar)
312 + $(use_enable pdo)
313 + $(use_enable opcache)
314 + $(use_with postgres pgsql "${EPREFIX}/usr")
315 + $(use_enable posix)
316 + $(use_with spell pspell "${EPREFIX}/usr")
317 + $(use_enable simplexml)
318 + $(use_enable sharedmem shmop)
319 + $(use_with snmp snmp "${EPREFIX}/usr")
320 + $(use_enable soap)
321 + $(use_enable sockets)
322 + $(use_with sodium)
323 + $(use_with sqlite sqlite3)
324 + $(use_enable sysvipc sysvmsg)
325 + $(use_enable sysvipc sysvsem)
326 + $(use_enable sysvipc sysvshm)
327 + $(use_with tidy tidy "${EPREFIX}/usr")
328 + $(use_enable tokenizer)
329 + $(use_enable xml)
330 + $(use_enable xmlreader)
331 + $(use_enable xmlwriter)
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 + our_conf+=(
449 + --with-external-pcre
450 + $(use_with jit 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$(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$(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 +}