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: Fri, 02 Mar 2018 02:10:43
Message-Id: 1519956621.b92d451af8317c4ec1999eb99f0732c1d33a77af.grknight@gentoo
1 commit: b92d451af8317c4ec1999eb99f0732c1d33a77af
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Fri Mar 2 02:02:05 2018 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Fri Mar 2 02:10:21 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b92d451a
7
8 dev-lang/php: Version bump for 7.2.3
9
10 Bug: https://bugs.gentoo.org/649274
11 Package-Manager: Portage-2.3.24, Repoman-2.3.6
12
13 dev-lang/php/Manifest | 1 +
14 dev-lang/php/php-7.2.3.ebuild | 737 ++++++++++++++++++++++++++++++++++++++++++
15 2 files changed, 738 insertions(+)
16
17 diff --git a/dev-lang/php/Manifest b/dev-lang/php/Manifest
18 index 1fec4ca5fb0..2abe163ea23 100644
19 --- a/dev-lang/php/Manifest
20 +++ b/dev-lang/php/Manifest
21 @@ -5,3 +5,4 @@ DIST php-7.0.28.tar.xz 11917836 BLAKE2B 8110b0486b0556abf2249d7cbdbd245249f32e23
22 DIST php-7.1.13.tar.xz 12194780 BLAKE2B 0bac1cb3ec46cd4206d71b0d8ec3058fff455bc7e3febb33dcb8e14d5a8b16918d3e4679e0691b8ba29b95ab90be2a3dc3a73bade45c1ca4eaf692d6d3c2db3d SHA512 f5357ffcbcaab1ba03d70edc0f1329b530f9f9c7779ac57d6fd2bd0bb730162f8d107025e5ff66592077d1bf504ee6816ec0379f50ceb1fac36cea90b0fc4fa2
23 DIST php-7.1.14.tar.xz 12198612 BLAKE2B 6ceb307423f07dafb75992b021d94259452fa4f08a9122c6d5e0da95dca1bcd88c7795effabefa7bddd06b398eca8093881a5ddb6d66fa91fc63a56c3a0fa4cc SHA512 7604e490aef95ae9c87bc4230491328c4cbcce42653234906885f9aa323f867ea941a7dbe80424aa4c4872392559ff5fa2acf1605c402055b6e428e6fe79ece6
24 DIST php-7.2.2.tar.xz 12022280 BLAKE2B 63daabcc37dc530524c9df58526690837b61ea71e9616bde22b3bb367b76504fa87f6cb976f120e57d6ccfe7ec6b3a1608d951ab3d68213fc401a6e1131e0e84 SHA512 36a3565161fc481307ac3e76c8d2ccc457c265bf510f085be1907835c7da7c747a0876502192d77bd664f94a584a1b149deee2600c650481fbedbf02d72d5fd0
25 +DIST php-7.2.3.tar.xz 12098236 BLAKE2B eb5f6618f31aef85db5f9010f0d000880b6f6e83314ba99dfad90c5d205cd2ac74ad4712681aae49b7315fab88a70c3bc93fdc7790f114b1ecab8cdf1c97ee4f SHA512 843d4ae46182eaec58beb583a321c55a6baddb0dbf1b77d7cf31953d816fc74813937576a87d0a18d388d256c5ec3f1c80065ec636e2f70d362384112b8c6c72
26
27 diff --git a/dev-lang/php/php-7.2.3.ebuild b/dev-lang/php/php-7.2.3.ebuild
28 new file mode 100644
29 index 00000000000..5407f131e1a
30 --- /dev/null
31 +++ b/dev-lang/php/php-7.2.3.ebuild
32 @@ -0,0 +1,737 @@
33 +# Copyright 1999-2018 Gentoo Foundation
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=6
37 +
38 +inherit flag-o-matic versionator systemd
39 +
40 +DESCRIPTION="The PHP language runtime engine"
41 +HOMEPAGE="https://secure.php.net/"
42 +SRC_URI="https://secure.php.net/distributions/${P}.tar.xz"
43 +
44 +LICENSE="PHP-3.01
45 + BSD
46 + Zend-2.0
47 + bcmath? ( LGPL-2.1+ )
48 + fpm? ( BSD-2 )
49 + gd? ( gd )
50 + unicode? ( BSD-2 LGPL-2.1 )"
51 +
52 +SLOT="$(get_version_component_range 1-2)"
53 +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"
54 +
55 +# We can build the following SAPIs in the given order
56 +SAPIS="embed cli cgi fpm apache2 phpdbg"
57 +
58 +# SAPIs and SAPI-specific USE flags (cli SAPI is default on):
59 +IUSE="${IUSE}
60 + ${SAPIS/cli/+cli}
61 + threads"
62 +
63 +IUSE="${IUSE} acl argon2 bcmath berkdb bzip2 calendar cdb cjk
64 + coverage +ctype curl debug
65 + enchant exif +fileinfo +filter firebird
66 + flatfile ftp gd gdbm gmp +hash +iconv imap inifile
67 + intl iodbc ipv6 +json kerberos ldap ldap-sasl libedit libressl lmdb
68 + mhash mssql mysql mysqli nls
69 + oci8-instant-client odbc +opcache pcntl pdo +phar +posix postgres qdbm
70 + readline recode selinux +session session-mm sharedmem
71 + +simplexml snmp soap sockets sodium spell sqlite ssl
72 + sysvipc systemd test tidy +tokenizer tokyocabinet truetype unicode wddx webp
73 + +xml xmlreader xmlwriter xmlrpc xpm xslt zip zip-encryption zlib"
74 +
75 +# The supported (that is, autodetected) versions of BDB are listed in
76 +# the ./configure script. Other versions *work*, but we need to stick to
77 +# the ones that can be detected to avoid a repeat of bug #564824.
78 +COMMON_DEPEND="
79 + >=app-eselect/eselect-php-0.9.1[apache2?,fpm?]
80 + >=dev-libs/libpcre-8.32[unicode]
81 + fpm? ( acl? ( sys-apps/acl ) )
82 + apache2? ( || ( >=www-servers/apache-2.4[apache2_modules_unixd,threads=]
83 + <www-servers/apache-2.4[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 )
96 + firebird? ( dev-db/firebird )
97 + gd? ( virtual/jpeg: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[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? ( || ( sys-freebsd/freebsd-lib 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 +# 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 + truetype? ( gd )
163 + webp? ( gd )
164 + cjk? ( gd )
165 + exif? ( gd )
166 + xpm? ( gd )
167 + gd? ( zlib )
168 + simplexml? ( xml )
169 + soap? ( xml )
170 + wddx? ( xml )
171 + xmlrpc? ( || ( xml iconv ) )
172 + xmlreader? ( xml )
173 + xslt? ( xml )
174 + ldap-sasl? ( ldap )
175 + mhash? ( hash )
176 + phar? ( hash )
177 + qdbm? ( !gdbm )
178 + readline? ( !libedit )
179 + recode? ( !imap !mysqli !mysql )
180 + session-mm? ( session !threads )
181 + mysql? ( || ( mysqli pdo ) )
182 + zip-encryption? ( zip )
183 +"
184 +
185 +PHP_MV="$(get_major_version)"
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 +
257 +src_configure() {
258 + addpredict /usr/share/snmp/mibs/.index
259 + addpredict /var/lib/net-snmp/mib_indexes
260 +
261 + PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
262 +
263 + # The php-fpm config file wants localstatedir to be ${EPREFIX}/var
264 + # and not the Gentoo default ${EPREFIX}/var/lib. See bug 572002.
265 + local our_conf=(
266 + --prefix="${PHP_DESTDIR}"
267 + --mandir="${PHP_DESTDIR}/man"
268 + --infodir="${PHP_DESTDIR}/info"
269 + --libdir="${PHP_DESTDIR}/lib"
270 + --with-libdir="$(get_libdir)"
271 + --localstatedir="${EPREFIX}/var"
272 + --without-pear
273 + $(use_enable threads maintainer-zts)
274 + )
275 +
276 + our_conf+=(
277 + $(use_with argon2 password-argon2 "${EPREFIX}/usr")
278 + $(use_enable bcmath bcmath)
279 + $(use_with bzip2 bz2 "${EPREFIX}/usr")
280 + $(use_enable calendar calendar)
281 + $(use_enable coverage gcov)
282 + $(use_enable ctype ctype)
283 + $(use_with curl curl "${EPREFIX}/usr")
284 + $(use_enable xml dom)
285 + $(use_with enchant enchant "${EPREFIX}/usr")
286 + $(use_enable exif exif)
287 + $(use_enable fileinfo fileinfo)
288 + $(use_enable filter filter)
289 + $(use_enable ftp ftp)
290 + $(use_with nls gettext "${EPREFIX}/usr")
291 + $(use_with gmp gmp "${EPREFIX}/usr")
292 + $(use_enable hash hash)
293 + $(use_with mhash mhash "${EPREFIX}/usr")
294 + $(use_with iconv iconv \
295 + $(use elibc_glibc || use elibc_musl || use elibc_FreeBSD || echo "${EPREFIX}/usr"))
296 + $(use_enable intl intl)
297 + $(use_enable ipv6 ipv6)
298 + $(use_enable json json)
299 + $(use_with kerberos kerberos "${EPREFIX}/usr")
300 + $(use_enable xml libxml)
301 + $(use_with xml libxml-dir "${EPREFIX}/usr")
302 + $(use_enable unicode mbstring)
303 + $(use_with unicode onig "${EPREFIX}/usr")
304 + $(use_with ssl openssl "${EPREFIX}/usr")
305 + $(use_with ssl openssl-dir "${EPREFIX}/usr")
306 + $(use_enable pcntl pcntl)
307 + $(use_enable phar phar)
308 + $(use_enable pdo pdo)
309 + $(use_enable opcache opcache)
310 + $(use_with postgres pgsql "${EPREFIX}/usr")
311 + $(use_enable posix posix)
312 + $(use_with spell pspell "${EPREFIX}/usr")
313 + $(use_with recode recode "${EPREFIX}/usr")
314 + $(use_enable simplexml simplexml)
315 + $(use_enable sharedmem shmop)
316 + $(use_with snmp snmp "${EPREFIX}/usr")
317 + $(use_enable soap soap)
318 + $(use_enable sockets sockets)
319 + $(use_with sodium sodium "${EPREFIX}/usr")
320 + $(use_with sqlite sqlite3 "${EPREFIX}/usr")
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 tokenizer)
326 + $(use_enable wddx wddx)
327 + $(use_enable xml xml)
328 + $(use_enable xmlreader xmlreader)
329 + $(use_enable xmlwriter xmlwriter)
330 + $(use_with xmlrpc xmlrpc)
331 + $(use_with xslt xsl "${EPREFIX}/usr")
332 + $(use_enable zip zip)
333 + $(use_with zip-encryption libzip "${EPREFIX}/usr")
334 + $(use_with zlib zlib "${EPREFIX}/usr")
335 + $(use_enable debug debug)
336 + )
337 +
338 + # DBA support
339 + if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
340 + || use qdbm || use lmdb || use tokyocabinet ; then
341 + our_conf+=( "--enable-dba${shared}" )
342 + fi
343 +
344 + # DBA drivers support
345 + our_conf+=(
346 + $(use_with cdb cdb)
347 + $(use_with berkdb db4 "${EPREFIX}/usr")
348 + $(use_enable flatfile flatfile)
349 + $(use_with gdbm gdbm "${EPREFIX}/usr")
350 + $(use_enable inifile inifile)
351 + $(use_with qdbm qdbm "${EPREFIX}/usr")
352 + $(use_with lmdb lmdb "${EPREFIX}/usr")
353 + )
354 +
355 + # Support for the GD graphics library
356 + our_conf+=(
357 + $(use_with truetype freetype-dir "${EPREFIX}/usr")
358 + $(use_enable cjk gd-jis-conv)
359 + $(use_with gd jpeg-dir "${EPREFIX}/usr")
360 + $(use_with gd png-dir "${EPREFIX}/usr")
361 + $(use_with xpm xpm-dir "${EPREFIX}/usr")
362 + )
363 + if use webp; then
364 + our_conf+=( --with-webp-dir="${EPREFIX}/usr" )
365 + fi
366 + # enable gd last, so configure can pick up the previous settings
367 + our_conf+=( $(use_with gd gd) )
368 +
369 + # IMAP support
370 + if use imap ; then
371 + our_conf+=(
372 + $(use_with imap imap "${EPREFIX}/usr")
373 + $(use_with ssl imap-ssl "${EPREFIX}/usr")
374 + )
375 + fi
376 +
377 + # Interbase/firebird support
378 + our_conf+=( $(use_with firebird interbase "${EPREFIX}/usr") )
379 +
380 + # LDAP support
381 + if use ldap ; then
382 + our_conf+=(
383 + $(use_with ldap ldap "${EPREFIX}/usr")
384 + $(use_with ldap-sasl ldap-sasl "${EPREFIX}/usr")
385 + )
386 + fi
387 +
388 + # MySQL support
389 + local mysqllib="mysqlnd"
390 + local mysqlilib="mysqlnd"
391 +
392 + our_conf+=( $(use_with mysqli mysqli "${mysqlilib}") )
393 +
394 + local mysqlsock="${EPREFIX}/var/run/mysqld/mysqld.sock"
395 + if use mysql || use mysqli ; then
396 + our_conf+=( $(use_with mysql mysql-sock "${mysqlsock}") )
397 + fi
398 +
399 + # ODBC support
400 + our_conf+=(
401 + $(use_with odbc unixODBC "${EPREFIX}/usr")
402 + $(use_with iodbc iodbc "${EPREFIX}/usr")
403 + )
404 +
405 + # Oracle support
406 + our_conf+=( $(use_with oci8-instant-client oci8) )
407 +
408 + # PDO support
409 + if use pdo ; then
410 + our_conf+=(
411 + $(use_with mssql pdo-dblib "${EPREFIX}/usr")
412 + $(use_with mysql pdo-mysql "${mysqllib}")
413 + $(use_with postgres pdo-pgsql)
414 + $(use_with sqlite pdo-sqlite "${EPREFIX}/usr")
415 + $(use_with firebird pdo-firebird "${EPREFIX}/usr")
416 + $(use_with odbc pdo-odbc "unixODBC,${EPREFIX}/usr")
417 + $(use_with oci8-instant-client pdo-oci)
418 + )
419 + fi
420 +
421 + # readline/libedit support
422 + our_conf+=(
423 + $(use_with readline readline "${EPREFIX}/usr")
424 + $(use_with libedit libedit "${EPREFIX}/usr")
425 + )
426 +
427 + # Session support
428 + if use session ; then
429 + our_conf+=( $(use_with session-mm mm "${EPREFIX}/usr") )
430 + else
431 + our_conf+=( $(use_enable session session) )
432 + fi
433 +
434 + # Use pic for shared modules such as apache2's mod_php
435 + our_conf+=( --with-pic )
436 +
437 + # we use the system copy of pcre
438 + # --with-pcre-regex affects ext/pcre
439 + # --with-pcre-dir affects ext/filter and ext/zip
440 + # --with-pcre-valgrind cannot be enabled with system pcre
441 + # Many arches don't support pcre-jit
442 + our_conf+=(
443 + --with-pcre-regex="${EPREFIX}/usr"
444 + --with-pcre-dir="${EPREFIX}/usr"
445 + --without-pcre-valgrind
446 + --without-pcre-jit
447 + )
448 +
449 + # Catch CFLAGS problems
450 + # Fixes bug #14067.
451 + # Changed order to run it in reverse for bug #32022 and #12021.
452 + replace-cpu-flags "k6*" "i586"
453 +
454 + # Cache the ./configure test results between SAPIs.
455 + our_conf+=( --cache-file="${T}/config.cache" )
456 +
457 + # Support user-passed configuration parameters
458 + our_conf+=( ${EXTRA_ECONF:-} )
459 +
460 + # Support the Apache2 extras, they must be set globally for all
461 + # SAPIs to work correctly, especially for external PHP extensions
462 +
463 + mkdir -p "${WORKDIR}/sapis-build" || die
464 + for one_sapi in $SAPIS ; do
465 + use "${one_sapi}" || continue
466 + php_set_ini_dir "${one_sapi}"
467 +
468 + # The BUILD_DIR variable is used to determine where to output
469 + # the files that autotools creates. This was all originally
470 + # based on the autotools-utils eclass.
471 + BUILD_DIR="${WORKDIR}/sapis-build/${one_sapi}"
472 + cp -a "${S}" "${BUILD_DIR}" || die
473 + cd "${BUILD_DIR}" || die
474 +
475 + local sapi_conf=(
476 + --with-config-file-path="${PHP_INI_DIR}"
477 + --with-config-file-scan-dir="${PHP_EXT_INI_DIR_ACTIVE}"
478 + )
479 +
480 + for sapi in $SAPIS ; do
481 + case "$sapi" in
482 + cli|cgi|embed|fpm|phpdbg)
483 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
484 + sapi_conf+=( "--enable-${sapi}" )
485 + if [[ "fpm" == "${sapi}" ]] ; then
486 + sapi_conf+=(
487 + $(use_with acl fpm-acl)
488 + $(use_with systemd fpm-systemd)
489 + )
490 + fi
491 + else
492 + sapi_conf+=( "--disable-${sapi}" )
493 + fi
494 + ;;
495 +
496 + apache2)
497 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
498 + sapi_conf+=( --with-apxs2="${EPREFIX}/usr/bin/apxs" )
499 + else
500 + sapi_conf+=( --without-apxs2 )
501 + fi
502 + ;;
503 + esac
504 + done
505 +
506 + # Construct the $myeconfargs array by concatenating $our_conf
507 + # (the common args) and $sapi_conf (the SAPI-specific args).
508 + local myeconfargs=( "${our_conf[@]}" )
509 + myeconfargs+=( "${sapi_conf[@]}" )
510 +
511 + pushd "${BUILD_DIR}" > /dev/null || die
512 + econf "${myeconfargs[@]}"
513 + popd > /dev/null || die
514 + done
515 +}
516 +
517 +src_compile() {
518 + # snmp seems to run during src_compile, too (bug #324739)
519 + addpredict /usr/share/snmp/mibs/.index
520 + addpredict /var/lib/net-snmp/mib_indexes
521 +
522 + for sapi in ${SAPIS} ; do
523 + if use "${sapi}"; then
524 + cd "${WORKDIR}/sapis-build/$sapi" || \
525 + die "Failed to change dir to ${WORKDIR}/sapis-build/$1"
526 + emake
527 + fi
528 + done
529 +}
530 +
531 +src_install() {
532 + # see bug #324739 for what happens when we don't have that
533 + addpredict /usr/share/snmp/mibs/.index
534 +
535 + # grab the first SAPI that got built and install common files from there
536 + local first_sapi=""
537 + for sapi in $SAPIS ; do
538 + if use $sapi ; then
539 + first_sapi=$sapi
540 + break
541 + fi
542 + done
543 +
544 + # Makefile forgets to create this before trying to write to it...
545 + dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
546 +
547 + # Install php environment (without any sapis)
548 + cd "${WORKDIR}/sapis-build/$first_sapi" || die
549 + emake INSTALL_ROOT="${D}" \
550 + install-build install-headers install-programs
551 +
552 + local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
553 +
554 + # Create the directory where we'll put version-specific php scripts
555 + keepdir "/usr/share/php${PHP_MV}"
556 +
557 + local sapi="", file=""
558 + local sapi_list=""
559 +
560 + for sapi in ${SAPIS}; do
561 + if use "${sapi}" ; then
562 + einfo "Installing SAPI: ${sapi}"
563 + cd "${WORKDIR}/sapis-build/${sapi}" || die
564 +
565 + if [[ "${sapi}" == "apache2" ]] ; then
566 + # We're specifically not using emake install-sapi as libtool
567 + # may cause unnecessary relink failures (see bug #351266)
568 + insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
569 + newins ".libs/libphp${PHP_MV}$(get_libname)" \
570 + "libphp${PHP_MV}$(get_libname)"
571 + keepdir "/usr/$(get_libdir)/apache2/modules"
572 + else
573 + # needed each time, php_install_ini would reset it
574 + local dest="${PHP_DESTDIR#${EPREFIX}}"
575 + into "${dest}"
576 + case "$sapi" in
577 + cli)
578 + source="sapi/cli/php"
579 + ;;
580 + cgi)
581 + source="sapi/cgi/php-cgi"
582 + ;;
583 + fpm)
584 + source="sapi/fpm/php-fpm"
585 + ;;
586 + embed)
587 + source="libs/libphp${PHP_MV}$(get_libname)"
588 + ;;
589 + phpdbg)
590 + source="sapi/phpdbg/phpdbg"
591 + ;;
592 + *)
593 + die "unhandled sapi in src_install"
594 + ;;
595 + esac
596 +
597 + if [[ "${source}" == *"$(get_libname)" ]]; then
598 + dolib.so "${source}"
599 + else
600 + dobin "${source}"
601 + local name="$(basename ${source})"
602 + dosym "${dest}/bin/${name}" "/usr/bin/${name}${SLOT}"
603 + fi
604 + fi
605 +
606 + php_install_ini "${sapi}"
607 +
608 + # construct correct SAPI string for php-config
609 + # thanks to ferringb for the bash voodoo
610 + if [[ "${sapi}" == "apache2" ]]; then
611 + sapi_list="${sapi_list:+${sapi_list} }apache2handler"
612 + else
613 + sapi_list="${sapi_list:+${sapi_list} }${sapi}"
614 + fi
615 + fi
616 + done
617 +
618 + # Installing opcache module
619 + if use opcache ; then
620 + into "${PHP_DESTDIR#${EPREFIX}}"
621 + dolib.so "modules/opcache$(get_libname)"
622 + fi
623 +
624 + # Install env.d files
625 + newenvd "${FILESDIR}/20php5-envd" "20php${SLOT}"
626 + sed -e "s|/lib/|/$(get_libdir)/|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
627 + sed -e "s|php5|php${SLOT}|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
628 +
629 + # set php-config variable correctly (bug #278439)
630 + sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
631 + "${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config" || die
632 +
633 + if use fpm ; then
634 + if use systemd; then
635 + systemd_newunit "${FILESDIR}/php-fpm_at.service" \
636 + "php-fpm@${SLOT}.service"
637 + else
638 + systemd_newunit "${FILESDIR}/php-fpm_at-simple.service" \
639 + "php-fpm@${SLOT}.service"
640 + fi
641 + fi
642 +}
643 +
644 +src_test() {
645 + echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
646 + PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php"
647 + if [[ ! -x "${PHP_BIN}" ]] ; then
648 + ewarn "Test phase requires USE=cli, skipping"
649 + return
650 + else
651 + export TEST_PHP_EXECUTABLE="${PHP_BIN}"
652 + fi
653 +
654 + if [[ -x "${WORKDIR}/sapis-build/cgi/sapi/cgi/php-cgi" ]] ; then
655 + export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis-build/cgi/sapi/cgi/php-cgi"
656 + fi
657 +
658 + if [[ -x "${WORKDIR}/sapis-build/phpdbg/sapi/phpdbg/phpdbg" ]] ; then
659 + export TEST_PHPDBG_EXECUTABLE="${WORKDIR}/sapis-build/phpdbg/sapi/phpdbg/phpdbg"
660 + fi
661 +
662 + REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d \
663 + "session.save_path=${T}" \
664 + "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d \
665 + "session.save_path=${T}"
666 +
667 + for name in ${EXPECTED_TEST_FAILURES}; do
668 + mv "${name}.out" "${name}.out.orig" 2>/dev/null || die
669 + done
670 +
671 + local failed="$(find -name '*.out')"
672 + if [[ ${failed} != "" ]] ; then
673 + ewarn "The following test cases failed unexpectedly:"
674 + for name in ${failed}; do
675 + ewarn " ${name/.out/}"
676 + done
677 + else
678 + einfo "No unexpected test failures, all fine"
679 + fi
680 +
681 + if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
682 + local passed=""
683 + for name in ${EXPECTED_TEST_FAILURES}; do
684 + [[ -f "${name}.diff" ]] && continue
685 + passed="${passed} ${name}"
686 + done
687 + if [[ ${passed} != "" ]] ; then
688 + einfo "The following test cases passed unexpectedly:"
689 + for name in ${passed}; do
690 + ewarn " ${passed}"
691 + done
692 + else
693 + einfo "None of the known-to-fail tests passed, all fine"
694 + fi
695 + fi
696 +}
697 +
698 +pkg_postinst() {
699 + # Output some general info to the user
700 + if use apache2 ; then
701 + elog
702 + elog "To enable PHP in apache, you will need to add \"-D PHP\" to"
703 + elog "your apache2 command. OpenRC users can append that string to"
704 + elog "APACHE2_OPTS in /etc/conf.d/apache2."
705 + elog
706 + elog "The apache module configuration file 70_mod_php.conf is"
707 + elog "provided (and maintained) by eselect-php."
708 + elog
709 + fi
710 +
711 + # Create the symlinks for php
712 + for m in ${SAPIS}; do
713 + [[ ${m} == 'embed' ]] && continue;
714 + if use $m ; then
715 + local ci=$(eselect php show $m)
716 + if [[ -z $ci ]]; then
717 + eselect php set $m php${SLOT} || die
718 + einfo "Switched ${m} to use php:${SLOT}"
719 + einfo
720 + elif [[ $ci != "php${SLOT}" ]] ; then
721 + elog "To switch $m to use php:${SLOT}, run"
722 + elog " eselect php set $m php${SLOT}"
723 + elog
724 + fi
725 + fi
726 + done
727 +
728 + # Remove dead symlinks for SAPIs that were just disabled. For
729 + # example, if the user has the cgi SAPI enabled, then he has an
730 + # eselect-php symlink for it. If he later reinstalls PHP with
731 + # USE="-cgi", that symlink will break. This call to eselect is
732 + # supposed to remove that dead link per bug 572436.
733 + eselect php cleanup || die
734 +
735 + if ! has "php${SLOT/./-}" ${PHP_TARGETS}; then
736 + elog "To build extensions for this version of PHP, you will need to"
737 + elog "add php${SLOT/./-} to your PHP_TARGETS USE_EXPAND variable."
738 + elog
739 + fi
740 +
741 + # Warn about the removal of PHP_INI_VERSION if the user has it set.
742 + if [[ -n "${PHP_INI_VERSION}" ]]; then
743 + ewarn 'The PHP_INI_VERSION variable has been phased out. You may'
744 + ewarn 'remove it from your configuration at your convenience. See'
745 + ewarn
746 + ewarn ' https://bugs.gentoo.org/611214'
747 + ewarn
748 + ewarn 'for more information.'
749 + fi
750 +
751 + elog "For details on how version slotting works, please see"
752 + elog "the wiki:"
753 + elog
754 + elog " https://wiki.gentoo.org/wiki/PHP"
755 + elog
756 +}
757 +
758 +pkg_postrm() {
759 + # This serves two purposes. First, if we have just removed the last
760 + # installed version of PHP, then this will remove any dead symlinks
761 + # belonging to eselect-php. Second, if a user upgrades slots from
762 + # (say) 5.6 to 7.0 and depcleans the old slot, then this will update
763 + # his existing symlinks to point to the new 7.0 installation. The
764 + # latter is bug 432962.
765 + #
766 + # Note: the eselect-php package may not be installed at this point,
767 + # so we can't die() if this command fails.
768 + eselect php cleanup
769 +}