Gentoo Archives: gentoo-commits

From: Michael Orlitzky <mjo@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/php/
Date: Thu, 07 Jan 2021 02:18:12
Message-Id: 1609985675.032809c08eb67aed3eb8e699287887015b5b6826.mjo@gentoo
1 commit: 032809c08eb67aed3eb8e699287887015b5b6826
2 Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jan 7 01:54:25 2021 +0000
4 Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
5 CommitDate: Thu Jan 7 02:14:35 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=032809c0
7
8 dev-lang/php: new revisions with app-text/recode slot operators.
9
10 Closes: https://bugs.gentoo.org/723398
11 Package-Manager: Portage-3.0.9, Repoman-3.0.2
12 Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>
13
14 dev-lang/php/php-7.2.34-r2.ebuild | 764 ++++++++++++++++++++++++++++++++++++++
15 dev-lang/php/php-7.3.25-r1.ebuild | 760 +++++++++++++++++++++++++++++++++++++
16 2 files changed, 1524 insertions(+)
17
18 diff --git a/dev-lang/php/php-7.2.34-r2.ebuild b/dev-lang/php/php-7.2.34-r2.ebuild
19 new file mode 100644
20 index 00000000000..643a7372408
21 --- /dev/null
22 +++ b/dev-lang/php/php-7.2.34-r2.ebuild
23 @@ -0,0 +1,764 @@
24 +# Copyright 1999-2021 Gentoo Authors
25 +# Distributed under the terms of the GNU General Public License v2
26 +
27 +EAPI="7"
28 +
29 +inherit flag-o-matic systemd autotools toolchain-funcs
30 +
31 +DESCRIPTION="The PHP language runtime engine"
32 +HOMEPAGE="https://www.php.net/"
33 +SRC_URI="https://www.php.net/distributions/${P}.tar.xz"
34 +
35 +LICENSE="PHP-3.01
36 + BSD
37 + Zend-2.0
38 + bcmath? ( LGPL-2.1+ )
39 + fpm? ( BSD-2 )
40 + gd? ( gd )
41 + unicode? ( BSD-2 LGPL-2.1 )"
42 +
43 +SLOT="$(ver_cut 1-2)"
44 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
45 +
46 +# We can build the following SAPIs in the given order
47 +SAPIS="embed cli cgi fpm apache2 phpdbg"
48 +
49 +# SAPIs and SAPI-specific USE flags (cli SAPI is default on):
50 +IUSE="${IUSE}
51 + ${SAPIS/cli/+cli}
52 + threads"
53 +
54 +IUSE="${IUSE} acl argon2 bcmath berkdb bzip2 calendar cdb cjk
55 + coverage +ctype curl debug
56 + enchant exif +fileinfo +filter firebird
57 + +flatfile ftp gd gdbm gmp +hash +iconv imap inifile
58 + intl iodbc ipv6 +json kerberos ldap ldap-sasl libedit libressl lmdb
59 + mhash mssql mysql mysqli nls
60 + oci8-instant-client odbc +opcache pcntl pdo +phar +posix postgres qdbm
61 + readline recode selinux +session session-mm sharedmem
62 + +simplexml snmp soap sockets sodium spell sqlite ssl
63 + sysvipc systemd test tidy +tokenizer tokyocabinet truetype unicode wddx webp
64 + +xml xmlreader xmlwriter xmlrpc xpm xslt zip zip-encryption zlib"
65 +
66 +# The supported (that is, autodetected) versions of BDB are listed in
67 +# the ./configure script. Other versions *work*, but we need to stick to
68 +# the ones that can be detected to avoid a repeat of bug #564824.
69 +COMMON_DEPEND="
70 + >=app-eselect/eselect-php-0.9.1[apache2?,fpm?]
71 + >=dev-libs/libpcre-8.32[unicode]
72 + fpm? ( acl? ( sys-apps/acl ) )
73 + apache2? ( www-servers/apache[apache2_modules_unixd(+),threads=] )
74 + argon2? ( app-crypt/argon2:= )
75 + berkdb? ( || ( sys-libs/db:5.3
76 + sys-libs/db:5.1
77 + sys-libs/db:4.8
78 + sys-libs/db:4.7
79 + sys-libs/db:4.6
80 + sys-libs/db:4.5 ) )
81 + bzip2? ( app-arch/bzip2:0= )
82 + cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
83 + coverage? ( dev-util/lcov )
84 + curl? ( >=net-misc/curl-7.10.5 )
85 + enchant? ( <app-text/enchant-2.0:0 )
86 + firebird? ( dev-db/firebird )
87 + gd? ( >=virtual/jpeg-0-r3:0 media-libs/libpng:0= sys-libs/zlib )
88 + gdbm? ( >=sys-libs/gdbm-1.8.0:0= )
89 + gmp? ( dev-libs/gmp:0= )
90 + iconv? ( virtual/libiconv )
91 + imap? ( >=virtual/imap-c-client-2[kerberos=,ssl=] )
92 + intl? ( dev-libs/icu:= )
93 + iodbc? ( dev-db/libiodbc )
94 + kerberos? ( virtual/krb5 )
95 + ldap? ( >=net-nds/openldap-1.2.11 )
96 + ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 )
97 + libedit? ( dev-libs/libedit )
98 + lmdb? ( dev-db/lmdb:= )
99 + mssql? ( dev-db/freetds[mssql] )
100 + nls? ( sys-devel/gettext )
101 + oci8-instant-client? ( dev-db/oracle-instantclient-basic )
102 + odbc? ( >=dev-db/unixODBC-1.8.13 )
103 + postgres? ( dev-db/postgresql:* )
104 + qdbm? ( dev-db/qdbm )
105 + readline? ( sys-libs/readline:0= )
106 + recode? ( app-text/recode:0= )
107 + session-mm? ( dev-libs/mm )
108 + simplexml? ( >=dev-libs/libxml2-2.6.8 )
109 + snmp? ( >=net-analyzer/net-snmp-5.2 )
110 + soap? ( >=dev-libs/libxml2-2.6.8 )
111 + sodium? ( dev-libs/libsodium:= )
112 + spell? ( >=app-text/aspell-0.50 )
113 + sqlite? ( >=dev-db/sqlite-3.7.6.3 )
114 + ssl? (
115 + !libressl? ( dev-libs/openssl:0= )
116 + libressl? ( dev-libs/libressl:0= )
117 + )
118 + tidy? ( || ( app-text/tidy-html5 app-text/htmltidy ) )
119 + tokyocabinet? ( dev-db/tokyocabinet )
120 + truetype? ( =media-libs/freetype-2* )
121 + unicode? ( dev-libs/oniguruma:= )
122 + wddx? ( >=dev-libs/libxml2-2.6.8 )
123 + webp? ( media-libs/libwebp:0= )
124 + xml? ( >=dev-libs/libxml2-2.6.8 )
125 + xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv )
126 + xmlreader? ( >=dev-libs/libxml2-2.6.8 )
127 + xmlwriter? ( >=dev-libs/libxml2-2.6.8 )
128 + xpm? ( x11-libs/libXpm )
129 + xslt? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
130 + zip? ( sys-libs/zlib:0= )
131 + zip-encryption? ( >=dev-libs/libzip-1.2.0:= )
132 + zlib? ( sys-libs/zlib:0= )
133 +"
134 +
135 +RDEPEND="${COMMON_DEPEND}
136 + virtual/mta
137 + fpm? (
138 + selinux? ( sec-policy/selinux-phpfpm )
139 + systemd? ( sys-apps/systemd ) )"
140 +
141 +# Bison isn't actually needed when building from a release tarball
142 +# However, the configure script will warn if it's absent or if you
143 +# have an incompatible version installed. See bug 593278.
144 +DEPEND="${COMMON_DEPEND}
145 + app-arch/xz-utils
146 + >=sys-devel/bison-3.0.1"
147 +
148 +BDEPEND="virtual/pkgconfig"
149 +
150 +# Without USE=readline or libedit, the interactive "php -a" CLI will hang.
151 +REQUIRED_USE="
152 + || ( cli cgi fpm apache2 embed phpdbg )
153 + cli? ( ^^ ( readline libedit ) )
154 + truetype? ( gd zlib )
155 + webp? ( gd zlib )
156 + cjk? ( gd zlib )
157 + exif? ( gd zlib )
158 + xpm? ( gd zlib )
159 + gd? ( zlib )
160 + simplexml? ( xml )
161 + soap? ( xml )
162 + wddx? ( xml )
163 + xmlrpc? ( || ( xml iconv ) )
164 + xmlreader? ( xml )
165 + xslt? ( xml )
166 + ldap-sasl? ( ldap )
167 + mhash? ( hash )
168 + phar? ( hash )
169 + qdbm? ( !gdbm )
170 + readline? ( !libedit )
171 + recode? ( !imap !mysqli !mysql )
172 + session-mm? ( session !threads )
173 + mysql? ( hash || ( mysqli pdo ) )
174 + mysqli? ( hash )
175 + zip-encryption? ( zip )
176 +"
177 +
178 +RESTRICT="!test? ( test )"
179 +
180 +PATCHES=(
181 + "${FILESDIR}/php-freetype-2.9.1.patch"
182 + "${FILESDIR}/php-7.2.13-intl-use-icu-namespace.patch"
183 + "${FILESDIR}/php-7.2.34-use-after-free-bug76047.patch"
184 +)
185 +
186 +PHP_MV="$(ver_cut 1)"
187 +
188 +php_install_ini() {
189 + local phpsapi="${1}"
190 +
191 + # work out where we are installing the ini file
192 + php_set_ini_dir "${phpsapi}"
193 +
194 + # Always install the production INI file, bug 611214.
195 + local phpinisrc="php.ini-production-${phpsapi}"
196 + cp php.ini-production "${phpinisrc}" || die
197 +
198 + # default to /tmp for save_path, bug #282768
199 + sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}" || die
200 +
201 + # Set the extension dir
202 + sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" \
203 + -i "${phpinisrc}" || die
204 +
205 + # Set the include path to point to where we want to find PEAR packages
206 + sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}" || die
207 +
208 + insinto "${PHP_INI_DIR#${EPREFIX}}"
209 + newins "${phpinisrc}" php.ini
210 +
211 + elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
212 + elog
213 +
214 + dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
215 + dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
216 +
217 + if use opcache; then
218 + elog "Adding opcache to $PHP_EXT_INI_DIR"
219 + echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> \
220 + "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
221 + dosym "../ext/opcache.ini" \
222 + "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
223 + fi
224 +
225 + # SAPI-specific handling
226 + if [[ "${sapi}" == "fpm" ]] ; then
227 + einfo "Installing FPM config files php-fpm.conf and www.conf"
228 + insinto "${PHP_INI_DIR#${EPREFIX}}"
229 + doins sapi/fpm/php-fpm.conf
230 + insinto "${PHP_INI_DIR#${EPREFIX}}/fpm.d"
231 + doins sapi/fpm/www.conf
232 + fi
233 +
234 + dodoc php.ini-{development,production}
235 +}
236 +
237 +php_set_ini_dir() {
238 + PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
239 + PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
240 + PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
241 +}
242 +
243 +src_prepare() {
244 + default
245 +
246 + # In php-7.x, the FPM pool configuration files have been split off
247 + # of the main config. By default the pool config files go in
248 + # e.g. /etc/php-fpm.d, which isn't slotted. So here we move the
249 + # include directory to a subdirectory "fpm.d" of $PHP_INI_DIR. Later
250 + # we'll install the pool configuration file "www.conf" there.
251 + php_set_ini_dir fpm
252 + sed -i "s~^include=.*$~include=${PHP_INI_DIR}/fpm.d/*.conf~" \
253 + sapi/fpm/php-fpm.conf.in \
254 + || die 'failed to move the include directory in php-fpm.conf'
255 +
256 + # Bug 669566 - necessary so that build tools are updated for commands like pecl
257 + # Force rebuilding aclocal.m4
258 + rm -f aclocal.m4 || die "failed to remove aclocal.m4 in src_prepare"
259 + eautoreconf
260 +}
261 +
262 +src_configure() {
263 + addpredict /usr/share/snmp/mibs/.index #nowarn
264 + addpredict /var/lib/net-snmp/mib_indexes #nowarn
265 +
266 + # Fix building against >=ICU-68, https://bugs.php.net/80310
267 + append-cflags -DU_DEFINE_FALSE_AND_TRUE=1
268 + append-cxxflags -DU_DEFINE_FALSE_AND_TRUE=1
269 +
270 + PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
271 +
272 + # The php-fpm config file wants localstatedir to be ${EPREFIX}/var
273 + # and not the Gentoo default ${EPREFIX}/var/lib. See bug 572002.
274 + local our_conf=(
275 + --prefix="${PHP_DESTDIR}"
276 + --mandir="${PHP_DESTDIR}/man"
277 + --infodir="${PHP_DESTDIR}/info"
278 + --libdir="${PHP_DESTDIR}/lib"
279 + --with-libdir="$(get_libdir)"
280 + --localstatedir="${EPREFIX}/var"
281 + --without-pear
282 + $(use_enable threads maintainer-zts)
283 + )
284 +
285 + our_conf+=(
286 + $(use_with argon2 password-argon2 "${EPREFIX}/usr")
287 + $(use_enable bcmath bcmath)
288 + $(use_with bzip2 bz2 "${EPREFIX}/usr")
289 + $(use_enable calendar calendar)
290 + $(use_enable coverage gcov)
291 + $(use_enable ctype ctype)
292 + $(use_with curl curl "${EPREFIX}/usr")
293 + $(use_enable xml dom)
294 + $(use_with enchant enchant "${EPREFIX}/usr")
295 + $(use_enable exif exif)
296 + $(use_enable fileinfo fileinfo)
297 + $(use_enable filter filter)
298 + $(use_enable ftp ftp)
299 + $(use_with nls gettext "${EPREFIX}/usr")
300 + $(use_with gmp gmp "${EPREFIX}/usr")
301 + $(use_enable hash hash)
302 + $(use_with mhash mhash "${EPREFIX}/usr")
303 + $(use_with iconv iconv \
304 + $(use elibc_glibc || use elibc_musl || use elibc_FreeBSD || echo "${EPREFIX}/usr"))
305 + $(use_enable intl intl)
306 + $(use_enable ipv6 ipv6)
307 + $(use_enable json json)
308 + $(use_with kerberos kerberos "${EPREFIX}/usr")
309 + $(use_enable xml libxml)
310 + $(use_with xml libxml-dir "${EPREFIX}/usr")
311 + $(use_enable unicode mbstring)
312 + $(use_with unicode onig "${EPREFIX}/usr")
313 + $(use_with ssl openssl "${EPREFIX}/usr")
314 + $(use_with ssl openssl-dir "${EPREFIX}/usr")
315 + $(use_enable pcntl pcntl)
316 + $(use_enable phar phar)
317 + $(use_enable pdo pdo)
318 + $(use_enable opcache opcache)
319 + $(use_with postgres pgsql "${EPREFIX}/usr")
320 + $(use_enable posix posix)
321 + $(use_with spell pspell "${EPREFIX}/usr")
322 + $(use_with recode recode "${EPREFIX}/usr")
323 + $(use_enable simplexml simplexml)
324 + $(use_enable sharedmem shmop)
325 + $(use_with snmp snmp "${EPREFIX}/usr")
326 + $(use_enable soap soap)
327 + $(use_enable sockets sockets)
328 + $(use_with sodium sodium "${EPREFIX}/usr")
329 + $(use_with sqlite sqlite3 "${EPREFIX}/usr")
330 + $(use_enable sysvipc sysvmsg)
331 + $(use_enable sysvipc sysvsem)
332 + $(use_enable sysvipc sysvshm)
333 + $(use_with tidy tidy "${EPREFIX}/usr")
334 + $(use_enable tokenizer tokenizer)
335 + $(use_enable wddx wddx)
336 + $(use_enable xml xml)
337 + $(use_enable xmlreader xmlreader)
338 + $(use_enable xmlwriter xmlwriter)
339 + $(use_with xmlrpc xmlrpc)
340 + $(use_with xslt xsl "${EPREFIX}/usr")
341 + $(use_enable zip zip)
342 + $(use_with zip-encryption libzip "${EPREFIX}/usr")
343 + $(use_with zlib zlib "${EPREFIX}/usr")
344 + $(use_enable debug debug)
345 + )
346 +
347 + # DBA support
348 + if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
349 + || use qdbm || use lmdb || use tokyocabinet ; then
350 + our_conf+=( "--enable-dba${shared}" )
351 + fi
352 +
353 + # DBA drivers support
354 + our_conf+=(
355 + $(use_with cdb cdb)
356 + $(use_with berkdb db4 "${EPREFIX}/usr")
357 + $(use_enable flatfile flatfile)
358 + $(use_with gdbm gdbm "${EPREFIX}/usr")
359 + $(use_enable inifile inifile)
360 + $(use_with qdbm qdbm "${EPREFIX}/usr")
361 + $(use_with lmdb lmdb "${EPREFIX}/usr")
362 + )
363 +
364 + # Support for the GD graphics library
365 + our_conf+=(
366 + $(use_with truetype freetype-dir "${EPREFIX}/usr")
367 + $(use_enable cjk gd-jis-conv)
368 + $(use_with gd jpeg-dir "${EPREFIX}/usr")
369 + $(use_with gd png-dir "${EPREFIX}/usr")
370 + $(use_with xpm xpm-dir "${EPREFIX}/usr")
371 + )
372 + if use webp; then
373 + our_conf+=( --with-webp-dir="${EPREFIX}/usr" )
374 + fi
375 + # enable gd last, so configure can pick up the previous settings
376 + our_conf+=( $(use_with gd gd) )
377 +
378 + # IMAP support
379 + if use imap ; then
380 + our_conf+=(
381 + $(use_with imap imap "${EPREFIX}/usr")
382 + $(use_with ssl imap-ssl "${EPREFIX}/usr")
383 + )
384 + fi
385 +
386 + # Interbase/firebird support
387 + our_conf+=( $(use_with firebird interbase "${EPREFIX}/usr") )
388 +
389 + # LDAP support
390 + if use ldap ; then
391 + our_conf+=(
392 + $(use_with ldap ldap "${EPREFIX}/usr")
393 + $(use_with ldap-sasl ldap-sasl "${EPREFIX}/usr")
394 + )
395 + fi
396 +
397 + # MySQL support
398 + local mysqllib="mysqlnd"
399 + local mysqlilib="mysqlnd"
400 +
401 + our_conf+=( $(use_with mysqli mysqli "${mysqlilib}") )
402 +
403 + local mysqlsock="${EPREFIX}/var/run/mysqld/mysqld.sock"
404 + if use mysql || use mysqli ; then
405 + our_conf+=( $(use_with mysql mysql-sock "${mysqlsock}") )
406 + fi
407 +
408 + # ODBC support
409 + our_conf+=(
410 + $(use_with odbc unixODBC "${EPREFIX}/usr")
411 + $(use_with iodbc iodbc "${EPREFIX}/usr")
412 + )
413 +
414 + # Oracle support
415 + our_conf+=( $(use_with oci8-instant-client oci8) )
416 +
417 + # PDO support
418 + if use pdo ; then
419 + our_conf+=(
420 + $(use_with mssql pdo-dblib "${EPREFIX}/usr")
421 + $(use_with mysql pdo-mysql "${mysqllib}")
422 + $(use_with postgres pdo-pgsql)
423 + $(use_with sqlite pdo-sqlite "${EPREFIX}/usr")
424 + $(use_with firebird pdo-firebird "${EPREFIX}/usr")
425 + $(use_with odbc pdo-odbc "unixODBC,${EPREFIX}/usr")
426 + $(use_with oci8-instant-client pdo-oci)
427 + )
428 + fi
429 +
430 + # readline/libedit support
431 + our_conf+=(
432 + $(use_with readline readline "${EPREFIX}/usr")
433 + $(use_with libedit libedit "${EPREFIX}/usr")
434 + )
435 +
436 + # Session support
437 + if use session ; then
438 + our_conf+=( $(use_with session-mm mm "${EPREFIX}/usr") )
439 + else
440 + our_conf+=( $(use_enable session session) )
441 + fi
442 +
443 + # Use pic for shared modules such as apache2's mod_php
444 + our_conf+=( --with-pic )
445 +
446 + # we use the system copy of pcre
447 + # --with-pcre-regex affects ext/pcre
448 + # --with-pcre-dir affects ext/filter and ext/zip
449 + # --with-pcre-valgrind cannot be enabled with system pcre
450 + # Many arches don't support pcre-jit
451 + our_conf+=(
452 + --with-pcre-regex="${EPREFIX}/usr"
453 + --with-pcre-dir="${EPREFIX}/usr"
454 + --without-pcre-valgrind
455 + --without-pcre-jit
456 + )
457 +
458 + # Catch CFLAGS problems
459 + # Fixes bug #14067.
460 + # Changed order to run it in reverse for bug #32022 and #12021.
461 + replace-cpu-flags "k6*" "i586"
462 +
463 + # Cache the ./configure test results between SAPIs.
464 + our_conf+=( --cache-file="${T}/config.cache" )
465 +
466 + # Support user-passed configuration parameters
467 + our_conf+=( ${EXTRA_ECONF:-} )
468 +
469 + # Support the Apache2 extras, they must be set globally for all
470 + # SAPIs to work correctly, especially for external PHP extensions
471 +
472 + local one_sapi
473 + local sapi
474 + mkdir -p "${WORKDIR}/sapis-build" || die
475 + for one_sapi in $SAPIS ; do
476 + use "${one_sapi}" || continue
477 + php_set_ini_dir "${one_sapi}"
478 +
479 + # The BUILD_DIR variable is used to determine where to output
480 + # the files that autotools creates. This was all originally
481 + # based on the autotools-utils eclass.
482 + BUILD_DIR="${WORKDIR}/sapis-build/${one_sapi}"
483 + cp -a "${S}" "${BUILD_DIR}" || die
484 + cd "${BUILD_DIR}" || die
485 +
486 + local sapi_conf=(
487 + --with-config-file-path="${PHP_INI_DIR}"
488 + --with-config-file-scan-dir="${PHP_EXT_INI_DIR_ACTIVE}"
489 + )
490 +
491 + for sapi in $SAPIS ; do
492 + case "$sapi" in
493 + cli|cgi|embed|fpm|phpdbg)
494 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
495 + sapi_conf+=( "--enable-${sapi}" )
496 + if [[ "fpm" == "${sapi}" ]] ; then
497 + sapi_conf+=(
498 + $(use_with acl fpm-acl)
499 + $(use_with systemd fpm-systemd)
500 + )
501 + fi
502 + else
503 + sapi_conf+=( "--disable-${sapi}" )
504 + fi
505 + ;;
506 +
507 + apache2)
508 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
509 + sapi_conf+=( --with-apxs2="${EPREFIX}/usr/bin/apxs" )
510 + else
511 + sapi_conf+=( --without-apxs2 )
512 + fi
513 + ;;
514 + esac
515 + done
516 +
517 + # Construct the $myeconfargs array by concatenating $our_conf
518 + # (the common args) and $sapi_conf (the SAPI-specific args).
519 + local myeconfargs=( "${our_conf[@]}" )
520 + myeconfargs+=( "${sapi_conf[@]}" )
521 +
522 + pushd "${BUILD_DIR}" > /dev/null || die
523 + econf "${myeconfargs[@]}"
524 + popd > /dev/null || die
525 + done
526 +}
527 +
528 +src_compile() {
529 + # snmp seems to run during src_compile, too (bug #324739)
530 + addpredict /usr/share/snmp/mibs/.index #nowarn
531 + addpredict /var/lib/net-snmp/mib_indexes #nowarn
532 +
533 + local sapi
534 + for sapi in ${SAPIS} ; do
535 + if use "${sapi}"; then
536 + cd "${WORKDIR}/sapis-build/$sapi" || \
537 + die "Failed to change dir to ${WORKDIR}/sapis-build/$1"
538 + emake
539 + fi
540 + done
541 +}
542 +
543 +src_install() {
544 + # see bug #324739 for what happens when we don't have that
545 + addpredict /usr/share/snmp/mibs/.index #nowarn
546 +
547 + # grab the first SAPI that got built and install common files from there
548 + local first_sapi="",sapi=""
549 + for sapi in $SAPIS ; do
550 + if use $sapi ; then
551 + first_sapi=$sapi
552 + break
553 + fi
554 + done
555 +
556 + # Makefile forgets to create this before trying to write to it...
557 + dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
558 +
559 + # Install php environment (without any sapis)
560 + cd "${WORKDIR}/sapis-build/$first_sapi" || die
561 + emake INSTALL_ROOT="${D}" \
562 + install-build install-headers install-programs
563 +
564 + local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
565 +
566 + # Create the directory where we'll put version-specific php scripts
567 + keepdir "/usr/share/php${PHP_MV}"
568 +
569 + local file=""
570 + local sapi_list=""
571 +
572 + for sapi in ${SAPIS}; do
573 + if use "${sapi}" ; then
574 + einfo "Installing SAPI: ${sapi}"
575 + cd "${WORKDIR}/sapis-build/${sapi}" || die
576 +
577 + if [[ "${sapi}" == "apache2" ]] ; then
578 + # We're specifically not using emake install-sapi as libtool
579 + # may cause unnecessary relink failures (see bug #351266)
580 + insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
581 + newins ".libs/libphp${PHP_MV}$(get_libname)" \
582 + "libphp${PHP_MV}$(get_libname)"
583 + keepdir "/usr/$(get_libdir)/apache2/modules"
584 + else
585 + # needed each time, php_install_ini would reset it
586 + local dest="${PHP_DESTDIR#${EPREFIX}}"
587 + into "${dest}"
588 + case "$sapi" in
589 + cli)
590 + source="sapi/cli/php"
591 + # Install the "phar" archive utility.
592 + if use phar ; then
593 + emake INSTALL_ROOT="${D}" install-pharcmd
594 + dosym "..${dest#/usr}/bin/phar" "/usr/bin/phar${SLOT}"
595 + fi
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#/usr}/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 + local m
730 + for m in ${SAPIS}; do
731 + [[ ${m} == 'embed' ]] && continue;
732 + if use $m ; then
733 + local ci=$(eselect php show $m)
734 + if [[ -z $ci ]]; then
735 + eselect php set $m php${SLOT} || die
736 + einfo "Switched ${m} to use php:${SLOT}"
737 + einfo
738 + elif [[ $ci != "php${SLOT}" ]] ; then
739 + elog "To switch $m to use php:${SLOT}, run"
740 + elog " eselect php set $m php${SLOT}"
741 + elog
742 + fi
743 + fi
744 + done
745 +
746 + # Remove dead symlinks for SAPIs that were just disabled. For
747 + # example, if the user has the cgi SAPI enabled, then he has an
748 + # eselect-php symlink for it. If he later reinstalls PHP with
749 + # USE="-cgi", that symlink will break. This call to eselect is
750 + # supposed to remove that dead link per bug 572436.
751 + eselect php cleanup || die
752 +
753 + if ! has "php${SLOT/./-}" ${PHP_TARGETS}; then
754 + elog "To build extensions for this version of PHP, you will need to"
755 + elog "add php${SLOT/./-} to your PHP_TARGETS USE_EXPAND variable."
756 + elog
757 + fi
758 +
759 + # Warn about the removal of PHP_INI_VERSION if the user has it set.
760 + if [[ -n "${PHP_INI_VERSION}" ]]; then
761 + ewarn 'The PHP_INI_VERSION variable has been phased out. You may'
762 + ewarn 'remove it from your configuration at your convenience. See'
763 + ewarn
764 + ewarn ' https://bugs.gentoo.org/611214'
765 + ewarn
766 + ewarn 'for more information.'
767 + fi
768 +
769 + elog "For details on how version slotting works, please see"
770 + elog "the wiki:"
771 + elog
772 + elog " https://wiki.gentoo.org/wiki/PHP"
773 + elog
774 +}
775 +
776 +pkg_postrm() {
777 + # This serves two purposes. First, if we have just removed the last
778 + # installed version of PHP, then this will remove any dead symlinks
779 + # belonging to eselect-php. Second, if a user upgrades slots from
780 + # (say) 5.6 to 7.0 and depcleans the old slot, then this will update
781 + # his existing symlinks to point to the new 7.0 installation. The
782 + # latter is bug 432962.
783 + #
784 + # Note: the eselect-php package may not be installed at this point,
785 + # so we can't die() if this command fails.
786 + eselect php cleanup
787 +}
788
789 diff --git a/dev-lang/php/php-7.3.25-r1.ebuild b/dev-lang/php/php-7.3.25-r1.ebuild
790 new file mode 100644
791 index 00000000000..1a73813dd91
792 --- /dev/null
793 +++ b/dev-lang/php/php-7.3.25-r1.ebuild
794 @@ -0,0 +1,760 @@
795 +# Copyright 1999-2021 Gentoo Authors
796 +# Distributed under the terms of the GNU General Public License v2
797 +
798 +EAPI="7"
799 +
800 +inherit flag-o-matic systemd autotools
801 +
802 +MY_PV=${PV/_rc/RC}
803 +DESCRIPTION="The PHP language runtime engine"
804 +HOMEPAGE="https://www.php.net/"
805 +SRC_URI="https://www.php.net/distributions/${P}.tar.xz"
806 +
807 +LICENSE="PHP-3.01
808 + BSD
809 + Zend-2.0
810 + bcmath? ( LGPL-2.1+ )
811 + fpm? ( BSD-2 )
812 + gd? ( gd )
813 + unicode? ( BSD-2 LGPL-2.1 )"
814 +
815 +SLOT="$(ver_cut 1-2)"
816 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
817 +
818 +S="${WORKDIR}/${PN}-${MY_PV}"
819 +
820 +# We can build the following SAPIs in the given order
821 +SAPIS="embed cli cgi fpm apache2 phpdbg"
822 +
823 +# SAPIs and SAPI-specific USE flags (cli SAPI is default on):
824 +IUSE="${IUSE}
825 + ${SAPIS/cli/+cli}
826 + threads"
827 +
828 +IUSE="${IUSE} acl argon2 bcmath berkdb bzip2 calendar cdb cjk
829 + coverage +ctype curl debug
830 + enchant exif +fileinfo +filter firebird
831 + +flatfile ftp gd gdbm gmp +hash +iconv imap inifile
832 + intl iodbc ipv6 +json kerberos ldap ldap-sasl libedit libressl lmdb
833 + mhash mssql mysql mysqli nls
834 + oci8-instant-client odbc +opcache pcntl pdo +phar +posix postgres qdbm
835 + readline recode selinux +session session-mm sharedmem
836 + +simplexml snmp soap sockets sodium spell sqlite ssl
837 + sysvipc systemd test tidy +tokenizer tokyocabinet truetype unicode wddx webp
838 + +xml xmlreader xmlwriter xmlrpc xpm xslt zip zip-encryption zlib"
839 +
840 +# The supported (that is, autodetected) versions of BDB are listed in
841 +# the ./configure script. Other versions *work*, but we need to stick to
842 +# the ones that can be detected to avoid a repeat of bug #564824.
843 +COMMON_DEPEND="
844 + >=app-eselect/eselect-php-0.9.1[apache2?,fpm?]
845 + >=dev-libs/libpcre2-10.30[unicode]
846 + fpm? ( acl? ( sys-apps/acl ) )
847 + apache2? ( www-servers/apache[apache2_modules_unixd(+),threads=] )
848 + argon2? ( app-crypt/argon2:= )
849 + berkdb? ( || ( sys-libs/db:5.3
850 + sys-libs/db:5.1
851 + sys-libs/db:4.8
852 + sys-libs/db:4.7
853 + sys-libs/db:4.6
854 + sys-libs/db:4.5 ) )
855 + bzip2? ( app-arch/bzip2:0= )
856 + cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
857 + coverage? ( dev-util/lcov )
858 + curl? ( >=net-misc/curl-7.10.5 )
859 + enchant? ( <app-text/enchant-2.0:0 )
860 + firebird? ( dev-db/firebird )
861 + gd? ( >=virtual/jpeg-0-r3:0 media-libs/libpng:0= >=sys-libs/zlib-1.2.0.4 )
862 + gdbm? ( >=sys-libs/gdbm-1.8.0:0= )
863 + gmp? ( dev-libs/gmp:0= )
864 + iconv? ( virtual/libiconv )
865 + imap? ( >=virtual/imap-c-client-2[kerberos=,ssl=] )
866 + intl? ( dev-libs/icu:= )
867 + iodbc? ( dev-db/libiodbc )
868 + kerberos? ( virtual/krb5 )
869 + ldap? ( >=net-nds/openldap-1.2.11 )
870 + ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 )
871 + libedit? ( dev-libs/libedit )
872 + lmdb? ( dev-db/lmdb:= )
873 + mssql? ( dev-db/freetds[mssql] )
874 + nls? ( sys-devel/gettext )
875 + oci8-instant-client? ( dev-db/oracle-instantclient-basic )
876 + odbc? ( >=dev-db/unixODBC-1.8.13 )
877 + postgres? ( dev-db/postgresql:* )
878 + qdbm? ( dev-db/qdbm )
879 + readline? ( sys-libs/readline:0= )
880 + recode? ( app-text/recode:0= )
881 + session-mm? ( dev-libs/mm )
882 + simplexml? ( >=dev-libs/libxml2-2.6.8 )
883 + snmp? ( >=net-analyzer/net-snmp-5.2 )
884 + soap? ( >=dev-libs/libxml2-2.6.8 )
885 + sodium? ( dev-libs/libsodium:= )
886 + spell? ( >=app-text/aspell-0.50 )
887 + sqlite? ( >=dev-db/sqlite-3.7.6.3 )
888 + ssl? (
889 + !libressl? ( >=dev-libs/openssl-1.0.1:0= )
890 + libressl? ( dev-libs/libressl:0= )
891 + )
892 + tidy? ( || ( app-text/tidy-html5 app-text/htmltidy ) )
893 + tokyocabinet? ( dev-db/tokyocabinet )
894 + truetype? ( =media-libs/freetype-2* )
895 + unicode? ( dev-libs/oniguruma:= )
896 + wddx? ( >=dev-libs/libxml2-2.6.8 )
897 + webp? ( media-libs/libwebp:0= )
898 + xml? ( >=dev-libs/libxml2-2.6.8 )
899 + xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv )
900 + xmlreader? ( >=dev-libs/libxml2-2.6.8 )
901 + xmlwriter? ( >=dev-libs/libxml2-2.6.8 )
902 + xpm? ( x11-libs/libXpm )
903 + xslt? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
904 + zip? ( >=sys-libs/zlib-1.2.0.4:0= )
905 + zip-encryption? ( >=dev-libs/libzip-1.2.0:= )
906 + zlib? ( >=sys-libs/zlib-1.2.0.4:0= )
907 +"
908 +
909 +RDEPEND="${COMMON_DEPEND}
910 + virtual/mta
911 + fpm? (
912 + selinux? ( sec-policy/selinux-phpfpm )
913 + systemd? ( sys-apps/systemd ) )"
914 +
915 +# Bison isn't actually needed when building from a release tarball
916 +# However, the configure script will warn if it's absent or if you
917 +# have an incompatible version installed. See bug 593278.
918 +DEPEND="${COMMON_DEPEND}
919 + app-arch/xz-utils
920 + >=sys-devel/bison-3.0.1"
921 +
922 +BDEPEND="virtual/pkgconfig"
923 +
924 +# Without USE=readline or libedit, the interactive "php -a" CLI will hang.
925 +REQUIRED_USE="
926 + || ( cli cgi fpm apache2 embed phpdbg )
927 + cli? ( ^^ ( readline libedit ) )
928 + truetype? ( gd zlib )
929 + webp? ( gd zlib )
930 + cjk? ( gd zlib )
931 + exif? ( gd zlib )
932 + xpm? ( gd zlib )
933 + gd? ( zlib )
934 + simplexml? ( xml )
935 + soap? ( xml )
936 + wddx? ( xml )
937 + xmlrpc? ( || ( xml iconv ) )
938 + xmlreader? ( xml )
939 + xslt? ( xml )
940 + ldap-sasl? ( ldap )
941 + mhash? ( hash )
942 + phar? ( hash )
943 + qdbm? ( !gdbm )
944 + readline? ( !libedit )
945 + recode? ( !imap !mysqli !mysql )
946 + session-mm? ( session !threads )
947 + mysql? ( || ( mysqli pdo ) )
948 + zip-encryption? ( zip )
949 +"
950 +
951 +RESTRICT="!test? ( test )"
952 +
953 +PATCHES=(
954 + "${FILESDIR}/php-freetype-2.9.1.patch"
955 +)
956 +
957 +PHP_MV="$(ver_cut 1)"
958 +
959 +php_install_ini() {
960 + local phpsapi="${1}"
961 +
962 + # work out where we are installing the ini file
963 + php_set_ini_dir "${phpsapi}"
964 +
965 + # Always install the production INI file, bug 611214.
966 + local phpinisrc="php.ini-production-${phpsapi}"
967 + cp php.ini-production "${phpinisrc}" || die
968 +
969 + # default to /tmp for save_path, bug #282768
970 + sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}" || die
971 +
972 + # Set the extension dir
973 + sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" \
974 + -i "${phpinisrc}" || die
975 +
976 + # Set the include path to point to where we want to find PEAR packages
977 + sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}" || die
978 +
979 + insinto "${PHP_INI_DIR#${EPREFIX}}"
980 + newins "${phpinisrc}" php.ini
981 +
982 + elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
983 + elog
984 +
985 + dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
986 + dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
987 +
988 + if use opcache; then
989 + elog "Adding opcache to $PHP_EXT_INI_DIR"
990 + echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> \
991 + "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
992 + dosym "../ext/opcache.ini" \
993 + "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
994 + fi
995 +
996 + # SAPI-specific handling
997 + if [[ "${sapi}" == "fpm" ]] ; then
998 + einfo "Installing FPM config files php-fpm.conf and www.conf"
999 + insinto "${PHP_INI_DIR#${EPREFIX}}"
1000 + doins sapi/fpm/php-fpm.conf
1001 + insinto "${PHP_INI_DIR#${EPREFIX}}/fpm.d"
1002 + doins sapi/fpm/www.conf
1003 + fi
1004 +
1005 + dodoc php.ini-{development,production}
1006 +}
1007 +
1008 +php_set_ini_dir() {
1009 + PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
1010 + PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
1011 + PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
1012 +}
1013 +
1014 +src_prepare() {
1015 + default
1016 +
1017 + # In php-7.x, the FPM pool configuration files have been split off
1018 + # of the main config. By default the pool config files go in
1019 + # e.g. /etc/php-fpm.d, which isn't slotted. So here we move the
1020 + # include directory to a subdirectory "fpm.d" of $PHP_INI_DIR. Later
1021 + # we'll install the pool configuration file "www.conf" there.
1022 + php_set_ini_dir fpm
1023 + sed -i "s~^include=.*$~include=${PHP_INI_DIR}/fpm.d/*.conf~" \
1024 + sapi/fpm/php-fpm.conf.in \
1025 + || die 'failed to move the include directory in php-fpm.conf'
1026 +
1027 + # Bug 669566 - necessary so that build tools are updated for commands like pecl
1028 + # Force rebuilding aclocal.m4
1029 + rm -f aclocal.m4 || die "failed to remove aclocal.m4 in src_prepare"
1030 + eautoreconf
1031 +}
1032 +
1033 +src_configure() {
1034 + addpredict /usr/share/snmp/mibs/.index #nowarn
1035 + addpredict /var/lib/net-snmp/mib_indexes #nowarn
1036 +
1037 + PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
1038 +
1039 + # The php-fpm config file wants localstatedir to be ${EPREFIX}/var
1040 + # and not the Gentoo default ${EPREFIX}/var/lib. See bug 572002.
1041 + local our_conf=(
1042 + --prefix="${PHP_DESTDIR}"
1043 + --mandir="${PHP_DESTDIR}/man"
1044 + --infodir="${PHP_DESTDIR}/info"
1045 + --libdir="${PHP_DESTDIR}/lib"
1046 + --with-libdir="$(get_libdir)"
1047 + --localstatedir="${EPREFIX}/var"
1048 + --without-pear
1049 + $(use_enable threads maintainer-zts)
1050 + )
1051 +
1052 + our_conf+=(
1053 + $(use_with argon2 password-argon2 "${EPREFIX}/usr")
1054 + $(use_enable bcmath bcmath)
1055 + $(use_with bzip2 bz2 "${EPREFIX}/usr")
1056 + $(use_enable calendar calendar)
1057 + $(use_enable coverage gcov)
1058 + $(use_enable ctype ctype)
1059 + $(use_with curl curl "${EPREFIX}/usr")
1060 + $(use_enable xml dom)
1061 + $(use_with enchant enchant "${EPREFIX}/usr")
1062 + $(use_enable exif exif)
1063 + $(use_enable fileinfo fileinfo)
1064 + $(use_enable filter filter)
1065 + $(use_enable ftp ftp)
1066 + $(use_with nls gettext "${EPREFIX}/usr")
1067 + $(use_with gmp gmp "${EPREFIX}/usr")
1068 + $(use_enable hash hash)
1069 + $(use_with mhash mhash "${EPREFIX}/usr")
1070 + $(use_with iconv iconv \
1071 + $(use elibc_glibc || use elibc_musl || use elibc_FreeBSD || echo "${EPREFIX}/usr"))
1072 + $(use_enable intl intl)
1073 + $(use_enable ipv6 ipv6)
1074 + $(use_enable json json)
1075 + $(use_with kerberos kerberos "${EPREFIX}/usr")
1076 + $(use_enable xml libxml)
1077 + $(use_with xml libxml-dir "${EPREFIX}/usr")
1078 + $(use_enable unicode mbstring)
1079 + $(use_with unicode onig "${EPREFIX}/usr")
1080 + $(use_with ssl openssl "${EPREFIX}/usr")
1081 + $(use_with ssl openssl-dir "${EPREFIX}/usr")
1082 + $(use_enable pcntl pcntl)
1083 + $(use_enable phar phar)
1084 + $(use_enable pdo pdo)
1085 + $(use_enable opcache opcache)
1086 + $(use_with postgres pgsql "${EPREFIX}/usr")
1087 + $(use_enable posix posix)
1088 + $(use_with spell pspell "${EPREFIX}/usr")
1089 + $(use_with recode recode "${EPREFIX}/usr")
1090 + $(use_enable simplexml simplexml)
1091 + $(use_enable sharedmem shmop)
1092 + $(use_with snmp snmp "${EPREFIX}/usr")
1093 + $(use_enable soap soap)
1094 + $(use_enable sockets sockets)
1095 + $(use_with sodium sodium "${EPREFIX}/usr")
1096 + $(use_with sqlite sqlite3 "${EPREFIX}/usr")
1097 + $(use_enable sysvipc sysvmsg)
1098 + $(use_enable sysvipc sysvsem)
1099 + $(use_enable sysvipc sysvshm)
1100 + $(use_with tidy tidy "${EPREFIX}/usr")
1101 + $(use_enable tokenizer tokenizer)
1102 + $(use_enable wddx wddx)
1103 + $(use_enable xml xml)
1104 + $(use_enable xmlreader xmlreader)
1105 + $(use_enable xmlwriter xmlwriter)
1106 + $(use_with xmlrpc xmlrpc)
1107 + $(use_with xslt xsl "${EPREFIX}/usr")
1108 + $(use_enable zip zip)
1109 + $(use_with zip-encryption libzip "${EPREFIX}/usr")
1110 + $(use_with zlib zlib "${EPREFIX}/usr")
1111 + $(use_enable debug debug)
1112 + )
1113 +
1114 + # DBA support
1115 + if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
1116 + || use qdbm || use lmdb || use tokyocabinet ; then
1117 + our_conf+=( "--enable-dba${shared}" )
1118 + fi
1119 +
1120 + # DBA drivers support
1121 + our_conf+=(
1122 + $(use_with cdb cdb)
1123 + $(use_with berkdb db4 "${EPREFIX}/usr")
1124 + $(use_enable flatfile flatfile)
1125 + $(use_with gdbm gdbm "${EPREFIX}/usr")
1126 + $(use_enable inifile inifile)
1127 + $(use_with qdbm qdbm "${EPREFIX}/usr")
1128 + $(use_with lmdb lmdb "${EPREFIX}/usr")
1129 + )
1130 +
1131 + # Support for the GD graphics library
1132 + our_conf+=(
1133 + $(use_with truetype freetype-dir "${EPREFIX}/usr")
1134 + $(use_enable cjk gd-jis-conv)
1135 + $(use_with gd jpeg-dir "${EPREFIX}/usr")
1136 + $(use_with gd png-dir "${EPREFIX}/usr")
1137 + $(use_with xpm xpm-dir "${EPREFIX}/usr")
1138 + )
1139 + if use webp; then
1140 + our_conf+=( --with-webp-dir="${EPREFIX}/usr" )
1141 + fi
1142 + # enable gd last, so configure can pick up the previous settings
1143 + our_conf+=( $(use_with gd gd) )
1144 +
1145 + # IMAP support
1146 + if use imap ; then
1147 + our_conf+=(
1148 + $(use_with imap imap "${EPREFIX}/usr")
1149 + $(use_with ssl imap-ssl "${EPREFIX}/usr")
1150 + )
1151 + fi
1152 +
1153 + # Interbase/firebird support
1154 + our_conf+=( $(use_with firebird interbase "${EPREFIX}/usr") )
1155 +
1156 + # LDAP support
1157 + if use ldap ; then
1158 + our_conf+=(
1159 + $(use_with ldap ldap "${EPREFIX}/usr")
1160 + $(use_with ldap-sasl ldap-sasl "${EPREFIX}/usr")
1161 + )
1162 + fi
1163 +
1164 + # MySQL support
1165 + local mysqllib="mysqlnd"
1166 + local mysqlilib="mysqlnd"
1167 +
1168 + our_conf+=( $(use_with mysqli mysqli "${mysqlilib}") )
1169 +
1170 + local mysqlsock="${EPREFIX}/var/run/mysqld/mysqld.sock"
1171 + if use mysql || use mysqli ; then
1172 + our_conf+=( $(use_with mysql mysql-sock "${mysqlsock}") )
1173 + fi
1174 +
1175 + # ODBC support
1176 + our_conf+=(
1177 + $(use_with odbc unixODBC "${EPREFIX}/usr")
1178 + $(use_with iodbc iodbc "${EPREFIX}/usr")
1179 + )
1180 +
1181 + # Oracle support
1182 + our_conf+=( $(use_with oci8-instant-client oci8) )
1183 +
1184 + # PDO support
1185 + if use pdo ; then
1186 + our_conf+=(
1187 + $(use_with mssql pdo-dblib "${EPREFIX}/usr")
1188 + $(use_with mysql pdo-mysql "${mysqllib}")
1189 + $(use_with postgres pdo-pgsql)
1190 + $(use_with sqlite pdo-sqlite "${EPREFIX}/usr")
1191 + $(use_with firebird pdo-firebird "${EPREFIX}/usr")
1192 + $(use_with odbc pdo-odbc "unixODBC,${EPREFIX}/usr")
1193 + $(use_with oci8-instant-client pdo-oci)
1194 + )
1195 + fi
1196 +
1197 + # readline/libedit support
1198 + our_conf+=(
1199 + $(use_with readline readline "${EPREFIX}/usr")
1200 + $(use_with libedit libedit "${EPREFIX}/usr")
1201 + )
1202 +
1203 + # Session support
1204 + if use session ; then
1205 + our_conf+=( $(use_with session-mm mm "${EPREFIX}/usr") )
1206 + else
1207 + our_conf+=( $(use_enable session session) )
1208 + fi
1209 +
1210 + # Use pic for shared modules such as apache2's mod_php
1211 + our_conf+=( --with-pic )
1212 +
1213 + # we use the system copy of pcre
1214 + # --with-pcre-regex affects ext/pcre
1215 + # --with-pcre-dir affects ext/filter and ext/zip
1216 + # --with-pcre-valgrind cannot be enabled with system pcre
1217 + # Many arches don't support pcre-jit
1218 + our_conf+=(
1219 + --with-pcre-regex="${EPREFIX}/usr"
1220 + --with-pcre-dir="${EPREFIX}/usr"
1221 + --without-pcre-valgrind
1222 + --without-pcre-jit
1223 + )
1224 +
1225 + # Catch CFLAGS problems
1226 + # Fixes bug #14067.
1227 + # Changed order to run it in reverse for bug #32022 and #12021.
1228 + replace-cpu-flags "k6*" "i586"
1229 +
1230 + # Cache the ./configure test results between SAPIs.
1231 + our_conf+=( --cache-file="${T}/config.cache" )
1232 +
1233 + # Support user-passed configuration parameters
1234 + our_conf+=( ${EXTRA_ECONF:-} )
1235 +
1236 + # Support the Apache2 extras, they must be set globally for all
1237 + # SAPIs to work correctly, especially for external PHP extensions
1238 +
1239 + local one_sapi
1240 + local sapi
1241 + mkdir -p "${WORKDIR}/sapis-build" || die
1242 + for one_sapi in $SAPIS ; do
1243 + use "${one_sapi}" || continue
1244 + php_set_ini_dir "${one_sapi}"
1245 +
1246 + # The BUILD_DIR variable is used to determine where to output
1247 + # the files that autotools creates. This was all originally
1248 + # based on the autotools-utils eclass.
1249 + BUILD_DIR="${WORKDIR}/sapis-build/${one_sapi}"
1250 + cp -a "${S}" "${BUILD_DIR}" || die
1251 + cd "${BUILD_DIR}" || die
1252 +
1253 + local sapi_conf=(
1254 + --with-config-file-path="${PHP_INI_DIR}"
1255 + --with-config-file-scan-dir="${PHP_EXT_INI_DIR_ACTIVE}"
1256 + )
1257 +
1258 + for sapi in $SAPIS ; do
1259 + case "$sapi" in
1260 + cli|cgi|embed|fpm|phpdbg)
1261 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
1262 + sapi_conf+=( "--enable-${sapi}" )
1263 + if [[ "fpm" == "${sapi}" ]] ; then
1264 + sapi_conf+=(
1265 + $(use_with acl fpm-acl)
1266 + $(use_with systemd fpm-systemd)
1267 + )
1268 + fi
1269 + else
1270 + sapi_conf+=( "--disable-${sapi}" )
1271 + fi
1272 + ;;
1273 +
1274 + apache2)
1275 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
1276 + sapi_conf+=( --with-apxs2="${EPREFIX}/usr/bin/apxs" )
1277 + else
1278 + sapi_conf+=( --without-apxs2 )
1279 + fi
1280 + ;;
1281 + esac
1282 + done
1283 +
1284 + # Construct the $myeconfargs array by concatenating $our_conf
1285 + # (the common args) and $sapi_conf (the SAPI-specific args).
1286 + local myeconfargs=( "${our_conf[@]}" )
1287 + myeconfargs+=( "${sapi_conf[@]}" )
1288 +
1289 + pushd "${BUILD_DIR}" > /dev/null || die
1290 + econf "${myeconfargs[@]}"
1291 + popd > /dev/null || die
1292 + done
1293 +}
1294 +
1295 +src_compile() {
1296 + # snmp seems to run during src_compile, too (bug #324739)
1297 + addpredict /usr/share/snmp/mibs/.index #nowarn
1298 + addpredict /var/lib/net-snmp/mib_indexes #nowarn
1299 +
1300 + local sapi
1301 + for sapi in ${SAPIS} ; do
1302 + if use "${sapi}"; then
1303 + cd "${WORKDIR}/sapis-build/$sapi" || \
1304 + die "Failed to change dir to ${WORKDIR}/sapis-build/$1"
1305 + emake
1306 + fi
1307 + done
1308 +}
1309 +
1310 +src_install() {
1311 + # see bug #324739 for what happens when we don't have that
1312 + addpredict /usr/share/snmp/mibs/.index #nowarn
1313 +
1314 + # grab the first SAPI that got built and install common files from there
1315 + local first_sapi="", sapi=""
1316 + for sapi in $SAPIS ; do
1317 + if use $sapi ; then
1318 + first_sapi=$sapi
1319 + break
1320 + fi
1321 + done
1322 +
1323 + # Makefile forgets to create this before trying to write to it...
1324 + dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
1325 +
1326 + # Install php environment (without any sapis)
1327 + cd "${WORKDIR}/sapis-build/$first_sapi" || die
1328 + emake INSTALL_ROOT="${D}" \
1329 + install-build install-headers install-programs
1330 +
1331 + local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
1332 +
1333 + # Create the directory where we'll put version-specific php scripts
1334 + keepdir "/usr/share/php${PHP_MV}"
1335 +
1336 + local file=""
1337 + local sapi_list=""
1338 +
1339 + for sapi in ${SAPIS}; do
1340 + if use "${sapi}" ; then
1341 + einfo "Installing SAPI: ${sapi}"
1342 + cd "${WORKDIR}/sapis-build/${sapi}" || die
1343 +
1344 + if [[ "${sapi}" == "apache2" ]] ; then
1345 + # We're specifically not using emake install-sapi as libtool
1346 + # may cause unnecessary relink failures (see bug #351266)
1347 + insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
1348 + newins ".libs/libphp${PHP_MV}$(get_libname)" \
1349 + "libphp${PHP_MV}$(get_libname)"
1350 + keepdir "/usr/$(get_libdir)/apache2/modules"
1351 + else
1352 + # needed each time, php_install_ini would reset it
1353 + local dest="${PHP_DESTDIR#${EPREFIX}}"
1354 + into "${dest}"
1355 + case "$sapi" in
1356 + cli)
1357 + source="sapi/cli/php"
1358 + # Install the "phar" archive utility.
1359 + if use phar ; then
1360 + emake INSTALL_ROOT="${D}" install-pharcmd
1361 + dosym "..${dest#/usr}/bin/phar" "/usr/bin/phar${SLOT}"
1362 + fi
1363 + ;;
1364 + cgi)
1365 + source="sapi/cgi/php-cgi"
1366 + ;;
1367 + fpm)
1368 + source="sapi/fpm/php-fpm"
1369 + ;;
1370 + embed)
1371 + source="libs/libphp${PHP_MV}$(get_libname)"
1372 + ;;
1373 + phpdbg)
1374 + source="sapi/phpdbg/phpdbg"
1375 + ;;
1376 + *)
1377 + die "unhandled sapi in src_install"
1378 + ;;
1379 + esac
1380 +
1381 + if [[ "${source}" == *"$(get_libname)" ]]; then
1382 + dolib.so "${source}"
1383 + else
1384 + dobin "${source}"
1385 + local name="$(basename ${source})"
1386 + dosym "..${dest#/usr}/bin/${name}" "/usr/bin/${name}${SLOT}"
1387 + fi
1388 + fi
1389 +
1390 + php_install_ini "${sapi}"
1391 +
1392 + # construct correct SAPI string for php-config
1393 + # thanks to ferringb for the bash voodoo
1394 + if [[ "${sapi}" == "apache2" ]]; then
1395 + sapi_list="${sapi_list:+${sapi_list} }apache2handler"
1396 + else
1397 + sapi_list="${sapi_list:+${sapi_list} }${sapi}"
1398 + fi
1399 + fi
1400 + done
1401 +
1402 + # Installing opcache module
1403 + if use opcache ; then
1404 + into "${PHP_DESTDIR#${EPREFIX}}"
1405 + dolib.so "modules/opcache$(get_libname)"
1406 + fi
1407 +
1408 + # Install env.d files
1409 + newenvd "${FILESDIR}/20php5-envd" "20php${SLOT}"
1410 + sed -e "s|/lib/|/$(get_libdir)/|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
1411 + sed -e "s|php5|php${SLOT}|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
1412 +
1413 + # set php-config variable correctly (bug #278439)
1414 + sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
1415 + "${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config" || die
1416 +
1417 + if use fpm ; then
1418 + if use systemd; then
1419 + systemd_newunit "${FILESDIR}/php-fpm_at.service" \
1420 + "php-fpm@${SLOT}.service"
1421 + else
1422 + systemd_newunit "${FILESDIR}/php-fpm_at-simple.service" \
1423 + "php-fpm@${SLOT}.service"
1424 + fi
1425 + fi
1426 +}
1427 +
1428 +src_test() {
1429 + echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
1430 + PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php"
1431 + if [[ ! -x "${PHP_BIN}" ]] ; then
1432 + ewarn "Test phase requires USE=cli, skipping"
1433 + return
1434 + else
1435 + export TEST_PHP_EXECUTABLE="${PHP_BIN}"
1436 + fi
1437 +
1438 + if [[ -x "${WORKDIR}/sapis-build/cgi/sapi/cgi/php-cgi" ]] ; then
1439 + export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis-build/cgi/sapi/cgi/php-cgi"
1440 + fi
1441 +
1442 + if [[ -x "${WORKDIR}/sapis-build/phpdbg/sapi/phpdbg/phpdbg" ]] ; then
1443 + export TEST_PHPDBG_EXECUTABLE="${WORKDIR}/sapis-build/phpdbg/sapi/phpdbg/phpdbg"
1444 + fi
1445 +
1446 + REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d \
1447 + "session.save_path=${T}" \
1448 + "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d \
1449 + "session.save_path=${T}"
1450 +
1451 + for name in ${EXPECTED_TEST_FAILURES}; do
1452 + mv "${name}.out" "${name}.out.orig" 2>/dev/null || die
1453 + done
1454 +
1455 + local failed="$(find -name '*.out')"
1456 + if [[ ${failed} != "" ]] ; then
1457 + ewarn "The following test cases failed unexpectedly:"
1458 + for name in ${failed}; do
1459 + ewarn " ${name/.out/}"
1460 + done
1461 + else
1462 + einfo "No unexpected test failures, all fine"
1463 + fi
1464 +
1465 + if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
1466 + local passed=""
1467 + for name in ${EXPECTED_TEST_FAILURES}; do
1468 + [[ -f "${name}.diff" ]] && continue
1469 + passed="${passed} ${name}"
1470 + done
1471 + if [[ ${passed} != "" ]] ; then
1472 + einfo "The following test cases passed unexpectedly:"
1473 + for name in ${passed}; do
1474 + ewarn " ${passed}"
1475 + done
1476 + else
1477 + einfo "None of the known-to-fail tests passed, all fine"
1478 + fi
1479 + fi
1480 +}
1481 +
1482 +pkg_postinst() {
1483 + # Output some general info to the user
1484 + if use apache2 ; then
1485 + elog
1486 + elog "To enable PHP in apache, you will need to add \"-D PHP\" to"
1487 + elog "your apache2 command. OpenRC users can append that string to"
1488 + elog "APACHE2_OPTS in /etc/conf.d/apache2."
1489 + elog
1490 + elog "The apache module configuration file 70_mod_php.conf is"
1491 + elog "provided (and maintained) by eselect-php."
1492 + elog
1493 + fi
1494 +
1495 + # Create the symlinks for php
1496 + local m
1497 + for m in ${SAPIS}; do
1498 + [[ ${m} == 'embed' ]] && continue;
1499 + if use $m ; then
1500 + local ci=$(eselect php show $m)
1501 + if [[ -z $ci ]]; then
1502 + eselect php set $m php${SLOT} || die
1503 + einfo "Switched ${m} to use php:${SLOT}"
1504 + einfo
1505 + elif [[ $ci != "php${SLOT}" ]] ; then
1506 + elog "To switch $m to use php:${SLOT}, run"
1507 + elog " eselect php set $m php${SLOT}"
1508 + elog
1509 + fi
1510 + fi
1511 + done
1512 +
1513 + # Remove dead symlinks for SAPIs that were just disabled. For
1514 + # example, if the user has the cgi SAPI enabled, then he has an
1515 + # eselect-php symlink for it. If he later reinstalls PHP with
1516 + # USE="-cgi", that symlink will break. This call to eselect is
1517 + # supposed to remove that dead link per bug 572436.
1518 + eselect php cleanup || die
1519 +
1520 + if ! has "php${SLOT/./-}" ${PHP_TARGETS}; then
1521 + elog "To build extensions for this version of PHP, you will need to"
1522 + elog "add php${SLOT/./-} to your PHP_TARGETS USE_EXPAND variable."
1523 + elog
1524 + fi
1525 +
1526 + # Warn about the removal of PHP_INI_VERSION if the user has it set.
1527 + if [[ -n "${PHP_INI_VERSION}" ]]; then
1528 + ewarn 'The PHP_INI_VERSION variable has been phased out. You may'
1529 + ewarn 'remove it from your configuration at your convenience. See'
1530 + ewarn
1531 + ewarn ' https://bugs.gentoo.org/611214'
1532 + ewarn
1533 + ewarn 'for more information.'
1534 + fi
1535 +
1536 + elog "For details on how version slotting works, please see"
1537 + elog "the wiki:"
1538 + elog
1539 + elog " https://wiki.gentoo.org/wiki/PHP"
1540 + elog
1541 +}
1542 +
1543 +pkg_postrm() {
1544 + # This serves two purposes. First, if we have just removed the last
1545 + # installed version of PHP, then this will remove any dead symlinks
1546 + # belonging to eselect-php. Second, if a user upgrades slots from
1547 + # (say) 5.6 to 7.0 and depcleans the old slot, then this will update
1548 + # his existing symlinks to point to the new 7.0 installation. The
1549 + # latter is bug 432962.
1550 + #
1551 + # Note: the eselect-php package may not be installed at this point,
1552 + # so we can't die() if this command fails.
1553 + eselect php cleanup
1554 +}