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, 04 Aug 2022 17:56:18
Message-Id: 1659635771.05382de84c156c99378bee7656c4eba4baef9a8f.grknight@gentoo
1 commit: 05382de84c156c99378bee7656c4eba4baef9a8f
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Thu Aug 4 16:38:14 2022 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Thu Aug 4 17:56:11 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=05382de8
7
8 dev-lang/php: Version bump for 8.1.9
9
10 Signed-off-by: Brian Evans <grknight <AT> gentoo.org>
11
12 dev-lang/php/Manifest | 1 +
13 dev-lang/php/php-8.1.9.ebuild | 756 ++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 757 insertions(+)
15
16 diff --git a/dev-lang/php/Manifest b/dev-lang/php/Manifest
17 index 79d898306f06..440f3f16edd7 100644
18 --- a/dev-lang/php/Manifest
19 +++ b/dev-lang/php/Manifest
20 @@ -2,3 +2,4 @@ DIST php-7.4.30.tar.xz 10419136 BLAKE2B 5860ead4051173d3139f93be24f15c7ed2044a9e
21 DIST php-8.0.20.tar.xz 10879064 BLAKE2B 3b18d6593ddc78e1c289b87ba8bb65e55cbd815d2b06d4f9759265e9ae76ea6b78dc9f52652be1b1a721ccfe736f80d2a8f59c01ba4c38a8ff46710753bcc9ed SHA512 24153733111bb5104298679fb5ee02d8abad4e6b2a8e0a07c2a6076e1c9104309abe56bcb7b5fe17670c266e5e9981c520ed0ac12b699ae0050953ff99ef04fa
22 DIST php-8.0.21.tar.xz 10785364 BLAKE2B ea8a640b47c96b235b49ce3a98accbfa4aa967c7e917684e19667a74ca0f77e070847dabdf15c3dbd56cff01ef662e79e9408d3e57e870e51893e969291a0932 SHA512 c1c1577f3d6af445d8ac15338877186f2a639a76ad980328011cb0a5e9592bdb24c1cda7ae8a0c495c881497d54cbca6e1373ede71bf097e69a040368841d567
23 DIST php-8.1.8.tar.xz 11722100 BLAKE2B 117e0823b47485d4fc469edfbc5e9051b5d35588bf36a2d9e12282b83c12056cfc2a4376bf0e21b5f947190a906e3e4fdde7bec20b7ea7e9ab36912e865c2c13 SHA512 4ef03b4c412bdbcdf6c3dc4784b3218a0519e6b91a0682e796270d4426c05c62309b4835ea31271857a5f2535d00f20a9f9b4a79703a49c3e40f16fafa948dd4
24 +DIST php-8.1.9.tar.xz 11787892 BLAKE2B f35911f272e0c0118841d713e52a347b001324d9456613b749e06031a6a2a292e4c813c950e329889af46f2e585eb3de92f825cff9bcb51f09b74e056fedda75 SHA512 a75731edbfa6e8841d4c836336b07fd7aec4668b3d38487e630015cfc9d76fdfd04bae946d4fe783679df05adee7e2617b42ca4d3c2415c0f88ed5bffad87d7d
25
26 diff --git a/dev-lang/php/php-8.1.9.ebuild b/dev-lang/php/php-8.1.9.ebuild
27 new file mode 100644
28 index 000000000000..08ae68bc439d
29 --- /dev/null
30 +++ b/dev-lang/php/php-8.1.9.ebuild
31 @@ -0,0 +1,756 @@
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 +
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 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-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 apparmor 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 +jit kerberos ldap ldap-sasl libedit 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 xpm xslt zip zlib"
78 +
79 +# Without USE=readline or libedit, the interactive "php -a" CLI will hang.
80 +# The Oracle instant client provides its own incompatible ldap library.
81 +REQUIRED_USE="
82 + || ( cli cgi fpm apache2 embed phpdbg )
83 + cli? ( ^^ ( readline libedit ) )
84 + !cli? ( ?? ( readline libedit ) )
85 + truetype? ( gd zlib )
86 + webp? ( gd zlib )
87 + cjk? ( gd zlib )
88 + exif? ( gd zlib )
89 + xpm? ( gd zlib )
90 + gd? ( zlib )
91 + simplexml? ( xml )
92 + soap? ( xml )
93 + xmlreader? ( xml )
94 + xmlwriter? ( xml )
95 + xslt? ( xml )
96 + ldap-sasl? ( ldap )
97 + oci8-instant-client? ( !ldap )
98 + qdbm? ( !gdbm )
99 + session-mm? ( session !threads )
100 + mysql? ( || ( mysqli pdo ) )
101 + firebird? ( pdo )
102 + mssql? ( pdo )
103 +"
104 +
105 +RESTRICT="!test? ( test )"
106 +
107 +# The supported (that is, autodetected) versions of BDB are listed in
108 +# the ./configure script. Other versions *work*, but we need to stick to
109 +# the ones that can be detected to avoid a repeat of bug #564824.
110 +COMMON_DEPEND="
111 + >=app-eselect/eselect-php-0.9.7[apache2?,fpm?]
112 + >=dev-libs/libpcre2-10.30[jit?,unicode]
113 + fpm? ( acl? ( sys-apps/acl ) apparmor? ( sys-libs/libapparmor ) )
114 + apache2? ( www-servers/apache[apache2_modules_unixd(+),threads=] )
115 + argon2? ( app-crypt/argon2:= )
116 + berkdb? ( || ( sys-libs/db:5.3 sys-libs/db:4.8 ) )
117 + bzip2? ( app-arch/bzip2:0= )
118 + cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
119 + coverage? ( dev-util/lcov )
120 + curl? ( >=net-misc/curl-7.29.0 )
121 + enchant? ( app-text/enchant:2 )
122 + ffi? ( >=dev-libs/libffi-3.0.11:= )
123 + firebird? ( dev-db/firebird )
124 + gd? ( media-libs/libjpeg-turbo:0= media-libs/libpng:0= )
125 + gdbm? ( >=sys-libs/gdbm-1.8.0:0= )
126 + gmp? ( dev-libs/gmp:0= )
127 + iconv? ( virtual/libiconv )
128 + imap? ( >=virtual/imap-c-client-2[kerberos=,ssl=] )
129 + intl? ( dev-libs/icu:= )
130 + kerberos? ( virtual/krb5 )
131 + ldap? ( >=net-nds/openldap-1.2.11:= )
132 + ldap-sasl? ( dev-libs/cyrus-sasl )
133 + libedit? ( dev-libs/libedit )
134 + lmdb? ( dev-db/lmdb:= )
135 + mssql? ( dev-db/freetds[mssql] )
136 + nls? ( sys-devel/gettext )
137 + oci8-instant-client? ( dev-db/oracle-instantclient[sdk] )
138 + odbc? ( iodbc? ( dev-db/libiodbc ) !iodbc? ( >=dev-db/unixODBC-1.8.13 ) )
139 + postgres? ( >=dev-db/postgresql-9.1:* )
140 + qdbm? ( dev-db/qdbm )
141 + readline? ( sys-libs/readline:0= )
142 + session-mm? ( dev-libs/mm )
143 + snmp? ( >=net-analyzer/net-snmp-5.2 )
144 + sodium? ( dev-libs/libsodium:=[-minimal] )
145 + spell? ( >=app-text/aspell-0.50 )
146 + sqlite? ( >=dev-db/sqlite-3.7.6.3 )
147 + ssl? ( >=dev-libs/openssl-1.0.2:0= )
148 + tidy? ( app-text/htmltidy )
149 + tokyocabinet? ( dev-db/tokyocabinet )
150 + truetype? ( =media-libs/freetype-2* )
151 + unicode? ( dev-libs/oniguruma:= )
152 + webp? ( media-libs/libwebp:0= )
153 + xml? ( >=dev-libs/libxml2-2.9.0 )
154 + xpm? ( x11-libs/libXpm )
155 + xslt? ( dev-libs/libxslt )
156 + zip? ( >=dev-libs/libzip-1.2.0:= )
157 + zlib? ( >=sys-libs/zlib-1.2.0.4:0= )
158 +"
159 +
160 +IDEPEND=">=app-eselect/eselect-php-0.9.7[apache2?,fpm?]"
161 +
162 +RDEPEND="${COMMON_DEPEND}
163 + virtual/mta
164 + fpm? (
165 + selinux? ( sec-policy/selinux-phpfpm )
166 + systemd? ( sys-apps/systemd ) )"
167 +
168 +# Bison isn't actually needed when building from a release tarball
169 +# However, the configure script will warn if it's absent or if you
170 +# have an incompatible version installed. See bug 593278.
171 +DEPEND="${COMMON_DEPEND}
172 + app-arch/xz-utils
173 + >=sys-devel/bison-3.0.1"
174 +
175 +BDEPEND="virtual/pkgconfig"
176 +
177 +PHP_MV="$(ver_cut 1)"
178 +
179 +PATCHES=(
180 + "${FILESDIR}/php-iodbc-header-location.patch"
181 +)
182 +
183 +php_install_ini() {
184 + local phpsapi="${1}"
185 +
186 + # work out where we are installing the ini file
187 + php_set_ini_dir "${phpsapi}"
188 +
189 + # Always install the production INI file, bug 611214.
190 + local phpinisrc="php.ini-production-${phpsapi}"
191 + cp php.ini-production "${phpinisrc}" || die
192 +
193 + # default to /tmp for save_path, bug #282768
194 + sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}" || die
195 +
196 + # Set the extension dir
197 + sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" \
198 + -i "${phpinisrc}" || die
199 +
200 + # Set the include path to point to where we want to find PEAR packages
201 + sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}" || die
202 +
203 + insinto "${PHP_INI_DIR#${EPREFIX}}"
204 + newins "${phpinisrc}" php.ini
205 +
206 + elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
207 + elog
208 +
209 + dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
210 + dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
211 +
212 + if use opcache; then
213 + elog "Adding opcache to $PHP_EXT_INI_DIR"
214 + echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> \
215 + "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
216 + dosym "../ext/opcache.ini" \
217 + "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
218 + fi
219 +
220 + # SAPI-specific handling
221 + if [[ "${sapi}" == "fpm" ]] ; then
222 + einfo "Installing FPM config files php-fpm.conf and www.conf"
223 + insinto "${PHP_INI_DIR#${EPREFIX}}"
224 + doins sapi/fpm/php-fpm.conf
225 + insinto "${PHP_INI_DIR#${EPREFIX}}/fpm.d"
226 + doins sapi/fpm/www.conf
227 + fi
228 +
229 + dodoc php.ini-{development,production}
230 +}
231 +
232 +php_set_ini_dir() {
233 + PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
234 + PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
235 + PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
236 +}
237 +
238 +src_prepare() {
239 + default
240 +
241 + # In php-7.x, the FPM pool configuration files have been split off
242 + # of the main config. By default the pool config files go in
243 + # e.g. /etc/php-fpm.d, which isn't slotted. So here we move the
244 + # include directory to a subdirectory "fpm.d" of $PHP_INI_DIR. Later
245 + # we'll install the pool configuration file "www.conf" there.
246 + php_set_ini_dir fpm
247 + sed -i "s~^include=.*$~include=${PHP_INI_DIR}/fpm.d/*.conf~" \
248 + sapi/fpm/php-fpm.conf.in \
249 + || die 'failed to move the include directory in php-fpm.conf'
250 +
251 + # Emulate buildconf to support cross-compilation
252 + rm -fr aclocal.m4 autom4te.cache config.cache \
253 + configure main/php_config.h.in || die
254 + eautoconf --force
255 + eautoheader
256 +
257 + # Remove false positive test failures
258 + # stream_isatty fails due to portage redirects
259 + # curl tests here fail for network sandbox issues
260 + # session tests here fail because we set the session directory to $T
261 + rm tests/output/stream_isatty_err.phpt \
262 + tests/output/stream_isatty_out-err.phpt \
263 + tests/output/stream_isatty_out.phpt \
264 + ext/curl/tests/bug76675.phpt \
265 + ext/curl/tests/bug77535.phpt \
266 + ext/curl/tests/curl_error_basic.phpt \
267 + ext/session/tests/bug74514.phpt \
268 + ext/session/tests/bug74936.phpt || die
269 +
270 +}
271 +
272 +src_configure() {
273 + addpredict /usr/share/snmp/mibs/.index #nowarn
274 + addpredict /var/lib/net-snmp/mib_indexes #nowarn
275 +
276 + PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
277 +
278 + # The php-fpm config file wants localstatedir to be ${EPREFIX}/var
279 + # and not the Gentoo default ${EPREFIX}/var/lib. See bug 572002.
280 + local our_conf=(
281 + --prefix="${PHP_DESTDIR}"
282 + --mandir="${PHP_DESTDIR}/man"
283 + --infodir="${PHP_DESTDIR}/info"
284 + --libdir="${PHP_DESTDIR}/lib"
285 + --with-libdir="$(get_libdir)"
286 + --localstatedir="${EPREFIX}/var"
287 + --without-pear
288 + $(use_enable threads zts)
289 + )
290 +
291 + our_conf+=(
292 + $(use_with apparmor fpm-apparmor)
293 + $(use_with argon2 password-argon2 "${EPREFIX}/usr")
294 + $(use_enable bcmath)
295 + $(use_with bzip2 bz2 "${EPREFIX}/usr")
296 + $(use_enable calendar)
297 + $(use_enable coverage gcov)
298 + $(use_enable ctype)
299 + $(use_with curl)
300 + $(use_enable xml dom)
301 + $(use_with enchant)
302 + $(use_enable exif)
303 + $(use_with ffi)
304 + $(use_enable fileinfo)
305 + $(use_enable filter)
306 + $(use_enable ftp)
307 + $(use_with nls gettext "${EPREFIX}/usr")
308 + $(use_with gmp gmp "${EPREFIX}/usr")
309 + $(use_with mhash mhash "${EPREFIX}/usr")
310 + $(use_with iconv iconv \
311 + $(use elibc_glibc || use elibc_musl || echo "${EPREFIX}/usr"))
312 + $(use_enable intl)
313 + $(use_enable ipv6)
314 + $(use_with kerberos)
315 + $(use_with xml libxml)
316 + $(use_enable unicode mbstring)
317 + $(use_with ssl openssl)
318 + $(use_enable pcntl)
319 + $(use_enable phar)
320 + $(use_enable pdo)
321 + $(use_enable opcache)
322 + $(use_with postgres pgsql "${EPREFIX}/usr")
323 + $(use_enable posix)
324 + $(use_with spell pspell "${EPREFIX}/usr")
325 + $(use_enable simplexml)
326 + $(use_enable sharedmem shmop)
327 + $(use_with snmp snmp "${EPREFIX}/usr")
328 + $(use_enable soap)
329 + $(use_enable sockets)
330 + $(use_with sodium)
331 + $(use_with sqlite sqlite3)
332 + $(use_enable sysvipc sysvmsg)
333 + $(use_enable sysvipc sysvsem)
334 + $(use_enable sysvipc sysvshm)
335 + $(use_with tidy tidy "${EPREFIX}/usr")
336 + $(use_enable tokenizer)
337 + $(use_enable xml)
338 + $(use_enable xmlreader)
339 + $(use_enable xmlwriter)
340 + $(use_with xslt xsl)
341 + $(use_with zip)
342 + $(use_with zlib zlib "${EPREFIX}/usr")
343 + $(use_enable debug)
344 + )
345 +
346 + # DBA support
347 + if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
348 + || use qdbm || use lmdb || use tokyocabinet ; then
349 + our_conf+=( "--enable-dba" )
350 + fi
351 +
352 + # DBA drivers support
353 + our_conf+=(
354 + $(use_with cdb)
355 + $(use_with berkdb db4 "${EPREFIX}/usr")
356 + $(use_enable flatfile)
357 + $(use_with gdbm gdbm "${EPREFIX}/usr")
358 + $(use_enable inifile)
359 + $(use_with qdbm qdbm "${EPREFIX}/usr")
360 + $(use_with tokyocabinet tcadb "${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)
367 + $(use_enable cjk gd-jis-conv)
368 + $(use_with gd jpeg)
369 + $(use_with xpm)
370 + $(use_with webp)
371 + )
372 + # enable gd last, so configure can pick up the previous settings
373 + our_conf+=( $(use_enable gd) )
374 +
375 + # IMAP support
376 + if use imap ; then
377 + our_conf+=(
378 + $(use_with imap imap "${EPREFIX}/usr")
379 + $(use_with ssl imap-ssl "${EPREFIX}/usr")
380 + )
381 + fi
382 +
383 + # LDAP support
384 + if use ldap ; then
385 + our_conf+=(
386 + $(use_with ldap ldap "${EPREFIX}/usr")
387 + $(use_with ldap-sasl)
388 + )
389 + fi
390 +
391 + # MySQL support
392 + our_conf+=( $(use_with mysqli mysqli "mysqlnd") )
393 +
394 + local mysqlsock="${EPREFIX}/var/run/mysqld/mysqld.sock"
395 + if use mysql || use mysqli ; then
396 + our_conf+=( $(use_with mysql mysql-sock "${mysqlsock}") )
397 + fi
398 +
399 + # ODBC support
400 + if use odbc && use iodbc ; then
401 + our_conf+=(
402 + --without-unixODBC
403 + --with-iodbc
404 + $(use_with pdo pdo-odbc "iODBC,${EPREFIX}/usr")
405 + )
406 + elif use odbc ; then
407 + our_conf+=(
408 + --with-unixODBC="${EPREFIX}/usr"
409 + --without-iodbc
410 + $(use_with pdo pdo-odbc "unixODBC,${EPREFIX}/usr")
411 + )
412 + else
413 + our_conf+=(
414 + --without-unixODBC
415 + --without-iodbc
416 + --without-pdo-odbc
417 + )
418 + fi
419 +
420 + # Oracle support
421 + our_conf+=( $(use_with oci8-instant-client oci8) )
422 +
423 + # PDO support
424 + if use pdo ; then
425 + our_conf+=(
426 + $(use_with mssql pdo-dblib "${EPREFIX}/usr")
427 + $(use_with mysql pdo-mysql "mysqlnd")
428 + $(use_with postgres pdo-pgsql)
429 + $(use_with sqlite pdo-sqlite)
430 + $(use_with firebird pdo-firebird "${EPREFIX}/usr")
431 + $(use_with oci8-instant-client pdo-oci)
432 + )
433 + fi
434 +
435 + # readline/libedit support
436 + our_conf+=(
437 + $(use_with readline readline "${EPREFIX}/usr")
438 + $(use_with libedit)
439 + )
440 +
441 + # Session support
442 + if use session ; then
443 + our_conf+=( $(use_with session-mm mm "${EPREFIX}/usr") )
444 + else
445 + our_conf+=( $(use_enable session) )
446 + fi
447 +
448 + # Use pic for shared modules such as apache2's mod_php
449 + our_conf+=( --with-pic )
450 +
451 + # we use the system copy of pcre
452 + # --with-external-pcre affects ext/pcre
453 + our_conf+=(
454 + --with-external-pcre
455 + $(use_with jit 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$(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$(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 + SKIP_ONLINE_TESTS=1 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 +}