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