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, 17 Aug 2018 03:34:55
Message-Id: 1534476877.103ef705a5893f19707e8572ef66fc0b1d2ff2a2.grknight@gentoo
1 commit: 103ef705a5893f19707e8572ef66fc0b1d2ff2a2
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Fri Aug 17 02:43:35 2018 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Fri Aug 17 03:34:37 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=103ef705
7
8 dev-lang/php: Version bump for 7.2.9
9
10 Package-Manager: Portage-2.3.46, Repoman-2.3.10
11
12 dev-lang/php/Manifest | 1 +
13 dev-lang/php/php-7.2.9.ebuild | 740 ++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 741 insertions(+)
15
16 diff --git a/dev-lang/php/Manifest b/dev-lang/php/Manifest
17 index 79e1931c3d4..bf41795784e 100644
18 --- a/dev-lang/php/Manifest
19 +++ b/dev-lang/php/Manifest
20 @@ -7,4 +7,5 @@ DIST php-7.1.16.tar.xz 12211512 BLAKE2B bf242e2438b2dc363368a9ef4478349a291f4834
21 DIST php-7.1.18.tar.xz 12213396 BLAKE2B f851c6eb261b8b532e84e73e6f173deb6ac00cd5168a02db9811843540aeadc390a4c5416eb17749cc950bbb1eda1045f538e2b80e4734ea2c0c4e264776bffb SHA512 7eacbc3b98d8b668c90d5c93030263f47ba2e0d4d7820594662590b8b68670f734a2274ae476e3aeac7e030c4ef10411a80da3523383e87a6757e87597caee90
22 DIST php-7.1.20.tar.xz 12227052 BLAKE2B c9872ffd1f8eb1a51a24d669965b0b908c3d233ad3eac86284e1edf7c6fa5e8099d5706bd1dd740cea039aeac2f66e60f96ccd15f1956eefe5635142b75857f1 SHA512 1f84ba63df45b0d32d704b74217b509807976e88ea953a330c06372491d6ca6e41891cf14bd16524b76f4b2f9007f1243845af7e652917de9325c022135ed9cf
23 DIST php-7.2.8.tar.xz 12153548 BLAKE2B 3ea98862238ae036cde188cf92d6ead5686ecb6b5be41ab828983ff02a278907644e8f76b65025e5050337c28c3c81d9d86df9876bd70b82fdc69e89d569e0c6 SHA512 8a52f2401ce46921c5842ca98bb81da1f6287d0ba68825f53d16853f808e702967fa9b4bea81d49a3e91c95c0b9eb218169cd6f32a403f7d120348ba5e009bea
24 +DIST php-7.2.9.tar.xz 12126780 BLAKE2B 0c509e281190e07199b189d220884b75fe6a81c64c7fdf271208b1d7f209c641defbd14aaa4e33b5a286bae8d9b40a72473e903b4349a36eca44499bf49757fd SHA512 b898e78fcb4aeeb441395dcabe2e7686425487e32dffbf0e99393aedb917da87a744b23f0be557c45e447433c8058df6e53c34869fc2dcf874cc1af97ff8331f
25 DIST php-7.3.0alpha3.tar.xz 11890052 BLAKE2B 4e069bb3c68e4fd26bac319fe840ad683d42f5a7a3f16b907f1814290be77c018670fd342032b6514f1b76eb924da7a614d79ce9c4708837bdc9cd214d4614fc SHA512 7d867db75ac1d5648c0f52c58a6d955329967f7a9399d5fa7b403868ba1a3d72cebe1c4e97ccd79baefae61a6fb1ff2363a6894bd712e81074c7e743e9bc2f1e
26
27 diff --git a/dev-lang/php/php-7.2.9.ebuild b/dev-lang/php/php-7.2.9.ebuild
28 new file mode 100644
29 index 00000000000..fb1c7c8293c
30 --- /dev/null
31 +++ b/dev-lang/php/php-7.2.9.ebuild
32 @@ -0,0 +1,740 @@
33 +# Copyright 1999-2018 Gentoo Foundation
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=6
37 +
38 +inherit flag-o-matic eapi7-ver systemd
39 +
40 +DESCRIPTION="The PHP language runtime engine"
41 +HOMEPAGE="https://secure.php.net/"
42 +SRC_URI="https://secure.php.net/distributions/${P}.tar.xz"
43 +
44 +LICENSE="PHP-3.01
45 + BSD
46 + Zend-2.0
47 + bcmath? ( LGPL-2.1+ )
48 + fpm? ( BSD-2 )
49 + gd? ( gd )
50 + unicode? ( BSD-2 LGPL-2.1 )"
51 +
52 +SLOT="$(ver_cut 1-2)"
53 +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"
54 +
55 +# We can build the following SAPIs in the given order
56 +SAPIS="embed cli cgi fpm apache2 phpdbg"
57 +
58 +# SAPIs and SAPI-specific USE flags (cli SAPI is default on):
59 +IUSE="${IUSE}
60 + ${SAPIS/cli/+cli}
61 + threads"
62 +
63 +IUSE="${IUSE} acl argon2 bcmath berkdb bzip2 calendar cdb cjk
64 + coverage +ctype curl debug
65 + enchant exif +fileinfo +filter firebird
66 + flatfile ftp gd gdbm gmp +hash +iconv imap inifile
67 + intl iodbc ipv6 +json kerberos ldap ldap-sasl libedit libressl lmdb
68 + mhash mssql mysql mysqli nls
69 + oci8-instant-client odbc +opcache pcntl pdo +phar +posix postgres qdbm
70 + readline recode selinux +session session-mm sharedmem
71 + +simplexml snmp soap sockets sodium spell sqlite ssl
72 + sysvipc systemd test tidy +tokenizer tokyocabinet truetype unicode wddx webp
73 + +xml xmlreader xmlwriter xmlrpc xpm xslt zip zip-encryption zlib"
74 +
75 +# The supported (that is, autodetected) versions of BDB are listed in
76 +# the ./configure script. Other versions *work*, but we need to stick to
77 +# the ones that can be detected to avoid a repeat of bug #564824.
78 +COMMON_DEPEND="
79 + >=app-eselect/eselect-php-0.9.1[apache2?,fpm?]
80 + >=dev-libs/libpcre-8.32[unicode]
81 + fpm? ( acl? ( sys-apps/acl ) )
82 + apache2? ( || ( >=www-servers/apache-2.4[apache2_modules_unixd,threads=]
83 + <www-servers/apache-2.4[threads=] ) )
84 + argon2? ( app-crypt/argon2:= )
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:0= )
92 + cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
93 + coverage? ( dev-util/lcov )
94 + curl? ( >=net-misc/curl-7.10.5 )
95 + enchant? ( app-text/enchant )
96 + firebird? ( dev-db/firebird )
97 + gd? ( virtual/jpeg:0 media-libs/libpng:0= sys-libs/zlib )
98 + gdbm? ( >=sys-libs/gdbm-1.8.0:0= )
99 + gmp? ( dev-libs/gmp:0= )
100 + iconv? ( virtual/libiconv )
101 + imap? ( virtual/imap-c-client[kerberos=,ssl=] )
102 + intl? ( dev-libs/icu:= )
103 + iodbc? ( dev-db/libiodbc )
104 + kerberos? ( virtual/krb5 )
105 + ldap? ( >=net-nds/openldap-1.2.11 )
106 + ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 )
107 + libedit? ( || ( sys-freebsd/freebsd-lib dev-libs/libedit ) )
108 + lmdb? ( dev-db/lmdb:= )
109 + mssql? ( dev-db/freetds[mssql] )
110 + nls? ( sys-devel/gettext )
111 + oci8-instant-client? ( dev-db/oracle-instantclient-basic )
112 + odbc? ( >=dev-db/unixODBC-1.8.13 )
113 + postgres? ( dev-db/postgresql:* )
114 + qdbm? ( dev-db/qdbm )
115 + readline? ( sys-libs/readline:0= )
116 + recode? ( app-text/recode )
117 + session-mm? ( dev-libs/mm )
118 + simplexml? ( >=dev-libs/libxml2-2.6.8 )
119 + snmp? ( >=net-analyzer/net-snmp-5.2 )
120 + soap? ( >=dev-libs/libxml2-2.6.8 )
121 + sodium? ( dev-libs/libsodium:= )
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:0= )
127 + )
128 + tidy? ( || ( app-text/tidy-html5 app-text/htmltidy ) )
129 + tokyocabinet? ( dev-db/tokyocabinet )
130 + truetype? ( =media-libs/freetype-2* )
131 + unicode? ( dev-libs/oniguruma:= )
132 + wddx? ( >=dev-libs/libxml2-2.6.8 )
133 + webp? ( media-libs/libwebp:0= )
134 + xml? ( >=dev-libs/libxml2-2.6.8 )
135 + xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv )
136 + xmlreader? ( >=dev-libs/libxml2-2.6.8 )
137 + xmlwriter? ( >=dev-libs/libxml2-2.6.8 )
138 + xpm? ( x11-libs/libXpm )
139 + xslt? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
140 + zip? ( sys-libs/zlib:0= )
141 + zip-encryption? ( >=dev-libs/libzip-1.2.0:= )
142 + zlib? ( sys-libs/zlib:0= )
143 +"
144 +
145 +RDEPEND="${COMMON_DEPEND}
146 + virtual/mta
147 + fpm? (
148 + selinux? ( sec-policy/selinux-phpfpm )
149 + systemd? ( sys-apps/systemd ) )"
150 +
151 +# Bison isn't actually needed when building from a release tarball
152 +# However, the configure script will warn if it's absent or if you
153 +# have an incompatible version installed. See bug 593278.
154 +DEPEND="${COMMON_DEPEND}
155 + app-arch/xz-utils
156 + >=sys-devel/bison-3.0.1"
157 +
158 +# Without USE=readline or libedit, the interactive "php -a" CLI will hang.
159 +REQUIRED_USE="
160 + || ( cli cgi fpm apache2 embed phpdbg )
161 + cli? ( ^^ ( readline libedit ) )
162 + truetype? ( gd zlib )
163 + webp? ( gd zlib )
164 + cjk? ( gd zlib )
165 + exif? ( gd zlib )
166 + xpm? ( gd zlib )
167 + gd? ( zlib )
168 + simplexml? ( xml )
169 + soap? ( xml )
170 + wddx? ( xml )
171 + xmlrpc? ( || ( xml iconv ) )
172 + xmlreader? ( xml )
173 + xslt? ( xml )
174 + ldap-sasl? ( ldap )
175 + mhash? ( hash )
176 + phar? ( hash )
177 + qdbm? ( !gdbm )
178 + readline? ( !libedit )
179 + recode? ( !imap !mysqli !mysql )
180 + session-mm? ( session !threads )
181 + mysql? ( || ( mysqli pdo ) )
182 + zip-encryption? ( zip )
183 +"
184 +PATCHES=(
185 + "${FILESDIR}/php-freetype-2.9.1.patch"
186 +)
187 +
188 +PHP_MV="$(ver_cut 1)"
189 +
190 +php_install_ini() {
191 + local phpsapi="${1}"
192 +
193 + # work out where we are installing the ini file
194 + php_set_ini_dir "${phpsapi}"
195 +
196 + # Always install the production INI file, bug 611214.
197 + local phpinisrc="php.ini-production-${phpsapi}"
198 + cp php.ini-production "${phpinisrc}" || die
199 +
200 + # default to /tmp for save_path, bug #282768
201 + sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}" || die
202 +
203 + # Set the extension dir
204 + sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" \
205 + -i "${phpinisrc}" || die
206 +
207 + # Set the include path to point to where we want to find PEAR packages
208 + sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}" || die
209 +
210 + dodir "${PHP_INI_DIR#${EPREFIX}}"
211 + insinto "${PHP_INI_DIR#${EPREFIX}}"
212 + newins "${phpinisrc}" php.ini
213 +
214 + elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
215 + elog
216 +
217 + dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
218 + dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
219 +
220 + if use opcache; then
221 + elog "Adding opcache to $PHP_EXT_INI_DIR"
222 + echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> \
223 + "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
224 + dosym "${PHP_EXT_INI_DIR#${EPREFIX}}/opcache.ini" \
225 + "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
226 + fi
227 +
228 + # SAPI-specific handling
229 + if [[ "${sapi}" == "fpm" ]] ; then
230 + einfo "Installing FPM config files php-fpm.conf and www.conf"
231 + insinto "${PHP_INI_DIR#${EPREFIX}}"
232 + doins sapi/fpm/php-fpm.conf
233 + insinto "${PHP_INI_DIR#${EPREFIX}}/fpm.d"
234 + doins sapi/fpm/www.conf
235 + fi
236 +
237 + dodoc php.ini-{development,production}
238 +}
239 +
240 +php_set_ini_dir() {
241 + PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
242 + PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
243 + PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
244 +}
245 +
246 +src_prepare() {
247 + default
248 +
249 + # In php-7.x, the FPM pool configuration files have been split off
250 + # of the main config. By default the pool config files go in
251 + # e.g. /etc/php-fpm.d, which isn't slotted. So here we move the
252 + # include directory to a subdirectory "fpm.d" of $PHP_INI_DIR. Later
253 + # we'll install the pool configuration file "www.conf" there.
254 + php_set_ini_dir fpm
255 + sed -i "s~^include=.*$~include=${PHP_INI_DIR}/fpm.d/*.conf~" \
256 + sapi/fpm/php-fpm.conf.in \
257 + || die 'failed to move the include directory in php-fpm.conf'
258 +}
259 +
260 +src_configure() {
261 + addpredict /usr/share/snmp/mibs/.index #nowarn
262 + addpredict /var/lib/net-snmp/mib_indexes #nowarn
263 +
264 + PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
265 +
266 + # The php-fpm config file wants localstatedir to be ${EPREFIX}/var
267 + # and not the Gentoo default ${EPREFIX}/var/lib. See bug 572002.
268 + local our_conf=(
269 + --prefix="${PHP_DESTDIR}"
270 + --mandir="${PHP_DESTDIR}/man"
271 + --infodir="${PHP_DESTDIR}/info"
272 + --libdir="${PHP_DESTDIR}/lib"
273 + --with-libdir="$(get_libdir)"
274 + --localstatedir="${EPREFIX}/var"
275 + --without-pear
276 + $(use_enable threads maintainer-zts)
277 + )
278 +
279 + our_conf+=(
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 || use elibc_FreeBSD || 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 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 session-mm 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 + if [[ "fpm" == "${sapi}" ]] ; then
489 + sapi_conf+=(
490 + $(use_with acl fpm-acl)
491 + $(use_with systemd fpm-systemd)
492 + )
493 + fi
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 #nowarn
523 + addpredict /var/lib/net-snmp/mib_indexes #nowarn
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 #nowarn
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 +}