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