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