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