Gentoo Archives: gentoo-commits

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