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