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: Fri, 21 Jan 2022 14:35:59
Message-Id: 1642775751.18f551edf592dfc5be215b402101ca996747ad6e.grknight@gentoo
1 commit: 18f551edf592dfc5be215b402101ca996747ad6e
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jan 21 14:32:45 2022 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Fri Jan 21 14:35:51 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=18f551ed
7
8 dev-lang/php: Version bump for 8.1.2
9
10 Signed-off-by: Brian Evans <grknight <AT> gentoo.org>
11
12 dev-lang/php/Manifest | 1 +
13 dev-lang/php/php-8.1.2.ebuild | 759 ++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 760 insertions(+)
15
16 diff --git a/dev-lang/php/Manifest b/dev-lang/php/Manifest
17 index 2df20a882aed..33447a6fd6ea 100644
18 --- a/dev-lang/php/Manifest
19 +++ b/dev-lang/php/Manifest
20 @@ -9,3 +9,4 @@ DIST php-8.0.14.tar.xz 10860176 BLAKE2B e63e8e4446c1e1ee0bdf6faf38ce95a793107e58
21 DIST php-8.0.15.tar.xz 10764936 BLAKE2B f7bdc42dd3c9e9b58744dba644720fd5dfe581442f522759cd48b94a30c3fc65167f2b0e670bbbe5d5524ec3a6704e3b432e5af2dc07c6944a93adc52e527e98 SHA512 e6ac50b2e38d6d02cf84ce388826438bb7d339b54d2038ca071874b90c65f80c5c5e0c69f870edd7450d2de8f83788c8855eeb983d0d4528d44e31679caf404f
22 DIST php-8.1.0.tar.xz 11737524 BLAKE2B 1c1bd664628343f1a0d502a009ab01cccc4cb3cb8239c1882ae1a9c1795db9cf382d5b5648cc83bc4a929a892e637324555cc59a6379118cb04f477d35cfabff SHA512 0f8667ec888dff2f1b7354ff3bd3def4130b1b7145258deb65e4529982383a90c1a7412f298d566f889b4f2c19a72d145ad150501881f8483a07fc9610c9ae49
23 DIST php-8.1.1.tar.xz 11728680 BLAKE2B a9a6dd380efea7637e92707dfc3f8b0705efdfd6cb2639a69e43fa4d7ac17ba80d12086840d4b7118e8f132c1f7e1638d9df79e03190c1fd9647ffe553003980 SHA512 ab1cca08eb49fc2316f19d9e136a2d6462fe5b33967ecb671564dd9def2a765cc1b864a764c9cfbb8e7853936fb2d4939e7ed4f97220ca30eaf08c3badeb44da
24 +DIST php-8.1.2.tar.xz 11681132 BLAKE2B e693237b76d94cd4a50c3df68289d4c2f070c40cc52c099fd91134331377115b7e7df509e5d6cdfc7742da3ae7b27d3cbe7015acc3825b887ba0d7d690663dd4 SHA512 ec68587fc14d4e5aaa19d4a189c74b85e67b8ab4d5a15ef36115b564fc9e2f2b63bd608ea8c0e4a99615a24f38711b233f4e65b3672c3bfb69e1ab9d554a88cd
25
26 diff --git a/dev-lang/php/php-8.1.2.ebuild b/dev-lang/php/php-8.1.2.ebuild
27 new file mode 100644
28 index 000000000000..423e9f806689
29 --- /dev/null
30 +++ b/dev-lang/php/php-8.1.2.ebuild
31 @@ -0,0 +1,759 @@
32 +# Copyright 1999-2022 Gentoo Authors
33 +# Distributed under the terms of the GNU General Public License v2
34 +
35 +EAPI="8"
36 +
37 +WANT_AUTOMAKE="none"
38 +
39 +inherit flag-o-matic systemd autotools
40 +
41 +MY_PV=${PV/_rc/RC}
42 +DESCRIPTION="The PHP language runtime engine"
43 +HOMEPAGE="https://www.php.net/"
44 +SRC_URI="https://www.php.net/distributions/${P}.tar.xz"
45 +
46 +LICENSE="PHP-3.01
47 + BSD
48 + Zend-2.0
49 + bcmath? ( LGPL-2.1+ )
50 + fpm? ( BSD-2 )
51 + gd? ( gd )
52 + unicode? ( BSD-2 LGPL-2.1 )"
53 +
54 +SLOT="$(ver_cut 1-2)"
55 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
56 +
57 +S="${WORKDIR}/${PN}-${MY_PV}"
58 +
59 +# We can build the following SAPIs in the given order
60 +SAPIS="embed cli cgi fpm apache2 phpdbg"
61 +
62 +# SAPIs and SAPI-specific USE flags (cli SAPI is default on):
63 +IUSE="${IUSE}
64 + ${SAPIS/cli/+cli}
65 + threads"
66 +
67 +IUSE="${IUSE} acl apparmor argon2 bcmath berkdb bzip2 calendar cdb cjk
68 + coverage +ctype curl debug
69 + enchant exif ffi +fileinfo +filter firebird
70 + +flatfile ftp gd gdbm gmp +iconv imap inifile
71 + intl iodbc ipv6 +jit kerberos ldap ldap-sasl libedit lmdb
72 + mhash mssql mysql mysqli nls
73 + oci8-instant-client odbc +opcache pcntl pdo +phar +posix postgres qdbm
74 + readline selinux +session session-mm sharedmem
75 + +simplexml snmp soap sockets sodium spell sqlite ssl
76 + sysvipc systemd test tidy +tokenizer tokyocabinet truetype unicode webp
77 + +xml xmlreader xmlwriter xpm xslt zip zlib"
78 +
79 +# Without USE=readline or libedit, the interactive "php -a" CLI will hang.
80 +# The Oracle instant client provides its own incompatible ldap library.
81 +REQUIRED_USE="
82 + || ( cli cgi fpm apache2 embed phpdbg )
83 + cli? ( ^^ ( readline libedit ) )
84 + !cli? ( ?? ( readline libedit ) )
85 + truetype? ( gd zlib )
86 + webp? ( gd zlib )
87 + cjk? ( gd zlib )
88 + exif? ( gd zlib )
89 + xpm? ( gd zlib )
90 + gd? ( zlib )
91 + simplexml? ( xml )
92 + soap? ( xml )
93 + xmlreader? ( xml )
94 + xmlwriter? ( xml )
95 + xslt? ( xml )
96 + ldap-sasl? ( ldap )
97 + oci8-instant-client? ( !ldap )
98 + qdbm? ( !gdbm )
99 + session-mm? ( session !threads )
100 + mysql? ( || ( mysqli pdo ) )
101 + firebird? ( pdo )
102 + mssql? ( pdo )
103 +"
104 +
105 +RESTRICT="!test? ( test )"
106 +
107 +# The supported (that is, autodetected) versions of BDB are listed in
108 +# the ./configure script. Other versions *work*, but we need to stick to
109 +# the ones that can be detected to avoid a repeat of bug #564824.
110 +COMMON_DEPEND="
111 + >=app-eselect/eselect-php-0.9.7[apache2?,fpm?]
112 + >=dev-libs/libpcre2-10.30[jit?,unicode]
113 + fpm? ( acl? ( sys-apps/acl ) apparmor? ( sys-libs/libapparmor ) )
114 + apache2? ( www-servers/apache[apache2_modules_unixd(+),threads=] )
115 + argon2? ( app-crypt/argon2:= )
116 + berkdb? ( || ( sys-libs/db:5.3 sys-libs/db:4.8 ) )
117 + bzip2? ( app-arch/bzip2:0= )
118 + cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
119 + coverage? ( dev-util/lcov )
120 + curl? ( >=net-misc/curl-7.29.0 )
121 + enchant? ( app-text/enchant:2 )
122 + ffi? ( >=dev-libs/libffi-3.0.11:= )
123 + firebird? ( dev-db/firebird )
124 + gd? ( >=virtual/jpeg-0-r3:0 media-libs/libpng:0= )
125 + gdbm? ( >=sys-libs/gdbm-1.8.0:0= )
126 + gmp? ( dev-libs/gmp:0= )
127 + iconv? ( virtual/libiconv )
128 + imap? ( >=virtual/imap-c-client-2[kerberos=,ssl=] )
129 + intl? ( dev-libs/icu:= )
130 + kerberos? ( virtual/krb5 )
131 + ldap? ( >=net-nds/openldap-1.2.11 )
132 + ldap-sasl? ( dev-libs/cyrus-sasl )
133 + libedit? ( dev-libs/libedit )
134 + lmdb? ( dev-db/lmdb:= )
135 + mssql? ( dev-db/freetds[mssql] )
136 + nls? ( sys-devel/gettext )
137 + oci8-instant-client? ( dev-db/oracle-instantclient[sdk] )
138 + odbc? ( iodbc? ( dev-db/libiodbc ) !iodbc? ( >=dev-db/unixODBC-1.8.13 ) )
139 + postgres? ( >=dev-db/postgresql-9.1:* )
140 + qdbm? ( dev-db/qdbm )
141 + readline? ( sys-libs/readline:0= )
142 + session-mm? ( dev-libs/mm )
143 + snmp? ( >=net-analyzer/net-snmp-5.2 )
144 + sodium? ( dev-libs/libsodium:=[-minimal] )
145 + spell? ( >=app-text/aspell-0.50 )
146 + sqlite? ( >=dev-db/sqlite-3.7.6.3 )
147 + ssl? ( >=dev-libs/openssl-1.0.2:0= )
148 + tidy? ( app-text/htmltidy )
149 + tokyocabinet? ( dev-db/tokyocabinet )
150 + truetype? ( =media-libs/freetype-2* )
151 + unicode? ( dev-libs/oniguruma:= )
152 + webp? ( media-libs/libwebp:0= )
153 + xml? ( >=dev-libs/libxml2-2.9.0 )
154 + xpm? ( x11-libs/libXpm )
155 + xslt? ( dev-libs/libxslt )
156 + zip? ( >=dev-libs/libzip-1.2.0:= )
157 + zlib? ( >=sys-libs/zlib-1.2.0.4:0= )
158 +"
159 +
160 +IDEPEND=">=app-eselect/eselect-php-0.9.7[apache2?,fpm?]"
161 +
162 +RDEPEND="${COMMON_DEPEND}
163 + virtual/mta
164 + fpm? (
165 + selinux? ( sec-policy/selinux-phpfpm )
166 + systemd? ( sys-apps/systemd ) )"
167 +
168 +# Bison isn't actually needed when building from a release tarball
169 +# However, the configure script will warn if it's absent or if you
170 +# have an incompatible version installed. See bug 593278.
171 +DEPEND="${COMMON_DEPEND}
172 + app-arch/xz-utils
173 + >=sys-devel/bison-3.0.1"
174 +
175 +BDEPEND="virtual/pkgconfig"
176 +
177 +PHP_MV="$(ver_cut 1)"
178 +
179 +PATCHES=(
180 + "${FILESDIR}/php-iodbc-header-location.patch"
181 +)
182 +
183 +php_install_ini() {
184 + local phpsapi="${1}"
185 +
186 + # work out where we are installing the ini file
187 + php_set_ini_dir "${phpsapi}"
188 +
189 + # Always install the production INI file, bug 611214.
190 + local phpinisrc="php.ini-production-${phpsapi}"
191 + cp php.ini-production "${phpinisrc}" || die
192 +
193 + # default to /tmp for save_path, bug #282768
194 + sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}" || die
195 +
196 + # Set the extension dir
197 + sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" \
198 + -i "${phpinisrc}" || die
199 +
200 + # Set the include path to point to where we want to find PEAR packages
201 + sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}" || die
202 +
203 + insinto "${PHP_INI_DIR#${EPREFIX}}"
204 + newins "${phpinisrc}" php.ini
205 +
206 + elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
207 + elog
208 +
209 + dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
210 + dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
211 +
212 + if use opcache; then
213 + elog "Adding opcache to $PHP_EXT_INI_DIR"
214 + echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> \
215 + "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
216 + dosym "../ext/opcache.ini" \
217 + "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
218 + fi
219 +
220 + # SAPI-specific handling
221 + if [[ "${sapi}" == "fpm" ]] ; then
222 + einfo "Installing FPM config files php-fpm.conf and www.conf"
223 + insinto "${PHP_INI_DIR#${EPREFIX}}"
224 + doins sapi/fpm/php-fpm.conf
225 + insinto "${PHP_INI_DIR#${EPREFIX}}/fpm.d"
226 + doins sapi/fpm/www.conf
227 + fi
228 +
229 + dodoc php.ini-{development,production}
230 +}
231 +
232 +php_set_ini_dir() {
233 + PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
234 + PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
235 + PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
236 +}
237 +
238 +src_prepare() {
239 + default
240 +
241 + # In php-7.x, the FPM pool configuration files have been split off
242 + # of the main config. By default the pool config files go in
243 + # e.g. /etc/php-fpm.d, which isn't slotted. So here we move the
244 + # include directory to a subdirectory "fpm.d" of $PHP_INI_DIR. Later
245 + # we'll install the pool configuration file "www.conf" there.
246 + php_set_ini_dir fpm
247 + sed -i "s~^include=.*$~include=${PHP_INI_DIR}/fpm.d/*.conf~" \
248 + sapi/fpm/php-fpm.conf.in \
249 + || die 'failed to move the include directory in php-fpm.conf'
250 +
251 + # Emulate buildconf to support cross-compilation
252 + rm -fr aclocal.m4 autom4te.cache config.cache \
253 + configure main/php_config.h.in || die
254 + eautoconf --force
255 + eautoheader
256 +
257 + # Remove false positive test failures
258 + # stream_isatty fails due to portage redirects
259 + # curl tests here fail for network sandbox issues
260 + # session tests here fail because we set the session directory to $T
261 + rm tests/output/stream_isatty_err.phpt \
262 + tests/output/stream_isatty_out-err.phpt \
263 + tests/output/stream_isatty_out.phpt \
264 + ext/curl/tests/bug76675.phpt \
265 + ext/curl/tests/bug77535.phpt \
266 + ext/curl/tests/curl_error_basic.phpt \
267 + ext/session/tests/bug74514.phpt \
268 + ext/session/tests/bug74936.phpt || die
269 +
270 +}
271 +
272 +src_configure() {
273 + addpredict /usr/share/snmp/mibs/.index #nowarn
274 + addpredict /var/lib/net-snmp/mib_indexes #nowarn
275 +
276 + PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
277 +
278 + # The php-fpm config file wants localstatedir to be ${EPREFIX}/var
279 + # and not the Gentoo default ${EPREFIX}/var/lib. See bug 572002.
280 + local our_conf=(
281 + --prefix="${PHP_DESTDIR}"
282 + --mandir="${PHP_DESTDIR}/man"
283 + --infodir="${PHP_DESTDIR}/info"
284 + --libdir="${PHP_DESTDIR}/lib"
285 + --with-libdir="$(get_libdir)"
286 + --localstatedir="${EPREFIX}/var"
287 + --without-pear
288 + $(use_enable threads zts)
289 + )
290 +
291 + our_conf+=(
292 + $(use_with apparmor fpm-apparmor)
293 + $(use_with argon2 password-argon2 "${EPREFIX}/usr")
294 + $(use_enable bcmath)
295 + $(use_with bzip2 bz2 "${EPREFIX}/usr")
296 + $(use_enable calendar)
297 + $(use_enable coverage gcov)
298 + $(use_enable ctype)
299 + $(use_with curl)
300 + $(use_enable xml dom)
301 + $(use_with enchant)
302 + $(use_enable exif)
303 + $(use_with ffi)
304 + $(use_enable fileinfo)
305 + $(use_enable filter)
306 + $(use_enable ftp)
307 + $(use_with nls gettext "${EPREFIX}/usr")
308 + $(use_with gmp gmp "${EPREFIX}/usr")
309 + $(use_with mhash mhash "${EPREFIX}/usr")
310 + $(use_with iconv iconv \
311 + $(use elibc_glibc || use elibc_musl || echo "${EPREFIX}/usr"))
312 + $(use_enable intl)
313 + $(use_enable ipv6)
314 + $(use_with kerberos)
315 + $(use_with xml libxml)
316 + $(use_enable unicode mbstring)
317 + $(use_with ssl openssl)
318 + $(use_enable pcntl)
319 + $(use_enable phar)
320 + $(use_enable pdo)
321 + $(use_enable opcache)
322 + $(use_with postgres pgsql "${EPREFIX}/usr")
323 + $(use_enable posix)
324 + $(use_with spell pspell "${EPREFIX}/usr")
325 + $(use_enable simplexml)
326 + $(use_enable sharedmem shmop)
327 + $(use_with snmp snmp "${EPREFIX}/usr")
328 + $(use_enable soap)
329 + $(use_enable sockets)
330 + $(use_with sodium)
331 + $(use_with sqlite sqlite3)
332 + $(use_enable sysvipc sysvmsg)
333 + $(use_enable sysvipc sysvsem)
334 + $(use_enable sysvipc sysvshm)
335 + $(use_with tidy tidy "${EPREFIX}/usr")
336 + $(use_enable tokenizer)
337 + $(use_enable xml)
338 + $(use_enable xmlreader)
339 + $(use_enable xmlwriter)
340 + $(use_with xslt xsl)
341 + $(use_with zip)
342 + $(use_with zlib zlib "${EPREFIX}/usr")
343 + $(use_enable debug)
344 + )
345 +
346 + # DBA support
347 + if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
348 + || use qdbm || use lmdb || use tokyocabinet ; then
349 + our_conf+=( "--enable-dba" )
350 + fi
351 +
352 + # DBA drivers support
353 + our_conf+=(
354 + $(use_with cdb)
355 + $(use_with berkdb db4 "${EPREFIX}/usr")
356 + $(use_enable flatfile)
357 + $(use_with gdbm gdbm "${EPREFIX}/usr")
358 + $(use_enable inifile)
359 + $(use_with qdbm qdbm "${EPREFIX}/usr")
360 + $(use_with tokyocabinet tcadb "${EPREFIX}/usr")
361 + $(use_with lmdb lmdb "${EPREFIX}/usr")
362 + )
363 +
364 + # Support for the GD graphics library
365 + our_conf+=(
366 + $(use_with truetype freetype)
367 + $(use_enable cjk gd-jis-conv)
368 + $(use_with gd jpeg)
369 + $(use_with xpm)
370 + $(use_with webp)
371 + )
372 + # enable gd last, so configure can pick up the previous settings
373 + our_conf+=( $(use_enable gd) )
374 +
375 + # IMAP support
376 + if use imap ; then
377 + our_conf+=(
378 + $(use_with imap imap "${EPREFIX}/usr")
379 + $(use_with ssl imap-ssl "${EPREFIX}/usr")
380 + )
381 + fi
382 +
383 + # LDAP support
384 + if use ldap ; then
385 + our_conf+=(
386 + $(use_with ldap ldap "${EPREFIX}/usr")
387 + $(use_with ldap-sasl)
388 + )
389 + fi
390 +
391 + # MySQL support
392 + local mysqllib="mysqlnd"
393 + local mysqlilib="mysqlnd"
394 +
395 + our_conf+=( $(use_with mysqli mysqli "${mysqlilib}") )
396 +
397 + local mysqlsock="${EPREFIX}/var/run/mysqld/mysqld.sock"
398 + if use mysql || use mysqli ; then
399 + our_conf+=( $(use_with mysql mysql-sock "${mysqlsock}") )
400 + fi
401 +
402 + # ODBC support
403 + if use odbc && use iodbc ; then
404 + our_conf+=(
405 + --without-unixODBC
406 + --with-iodbc
407 + $(use_with pdo pdo-odbc "iODBC,${EPREFIX}/usr")
408 + )
409 + elif use odbc ; then
410 + our_conf+=(
411 + --with-unixODBC="${EPREFIX}/usr"
412 + --without-iodbc
413 + $(use_with pdo pdo-odbc "unixODBC,${EPREFIX}/usr")
414 + )
415 + else
416 + our_conf+=(
417 + --without-unixODBC
418 + --without-iodbc
419 + --without-pdo-odbc
420 + )
421 + fi
422 +
423 + # Oracle support
424 + our_conf+=( $(use_with oci8-instant-client oci8) )
425 +
426 + # PDO support
427 + if use pdo ; then
428 + our_conf+=(
429 + $(use_with mssql pdo-dblib "${EPREFIX}/usr")
430 + $(use_with mysql pdo-mysql "${mysqllib}")
431 + $(use_with postgres pdo-pgsql)
432 + $(use_with sqlite pdo-sqlite)
433 + $(use_with firebird pdo-firebird "${EPREFIX}/usr")
434 + $(use_with oci8-instant-client pdo-oci)
435 + )
436 + fi
437 +
438 + # readline/libedit support
439 + our_conf+=(
440 + $(use_with readline readline "${EPREFIX}/usr")
441 + $(use_with libedit)
442 + )
443 +
444 + # Session support
445 + if use session ; then
446 + our_conf+=( $(use_with session-mm mm "${EPREFIX}/usr") )
447 + else
448 + our_conf+=( $(use_enable session) )
449 + fi
450 +
451 + # Use pic for shared modules such as apache2's mod_php
452 + our_conf+=( --with-pic )
453 +
454 + # we use the system copy of pcre
455 + # --with-external-pcre affects ext/pcre
456 + our_conf+=(
457 + --with-external-pcre
458 + $(use_with jit 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$(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$(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 +}