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