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