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