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