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