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