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