Gentoo Archives: gentoo-commits

From: Brian Evans <grknight@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/php/
Date: Thu, 19 Sep 2019 17:29:39
Message-Id: 1568914165.2dc5ae9c4d9efcc91facc6203a4f49065e270189.grknight@gentoo
1 commit: 2dc5ae9c4d9efcc91facc6203a4f49065e270189
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Thu Sep 19 17:29:25 2019 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Thu Sep 19 17:29:25 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2dc5ae9c
7
8 dev-lang/php: Version bump for 7.4.0_rc2
9
10 Package-Manager: Portage-2.3.76, Repoman-2.3.17
11 Signed-off-by: Brian Evans <grknight <AT> gentoo.org>
12
13 dev-lang/php/Manifest | 1 +
14 dev-lang/php/php-7.4.0_rc2.ebuild | 725 ++++++++++++++++++++++++++++++++++++++
15 2 files changed, 726 insertions(+)
16
17 diff --git a/dev-lang/php/Manifest b/dev-lang/php/Manifest
18 index 4183ac5c84c..fe9a1f1bb8b 100644
19 --- a/dev-lang/php/Manifest
20 +++ b/dev-lang/php/Manifest
21 @@ -6,4 +6,5 @@ DIST php-7.2.22.tar.xz 12271632 BLAKE2B be3089066ba1c25c479eedaf3e6dd8f7773a6d87
22 DIST php-7.3.8.tar.xz 12064620 BLAKE2B cfe2fde5e48080e13bd21cb2e2ca0c0ae38da03c94d0692e11bfe6722e50bd0b864d629a0ef6aed4ac5d9830ec4b4b214b9abdf917519a0c0cb70a4362fc8390 SHA512 9e9e13845350f3d4a8a80c3e2fe8291996e2749b2c862261b96346c01e5e24640cb81adad5e3b7668b56b2266c1fcbb713e8c38da4f9aa474f5f632f91378a8d
23 DIST php-7.3.9.tar.xz 12064244 BLAKE2B 2837463a74a0ccffc1a2193f9fbce78c98c15dd60214cb5d5d704aed7d74449696c3a516e86f440aed9ff3dc2ed8e7bbebcaf0a1268afa55aca2b642e958abf1 SHA512 017d2ae3cd499a7f6ee30111baf0a119e2f404919575acc5ae91fa6e53a303c9d1b5d165205eec3943c3547ff8759e21fbccc62845e3269176f6fc0f2ba88490
24 DIST php-7.4.0RC1.tar.xz 10212396 BLAKE2B 5ec878ee88c1828f36e4f23d289813da14417a4f0f79ec743e7cb3171acaa37d0e6c5c217f2f1efceee87af23e134d2582e1a254e64d971e25e1d6f47273a348 SHA512 17e4641496a7503a4d7a1f658a2a0a4c2db8b3d459f32459c97a40370e71b687b8bd44cc397408788ef697e879d20e1de0c4a655c1da7bc1e82598267460f57a
25 +DIST php-7.4.0RC2.tar.xz 10217992 BLAKE2B d36329098f4e5e6a2bea732f14834c489149243f5adf04e0560151cea611be87399bde5a07111ed930de54e9a0ee75ce1c0f35e7e1de412f59a4272edd1952d5 SHA512 ea1c88ee33336bf51ae44aa20bc23aa96db64a53d054003b1041a683388d94f4fbfe0da4b826b3a44295ee667c456eb709511fa1620e689c61a3c70a3524c34d
26 DIST php-patches-7.1.31bp.tar.bz2 37219 BLAKE2B 4f3ead2f69adf00ac1317371172c8adbb823f597cd8e3cafe7044d6a46671437fd2e5eaef4309a6fd5825123394044543284d3cbe892c918353a5b07c12b7401 SHA512 eb52679d035ceb4124c8e9175024f4f753e20d139479af4a57e01de941991716b2ce37f6190242c1bec46fd5305bad1f91613b04ee849a0d94f4a33ce013781e
27
28 diff --git a/dev-lang/php/php-7.4.0_rc2.ebuild b/dev-lang/php/php-7.4.0_rc2.ebuild
29 new file mode 100644
30 index 00000000000..fafdcb64e83
31 --- /dev/null
32 +++ b/dev-lang/php/php-7.4.0_rc2.ebuild
33 @@ -0,0 +1,725 @@
34 +# Copyright 1999-2019 Gentoo Authors
35 +# Distributed under the terms of the GNU General Public License v2
36 +
37 +EAPI="7"
38 +
39 +WANT_AUTOMAKE="none"
40 +
41 +inherit flag-o-matic systemd autotools
42 +
43 +MY_PV=${PV/_rc/RC}
44 +DESCRIPTION="The PHP language runtime engine"
45 +HOMEPAGE="https://php.net/"
46 +SRC_URI="https://downloads.php.net/~derick/${PN}-${MY_PV}.tar.xz"
47 +
48 +LICENSE="PHP-3.01
49 + BSD
50 + Zend-2.0
51 + bcmath? ( LGPL-2.1+ )
52 + fpm? ( BSD-2 )
53 + gd? ( gd )
54 + unicode? ( BSD-2 LGPL-2.1 )"
55 +
56 +SLOT="$(ver_cut 1-2)"
57 +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"
58 +
59 +S="${WORKDIR}/${PN}-${MY_PV}"
60 +
61 +# We can build the following SAPIs in the given order
62 +SAPIS="embed cli cgi fpm apache2 phpdbg"
63 +
64 +# SAPIs and SAPI-specific USE flags (cli SAPI is default on):
65 +IUSE="${IUSE}
66 + ${SAPIS/cli/+cli}
67 + threads"
68 +
69 +IUSE="${IUSE} acl argon2 bcmath berkdb bzip2 calendar cdb cjk
70 + coverage +ctype curl debug
71 + enchant exif ffi +fileinfo +filter firebird
72 + +flatfile ftp gd gdbm gmp +iconv imap inifile
73 + intl iodbc ipv6 +json kerberos ldap ldap-sasl libedit libressl lmdb
74 + mhash mssql mysql mysqli nls
75 + oci8-instant-client odbc +opcache pcntl pdo +phar +posix postgres qdbm
76 + readline selinux +session session-mm sharedmem
77 + +simplexml snmp soap sockets sodium spell sqlite ssl
78 + sysvipc systemd test tidy +tokenizer tokyocabinet truetype unicode webp
79 + +xml xmlreader xmlwriter xmlrpc xpm xslt zip zlib"
80 +
81 +# The supported (that is, autodetected) versions of BDB are listed in
82 +# the ./configure script. Other versions *work*, but we need to stick to
83 +# the ones that can be detected to avoid a repeat of bug #564824.
84 +COMMON_DEPEND="
85 + >=app-eselect/eselect-php-0.9.1[apache2?,fpm?]
86 + >=dev-libs/libpcre2-10.30[unicode]
87 + fpm? ( acl? ( sys-apps/acl ) )
88 + apache2? ( || ( >=www-servers/apache-2.4[apache2_modules_unixd,threads=]
89 + <www-servers/apache-2.4[threads=] ) )
90 + argon2? ( app-crypt/argon2:= )
91 + berkdb? ( || ( sys-libs/db:5.3
92 + sys-libs/db:5.1
93 + sys-libs/db:4.8
94 + sys-libs/db:4.7
95 + sys-libs/db:4.6
96 + sys-libs/db:4.5 ) )
97 + bzip2? ( app-arch/bzip2:0= )
98 + cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
99 + coverage? ( dev-util/lcov )
100 + curl? ( >=net-misc/curl-7.10.5 )
101 + enchant? ( <app-text/enchant-2.0:0 )
102 + ffi? ( >=virtual/libffi-3.0.11 )
103 + firebird? ( dev-db/firebird )
104 + gd? ( virtual/jpeg:0 media-libs/libpng:0= )
105 + gdbm? ( >=sys-libs/gdbm-1.8.0:0= )
106 + gmp? ( dev-libs/gmp:0= )
107 + iconv? ( virtual/libiconv )
108 + imap? ( virtual/imap-c-client[kerberos=,ssl=] )
109 + intl? ( dev-libs/icu:= )
110 + kerberos? ( virtual/krb5 )
111 + ldap? ( >=net-nds/openldap-1.2.11 )
112 + ldap-sasl? ( dev-libs/cyrus-sasl )
113 + libedit? ( || ( sys-freebsd/freebsd-lib dev-libs/libedit ) )
114 + lmdb? ( dev-db/lmdb:= )
115 + mssql? ( dev-db/freetds[mssql] )
116 + nls? ( sys-devel/gettext )
117 + oci8-instant-client? ( dev-db/oracle-instantclient-basic )
118 + odbc? ( iodbc? ( dev-db/libiodbc ) !iodbc? ( >=dev-db/unixODBC-1.8.13 ) )
119 + postgres? ( dev-db/postgresql:* )
120 + qdbm? ( dev-db/qdbm )
121 + readline? ( sys-libs/readline:0= )
122 + session-mm? ( dev-libs/mm )
123 + snmp? ( >=net-analyzer/net-snmp-5.2 )
124 + sodium? ( dev-libs/libsodium:= )
125 + spell? ( >=app-text/aspell-0.50 )
126 + sqlite? ( >=dev-db/sqlite-3.7.6.3 )
127 + ssl? (
128 + !libressl? ( >=dev-libs/openssl-1.0.1:0= )
129 + libressl? ( dev-libs/libressl:0= )
130 + )
131 + tidy? ( || ( app-text/tidy-html5 app-text/htmltidy ) )
132 + tokyocabinet? ( dev-db/tokyocabinet )
133 + truetype? ( =media-libs/freetype-2* )
134 + unicode? ( dev-libs/oniguruma:= )
135 + webp? ( media-libs/libwebp:0= )
136 + xml? ( >=dev-libs/libxml2-2.7.6 )
137 + xpm? ( x11-libs/libXpm )
138 + xslt? ( dev-libs/libxslt )
139 + zip? ( >=dev-libs/libzip-1.2.0:= )
140 + zlib? ( >=sys-libs/zlib-1.2.0.4:0= )
141 +"
142 +
143 +RDEPEND="${COMMON_DEPEND}
144 + virtual/mta
145 + fpm? (
146 + selinux? ( sec-policy/selinux-phpfpm )
147 + systemd? ( sys-apps/systemd ) )"
148 +
149 +# Bison isn't actually needed when building from a release tarball
150 +# However, the configure script will warn if it's absent or if you
151 +# have an incompatible version installed. See bug 593278.
152 +DEPEND="${COMMON_DEPEND}
153 + app-arch/xz-utils
154 + >=sys-devel/bison-3.0.1"
155 +
156 +BDEPEND="virtual/pkgconfig"
157 +
158 +# Without USE=readline or libedit, the interactive "php -a" CLI will hang.
159 +REQUIRED_USE="
160 + || ( cli cgi fpm apache2 embed phpdbg )
161 + cli? ( ^^ ( readline libedit ) )
162 + !cli? ( ?? ( readline libedit ) )
163 + truetype? ( gd zlib )
164 + webp? ( gd zlib )
165 + cjk? ( gd zlib )
166 + exif? ( gd zlib )
167 + xpm? ( gd zlib )
168 + gd? ( zlib )
169 + simplexml? ( xml )
170 + soap? ( xml )
171 + xmlrpc? ( xml iconv )
172 + xmlreader? ( xml )
173 + xmlwriter? ( xml )
174 + xslt? ( xml )
175 + ldap-sasl? ( ldap )
176 + qdbm? ( !gdbm )
177 + session-mm? ( session !threads )
178 + mysql? ( || ( mysqli pdo ) )
179 + firebird? ( pdo )
180 + mssql? ( pdo )
181 +"
182 +
183 +PHP_MV="$(ver_cut 1)"
184 +
185 +php_install_ini() {
186 + local phpsapi="${1}"
187 +
188 + # work out where we are installing the ini file
189 + php_set_ini_dir "${phpsapi}"
190 +
191 + # Always install the production INI file, bug 611214.
192 + local phpinisrc="php.ini-production-${phpsapi}"
193 + cp php.ini-production "${phpinisrc}" || die
194 +
195 + # default to /tmp for save_path, bug #282768
196 + sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}" || die
197 +
198 + # Set the extension dir
199 + sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" \
200 + -i "${phpinisrc}" || die
201 +
202 + # Set the include path to point to where we want to find PEAR packages
203 + sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}" || die
204 +
205 + dodir "${PHP_INI_DIR#${EPREFIX}}"
206 + insinto "${PHP_INI_DIR#${EPREFIX}}"
207 + newins "${phpinisrc}" php.ini
208 +
209 + elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
210 + elog
211 +
212 + dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
213 + dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
214 +
215 + if use opcache; then
216 + elog "Adding opcache to $PHP_EXT_INI_DIR"
217 + echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> \
218 + "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
219 + dosym "${PHP_EXT_INI_DIR#${EPREFIX}}/opcache.ini" \
220 + "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
221 + fi
222 +
223 + # SAPI-specific handling
224 + if [[ "${sapi}" == "fpm" ]] ; then
225 + einfo "Installing FPM config files php-fpm.conf and www.conf"
226 + insinto "${PHP_INI_DIR#${EPREFIX}}"
227 + doins sapi/fpm/php-fpm.conf
228 + insinto "${PHP_INI_DIR#${EPREFIX}}/fpm.d"
229 + doins sapi/fpm/www.conf
230 + fi
231 +
232 + dodoc php.ini-{development,production}
233 +}
234 +
235 +php_set_ini_dir() {
236 + PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
237 + PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
238 + PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
239 +}
240 +
241 +src_prepare() {
242 + default
243 +
244 + # In php-7.x, the FPM pool configuration files have been split off
245 + # of the main config. By default the pool config files go in
246 + # e.g. /etc/php-fpm.d, which isn't slotted. So here we move the
247 + # include directory to a subdirectory "fpm.d" of $PHP_INI_DIR. Later
248 + # we'll install the pool configuration file "www.conf" there.
249 + php_set_ini_dir fpm
250 + sed -i "s~^include=.*$~include=${PHP_INI_DIR}/fpm.d/*.conf~" \
251 + sapi/fpm/php-fpm.conf.in \
252 + || die 'failed to move the include directory in php-fpm.conf'
253 +
254 + # Emulate buildconf to support cross-compilation
255 + rm -fr aclocal.m4 autom4te.cache config.cache \
256 + configure main/php_config.h.in || die
257 + eautoconf --force
258 + eautoheader
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 +}