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