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, 30 Dec 2021 16:15:47
Message-Id: 1640880922.d41e30e4512a37843bd20148db23859312421182.grknight@gentoo
1 commit: d41e30e4512a37843bd20148db23859312421182
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Thu Dec 30 16:15:22 2021 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Thu Dec 30 16:15:22 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d41e30e4
7
8 dev-lang/php: Version bump for 7.4.27
9
10 Signed-off-by: Brian Evans <grknight <AT> gentoo.org>
11
12 dev-lang/php/Manifest | 1 +
13 dev-lang/php/php-7.4.27.ebuild | 745 +++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 746 insertions(+)
15
16 diff --git a/dev-lang/php/Manifest b/dev-lang/php/Manifest
17 index 6388dd7116cb..e255f0837c83 100644
18 --- a/dev-lang/php/Manifest
19 +++ b/dev-lang/php/Manifest
20 @@ -2,6 +2,7 @@ DIST php-7.3.32.tar.xz 12142436 BLAKE2B 375092f7fade8b93d2fbf409552cda42a6852672
21 DIST php-7.3.33.tar.xz 12143820 BLAKE2B 77b5ada50169b308b42dbf2c69b5aebd6e9ab9663be8de5bd26391e42015d856631f12b0268b98889f2c3058564a6c71ad298b725b8afff920e277aa3e787422 SHA512 b05edb3e87775c0b2d7bd5990e47751279076e6ef2356f59dc917f4a1447d95894f596cd8de711f03278650ff74ff9f2687ed96cec69d2d669a6af563a455e25
22 DIST php-7.4.25.tar.xz 10376304 BLAKE2B 75682840a9e978d2ce350892bb8d743238f1ca86d4e1bb549637ad259541264c911128d3fbb2a89768acaa366eac91e66b26f8411f6b9f6d55475b139f5ae95a SHA512 7fcb236f6d2a92514059b2e107c2b592e6139e3c65046566ae98fb9d2c09eb3e9ca1a41ea6535fc814bc7127d8fd9f8bb5a80bd86eec32120eb150a34b9b5c34
23 DIST php-7.4.26.tar.xz 10420236 BLAKE2B d4675ecf3632bb63e24d2f3cdef10c01fbf4a7a28384abc1e2eeb9ae7dc4ecfe341b95d946e182647837f4e082f0261e2ba921822ec5844b7fe833bf639197b7 SHA512 36cd493c9c95aabb1ee47e82cb0c20b2be99fe7ebd98743355139064590d0b9a1746d71e31dd47f164df34ebe3f8366a75f3efc149262e1391b43d83d3045c6e
24 +DIST php-7.4.27.tar.xz 10419380 BLAKE2B e62218f54f0455377f085499b3fa75d9d9a33c81d621ac4303cee59e70565a3cd9bfa6372ebb3492a4093eb22bf101653b6e8b3804cb8795db5d5ac2845de2f5 SHA512 2401f19d738a511c20efdf199fed7a6bdd02b51d91abf68a410f760cf846df87fce4bbf71acdf209926877cf3e8f8f39f045f1f03755862d09491f6ab6c9cfc8
25 DIST php-8.0.12.tar.xz 10713980 BLAKE2B ce8ca0d671e8613a81744a55cf94ff43254482a08dec365c05eb4ca22c1b31732e5ef93a51d383d2e8daf0cf332ed7946e79ba3b385386ca0773fc673fe58307 SHA512 927b15c4443f3741a5325ec7bf387987b405cd5e64e40fd81f1945bf073adda30eeede8e1f98185f505cb61f969cf1abe05b8dad57a3c4e87971e8037bb16b23
26 DIST php-8.0.13.tar.xz 10854284 BLAKE2B 7f232dcfc89f0803cf1f1eff664fa9e16436d6b3c5a22c0454432a546e848a8e962057820866a85cb2af1234a0c0fa38f813c62be90526dbeab483f0e9095fd3 SHA512 cb00482b74146670c4644f4b5da63b40d9afd111e198cdf1e67bfcf4280501a657b4fbad8fd7580f4e3f537db3c8a9db5f4115d3a466392cefac9866e233fa49
27 DIST php-8.0.14.tar.xz 10860176 BLAKE2B e63e8e4446c1e1ee0bdf6faf38ce95a793107e582bd74677555d6f3576184af73d454111f14cd680086b11f288222d1ad5fb0e5ee38df53cd476fab6015b7fa7 SHA512 1fb96dd7e229dd71d0e872c8450e18bdefadebaf0b6b6429bd5d054be1b940cd2d53f132ba2d166d454b89374e79e4ea02d483320792e983d572df68ef769788
28
29 diff --git a/dev-lang/php/php-7.4.27.ebuild b/dev-lang/php/php-7.4.27.ebuild
30 new file mode 100644
31 index 000000000000..2ef10fa15f96
32 --- /dev/null
33 +++ b/dev-lang/php/php-7.4.27.ebuild
34 @@ -0,0 +1,745 @@
35 +# Copyright 1999-2021 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 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 +json 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 xmlrpc 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 + xmlrpc? ( xml iconv )
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.1[apache2?,fpm?]
116 + >=dev-libs/libpcre2-10.30[jit?,unicode]
117 + fpm? ( acl? ( sys-apps/acl ) )
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.10.5 )
125 + enchant? ( <app-text/enchant-2.0:0 )
126 + ffi? ( >=dev-libs/libffi-3.0.11:= )
127 + firebird? ( dev-db/firebird )
128 + gd? ( >=virtual/jpeg-0-r3: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:* )
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.7.6 )
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 +)
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 +
260 +src_configure() {
261 + addpredict /usr/share/snmp/mibs/.index #nowarn
262 + addpredict /var/lib/net-snmp/mib_indexes #nowarn
263 +
264 + PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
265 +
266 + # The php-fpm config file wants localstatedir to be ${EPREFIX}/var
267 + # and not the Gentoo default ${EPREFIX}/var/lib. See bug 572002.
268 + local our_conf=(
269 + --prefix="${PHP_DESTDIR}"
270 + --mandir="${PHP_DESTDIR}/man"
271 + --infodir="${PHP_DESTDIR}/info"
272 + --libdir="${PHP_DESTDIR}/lib"
273 + --with-libdir="$(get_libdir)"
274 + --localstatedir="${EPREFIX}/var"
275 + --without-pear
276 + $(use_enable threads maintainer-zts)
277 + )
278 +
279 + our_conf+=(
280 + $(use_with argon2 password-argon2 "${EPREFIX}/usr")
281 + $(use_enable bcmath)
282 + $(use_with bzip2 bz2 "${EPREFIX}/usr")
283 + $(use_enable calendar)
284 + $(use_enable coverage gcov)
285 + $(use_enable ctype)
286 + $(use_with curl)
287 + $(use_enable xml dom)
288 + $(use_with enchant)
289 + $(use_enable exif)
290 + $(use_with ffi)
291 + $(use_enable fileinfo)
292 + $(use_enable filter)
293 + $(use_enable ftp)
294 + $(use_with nls gettext "${EPREFIX}/usr")
295 + $(use_with gmp gmp "${EPREFIX}/usr")
296 + $(use_with mhash mhash "${EPREFIX}/usr")
297 + $(use_with iconv iconv \
298 + $(use elibc_glibc || use elibc_musl || use elibc_FreeBSD || echo "${EPREFIX}/usr"))
299 + $(use_enable intl)
300 + $(use_enable ipv6)
301 + $(use_enable json)
302 + $(use_with kerberos)
303 + $(use_with xml libxml)
304 + $(use_enable unicode mbstring)
305 + $(use_with ssl openssl)
306 + $(use_enable pcntl)
307 + $(use_enable phar)
308 + $(use_enable pdo)
309 + $(use_enable opcache)
310 + $(use_with postgres pgsql "${EPREFIX}/usr")
311 + $(use_enable posix)
312 + $(use_with spell pspell "${EPREFIX}/usr")
313 + $(use_enable simplexml)
314 + $(use_enable sharedmem shmop)
315 + $(use_with snmp snmp "${EPREFIX}/usr")
316 + $(use_enable soap)
317 + $(use_enable sockets)
318 + $(use_with sodium)
319 + $(use_with sqlite sqlite3)
320 + $(use_enable sysvipc sysvmsg)
321 + $(use_enable sysvipc sysvsem)
322 + $(use_enable sysvipc sysvshm)
323 + $(use_with tidy tidy "${EPREFIX}/usr")
324 + $(use_enable tokenizer)
325 + $(use_enable xml)
326 + $(use_enable xmlreader)
327 + $(use_enable xmlwriter)
328 + $(use_with xmlrpc)
329 + $(use_with xslt xsl)
330 + $(use_with zip)
331 + $(use_with zlib zlib "${EPREFIX}/usr")
332 + $(use_enable debug)
333 + )
334 +
335 + # DBA support
336 + if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
337 + || use qdbm || use lmdb || use tokyocabinet ; then
338 + our_conf+=( "--enable-dba" )
339 + fi
340 +
341 + # DBA drivers support
342 + our_conf+=(
343 + $(use_with cdb)
344 + $(use_with berkdb db4 "${EPREFIX}/usr")
345 + $(use_enable flatfile)
346 + $(use_with gdbm gdbm "${EPREFIX}/usr")
347 + $(use_enable inifile)
348 + $(use_with qdbm qdbm "${EPREFIX}/usr")
349 + $(use_with tokyocabinet tcadb "${EPREFIX}/usr")
350 + $(use_with lmdb lmdb "${EPREFIX}/usr")
351 + )
352 +
353 + # Support for the GD graphics library
354 + our_conf+=(
355 + $(use_with truetype freetype)
356 + $(use_enable cjk gd-jis-conv)
357 + $(use_with gd jpeg)
358 + $(use_with xpm)
359 + $(use_with webp)
360 + )
361 + # enable gd last, so configure can pick up the previous settings
362 + our_conf+=( $(use_enable gd) )
363 +
364 + # IMAP support
365 + if use imap ; then
366 + our_conf+=(
367 + $(use_with imap imap "${EPREFIX}/usr")
368 + $(use_with ssl imap-ssl "${EPREFIX}/usr")
369 + )
370 + fi
371 +
372 + # LDAP support
373 + if use ldap ; then
374 + our_conf+=(
375 + $(use_with ldap ldap "${EPREFIX}/usr")
376 + $(use_with ldap-sasl)
377 + )
378 + fi
379 +
380 + # MySQL support
381 + local mysqllib="mysqlnd"
382 + local mysqlilib="mysqlnd"
383 +
384 + our_conf+=( $(use_with mysqli mysqli "${mysqlilib}") )
385 +
386 + local mysqlsock="${EPREFIX}/var/run/mysqld/mysqld.sock"
387 + if use mysql || use mysqli ; then
388 + our_conf+=( $(use_with mysql mysql-sock "${mysqlsock}") )
389 + fi
390 +
391 + # ODBC support
392 + if use odbc && use iodbc ; then
393 + our_conf+=(
394 + --without-unixODBC
395 + --with-iodbc
396 + $(use_with pdo pdo-odbc "iODBC,${EPREFIX}/usr")
397 + )
398 + elif use odbc ; then
399 + our_conf+=(
400 + --with-unixODBC="${EPREFIX}/usr"
401 + --without-iodbc
402 + $(use_with pdo pdo-odbc "unixODBC,${EPREFIX}/usr")
403 + )
404 + else
405 + our_conf+=(
406 + --without-unixODBC
407 + --without-iodbc
408 + --without-pdo-odbc
409 + )
410 + fi
411 +
412 + # Oracle support
413 + our_conf+=( $(use_with oci8-instant-client oci8) )
414 +
415 + # PDO support
416 + if use pdo ; then
417 + our_conf+=(
418 + $(use_with mssql pdo-dblib "${EPREFIX}/usr")
419 + $(use_with mysql pdo-mysql "${mysqllib}")
420 + $(use_with postgres pdo-pgsql)
421 + $(use_with sqlite pdo-sqlite)
422 + $(use_with firebird pdo-firebird "${EPREFIX}/usr")
423 + $(use_with oci8-instant-client pdo-oci)
424 + )
425 + fi
426 +
427 + # readline/libedit support
428 + our_conf+=(
429 + $(use_with readline readline "${EPREFIX}/usr")
430 + $(use_with libedit)
431 + )
432 +
433 + # Session support
434 + if use session ; then
435 + our_conf+=( $(use_with session-mm mm "${EPREFIX}/usr") )
436 + else
437 + our_conf+=( $(use_enable session) )
438 + fi
439 +
440 + # Use pic for shared modules such as apache2's mod_php
441 + our_conf+=( --with-pic )
442 +
443 + # we use the system copy of pcre
444 + # --with-external-pcre affects ext/pcre
445 + our_conf+=(
446 + --with-external-pcre
447 + $(use_with jit pcre-jit)
448 + )
449 +
450 + # Catch CFLAGS problems
451 + # Fixes bug #14067.
452 + # Changed order to run it in reverse for bug #32022 and #12021.
453 + replace-cpu-flags "k6*" "i586"
454 +
455 + # Cache the ./configure test results between SAPIs.
456 + our_conf+=( --cache-file="${T}/config.cache" )
457 +
458 + # Support user-passed configuration parameters
459 + our_conf+=( ${EXTRA_ECONF:-} )
460 +
461 + # Support the Apache2 extras, they must be set globally for all
462 + # SAPIs to work correctly, especially for external PHP extensions
463 +
464 + local one_sapi
465 + local sapi
466 + mkdir -p "${WORKDIR}/sapis-build" || die
467 + for one_sapi in $SAPIS ; do
468 + use "${one_sapi}" || continue
469 + php_set_ini_dir "${one_sapi}"
470 +
471 + # The BUILD_DIR variable is used to determine where to output
472 + # the files that autotools creates. This was all originally
473 + # based on the autotools-utils eclass.
474 + BUILD_DIR="${WORKDIR}/sapis-build/${one_sapi}"
475 + cp -a "${S}" "${BUILD_DIR}" || die
476 + cd "${BUILD_DIR}" || die
477 +
478 + local sapi_conf=(
479 + --with-config-file-path="${PHP_INI_DIR}"
480 + --with-config-file-scan-dir="${PHP_EXT_INI_DIR_ACTIVE}"
481 + )
482 +
483 + for sapi in $SAPIS ; do
484 + case "$sapi" in
485 + cli|cgi|embed|fpm|phpdbg)
486 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
487 + sapi_conf+=( "--enable-${sapi}" )
488 + if [[ "fpm" == "${sapi}" ]] ; then
489 + sapi_conf+=(
490 + $(use_with acl fpm-acl)
491 + $(use_with systemd fpm-systemd)
492 + )
493 + fi
494 + else
495 + sapi_conf+=( "--disable-${sapi}" )
496 + fi
497 + ;;
498 +
499 + apache2)
500 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
501 + sapi_conf+=( --with-apxs2="${EPREFIX}/usr/bin/apxs" )
502 + else
503 + sapi_conf+=( --without-apxs2 )
504 + fi
505 + ;;
506 + esac
507 + done
508 +
509 + # Construct the $myeconfargs array by concatenating $our_conf
510 + # (the common args) and $sapi_conf (the SAPI-specific args).
511 + local myeconfargs=( "${our_conf[@]}" )
512 + myeconfargs+=( "${sapi_conf[@]}" )
513 +
514 + pushd "${BUILD_DIR}" > /dev/null || die
515 + econf "${myeconfargs[@]}"
516 + popd > /dev/null || die
517 + done
518 +}
519 +
520 +src_compile() {
521 + # snmp seems to run during src_compile, too (bug #324739)
522 + addpredict /usr/share/snmp/mibs/.index #nowarn
523 + addpredict /var/lib/net-snmp/mib_indexes #nowarn
524 +
525 + local sapi
526 + for sapi in ${SAPIS} ; do
527 + if use "${sapi}"; then
528 + cd "${WORKDIR}/sapis-build/$sapi" || \
529 + die "Failed to change dir to ${WORKDIR}/sapis-build/$1"
530 + emake
531 + fi
532 + done
533 +}
534 +
535 +src_install() {
536 + # see bug #324739 for what happens when we don't have that
537 + addpredict /usr/share/snmp/mibs/.index #nowarn
538 +
539 + # grab the first SAPI that got built and install common files from there
540 + local first_sapi="", sapi=""
541 + for sapi in $SAPIS ; do
542 + if use $sapi ; then
543 + first_sapi=$sapi
544 + break
545 + fi
546 + done
547 +
548 + # Makefile forgets to create this before trying to write to it...
549 + dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
550 +
551 + # Install php environment (without any sapis)
552 + cd "${WORKDIR}/sapis-build/$first_sapi" || die
553 + emake INSTALL_ROOT="${D}" \
554 + install-build install-headers install-programs
555 +
556 + local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
557 +
558 + # Create the directory where we'll put version-specific php scripts
559 + keepdir "/usr/share/php${PHP_MV}"
560 +
561 + local file=""
562 + local sapi_list=""
563 +
564 + for sapi in ${SAPIS}; do
565 + if use "${sapi}" ; then
566 + einfo "Installing SAPI: ${sapi}"
567 + cd "${WORKDIR}/sapis-build/${sapi}" || die
568 +
569 + if [[ "${sapi}" == "apache2" ]] ; then
570 + # We're specifically not using emake install-sapi as libtool
571 + # may cause unnecessary relink failures (see bug #351266)
572 + insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
573 + newins ".libs/libphp${PHP_MV}$(get_libname)" \
574 + "libphp${PHP_MV}$(get_libname)"
575 + keepdir "/usr/$(get_libdir)/apache2/modules"
576 + else
577 + # needed each time, php_install_ini would reset it
578 + local dest="${PHP_DESTDIR#${EPREFIX}}"
579 + into "${dest}"
580 + case "$sapi" in
581 + cli)
582 + source="sapi/cli/php"
583 + # Install the "phar" archive utility.
584 + if use phar ; then
585 + emake INSTALL_ROOT="${D}" install-pharcmd
586 + dosym "..${dest#/usr}/bin/phar" "/usr/bin/phar${SLOT}"
587 + fi
588 + ;;
589 + cgi)
590 + source="sapi/cgi/php-cgi"
591 + ;;
592 + fpm)
593 + source="sapi/fpm/php-fpm"
594 + ;;
595 + embed)
596 + source="libs/libphp${PHP_MV}$(get_libname)"
597 + ;;
598 + phpdbg)
599 + source="sapi/phpdbg/phpdbg"
600 + ;;
601 + *)
602 + die "unhandled sapi in src_install"
603 + ;;
604 + esac
605 +
606 + if [[ "${source}" == *"$(get_libname)" ]]; then
607 + dolib.so "${source}"
608 + else
609 + dobin "${source}"
610 + local name="$(basename ${source})"
611 + dosym "..${dest#/usr}/bin/${name}" "/usr/bin/${name}${SLOT}"
612 + fi
613 + fi
614 +
615 + php_install_ini "${sapi}"
616 +
617 + # construct correct SAPI string for php-config
618 + # thanks to ferringb for the bash voodoo
619 + if [[ "${sapi}" == "apache2" ]]; then
620 + sapi_list="${sapi_list:+${sapi_list} }apache2handler"
621 + else
622 + sapi_list="${sapi_list:+${sapi_list} }${sapi}"
623 + fi
624 + fi
625 + done
626 +
627 + # Installing opcache module
628 + if use opcache ; then
629 + into "${PHP_DESTDIR#${EPREFIX}}"
630 + dolib.so "modules/opcache$(get_libname)"
631 + fi
632 +
633 + # Install env.d files
634 + newenvd "${FILESDIR}/20php5-envd" "20php${SLOT}"
635 + sed -e "s|/lib/|/$(get_libdir)/|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
636 + sed -e "s|php5|php${SLOT}|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
637 +
638 + # set php-config variable correctly (bug #278439)
639 + sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
640 + "${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config" || die
641 +
642 + if use fpm ; then
643 + if use systemd; then
644 + systemd_newunit "${FILESDIR}/php-fpm_at.service" \
645 + "php-fpm@${SLOT}.service"
646 + else
647 + systemd_newunit "${FILESDIR}/php-fpm_at-simple.service" \
648 + "php-fpm@${SLOT}.service"
649 + fi
650 + fi
651 +}
652 +
653 +src_test() {
654 + echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
655 + PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php"
656 + if [[ ! -x "${PHP_BIN}" ]] ; then
657 + ewarn "Test phase requires USE=cli, skipping"
658 + return
659 + else
660 + export TEST_PHP_EXECUTABLE="${PHP_BIN}"
661 + fi
662 +
663 + if [[ -x "${WORKDIR}/sapis-build/cgi/sapi/cgi/php-cgi" ]] ; then
664 + export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis-build/cgi/sapi/cgi/php-cgi"
665 + fi
666 +
667 + if [[ -x "${WORKDIR}/sapis-build/phpdbg/sapi/phpdbg/phpdbg" ]] ; then
668 + export TEST_PHPDBG_EXECUTABLE="${WORKDIR}/sapis-build/phpdbg/sapi/phpdbg/phpdbg"
669 + fi
670 +
671 + REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d \
672 + "session.save_path=${T}" \
673 + "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d \
674 + "session.save_path=${T}"
675 +
676 + for name in ${EXPECTED_TEST_FAILURES}; do
677 + mv "${name}.out" "${name}.out.orig" 2>/dev/null || die
678 + done
679 +
680 + local failed="$(find -name '*.out')"
681 + if [[ ${failed} != "" ]] ; then
682 + ewarn "The following test cases failed unexpectedly:"
683 + for name in ${failed}; do
684 + ewarn " ${name/.out/}"
685 + done
686 + else
687 + einfo "No unexpected test failures, all fine"
688 + fi
689 +
690 + if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
691 + local passed=""
692 + for name in ${EXPECTED_TEST_FAILURES}; do
693 + [[ -f "${name}.diff" ]] && continue
694 + passed="${passed} ${name}"
695 + done
696 + if [[ ${passed} != "" ]] ; then
697 + einfo "The following test cases passed unexpectedly:"
698 + for name in ${passed}; do
699 + ewarn " ${passed}"
700 + done
701 + else
702 + einfo "None of the known-to-fail tests passed, all fine"
703 + fi
704 + fi
705 +}
706 +
707 +pkg_postinst() {
708 + # Output some general info to the user
709 + if use apache2 ; then
710 + elog
711 + elog "To enable PHP in apache, you will need to add \"-D PHP\" to"
712 + elog "your apache2 command. OpenRC users can append that string to"
713 + elog "APACHE2_OPTS in /etc/conf.d/apache2."
714 + elog
715 + elog "The apache module configuration file 70_mod_php.conf is"
716 + elog "provided (and maintained) by eselect-php."
717 + elog
718 + fi
719 +
720 + # Create the symlinks for php
721 + local m
722 + for m in ${SAPIS}; do
723 + [[ ${m} == 'embed' ]] && continue;
724 + if use $m ; then
725 + local ci=$(eselect php show $m)
726 + if [[ -z $ci ]]; then
727 + eselect php set $m php${SLOT} || die
728 + einfo "Switched ${m} to use php:${SLOT}"
729 + einfo
730 + elif [[ $ci != "php${SLOT}" ]] ; then
731 + elog "To switch $m to use php:${SLOT}, run"
732 + elog " eselect php set $m php${SLOT}"
733 + elog
734 + fi
735 + fi
736 + done
737 +
738 + # Remove dead symlinks for SAPIs that were just disabled. For
739 + # example, if the user has the cgi SAPI enabled, then he has an
740 + # eselect-php symlink for it. If he later reinstalls PHP with
741 + # USE="-cgi", that symlink will break. This call to eselect is
742 + # supposed to remove that dead link per bug 572436.
743 + eselect php cleanup || die
744 +
745 + if ! has "php${SLOT/./-}" ${PHP_TARGETS}; then
746 + elog "To build extensions for this version of PHP, you will need to"
747 + elog "add php${SLOT/./-} to your PHP_TARGETS USE_EXPAND variable."
748 + elog
749 + fi
750 +
751 + # Warn about the removal of PHP_INI_VERSION if the user has it set.
752 + if [[ -n "${PHP_INI_VERSION}" ]]; then
753 + ewarn 'The PHP_INI_VERSION variable has been phased out. You may'
754 + ewarn 'remove it from your configuration at your convenience. See'
755 + ewarn
756 + ewarn ' https://bugs.gentoo.org/611214'
757 + ewarn
758 + ewarn 'for more information.'
759 + fi
760 +
761 + elog "For details on how version slotting works, please see"
762 + elog "the wiki:"
763 + elog
764 + elog " https://wiki.gentoo.org/wiki/PHP"
765 + elog
766 +}
767 +
768 +pkg_postrm() {
769 + # This serves two purposes. First, if we have just removed the last
770 + # installed version of PHP, then this will remove any dead symlinks
771 + # belonging to eselect-php. Second, if a user upgrades slots from
772 + # (say) 5.6 to 7.0 and depcleans the old slot, then this will update
773 + # his existing symlinks to point to the new 7.0 installation. The
774 + # latter is bug 432962.
775 + #
776 + # Note: the eselect-php package may not be installed at this point,
777 + # so we can't die() if this command fails.
778 + eselect php cleanup
779 +}