Gentoo Archives: gentoo-commits

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