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, 03 Nov 2022 13:02:42
Message-Id: 1667480534.d9788a266bffae184d77b33abfb39cd38003be75.grknight@gentoo
1 commit: d9788a266bffae184d77b33abfb39cd38003be75
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Thu Nov 3 13:01:49 2022 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Thu Nov 3 13:02:14 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d9788a26
7
8 dev-lang/php: Version bump for 7.4.33
9
10 Bug: https://bugs.gentoo.org/877853
11 Signed-off-by: Brian Evans <grknight <AT> gentoo.org>
12
13 dev-lang/php/Manifest | 1 +
14 dev-lang/php/php-7.4.33.ebuild | 749 +++++++++++++++++++++++++++++++++++++++++
15 2 files changed, 750 insertions(+)
16
17 diff --git a/dev-lang/php/Manifest b/dev-lang/php/Manifest
18 index 4f94a4299e92..a9b1eed71fc3 100644
19 --- a/dev-lang/php/Manifest
20 +++ b/dev-lang/php/Manifest
21 @@ -1,4 +1,5 @@
22 DIST php-7.4.32.tar.xz 10419092 BLAKE2B 7657360e661274a34ab17e0e5a103e037d83876187b5413f020c246a91f02b00ac4f0cf34848729d0ccb86d8b9830e5a0ba8a85cc030ec9bd61ec7d4d1a07f5e SHA512 052fbb6120b9943927685f736574871bc2b0c60d4ef18b54ec3f3d92398842286189fd426647c3c91eec38b11ce607090c4cd339040c92bda852574b96c36f67
23 +DIST php-7.4.33.tar.xz 10420144 BLAKE2B e75817e79c698628c873c90afb3b5677480d03ecf07e8f2e26a062bc5b91affc6079e792e864f28cf12d45f86e5d01ede289ecdcefc06477986d193d22c982ef SHA512 499b63b99e5d8e8082ff89d3a91b4cb9a593ea7553b96e48863414c13d2e50275904ed29070e2232e529ee91160f505e6060a4d129cb5bf098aa5b6ea0928d3d
24 DIST php-8.0.24.tar.xz 10895332 BLAKE2B efdf65b8d715ed9dd817437beac4949de54d3d96d2289bfcaac5cf7cfaa4015d8e507b7dc43f02760afb5f0be5a5b146abb19324e37a6331e18d5db8ca3cde9d SHA512 f4922c03b613aae35005b6b39630c0de7c25929b7f4edd9c5062a747a747df065ae9b52c17c34433ecb801bc54fce2fa34ae46165deb527f0fe2c86e5da73400
25 DIST php-8.0.25.tar.xz 10802888 BLAKE2B c1f283613c43551cccd52955deaae364781fffd4f73befa5e103211ed2b972272189973639d840ef1839b038e1872a6a28424939ea133f0bf86d82b56bb591fb SHA512 43bb0637e424e2a637e05f3faf0ca2c5309f2d9cc03def9fc9af9b756003ea6efe730b608c70177c3c1b9cb03cef31c27cd6507cca9d9f0fd854aadb5e51aee3
26 DIST php-8.1.11.tar.xz 11797016 BLAKE2B d9e3839931370cb833692b7829d98d29a3e942368ed656777303766cfb931ef94e10a44782f0232ef0610b8170c0ffb3fe3320fca0ec7081e4b5dfc19861495d SHA512 2a9eb4642b4077077f6551ca9a40fd2c48272cc1ee443117362331259efbec88bad0141b09f7a9ff710cde044f9463e1e668f7066b2429ea4274dec7291725cc
27
28 diff --git a/dev-lang/php/php-7.4.33.ebuild b/dev-lang/php/php-7.4.33.ebuild
29 new file mode 100644
30 index 000000000000..609c605be729
31 --- /dev/null
32 +++ b/dev-lang/php/php-7.4.33.ebuild
33 @@ -0,0 +1,749 @@
34 +# Copyright 1999-2022 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 ~riscv ~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 +jit +json kerberos ldap ldap-sasl libedit 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 +# The Oracle instant client provides its own incompatible ldap library.
83 +REQUIRED_USE="
84 + || ( cli cgi fpm apache2 embed phpdbg )
85 + cli? ( ^^ ( readline libedit ) )
86 + !cli? ( ?? ( readline libedit ) )
87 + truetype? ( gd zlib )
88 + webp? ( gd zlib )
89 + cjk? ( gd zlib )
90 + exif? ( gd zlib )
91 + xpm? ( gd zlib )
92 + gd? ( zlib )
93 + simplexml? ( xml )
94 + soap? ( xml )
95 + xmlrpc? ( xml iconv )
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.1[apache2?,fpm?]
115 + >=dev-libs/libpcre2-10.30[jit?,unicode]
116 + fpm? ( acl? ( sys-apps/acl ) )
117 + apache2? ( www-servers/apache[apache2_modules_unixd(+),threads=] )
118 + argon2? ( app-crypt/argon2:= )
119 + berkdb? ( || ( sys-libs/db:5.3 sys-libs/db:4.8 ) )
120 + bzip2? ( app-arch/bzip2:0= )
121 + cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
122 + coverage? ( dev-util/lcov )
123 + curl? ( >=net-misc/curl-7.10.5 )
124 + enchant? ( <app-text/enchant-2.0:0 )
125 + ffi? ( >=dev-libs/libffi-3.0.11:= )
126 + firebird? ( dev-db/firebird )
127 + gd? ( media-libs/libjpeg-turbo:0= media-libs/libpng:0= )
128 + gdbm? ( >=sys-libs/gdbm-1.8.0:0= )
129 + gmp? ( dev-libs/gmp:0= )
130 + iconv? ( virtual/libiconv )
131 + imap? ( net-libs/c-client[kerberos=,ssl=] )
132 + intl? ( dev-libs/icu:= )
133 + kerberos? ( virtual/krb5 )
134 + ldap? ( >=net-nds/openldap-1.2.11:= )
135 + ldap-sasl? ( dev-libs/cyrus-sasl )
136 + libedit? ( dev-libs/libedit )
137 + lmdb? ( dev-db/lmdb:= )
138 + mssql? ( dev-db/freetds[mssql] )
139 + nls? ( sys-devel/gettext )
140 + oci8-instant-client? ( dev-db/oracle-instantclient[sdk] )
141 + odbc? ( iodbc? ( dev-db/libiodbc ) !iodbc? ( >=dev-db/unixODBC-1.8.13 ) )
142 + postgres? ( dev-db/postgresql:* )
143 + qdbm? ( dev-db/qdbm )
144 + readline? ( sys-libs/readline:0= )
145 + session-mm? ( dev-libs/mm )
146 + snmp? ( >=net-analyzer/net-snmp-5.2 )
147 + sodium? ( dev-libs/libsodium:=[-minimal] )
148 + spell? ( >=app-text/aspell-0.50 )
149 + sqlite? ( >=dev-db/sqlite-3.7.6.3 )
150 + ssl? ( >=dev-libs/openssl-1.0.1:0= )
151 + tidy? ( app-text/htmltidy )
152 + tokyocabinet? ( dev-db/tokyocabinet )
153 + truetype? ( =media-libs/freetype-2* )
154 + unicode? ( dev-libs/oniguruma:= )
155 + webp? ( media-libs/libwebp:0= )
156 + xml? ( >=dev-libs/libxml2-2.7.6 )
157 + xpm? ( x11-libs/libXpm )
158 + xslt? ( dev-libs/libxslt )
159 + zip? ( >=dev-libs/libzip-1.2.0:= )
160 + zlib? ( >=sys-libs/zlib-1.2.0.4:0= )
161 +"
162 +
163 +RDEPEND="${COMMON_DEPEND}
164 + virtual/mta
165 + fpm? (
166 + selinux? ( sec-policy/selinux-phpfpm )
167 + systemd? ( sys-apps/systemd ) )"
168 +
169 +# Bison isn't actually needed when building from a release tarball
170 +# However, the configure script will warn if it's absent or if you
171 +# have an incompatible version installed. See bug 593278.
172 +DEPEND="${COMMON_DEPEND}
173 + app-arch/xz-utils
174 + >=sys-devel/bison-3.0.1"
175 +
176 +BDEPEND="virtual/pkgconfig"
177 +
178 +PHP_MV="$(ver_cut 1)"
179 +
180 +PATCHES=(
181 + "${FILESDIR}"/php-iodbc-header-location.patch
182 + "${FILESDIR}"/bug81656-gcc-11.patch
183 +)
184 +
185 +php_install_ini() {
186 + local phpsapi="${1}"
187 +
188 + # work out where we are installing the ini file
189 + php_set_ini_dir "${phpsapi}"
190 +
191 + # Always install the production INI file, bug 611214.
192 + local phpinisrc="php.ini-production-${phpsapi}"
193 + cp php.ini-production "${phpinisrc}" || die
194 +
195 + # default to /tmp for save_path, bug #282768
196 + sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}" || die
197 +
198 + # Set the extension dir
199 + sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" \
200 + -i "${phpinisrc}" || die
201 +
202 + # Set the include path to point to where we want to find PEAR packages
203 + sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}" || die
204 +
205 + insinto "${PHP_INI_DIR#${EPREFIX}}"
206 + newins "${phpinisrc}" php.ini
207 +
208 + elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
209 + elog
210 +
211 + dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
212 + dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
213 +
214 + if use opcache; then
215 + elog "Adding opcache to $PHP_EXT_INI_DIR"
216 + echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> \
217 + "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
218 + dosym "../ext/opcache.ini" \
219 + "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
220 + fi
221 +
222 + # SAPI-specific handling
223 + if [[ "${sapi}" == "fpm" ]] ; then
224 + einfo "Installing FPM config files php-fpm.conf and www.conf"
225 + insinto "${PHP_INI_DIR#${EPREFIX}}"
226 + doins sapi/fpm/php-fpm.conf
227 + insinto "${PHP_INI_DIR#${EPREFIX}}/fpm.d"
228 + doins sapi/fpm/www.conf
229 + fi
230 +
231 + dodoc php.ini-{development,production}
232 +}
233 +
234 +php_set_ini_dir() {
235 + PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
236 + PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
237 + PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
238 +}
239 +
240 +src_prepare() {
241 + default
242 +
243 + # In php-7.x, the FPM pool configuration files have been split off
244 + # of the main config. By default the pool config files go in
245 + # e.g. /etc/php-fpm.d, which isn't slotted. So here we move the
246 + # include directory to a subdirectory "fpm.d" of $PHP_INI_DIR. Later
247 + # we'll install the pool configuration file "www.conf" there.
248 + php_set_ini_dir fpm
249 + sed -i "s~^include=.*$~include=${PHP_INI_DIR}/fpm.d/*.conf~" \
250 + sapi/fpm/php-fpm.conf.in \
251 + || die 'failed to move the include directory in php-fpm.conf'
252 +
253 + # Emulate buildconf to support cross-compilation
254 + rm -fr aclocal.m4 autom4te.cache config.cache \
255 + configure main/php_config.h.in || die
256 + eautoconf --force
257 + eautoheader
258 +}
259 +
260 +src_configure() {
261 + filter-lto # bug 855644
262 +
263 + addpredict /usr/share/snmp/mibs/.index #nowarn
264 + addpredict /var/lib/net-snmp/mib_indexes #nowarn
265 +
266 + PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
267 +
268 + # The php-fpm config file wants localstatedir to be ${EPREFIX}/var
269 + # and not the Gentoo default ${EPREFIX}/var/lib. See bug 572002.
270 + local our_conf=(
271 + --prefix="${PHP_DESTDIR}"
272 + --mandir="${PHP_DESTDIR}/man"
273 + --infodir="${PHP_DESTDIR}/info"
274 + --libdir="${PHP_DESTDIR}/lib"
275 + --with-libdir="$(get_libdir)"
276 + --localstatedir="${EPREFIX}/var"
277 + --without-pear
278 + --without-valgrind
279 + $(use_enable threads maintainer-zts)
280 + )
281 +
282 + our_conf+=(
283 + $(use_with argon2 password-argon2 "${EPREFIX}/usr")
284 + $(use_enable bcmath)
285 + $(use_with bzip2 bz2 "${EPREFIX}/usr")
286 + $(use_enable calendar)
287 + $(use_enable coverage gcov)
288 + $(use_enable ctype)
289 + $(use_with curl)
290 + $(use_enable xml dom)
291 + $(use_with enchant)
292 + $(use_enable exif)
293 + $(use_with ffi)
294 + $(use_enable fileinfo)
295 + $(use_enable filter)
296 + $(use_enable ftp)
297 + $(use_with nls gettext "${EPREFIX}/usr")
298 + $(use_with gmp gmp "${EPREFIX}/usr")
299 + $(use_with mhash mhash "${EPREFIX}/usr")
300 + $(use_with iconv iconv \
301 + $(use elibc_glibc || use elibc_musl || echo "${EPREFIX}/usr"))
302 + $(use_enable intl)
303 + $(use_enable ipv6)
304 + $(use_enable json)
305 + $(use_with kerberos)
306 + $(use_with xml libxml)
307 + $(use_enable unicode mbstring)
308 + $(use_with ssl openssl)
309 + $(use_enable pcntl)
310 + $(use_enable phar)
311 + $(use_enable pdo)
312 + $(use_enable opcache)
313 + $(use_with postgres pgsql "${EPREFIX}/usr")
314 + $(use_enable posix)
315 + $(use_with spell pspell "${EPREFIX}/usr")
316 + $(use_enable simplexml)
317 + $(use_enable sharedmem shmop)
318 + $(use_with snmp snmp "${EPREFIX}/usr")
319 + $(use_enable soap)
320 + $(use_enable sockets)
321 + $(use_with sodium)
322 + $(use_with sqlite sqlite3)
323 + $(use_enable sysvipc sysvmsg)
324 + $(use_enable sysvipc sysvsem)
325 + $(use_enable sysvipc sysvshm)
326 + $(use_with tidy tidy "${EPREFIX}/usr")
327 + $(use_enable tokenizer)
328 + $(use_enable xml)
329 + $(use_enable xmlreader)
330 + $(use_enable xmlwriter)
331 + $(use_with xmlrpc)
332 + $(use_with xslt xsl)
333 + $(use_with zip)
334 + $(use_with zlib zlib "${EPREFIX}/usr")
335 + $(use_enable debug)
336 + )
337 +
338 + # DBA support
339 + if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
340 + || use qdbm || use lmdb || use tokyocabinet ; then
341 + our_conf+=( "--enable-dba" )
342 + fi
343 +
344 + # DBA drivers support
345 + our_conf+=(
346 + $(use_with cdb)
347 + $(use_with berkdb db4 "${EPREFIX}/usr")
348 + $(use_enable flatfile)
349 + $(use_with gdbm gdbm "${EPREFIX}/usr")
350 + $(use_enable inifile)
351 + $(use_with qdbm qdbm "${EPREFIX}/usr")
352 + $(use_with tokyocabinet tcadb "${EPREFIX}/usr")
353 + $(use_with lmdb lmdb "${EPREFIX}/usr")
354 + )
355 +
356 + # Support for the GD graphics library
357 + our_conf+=(
358 + $(use_with truetype freetype)
359 + $(use_enable cjk gd-jis-conv)
360 + $(use_with gd jpeg)
361 + $(use_with xpm)
362 + $(use_with webp)
363 + )
364 + # enable gd last, so configure can pick up the previous settings
365 + our_conf+=( $(use_enable gd) )
366 +
367 + # IMAP support
368 + if use imap ; then
369 + our_conf+=(
370 + $(use_with imap imap "${EPREFIX}/usr")
371 + $(use_with ssl imap-ssl "${EPREFIX}/usr")
372 + )
373 + fi
374 +
375 + # LDAP support
376 + if use ldap ; then
377 + our_conf+=(
378 + $(use_with ldap ldap "${EPREFIX}/usr")
379 + $(use_with ldap-sasl)
380 + )
381 + fi
382 +
383 + # MySQL support
384 + local mysqllib="mysqlnd"
385 + local mysqlilib="mysqlnd"
386 +
387 + our_conf+=( $(use_with mysqli mysqli "${mysqlilib}") )
388 +
389 + local mysqlsock="${EPREFIX}/var/run/mysqld/mysqld.sock"
390 + if use mysql || use mysqli ; then
391 + our_conf+=( $(use_with mysql mysql-sock "${mysqlsock}") )
392 + fi
393 +
394 + # ODBC support
395 + if use odbc && use iodbc ; then
396 + our_conf+=(
397 + --without-unixODBC
398 + --with-iodbc
399 + $(use_with pdo pdo-odbc "iODBC,${EPREFIX}/usr")
400 + )
401 + elif use odbc ; then
402 + our_conf+=(
403 + --with-unixODBC="${EPREFIX}/usr"
404 + --without-iodbc
405 + $(use_with pdo pdo-odbc "unixODBC,${EPREFIX}/usr")
406 + )
407 + else
408 + our_conf+=(
409 + --without-unixODBC
410 + --without-iodbc
411 + --without-pdo-odbc
412 + )
413 + fi
414 +
415 + # Oracle support
416 + our_conf+=( $(use_with oci8-instant-client oci8) )
417 +
418 + # PDO support
419 + if use pdo ; then
420 + our_conf+=(
421 + $(use_with mssql pdo-dblib "${EPREFIX}/usr")
422 + $(use_with mysql pdo-mysql "${mysqllib}")
423 + $(use_with postgres pdo-pgsql)
424 + $(use_with sqlite pdo-sqlite)
425 + $(use_with firebird pdo-firebird "${EPREFIX}/usr")
426 + $(use_with oci8-instant-client pdo-oci)
427 + )
428 + fi
429 +
430 + # readline/libedit support
431 + our_conf+=(
432 + $(use_with readline readline "${EPREFIX}/usr")
433 + $(use_with libedit)
434 + )
435 +
436 + # Session support
437 + if use session ; then
438 + our_conf+=( $(use_with session-mm mm "${EPREFIX}/usr") )
439 + else
440 + our_conf+=( $(use_enable session) )
441 + fi
442 +
443 + # Use pic for shared modules such as apache2's mod_php
444 + our_conf+=( --with-pic )
445 +
446 + # we use the system copy of pcre
447 + # --with-external-pcre affects ext/pcre
448 + 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${PHP_MV}$(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${PHP_MV}$(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 +}