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