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