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