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: Tue, 06 Feb 2018 20:06:51
Message-Id: 1517947597.0682d8c0dc20106f896849175c2cbfbd69cb9a49.grknight@gentoo
1 commit: 0682d8c0dc20106f896849175c2cbfbd69cb9a49
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Tue Feb 6 20:01:59 2018 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Tue Feb 6 20:06:37 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0682d8c0
7
8 dev-lang/php: Version bump for 7.2.2
9
10 Package-Manager: Portage-2.3.24, Repoman-2.3.6
11
12 dev-lang/php/Manifest | 1 +
13 dev-lang/php/php-7.2.2.ebuild | 733 ++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 734 insertions(+)
15
16 diff --git a/dev-lang/php/Manifest b/dev-lang/php/Manifest
17 index 619b63f4801..bffcf9139a1 100644
18 --- a/dev-lang/php/Manifest
19 +++ b/dev-lang/php/Manifest
20 @@ -3,3 +3,4 @@ DIST php-7.0.27.tar.xz 11916824 BLAKE2B 9d2881a611435b3f9607e04d1f271ca497b85437
21 DIST php-7.1.13.tar.xz 12194780 BLAKE2B 0bac1cb3ec46cd4206d71b0d8ec3058fff455bc7e3febb33dcb8e14d5a8b16918d3e4679e0691b8ba29b95ab90be2a3dc3a73bade45c1ca4eaf692d6d3c2db3d SHA512 f5357ffcbcaab1ba03d70edc0f1329b530f9f9c7779ac57d6fd2bd0bb730162f8d107025e5ff66592077d1bf504ee6816ec0379f50ceb1fac36cea90b0fc4fa2
22 DIST php-7.1.14.tar.xz 12198612 BLAKE2B 6ceb307423f07dafb75992b021d94259452fa4f08a9122c6d5e0da95dca1bcd88c7795effabefa7bddd06b398eca8093881a5ddb6d66fa91fc63a56c3a0fa4cc SHA512 7604e490aef95ae9c87bc4230491328c4cbcce42653234906885f9aa323f867ea941a7dbe80424aa4c4872392559ff5fa2acf1605c402055b6e428e6fe79ece6
23 DIST php-7.2.1.tar.xz 12094840 BLAKE2B fde1dc143598a74be552eef53d4e7a8cc5a09db67b8d98a4d527e6a7e6a0ad2b9e78429a8981074630c84bb6a95ee2bd8f1a78020062c770abb6fdbdba738cec SHA512 2445f2cff20214b521c48592e5ab42b770c291702178d7cb2a84912c81b7e5d2cc45948a3a4a7830194fa444708d544c73efbaa8e90c95ab77937f7feffb2ffc
24 +DIST php-7.2.2.tar.xz 12022280 BLAKE2B 63daabcc37dc530524c9df58526690837b61ea71e9616bde22b3bb367b76504fa87f6cb976f120e57d6ccfe7ec6b3a1608d951ab3d68213fc401a6e1131e0e84 SHA512 36a3565161fc481307ac3e76c8d2ccc457c265bf510f085be1907835c7da7c747a0876502192d77bd664f94a584a1b149deee2600c650481fbedbf02d72d5fd0
25
26 diff --git a/dev-lang/php/php-7.2.2.ebuild b/dev-lang/php/php-7.2.2.ebuild
27 new file mode 100644
28 index 00000000000..7a3dc1d3e71
29 --- /dev/null
30 +++ b/dev-lang/php/php-7.2.2.ebuild
31 @@ -0,0 +1,733 @@
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 + 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 acl fpm-acl)
277 + $(use_with argon2 password-argon2 "${EPREFIX}/usr")
278 + $(use_enable bcmath bcmath)
279 + $(use_with bzip2 bz2 "${EPREFIX}/usr")
280 + $(use_enable calendar calendar)
281 + $(use_enable coverage gcov)
282 + $(use_enable ctype ctype)
283 + $(use_with curl curl "${EPREFIX}/usr")
284 + $(use_enable xml dom)
285 + $(use_with enchant enchant "${EPREFIX}/usr")
286 + $(use_enable exif exif)
287 + $(use_enable fileinfo fileinfo)
288 + $(use_enable filter filter)
289 + $(use_enable ftp ftp)
290 + $(use_with nls gettext "${EPREFIX}/usr")
291 + $(use_with gmp gmp "${EPREFIX}/usr")
292 + $(use_enable hash hash)
293 + $(use_with mhash mhash "${EPREFIX}/usr")
294 + $(use_with iconv iconv \
295 + $(use elibc_glibc || use elibc_musl || echo "${EPREFIX}/usr"))
296 + $(use_enable intl intl)
297 + $(use_enable ipv6 ipv6)
298 + $(use_enable json json)
299 + $(use_with kerberos kerberos "${EPREFIX}/usr")
300 + $(use_enable xml libxml)
301 + $(use_with xml libxml-dir "${EPREFIX}/usr")
302 + $(use_enable unicode mbstring)
303 + $(use_with unicode onig "${EPREFIX}/usr")
304 + $(use_with ssl openssl "${EPREFIX}/usr")
305 + $(use_with ssl openssl-dir "${EPREFIX}/usr")
306 + $(use_enable pcntl pcntl)
307 + $(use_enable phar phar)
308 + $(use_enable pdo pdo)
309 + $(use_enable opcache opcache)
310 + $(use_with postgres pgsql "${EPREFIX}/usr")
311 + $(use_enable posix posix)
312 + $(use_with spell pspell "${EPREFIX}/usr")
313 + $(use_with recode recode "${EPREFIX}/usr")
314 + $(use_enable simplexml simplexml)
315 + $(use_enable sharedmem shmop)
316 + $(use_with snmp snmp "${EPREFIX}/usr")
317 + $(use_enable soap soap)
318 + $(use_enable sockets sockets)
319 + $(use_with sodium sodium "${EPREFIX}/usr")
320 + $(use_with sqlite sqlite3 "${EPREFIX}/usr")
321 + $(use_enable sysvipc sysvmsg)
322 + $(use_enable sysvipc sysvsem)
323 + $(use_enable sysvipc sysvshm)
324 + $(use_with systemd fpm-systemd)
325 + $(use_with tidy tidy "${EPREFIX}/usr")
326 + $(use_enable tokenizer tokenizer)
327 + $(use_enable wddx wddx)
328 + $(use_enable xml xml)
329 + $(use_enable xmlreader xmlreader)
330 + $(use_enable xmlwriter xmlwriter)
331 + $(use_with xmlrpc xmlrpc)
332 + $(use_with xslt xsl "${EPREFIX}/usr")
333 + $(use_enable zip zip)
334 + $(use_with zip-encryption libzip "${EPREFIX}/usr")
335 + $(use_with zlib zlib "${EPREFIX}/usr")
336 + $(use_enable debug debug)
337 + )
338 +
339 + # DBA support
340 + if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
341 + || use qdbm || use lmdb || use tokyocabinet ; then
342 + our_conf+=( "--enable-dba${shared}" )
343 + fi
344 +
345 + # DBA drivers support
346 + our_conf+=(
347 + $(use_with cdb cdb)
348 + $(use_with berkdb db4 "${EPREFIX}/usr")
349 + $(use_enable flatfile flatfile)
350 + $(use_with gdbm gdbm "${EPREFIX}/usr")
351 + $(use_enable inifile inifile)
352 + $(use_with qdbm qdbm "${EPREFIX}/usr")
353 + $(use_with lmdb lmdb "${EPREFIX}/usr")
354 + )
355 +
356 + # Support for the GD graphics library
357 + our_conf+=(
358 + $(use_with truetype freetype-dir "${EPREFIX}/usr")
359 + $(use_enable cjk gd-jis-conv)
360 + $(use_with gd jpeg-dir "${EPREFIX}/usr")
361 + $(use_with gd png-dir "${EPREFIX}/usr")
362 + $(use_with xpm xpm-dir "${EPREFIX}/usr")
363 + )
364 + if use webp; then
365 + our_conf+=( --with-webp-dir="${EPREFIX}/usr" )
366 + fi
367 + # enable gd last, so configure can pick up the previous settings
368 + our_conf+=( $(use_with gd gd) )
369 +
370 + # IMAP support
371 + if use imap ; then
372 + our_conf+=(
373 + $(use_with imap imap "${EPREFIX}/usr")
374 + $(use_with ssl imap-ssl "${EPREFIX}/usr")
375 + )
376 + fi
377 +
378 + # Interbase/firebird support
379 + our_conf+=( $(use_with firebird interbase "${EPREFIX}/usr") )
380 +
381 + # LDAP support
382 + if use ldap ; then
383 + our_conf+=(
384 + $(use_with ldap ldap "${EPREFIX}/usr")
385 + $(use_with ldap-sasl ldap-sasl "${EPREFIX}/usr")
386 + )
387 + fi
388 +
389 + # MySQL support
390 + local mysqllib="mysqlnd"
391 + local mysqlilib="mysqlnd"
392 +
393 + our_conf+=( $(use_with mysqli mysqli "${mysqlilib}") )
394 +
395 + local mysqlsock="${EPREFIX}/var/run/mysqld/mysqld.sock"
396 + if use mysql || use mysqli ; then
397 + our_conf+=( $(use_with mysql mysql-sock "${mysqlsock}") )
398 + fi
399 +
400 + # ODBC support
401 + our_conf+=(
402 + $(use_with odbc unixODBC "${EPREFIX}/usr")
403 + $(use_with iodbc iodbc "${EPREFIX}/usr")
404 + )
405 +
406 + # Oracle support
407 + our_conf+=( $(use_with oci8-instant-client oci8) )
408 +
409 + # PDO support
410 + if use pdo ; then
411 + our_conf+=(
412 + $(use_with mssql pdo-dblib "${EPREFIX}/usr")
413 + $(use_with mysql pdo-mysql "${mysqllib}")
414 + $(use_with postgres pdo-pgsql)
415 + $(use_with sqlite pdo-sqlite "${EPREFIX}/usr")
416 + $(use_with firebird pdo-firebird "${EPREFIX}/usr")
417 + $(use_with odbc pdo-odbc "unixODBC,${EPREFIX}/usr")
418 + $(use_with oci8-instant-client pdo-oci)
419 + )
420 + fi
421 +
422 + # readline/libedit support
423 + our_conf+=(
424 + $(use_with readline readline "${EPREFIX}/usr")
425 + $(use_with libedit libedit "${EPREFIX}/usr")
426 + )
427 +
428 + # Session support
429 + if use session ; then
430 + our_conf+=( $(use_with session-mm mm "${EPREFIX}/usr") )
431 + else
432 + our_conf+=( $(use_enable session session) )
433 + fi
434 +
435 + # Use pic for shared modules such as apache2's mod_php
436 + our_conf+=( --with-pic )
437 +
438 + # we use the system copy of pcre
439 + # --with-pcre-regex affects ext/pcre
440 + # --with-pcre-dir affects ext/filter and ext/zip
441 + # --with-pcre-valgrind cannot be enabled with system pcre
442 + # Many arches don't support pcre-jit
443 + our_conf+=(
444 + --with-pcre-regex="${EPREFIX}/usr"
445 + --with-pcre-dir="${EPREFIX}/usr"
446 + --without-pcre-valgrind
447 + --without-pcre-jit
448 + )
449 +
450 + # Catch CFLAGS problems
451 + # Fixes bug #14067.
452 + # Changed order to run it in reverse for bug #32022 and #12021.
453 + replace-cpu-flags "k6*" "i586"
454 +
455 + # Cache the ./configure test results between SAPIs.
456 + our_conf+=( --cache-file="${T}/config.cache" )
457 +
458 + # Support user-passed configuration parameters
459 + our_conf+=( ${EXTRA_ECONF:-} )
460 +
461 + # Support the Apache2 extras, they must be set globally for all
462 + # SAPIs to work correctly, especially for external PHP extensions
463 +
464 + mkdir -p "${WORKDIR}/sapis-build" || die
465 + for one_sapi in $SAPIS ; do
466 + use "${one_sapi}" || continue
467 + php_set_ini_dir "${one_sapi}"
468 +
469 + # The BUILD_DIR variable is used to determine where to output
470 + # the files that autotools creates. This was all originally
471 + # based on the autotools-utils eclass.
472 + BUILD_DIR="${WORKDIR}/sapis-build/${one_sapi}"
473 + cp -a "${S}" "${BUILD_DIR}" || die
474 + cd "${BUILD_DIR}" || die
475 +
476 + local sapi_conf=(
477 + --with-config-file-path="${PHP_INI_DIR}"
478 + --with-config-file-scan-dir="${PHP_EXT_INI_DIR_ACTIVE}"
479 + )
480 +
481 + for sapi in $SAPIS ; do
482 + case "$sapi" in
483 + cli|cgi|embed|fpm|phpdbg)
484 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
485 + sapi_conf+=( "--enable-${sapi}" )
486 + else
487 + sapi_conf+=( "--disable-${sapi}" )
488 + fi
489 + ;;
490 +
491 + apache2)
492 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
493 + sapi_conf+=( --with-apxs2="${EPREFIX}/usr/bin/apxs" )
494 + else
495 + sapi_conf+=( --without-apxs2 )
496 + fi
497 + ;;
498 + esac
499 + done
500 +
501 + # Construct the $myeconfargs array by concatenating $our_conf
502 + # (the common args) and $sapi_conf (the SAPI-specific args).
503 + local myeconfargs=( "${our_conf[@]}" )
504 + myeconfargs+=( "${sapi_conf[@]}" )
505 +
506 + pushd "${BUILD_DIR}" > /dev/null || die
507 + econf "${myeconfargs[@]}"
508 + popd > /dev/null || die
509 + done
510 +}
511 +
512 +src_compile() {
513 + # snmp seems to run during src_compile, too (bug #324739)
514 + addpredict /usr/share/snmp/mibs/.index
515 + addpredict /var/lib/net-snmp/mib_indexes
516 +
517 + for sapi in ${SAPIS} ; do
518 + if use "${sapi}"; then
519 + cd "${WORKDIR}/sapis-build/$sapi" || \
520 + die "Failed to change dir to ${WORKDIR}/sapis-build/$1"
521 + emake
522 + fi
523 + done
524 +}
525 +
526 +src_install() {
527 + # see bug #324739 for what happens when we don't have that
528 + addpredict /usr/share/snmp/mibs/.index
529 +
530 + # grab the first SAPI that got built and install common files from there
531 + local first_sapi=""
532 + for sapi in $SAPIS ; do
533 + if use $sapi ; then
534 + first_sapi=$sapi
535 + break
536 + fi
537 + done
538 +
539 + # Makefile forgets to create this before trying to write to it...
540 + dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
541 +
542 + # Install php environment (without any sapis)
543 + cd "${WORKDIR}/sapis-build/$first_sapi" || die
544 + emake INSTALL_ROOT="${D}" \
545 + install-build install-headers install-programs
546 +
547 + local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
548 +
549 + # Create the directory where we'll put version-specific php scripts
550 + keepdir "/usr/share/php${PHP_MV}"
551 +
552 + local sapi="", file=""
553 + local sapi_list=""
554 +
555 + for sapi in ${SAPIS}; do
556 + if use "${sapi}" ; then
557 + einfo "Installing SAPI: ${sapi}"
558 + cd "${WORKDIR}/sapis-build/${sapi}" || die
559 +
560 + if [[ "${sapi}" == "apache2" ]] ; then
561 + # We're specifically not using emake install-sapi as libtool
562 + # may cause unnecessary relink failures (see bug #351266)
563 + insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
564 + newins ".libs/libphp${PHP_MV}$(get_libname)" \
565 + "libphp${PHP_MV}$(get_libname)"
566 + keepdir "/usr/$(get_libdir)/apache2/modules"
567 + else
568 + # needed each time, php_install_ini would reset it
569 + local dest="${PHP_DESTDIR#${EPREFIX}}"
570 + into "${dest}"
571 + case "$sapi" in
572 + cli)
573 + source="sapi/cli/php"
574 + ;;
575 + cgi)
576 + source="sapi/cgi/php-cgi"
577 + ;;
578 + fpm)
579 + source="sapi/fpm/php-fpm"
580 + ;;
581 + embed)
582 + source="libs/libphp${PHP_MV}$(get_libname)"
583 + ;;
584 + phpdbg)
585 + source="sapi/phpdbg/phpdbg"
586 + ;;
587 + *)
588 + die "unhandled sapi in src_install"
589 + ;;
590 + esac
591 +
592 + if [[ "${source}" == *"$(get_libname)" ]]; then
593 + dolib.so "${source}"
594 + else
595 + dobin "${source}"
596 + local name="$(basename ${source})"
597 + dosym "${dest}/bin/${name}" "/usr/bin/${name}${SLOT}"
598 + fi
599 + fi
600 +
601 + php_install_ini "${sapi}"
602 +
603 + # construct correct SAPI string for php-config
604 + # thanks to ferringb for the bash voodoo
605 + if [[ "${sapi}" == "apache2" ]]; then
606 + sapi_list="${sapi_list:+${sapi_list} }apache2handler"
607 + else
608 + sapi_list="${sapi_list:+${sapi_list} }${sapi}"
609 + fi
610 + fi
611 + done
612 +
613 + # Installing opcache module
614 + if use opcache ; then
615 + into "${PHP_DESTDIR#${EPREFIX}}"
616 + dolib.so "modules/opcache$(get_libname)"
617 + fi
618 +
619 + # Install env.d files
620 + newenvd "${FILESDIR}/20php5-envd" "20php${SLOT}"
621 + sed -e "s|/lib/|/$(get_libdir)/|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
622 + sed -e "s|php5|php${SLOT}|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
623 +
624 + # set php-config variable correctly (bug #278439)
625 + sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
626 + "${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config" || die
627 +
628 + if use fpm ; then
629 + if use systemd; then
630 + systemd_newunit "${FILESDIR}/php-fpm_at.service" \
631 + "php-fpm@${SLOT}.service"
632 + else
633 + systemd_newunit "${FILESDIR}/php-fpm_at-simple.service" \
634 + "php-fpm@${SLOT}.service"
635 + fi
636 + fi
637 +}
638 +
639 +src_test() {
640 + echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
641 + PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php"
642 + if [[ ! -x "${PHP_BIN}" ]] ; then
643 + ewarn "Test phase requires USE=cli, skipping"
644 + return
645 + else
646 + export TEST_PHP_EXECUTABLE="${PHP_BIN}"
647 + fi
648 +
649 + if [[ -x "${WORKDIR}/sapis-build/cgi/sapi/cgi/php-cgi" ]] ; then
650 + export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis-build/cgi/sapi/cgi/php-cgi"
651 + fi
652 +
653 + if [[ -x "${WORKDIR}/sapis-build/phpdbg/sapi/phpdbg/phpdbg" ]] ; then
654 + export TEST_PHPDBG_EXECUTABLE="${WORKDIR}/sapis-build/phpdbg/sapi/phpdbg/phpdbg"
655 + fi
656 +
657 + REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d \
658 + "session.save_path=${T}" \
659 + "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d \
660 + "session.save_path=${T}"
661 +
662 + for name in ${EXPECTED_TEST_FAILURES}; do
663 + mv "${name}.out" "${name}.out.orig" 2>/dev/null || die
664 + done
665 +
666 + local failed="$(find -name '*.out')"
667 + if [[ ${failed} != "" ]] ; then
668 + ewarn "The following test cases failed unexpectedly:"
669 + for name in ${failed}; do
670 + ewarn " ${name/.out/}"
671 + done
672 + else
673 + einfo "No unexpected test failures, all fine"
674 + fi
675 +
676 + if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
677 + local passed=""
678 + for name in ${EXPECTED_TEST_FAILURES}; do
679 + [[ -f "${name}.diff" ]] && continue
680 + passed="${passed} ${name}"
681 + done
682 + if [[ ${passed} != "" ]] ; then
683 + einfo "The following test cases passed unexpectedly:"
684 + for name in ${passed}; do
685 + ewarn " ${passed}"
686 + done
687 + else
688 + einfo "None of the known-to-fail tests passed, all fine"
689 + fi
690 + fi
691 +}
692 +
693 +pkg_postinst() {
694 + # Output some general info to the user
695 + if use apache2 ; then
696 + elog
697 + elog "To enable PHP in apache, you will need to add \"-D PHP\" to"
698 + elog "your apache2 command. OpenRC users can append that string to"
699 + elog "APACHE2_OPTS in /etc/conf.d/apache2."
700 + elog
701 + elog "The apache module configuration file 70_mod_php.conf is"
702 + elog "provided (and maintained) by eselect-php."
703 + elog
704 + fi
705 +
706 + # Create the symlinks for php
707 + for m in ${SAPIS}; do
708 + [[ ${m} == 'embed' ]] && continue;
709 + if use $m ; then
710 + local ci=$(eselect php show $m)
711 + if [[ -z $ci ]]; then
712 + eselect php set $m php${SLOT} || die
713 + einfo "Switched ${m} to use php:${SLOT}"
714 + einfo
715 + elif [[ $ci != "php${SLOT}" ]] ; then
716 + elog "To switch $m to use php:${SLOT}, run"
717 + elog " eselect php set $m php${SLOT}"
718 + elog
719 + fi
720 + fi
721 + done
722 +
723 + # Remove dead symlinks for SAPIs that were just disabled. For
724 + # example, if the user has the cgi SAPI enabled, then he has an
725 + # eselect-php symlink for it. If he later reinstalls PHP with
726 + # USE="-cgi", that symlink will break. This call to eselect is
727 + # supposed to remove that dead link per bug 572436.
728 + eselect php cleanup || die
729 +
730 + if ! has "php${SLOT/./-}" ${PHP_TARGETS}; then
731 + elog "To build extensions for this version of PHP, you will need to"
732 + elog "add php${SLOT/./-} to your PHP_TARGETS USE_EXPAND variable."
733 + elog
734 + fi
735 +
736 + # Warn about the removal of PHP_INI_VERSION if the user has it set.
737 + if [[ -n "${PHP_INI_VERSION}" ]]; then
738 + ewarn 'The PHP_INI_VERSION variable has been phased out. You may'
739 + ewarn 'remove it from your configuration at your convenience. See'
740 + ewarn
741 + ewarn ' https://bugs.gentoo.org/611214'
742 + ewarn
743 + ewarn 'for more information.'
744 + fi
745 +
746 + elog "For details on how version slotting works, please see"
747 + elog "the wiki:"
748 + elog
749 + elog " https://wiki.gentoo.org/wiki/PHP"
750 + elog
751 +}
752 +
753 +pkg_postrm() {
754 + # This serves two purposes. First, if we have just removed the last
755 + # installed version of PHP, then this will remove any dead symlinks
756 + # belonging to eselect-php. Second, if a user upgrades slots from
757 + # (say) 5.6 to 7.0 and depcleans the old slot, then this will update
758 + # his existing symlinks to point to the new 7.0 installation. The
759 + # latter is bug 432962.
760 + #
761 + # Note: the eselect-php package may not be installed at this point,
762 + # so we can't die() if this command fails.
763 + eselect php cleanup
764 +}