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: Sun, 08 Sep 2019 13:54:44
Message-Id: 1567950871.29c28d0002353099baa75f69cf73bb6dff0bdcfb.whissi@gentoo
1 commit: 29c28d0002353099baa75f69cf73bb6dff0bdcfb
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Sun Sep 8 13:42:36 2019 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Sun Sep 8 13:54:31 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=29c28d00
7
8 dev-lang/php: bump to v7.4.0 RC1
9
10 Package-Manager: Portage-2.3.75, Repoman-2.3.17
11 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
12
13 dev-lang/php/Manifest | 1 +
14 dev-lang/php/php-7.4.0_rc1.ebuild | 723 ++++++++++++++++++++++++++++++++++++++
15 2 files changed, 724 insertions(+)
16
17 diff --git a/dev-lang/php/Manifest b/dev-lang/php/Manifest
18 index f5caf1eb9cf..6a9d1f49470 100644
19 --- a/dev-lang/php/Manifest
20 +++ b/dev-lang/php/Manifest
21 @@ -4,6 +4,7 @@ DIST php-7.2.21.tar.xz 12298448 BLAKE2B f82b35fd3cdf45d8c84639d044729602340c2d34
22 DIST php-7.2.22.tar.xz 12271632 BLAKE2B be3089066ba1c25c479eedaf3e6dd8f7773a6d87a16ce49d8c5379bc9b25d073b497004ccb219795bcfdc3af1310570f94f109754120c254ea5bbaaf1a5e953f SHA512 526dbcc03726d6e2f146adbdf8d89f0c8acb2575a3c21e5ef14ae256f29447d82154e0b1869c0143d831f81c2da0d943957c51144fb458457d3681cdfbc6d49b
23 DIST php-7.3.8.tar.xz 12064620 BLAKE2B cfe2fde5e48080e13bd21cb2e2ca0c0ae38da03c94d0692e11bfe6722e50bd0b864d629a0ef6aed4ac5d9830ec4b4b214b9abdf917519a0c0cb70a4362fc8390 SHA512 9e9e13845350f3d4a8a80c3e2fe8291996e2749b2c862261b96346c01e5e24640cb81adad5e3b7668b56b2266c1fcbb713e8c38da4f9aa474f5f632f91378a8d
24 DIST php-7.3.9.tar.xz 12064244 BLAKE2B 2837463a74a0ccffc1a2193f9fbce78c98c15dd60214cb5d5d704aed7d74449696c3a516e86f440aed9ff3dc2ed8e7bbebcaf0a1268afa55aca2b642e958abf1 SHA512 017d2ae3cd499a7f6ee30111baf0a119e2f404919575acc5ae91fa6e53a303c9d1b5d165205eec3943c3547ff8759e21fbccc62845e3269176f6fc0f2ba88490
25 +DIST php-7.4.0RC1.tar.xz 10212396 BLAKE2B 5ec878ee88c1828f36e4f23d289813da14417a4f0f79ec743e7cb3171acaa37d0e6c5c217f2f1efceee87af23e134d2582e1a254e64d971e25e1d6f47273a348 SHA512 17e4641496a7503a4d7a1f658a2a0a4c2db8b3d459f32459c97a40370e71b687b8bd44cc397408788ef697e879d20e1de0c4a655c1da7bc1e82598267460f57a
26 DIST php-7.4.0beta1.tar.xz 10200060 BLAKE2B f49c49fcebe0309bbe266dec5c468037499fc96908a4130454403e57caa3ef7da3c46dbc83829bb290c46edfc14921f71fafddb8b0777c23adec35fbb57ad68c SHA512 3e4307201c91cec238c9bc6c27a629a93de8baba0307f2e61cb4bb242720178382dd50b38e7a18fbd65baf25068b358faf571dcb895e7cd6fb292038dee3ed6b
27 DIST php-7.4.0beta4.tar.xz 10207868 BLAKE2B b7fe60ec6b98c00e58b88e59aeddee7750df4480e505eab78f6ad4268bbcdba53fea36a4a0fb4e2b4e140247adc68946dcdcbc13ae339fe85570b91145025201 SHA512 c87c519453a8ba7f06b921b214b3315938b77c7d6f4f88f173f9c1e48a578937e4aa9bdb4d5a23c922b5cedaafc4d6bc29067dc55103fdecaa3a8ab4b381f203
28 DIST php-patches-7.1.31bp.tar.bz2 37219 BLAKE2B 4f3ead2f69adf00ac1317371172c8adbb823f597cd8e3cafe7044d6a46671437fd2e5eaef4309a6fd5825123394044543284d3cbe892c918353a5b07c12b7401 SHA512 eb52679d035ceb4124c8e9175024f4f753e20d139479af4a57e01de941991716b2ce37f6190242c1bec46fd5305bad1f91613b04ee849a0d94f4a33ce013781e
29
30 diff --git a/dev-lang/php/php-7.4.0_rc1.ebuild b/dev-lang/php/php-7.4.0_rc1.ebuild
31 new file mode 100644
32 index 00000000000..4c04d93e4d4
33 --- /dev/null
34 +++ b/dev-lang/php/php-7.4.0_rc1.ebuild
35 @@ -0,0 +1,723 @@
36 +# Copyright 1999-2019 Gentoo Authors
37 +# Distributed under the terms of the GNU General Public License v2
38 +
39 +EAPI="7"
40 +
41 +WANT_AUTOMAKE="none"
42 +
43 +inherit flag-o-matic systemd autotools
44 +
45 +MY_PV=${PV/_rc/RC}
46 +DESCRIPTION="The PHP language runtime engine"
47 +HOMEPAGE="https://php.net/"
48 +SRC_URI="https://downloads.php.net/~derick/${PN}-${MY_PV}.tar.xz"
49 +
50 +LICENSE="PHP-3.01
51 + BSD
52 + Zend-2.0
53 + bcmath? ( LGPL-2.1+ )
54 + fpm? ( BSD-2 )
55 + gd? ( gd )
56 + unicode? ( BSD-2 LGPL-2.1 )"
57 +
58 +SLOT="$(ver_cut 1-2)"
59 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
60 +
61 +S="${WORKDIR}/${PN}-${MY_PV}"
62 +
63 +# We can build the following SAPIs in the given order
64 +SAPIS="embed cli cgi fpm apache2 phpdbg"
65 +
66 +# SAPIs and SAPI-specific USE flags (cli SAPI is default on):
67 +IUSE="${IUSE}
68 + ${SAPIS/cli/+cli}
69 + threads"
70 +
71 +IUSE="${IUSE} acl argon2 bcmath berkdb bzip2 calendar cdb cjk
72 + coverage +ctype curl debug
73 + enchant exif ffi +fileinfo +filter firebird
74 + +flatfile ftp gd gdbm gmp +iconv imap inifile
75 + intl iodbc ipv6 +json kerberos ldap ldap-sasl libedit libressl lmdb
76 + mhash mssql mysql mysqli nls
77 + oci8-instant-client odbc +opcache pcntl pdo +phar +posix postgres qdbm
78 + readline selinux +session session-mm sharedmem
79 + +simplexml snmp soap sockets sodium spell sqlite ssl
80 + sysvipc systemd test tidy +tokenizer tokyocabinet truetype unicode webp
81 + +xml xmlreader xmlwriter xmlrpc xpm xslt zip zlib"
82 +
83 +# The supported (that is, autodetected) versions of BDB are listed in
84 +# the ./configure script. Other versions *work*, but we need to stick to
85 +# the ones that can be detected to avoid a repeat of bug #564824.
86 +COMMON_DEPEND="
87 + >=app-eselect/eselect-php-0.9.1[apache2?,fpm?]
88 + >=dev-libs/libpcre2-10.30[unicode]
89 + fpm? ( acl? ( sys-apps/acl ) )
90 + apache2? ( || ( >=www-servers/apache-2.4[apache2_modules_unixd,threads=]
91 + <www-servers/apache-2.4[threads=] ) )
92 + argon2? ( app-crypt/argon2:= )
93 + berkdb? ( || ( sys-libs/db:5.3
94 + sys-libs/db:5.1
95 + sys-libs/db:4.8
96 + sys-libs/db:4.7
97 + sys-libs/db:4.6
98 + sys-libs/db:4.5 ) )
99 + bzip2? ( app-arch/bzip2:0= )
100 + cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
101 + coverage? ( dev-util/lcov )
102 + curl? ( >=net-misc/curl-7.10.5 )
103 + enchant? ( <app-text/enchant-2.0:0 )
104 + ffi? ( >=virtual/libffi-3.0.11 )
105 + firebird? ( dev-db/firebird )
106 + gd? ( virtual/jpeg:0 media-libs/libpng:0= )
107 + gdbm? ( >=sys-libs/gdbm-1.8.0:0= )
108 + gmp? ( dev-libs/gmp:0= )
109 + iconv? ( virtual/libiconv )
110 + imap? ( virtual/imap-c-client[kerberos=,ssl=] )
111 + intl? ( dev-libs/icu:= )
112 + kerberos? ( virtual/krb5 )
113 + ldap? ( >=net-nds/openldap-1.2.11 )
114 + ldap-sasl? ( dev-libs/cyrus-sasl )
115 + libedit? ( || ( sys-freebsd/freebsd-lib dev-libs/libedit ) )
116 + lmdb? ( dev-db/lmdb:= )
117 + mssql? ( dev-db/freetds[mssql] )
118 + nls? ( sys-devel/gettext )
119 + oci8-instant-client? ( dev-db/oracle-instantclient-basic )
120 + odbc? ( iodbc? ( dev-db/libiodbc ) !iodbc? ( >=dev-db/unixODBC-1.8.13 ) )
121 + postgres? ( dev-db/postgresql:* )
122 + qdbm? ( dev-db/qdbm )
123 + readline? ( sys-libs/readline:0= )
124 + session-mm? ( dev-libs/mm )
125 + snmp? ( >=net-analyzer/net-snmp-5.2 )
126 + sodium? ( dev-libs/libsodium:= )
127 + spell? ( >=app-text/aspell-0.50 )
128 + sqlite? ( >=dev-db/sqlite-3.7.6.3 )
129 + ssl? (
130 + !libressl? ( >=dev-libs/openssl-1.0.1:0= )
131 + libressl? ( dev-libs/libressl:0= )
132 + )
133 + tidy? ( || ( app-text/tidy-html5 app-text/htmltidy ) )
134 + tokyocabinet? ( dev-db/tokyocabinet )
135 + truetype? ( =media-libs/freetype-2* )
136 + unicode? ( dev-libs/oniguruma:= )
137 + webp? ( media-libs/libwebp:0= )
138 + xml? ( >=dev-libs/libxml2-2.7.6 )
139 + xpm? ( x11-libs/libXpm )
140 + xslt? ( dev-libs/libxslt )
141 + zip? ( >=dev-libs/libzip-1.2.0:= )
142 + zlib? ( >=sys-libs/zlib-1.2.0.4: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 + !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 + xmlrpc? ( xml iconv )
174 + xmlreader? ( xml )
175 + xmlwriter? ( xml )
176 + xslt? ( xml )
177 + ldap-sasl? ( ldap )
178 + qdbm? ( !gdbm )
179 + session-mm? ( session !threads )
180 + mysql? ( || ( mysqli pdo ) )
181 + firebird? ( pdo )
182 + mssql? ( pdo )
183 +"
184 +
185 +PHP_MV="$(ver_cut 1)"
186 +
187 +php_install_ini() {
188 + local phpsapi="${1}"
189 +
190 + # work out where we are installing the ini file
191 + php_set_ini_dir "${phpsapi}"
192 +
193 + # Always install the production INI file, bug 611214.
194 + local phpinisrc="php.ini-production-${phpsapi}"
195 + cp php.ini-production "${phpinisrc}" || die
196 +
197 + # default to /tmp for save_path, bug #282768
198 + sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}" || die
199 +
200 + # Set the extension dir
201 + sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" \
202 + -i "${phpinisrc}" || die
203 +
204 + # Set the include path to point to where we want to find PEAR packages
205 + sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}" || die
206 +
207 + dodir "${PHP_INI_DIR#${EPREFIX}}"
208 + insinto "${PHP_INI_DIR#${EPREFIX}}"
209 + newins "${phpinisrc}" php.ini
210 +
211 + elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
212 + elog
213 +
214 + dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
215 + dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
216 +
217 + if use opcache; then
218 + elog "Adding opcache to $PHP_EXT_INI_DIR"
219 + echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> \
220 + "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
221 + dosym "${PHP_EXT_INI_DIR#${EPREFIX}}/opcache.ini" \
222 + "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
223 + fi
224 +
225 + # SAPI-specific handling
226 + if [[ "${sapi}" == "fpm" ]] ; then
227 + einfo "Installing FPM config files php-fpm.conf and www.conf"
228 + insinto "${PHP_INI_DIR#${EPREFIX}}"
229 + doins sapi/fpm/php-fpm.conf
230 + insinto "${PHP_INI_DIR#${EPREFIX}}/fpm.d"
231 + doins sapi/fpm/www.conf
232 + fi
233 +
234 + dodoc php.ini-{development,production}
235 +}
236 +
237 +php_set_ini_dir() {
238 + PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
239 + PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
240 + PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
241 +}
242 +
243 +src_prepare() {
244 + default
245 +
246 + # In php-7.x, the FPM pool configuration files have been split off
247 + # of the main config. By default the pool config files go in
248 + # e.g. /etc/php-fpm.d, which isn't slotted. So here we move the
249 + # include directory to a subdirectory "fpm.d" of $PHP_INI_DIR. Later
250 + # we'll install the pool configuration file "www.conf" there.
251 + php_set_ini_dir fpm
252 + sed -i "s~^include=.*$~include=${PHP_INI_DIR}/fpm.d/*.conf~" \
253 + sapi/fpm/php-fpm.conf.in \
254 + || die 'failed to move the include directory in php-fpm.conf'
255 +
256 + # Bug 669566 - necessary so that build tools are updated for commands like pecl
257 + cp "${BROOT}/usr/share/aclocal/libtool.m4" build/ || die
258 + eautoreconf
259 +}
260 +
261 +src_configure() {
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 || use elibc_FreeBSD || 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 + our_conf+=(
394 + $(use_with odbc unixODBC "${EPREFIX}/usr")
395 + $(use_with iodbc)
396 + )
397 +
398 + # Oracle support
399 + our_conf+=( $(use_with oci8-instant-client oci8) )
400 +
401 + # PDO support
402 + if use pdo ; then
403 + our_conf+=(
404 + $(use_with mssql pdo-dblib "${EPREFIX}/usr")
405 + $(use_with mysql pdo-mysql "${mysqllib}")
406 + $(use_with postgres pdo-pgsql)
407 + $(use_with sqlite pdo-sqlite)
408 + $(use_with firebird pdo-firebird "${EPREFIX}/usr")
409 + $(use_with odbc pdo-odbc "unixODBC,${EPREFIX}/usr")
410 + $(use_with oci8-instant-client pdo-oci)
411 + )
412 + fi
413 +
414 + # readline/libedit support
415 + our_conf+=(
416 + $(use_with readline readline "${EPREFIX}/usr")
417 + $(use_with libedit)
418 + )
419 +
420 + # Session support
421 + if use session ; then
422 + our_conf+=( $(use_with session-mm mm "${EPREFIX}/usr") )
423 + else
424 + our_conf+=( $(use_enable session) )
425 + fi
426 +
427 + # Use pic for shared modules such as apache2's mod_php
428 + our_conf+=( --with-pic )
429 +
430 + # we use the system copy of pcre
431 + # --with-external-pcre affects ext/pcre
432 + # Many arches don't support pcre-jit
433 + our_conf+=(
434 + --with-external-pcre
435 + --without-pcre-jit
436 + )
437 +
438 + # Catch CFLAGS problems
439 + # Fixes bug #14067.
440 + # Changed order to run it in reverse for bug #32022 and #12021.
441 + replace-cpu-flags "k6*" "i586"
442 +
443 + # Cache the ./configure test results between SAPIs.
444 + our_conf+=( --cache-file="${T}/config.cache" )
445 +
446 + # Support user-passed configuration parameters
447 + our_conf+=( ${EXTRA_ECONF:-} )
448 +
449 + # Support the Apache2 extras, they must be set globally for all
450 + # SAPIs to work correctly, especially for external PHP extensions
451 +
452 + mkdir -p "${WORKDIR}/sapis-build" || die
453 + for one_sapi in $SAPIS ; do
454 + use "${one_sapi}" || continue
455 + php_set_ini_dir "${one_sapi}"
456 +
457 + # The BUILD_DIR variable is used to determine where to output
458 + # the files that autotools creates. This was all originally
459 + # based on the autotools-utils eclass.
460 + BUILD_DIR="${WORKDIR}/sapis-build/${one_sapi}"
461 + cp -a "${S}" "${BUILD_DIR}" || die
462 + cd "${BUILD_DIR}" || die
463 +
464 + local sapi_conf=(
465 + --with-config-file-path="${PHP_INI_DIR}"
466 + --with-config-file-scan-dir="${PHP_EXT_INI_DIR_ACTIVE}"
467 + )
468 +
469 + for sapi in $SAPIS ; do
470 + case "$sapi" in
471 + cli|cgi|embed|fpm|phpdbg)
472 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
473 + sapi_conf+=( "--enable-${sapi}" )
474 + if [[ "fpm" == "${sapi}" ]] ; then
475 + sapi_conf+=(
476 + $(use_with acl fpm-acl)
477 + $(use_with systemd fpm-systemd)
478 + )
479 + fi
480 + else
481 + sapi_conf+=( "--disable-${sapi}" )
482 + fi
483 + ;;
484 +
485 + apache2)
486 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
487 + sapi_conf+=( --with-apxs2="${EPREFIX}/usr/bin/apxs" )
488 + else
489 + sapi_conf+=( --without-apxs2 )
490 + fi
491 + ;;
492 + esac
493 + done
494 +
495 + # Construct the $myeconfargs array by concatenating $our_conf
496 + # (the common args) and $sapi_conf (the SAPI-specific args).
497 + local myeconfargs=( "${our_conf[@]}" )
498 + myeconfargs+=( "${sapi_conf[@]}" )
499 +
500 + pushd "${BUILD_DIR}" > /dev/null || die
501 + econf "${myeconfargs[@]}"
502 + popd > /dev/null || die
503 + done
504 +}
505 +
506 +src_compile() {
507 + # snmp seems to run during src_compile, too (bug #324739)
508 + addpredict /usr/share/snmp/mibs/.index #nowarn
509 + addpredict /var/lib/net-snmp/mib_indexes #nowarn
510 +
511 + for sapi in ${SAPIS} ; do
512 + if use "${sapi}"; then
513 + cd "${WORKDIR}/sapis-build/$sapi" || \
514 + die "Failed to change dir to ${WORKDIR}/sapis-build/$1"
515 + emake
516 + fi
517 + done
518 +}
519 +
520 +src_install() {
521 + # see bug #324739 for what happens when we don't have that
522 + addpredict /usr/share/snmp/mibs/.index #nowarn
523 +
524 + # grab the first SAPI that got built and install common files from there
525 + local first_sapi=""
526 + for sapi in $SAPIS ; do
527 + if use $sapi ; then
528 + first_sapi=$sapi
529 + break
530 + fi
531 + done
532 +
533 + # Makefile forgets to create this before trying to write to it...
534 + dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
535 +
536 + # Install php environment (without any sapis)
537 + cd "${WORKDIR}/sapis-build/$first_sapi" || die
538 + emake INSTALL_ROOT="${D}" \
539 + install-build install-headers install-programs
540 +
541 + local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
542 +
543 + # Create the directory where we'll put version-specific php scripts
544 + keepdir "/usr/share/php${PHP_MV}"
545 +
546 + local sapi="", file=""
547 + local sapi_list=""
548 +
549 + for sapi in ${SAPIS}; do
550 + if use "${sapi}" ; then
551 + einfo "Installing SAPI: ${sapi}"
552 + cd "${WORKDIR}/sapis-build/${sapi}" || die
553 +
554 + if [[ "${sapi}" == "apache2" ]] ; then
555 + # We're specifically not using emake install-sapi as libtool
556 + # may cause unnecessary relink failures (see bug #351266)
557 + insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
558 + newins ".libs/libphp${PHP_MV}$(get_libname)" \
559 + "libphp${PHP_MV}$(get_libname)"
560 + keepdir "/usr/$(get_libdir)/apache2/modules"
561 + else
562 + # needed each time, php_install_ini would reset it
563 + local dest="${PHP_DESTDIR#${EPREFIX}}"
564 + into "${dest}"
565 + case "$sapi" in
566 + cli)
567 + source="sapi/cli/php"
568 + ;;
569 + cgi)
570 + source="sapi/cgi/php-cgi"
571 + ;;
572 + fpm)
573 + source="sapi/fpm/php-fpm"
574 + ;;
575 + embed)
576 + source="libs/libphp${PHP_MV}$(get_libname)"
577 + ;;
578 + phpdbg)
579 + source="sapi/phpdbg/phpdbg"
580 + ;;
581 + *)
582 + die "unhandled sapi in src_install"
583 + ;;
584 + esac
585 +
586 + if [[ "${source}" == *"$(get_libname)" ]]; then
587 + dolib.so "${source}"
588 + else
589 + dobin "${source}"
590 + local name="$(basename ${source})"
591 + dosym "${dest}/bin/${name}" "/usr/bin/${name}${SLOT}"
592 + fi
593 + fi
594 +
595 + php_install_ini "${sapi}"
596 +
597 + # construct correct SAPI string for php-config
598 + # thanks to ferringb for the bash voodoo
599 + if [[ "${sapi}" == "apache2" ]]; then
600 + sapi_list="${sapi_list:+${sapi_list} }apache2handler"
601 + else
602 + sapi_list="${sapi_list:+${sapi_list} }${sapi}"
603 + fi
604 + fi
605 + done
606 +
607 + # Installing opcache module
608 + if use opcache ; then
609 + into "${PHP_DESTDIR#${EPREFIX}}"
610 + dolib.so "modules/opcache$(get_libname)"
611 + fi
612 +
613 + # Install env.d files
614 + newenvd "${FILESDIR}/20php5-envd" "20php${SLOT}"
615 + sed -e "s|/lib/|/$(get_libdir)/|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
616 + sed -e "s|php5|php${SLOT}|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
617 +
618 + # set php-config variable correctly (bug #278439)
619 + sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
620 + "${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config" || die
621 +
622 + if use fpm ; then
623 + if use systemd; then
624 + systemd_newunit "${FILESDIR}/php-fpm_at.service" \
625 + "php-fpm@${SLOT}.service"
626 + else
627 + systemd_newunit "${FILESDIR}/php-fpm_at-simple.service" \
628 + "php-fpm@${SLOT}.service"
629 + fi
630 + fi
631 +}
632 +
633 +src_test() {
634 + echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
635 + PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php"
636 + if [[ ! -x "${PHP_BIN}" ]] ; then
637 + ewarn "Test phase requires USE=cli, skipping"
638 + return
639 + else
640 + export TEST_PHP_EXECUTABLE="${PHP_BIN}"
641 + fi
642 +
643 + if [[ -x "${WORKDIR}/sapis-build/cgi/sapi/cgi/php-cgi" ]] ; then
644 + export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis-build/cgi/sapi/cgi/php-cgi"
645 + fi
646 +
647 + if [[ -x "${WORKDIR}/sapis-build/phpdbg/sapi/phpdbg/phpdbg" ]] ; then
648 + export TEST_PHPDBG_EXECUTABLE="${WORKDIR}/sapis-build/phpdbg/sapi/phpdbg/phpdbg"
649 + fi
650 +
651 + REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d \
652 + "session.save_path=${T}" \
653 + "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d \
654 + "session.save_path=${T}"
655 +
656 + for name in ${EXPECTED_TEST_FAILURES}; do
657 + mv "${name}.out" "${name}.out.orig" 2>/dev/null || die
658 + done
659 +
660 + local failed="$(find -name '*.out')"
661 + if [[ ${failed} != "" ]] ; then
662 + ewarn "The following test cases failed unexpectedly:"
663 + for name in ${failed}; do
664 + ewarn " ${name/.out/}"
665 + done
666 + else
667 + einfo "No unexpected test failures, all fine"
668 + fi
669 +
670 + if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
671 + local passed=""
672 + for name in ${EXPECTED_TEST_FAILURES}; do
673 + [[ -f "${name}.diff" ]] && continue
674 + passed="${passed} ${name}"
675 + done
676 + if [[ ${passed} != "" ]] ; then
677 + einfo "The following test cases passed unexpectedly:"
678 + for name in ${passed}; do
679 + ewarn " ${passed}"
680 + done
681 + else
682 + einfo "None of the known-to-fail tests passed, all fine"
683 + fi
684 + fi
685 +}
686 +
687 +pkg_postinst() {
688 + # Output some general info to the user
689 + if use apache2 ; then
690 + elog
691 + elog "To enable PHP in apache, you will need to add \"-D PHP\" to"
692 + elog "your apache2 command. OpenRC users can append that string to"
693 + elog "APACHE2_OPTS in /etc/conf.d/apache2."
694 + elog
695 + elog "The apache module configuration file 70_mod_php.conf is"
696 + elog "provided (and maintained) by eselect-php."
697 + elog
698 + fi
699 +
700 + # Create the symlinks for php
701 + for m in ${SAPIS}; do
702 + [[ ${m} == 'embed' ]] && continue;
703 + if use $m ; then
704 + local ci=$(eselect php show $m)
705 + if [[ -z $ci ]]; then
706 + eselect php set $m php${SLOT} || die
707 + einfo "Switched ${m} to use php:${SLOT}"
708 + einfo
709 + elif [[ $ci != "php${SLOT}" ]] ; then
710 + elog "To switch $m to use php:${SLOT}, run"
711 + elog " eselect php set $m php${SLOT}"
712 + elog
713 + fi
714 + fi
715 + done
716 +
717 + # Remove dead symlinks for SAPIs that were just disabled. For
718 + # example, if the user has the cgi SAPI enabled, then he has an
719 + # eselect-php symlink for it. If he later reinstalls PHP with
720 + # USE="-cgi", that symlink will break. This call to eselect is
721 + # supposed to remove that dead link per bug 572436.
722 + eselect php cleanup || die
723 +
724 + if ! has "php${SLOT/./-}" ${PHP_TARGETS}; then
725 + elog "To build extensions for this version of PHP, you will need to"
726 + elog "add php${SLOT/./-} to your PHP_TARGETS USE_EXPAND variable."
727 + elog
728 + fi
729 +
730 + # Warn about the removal of PHP_INI_VERSION if the user has it set.
731 + if [[ -n "${PHP_INI_VERSION}" ]]; then
732 + ewarn 'The PHP_INI_VERSION variable has been phased out. You may'
733 + ewarn 'remove it from your configuration at your convenience. See'
734 + ewarn
735 + ewarn ' https://bugs.gentoo.org/611214'
736 + ewarn
737 + ewarn 'for more information.'
738 + fi
739 +
740 + elog "For details on how version slotting works, please see"
741 + elog "the wiki:"
742 + elog
743 + elog " https://wiki.gentoo.org/wiki/PHP"
744 + elog
745 +}
746 +
747 +pkg_postrm() {
748 + # This serves two purposes. First, if we have just removed the last
749 + # installed version of PHP, then this will remove any dead symlinks
750 + # belonging to eselect-php. Second, if a user upgrades slots from
751 + # (say) 5.6 to 7.0 and depcleans the old slot, then this will update
752 + # his existing symlinks to point to the new 7.0 installation. The
753 + # latter is bug 432962.
754 + #
755 + # Note: the eselect-php package may not be installed at this point,
756 + # so we can't die() if this command fails.
757 + eselect php cleanup
758 +}