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