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