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: Sat, 25 Sep 2021 23:44:56
Message-Id: 1632613485.e5d83b155fdc25fece6a3bf38f2092e189f88da9.grknight@gentoo
1 commit: e5d83b155fdc25fece6a3bf38f2092e189f88da9
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Sat Sep 25 23:08:03 2021 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Sat Sep 25 23:44:45 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e5d83b15
7
8 dev-lang/php: Version bump for 7.3.31
9
10 Bug: https://bugs.gentoo.org/814821
11 Signed-off-by: Brian Evans <grknight <AT> gentoo.org>
12
13 dev-lang/php/Manifest | 1 +
14 dev-lang/php/php-7.3.31.ebuild | 758 +++++++++++++++++++++++++++++++++++++++++
15 2 files changed, 759 insertions(+)
16
17 diff --git a/dev-lang/php/Manifest b/dev-lang/php/Manifest
18 index 0f250661320..1e35c86b69f 100644
19 --- a/dev-lang/php/Manifest
20 +++ b/dev-lang/php/Manifest
21 @@ -1,5 +1,6 @@
22 DIST php-7.3.29.tar.xz 12139492 BLAKE2B 7e1287e0fd236252f5bc92009e4ff51676eccd197c1c579f0e79a5428fa3920b5d1f95a459cdd77c22699fbe83984a6d726ab4fc0fc1e309da8b34e0e3998071 SHA512 8a495546d575a31f864f85139d8d7931361e6ac421f2cf5ef3b4cb57f59c44568cb9ad0c8793f50169d8d9933abdcec14ab90add2d7fab056e19e7f66d60689f
23 DIST php-7.3.30.tar.xz 12142596 BLAKE2B 9d8d60aa2a24465e53d99be05f66c8c65ce738c866af0889cdfcd95d545d6308fce33ca2faaaeb2a298eae13d58b5f5b5c519de6af48230a4d9c4e3d41debb28 SHA512 89eb62ab4284393f33b79ee336c1672613c498adb858b16e1a17d5b2056068c849b96bbf591311ff322c607168d9518ade3bfebedbc4da4f37c34d2c64c671b6
24 +DIST php-7.3.31.tar.xz 12142912 BLAKE2B dc68d2e2f38c93653950be4b30dde12fec6e7279e288fe40439a8e3e31110a228a69275e032604a493a53951230f6f42257719617ae18179116be414e49a2af5 SHA512 63a8122233b9892453b6b92429497a7ad9761ad88063e2b95607b5d4d4c0a0e1135073bcae5a0e69a17082d2348911cbbd4807c0d20905d93324d89e5b019a05
25 DIST php-7.4.21.tar.xz 10346628 BLAKE2B f758d6bef60f5e0c99bd097533d1663640362c2b752a3bd54389acc3bd7d173c1ba5d4b1c119b6ad50f5029aabe2349bb4646a33212dc3cf34fd294f24def401 SHA512 778ddbfe614fdc6a00bc82c61f4c636bdbe815ce3398415a29bd24a2fd4ca2113b3b804303585d8830242e04b0c202bbc7c725a46c9bad79b070a0e896e5e681
26 DIST php-7.4.22.tar.xz 10348532 BLAKE2B 20e4bfb0362bb13ca8cacf9fb2500ffdd2db011d69cb82f113dd0c25e8a5fd4a017d77481732930afd24a8e092edbce3eafe9d45f27718ddf7567469f80c5642 SHA512 80587ba613b8a863a666f44a16ebb33cbb5a5d396601d1eaf063c8f7793a98abae903cb76fca4216860f1a043d5ee997464d479d53ffff6a1d6a6cd31da9100d
27 DIST php-7.4.23.tar.xz 10371160 BLAKE2B 5e9fc033f856132dd6b7b06fc5aedc72218f083779fd90a8c4c7a23fb4f8c248a7ff769f9d9f46e5143ddf88ce9289f5a8013c194aeaf22eca74d97846868611 SHA512 659b6bbf9be21a09640529bc088dfd7a494081188e37eb1f2dac2cab92a1084062fd06d550dc8c97bdd7dd9b57f4146e357447be2cb86643bda1d8dbc8a0d4a3
28
29 diff --git a/dev-lang/php/php-7.3.31.ebuild b/dev-lang/php/php-7.3.31.ebuild
30 new file mode 100644
31 index 00000000000..ca53010503c
32 --- /dev/null
33 +++ b/dev-lang/php/php-7.3.31.ebuild
34 @@ -0,0 +1,758 @@
35 +# Copyright 1999-2021 Gentoo Authors
36 +# Distributed under the terms of the GNU General Public License v2
37 +
38 +EAPI="7"
39 +
40 +inherit flag-o-matic systemd autotools
41 +
42 +MY_PV=${PV/_rc/RC}
43 +DESCRIPTION="The PHP language runtime engine"
44 +HOMEPAGE="https://www.php.net/"
45 +SRC_URI="https://www.php.net/distributions/${P}.tar.xz"
46 +
47 +LICENSE="PHP-3.01
48 + BSD
49 + Zend-2.0
50 + bcmath? ( LGPL-2.1+ )
51 + fpm? ( BSD-2 )
52 + gd? ( gd )
53 + unicode? ( BSD-2 LGPL-2.1 )"
54 +
55 +SLOT="$(ver_cut 1-2)"
56 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
57 +
58 +S="${WORKDIR}/${PN}-${MY_PV}"
59 +
60 +# We can build the following SAPIs in the given order
61 +SAPIS="embed cli cgi fpm apache2 phpdbg"
62 +
63 +# SAPIs and SAPI-specific USE flags (cli SAPI is default on):
64 +IUSE="${IUSE}
65 + ${SAPIS/cli/+cli}
66 + threads"
67 +
68 +IUSE="${IUSE} acl argon2 bcmath berkdb bzip2 calendar cdb cjk
69 + coverage +ctype curl debug
70 + enchant exif +fileinfo +filter firebird
71 + +flatfile ftp gd gdbm gmp +hash +iconv imap inifile
72 + intl iodbc ipv6 +jit +json kerberos ldap ldap-sasl libedit lmdb
73 + mhash mssql mysql mysqli nls
74 + oci8-instant-client odbc +opcache pcntl pdo +phar +posix postgres qdbm
75 + readline recode selinux +session session-mm sharedmem
76 + +simplexml snmp soap sockets sodium spell sqlite ssl
77 + sysvipc systemd test tidy +tokenizer tokyocabinet truetype unicode wddx webp
78 + +xml xmlreader xmlwriter xmlrpc xpm xslt zip zip-encryption zlib"
79 +
80 +# The supported (that is, autodetected) versions of BDB are listed in
81 +# the ./configure script. Other versions *work*, but we need to stick to
82 +# the ones that can be detected to avoid a repeat of bug #564824.
83 +COMMON_DEPEND="
84 + >=app-eselect/eselect-php-0.9.1[apache2?,fpm?]
85 + >=dev-libs/libpcre2-10.30[jit?,unicode]
86 + fpm? ( acl? ( sys-apps/acl ) )
87 + apache2? ( www-servers/apache[apache2_modules_unixd(+),threads=] )
88 + argon2? ( app-crypt/argon2:= )
89 + berkdb? ( || ( sys-libs/db:5.3
90 + sys-libs/db:5.1
91 + sys-libs/db:4.8
92 + sys-libs/db:4.7
93 + sys-libs/db:4.6
94 + sys-libs/db:4.5 ) )
95 + bzip2? ( app-arch/bzip2:0= )
96 + cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
97 + coverage? ( dev-util/lcov )
98 + curl? ( >=net-misc/curl-7.10.5 )
99 + enchant? ( <app-text/enchant-2.0:0 )
100 + firebird? ( dev-db/firebird )
101 + gd? ( >=virtual/jpeg-0-r3:0 media-libs/libpng:0= >=sys-libs/zlib-1.2.0.4 )
102 + gdbm? ( >=sys-libs/gdbm-1.8.0:0= )
103 + gmp? ( dev-libs/gmp:0= )
104 + iconv? ( virtual/libiconv )
105 + imap? ( >=virtual/imap-c-client-2[kerberos=,ssl=] )
106 + intl? ( dev-libs/icu:= )
107 + iodbc? ( dev-db/libiodbc )
108 + kerberos? ( virtual/krb5 )
109 + ldap? ( >=net-nds/openldap-1.2.11 )
110 + ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 )
111 + libedit? ( dev-libs/libedit )
112 + lmdb? ( dev-db/lmdb:= )
113 + mssql? ( dev-db/freetds[mssql] )
114 + nls? ( sys-devel/gettext )
115 + oci8-instant-client? ( dev-db/oracle-instantclient[sdk] )
116 + odbc? ( >=dev-db/unixODBC-1.8.13 )
117 + postgres? ( dev-db/postgresql:* )
118 + qdbm? ( dev-db/qdbm )
119 + readline? ( sys-libs/readline:0= )
120 + recode? ( app-text/recode:0= )
121 + session-mm? ( dev-libs/mm )
122 + simplexml? ( >=dev-libs/libxml2-2.6.8 )
123 + snmp? ( >=net-analyzer/net-snmp-5.2 )
124 + soap? ( >=dev-libs/libxml2-2.6.8 )
125 + sodium? ( dev-libs/libsodium:=[-minimal] )
126 + spell? ( >=app-text/aspell-0.50 )
127 + sqlite? ( >=dev-db/sqlite-3.7.6.3 )
128 + ssl? ( >=dev-libs/openssl-1.0.1:0= )
129 + tidy? ( || ( app-text/tidy-html5 app-text/htmltidy ) )
130 + tokyocabinet? ( dev-db/tokyocabinet )
131 + truetype? ( =media-libs/freetype-2* )
132 + unicode? ( dev-libs/oniguruma:= )
133 + wddx? ( >=dev-libs/libxml2-2.6.8 )
134 + webp? ( media-libs/libwebp:0= )
135 + xml? ( >=dev-libs/libxml2-2.6.8 )
136 + xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv )
137 + xmlreader? ( >=dev-libs/libxml2-2.6.8 )
138 + xmlwriter? ( >=dev-libs/libxml2-2.6.8 )
139 + xpm? ( x11-libs/libXpm )
140 + xslt? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
141 + zip? ( >=sys-libs/zlib-1.2.0.4:0= )
142 + zip-encryption? ( >=dev-libs/libzip-1.2.0:= )
143 + zlib? ( >=sys-libs/zlib-1.2.0.4:0= )
144 +"
145 +
146 +RDEPEND="${COMMON_DEPEND}
147 + virtual/mta
148 + fpm? (
149 + selinux? ( sec-policy/selinux-phpfpm )
150 + systemd? ( sys-apps/systemd ) )"
151 +
152 +# Bison isn't actually needed when building from a release tarball
153 +# However, the configure script will warn if it's absent or if you
154 +# have an incompatible version installed. See bug 593278.
155 +DEPEND="${COMMON_DEPEND}
156 + app-arch/xz-utils
157 + >=sys-devel/bison-3.0.1"
158 +
159 +BDEPEND="virtual/pkgconfig"
160 +
161 +# Without USE=readline or libedit, the interactive "php -a" CLI will hang.
162 +# The Oracle instant client provides its own incompatible ldap library.
163 +REQUIRED_USE="
164 + || ( cli cgi fpm apache2 embed phpdbg )
165 + cli? ( ^^ ( readline libedit ) )
166 + truetype? ( gd zlib )
167 + webp? ( gd zlib )
168 + cjk? ( gd zlib )
169 + exif? ( gd zlib )
170 + xpm? ( gd zlib )
171 + gd? ( zlib )
172 + simplexml? ( xml )
173 + soap? ( xml )
174 + wddx? ( xml )
175 + xmlrpc? ( || ( xml iconv ) )
176 + xmlreader? ( xml )
177 + xslt? ( xml )
178 + ldap-sasl? ( ldap )
179 + mhash? ( hash )
180 + oci8-instant-client? ( !ldap )
181 + phar? ( hash )
182 + qdbm? ( !gdbm )
183 + readline? ( !libedit )
184 + recode? ( !imap !mysqli !mysql )
185 + session-mm? ( session !threads )
186 + mysql? ( || ( mysqli pdo ) )
187 + zip-encryption? ( zip )
188 +"
189 +
190 +RESTRICT="!test? ( test )"
191 +
192 +PATCHES=(
193 + "${FILESDIR}/php-freetype-2.9.1.patch"
194 +)
195 +
196 +PHP_MV="$(ver_cut 1)"
197 +
198 +php_install_ini() {
199 + local phpsapi="${1}"
200 +
201 + # work out where we are installing the ini file
202 + php_set_ini_dir "${phpsapi}"
203 +
204 + # Always install the production INI file, bug 611214.
205 + local phpinisrc="php.ini-production-${phpsapi}"
206 + cp php.ini-production "${phpinisrc}" || die
207 +
208 + # default to /tmp for save_path, bug #282768
209 + sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}" || die
210 +
211 + # Set the extension dir
212 + sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" \
213 + -i "${phpinisrc}" || die
214 +
215 + # Set the include path to point to where we want to find PEAR packages
216 + sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}" || die
217 +
218 + insinto "${PHP_INI_DIR#${EPREFIX}}"
219 + newins "${phpinisrc}" php.ini
220 +
221 + elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
222 + elog
223 +
224 + dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
225 + dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
226 +
227 + if use opcache; then
228 + elog "Adding opcache to $PHP_EXT_INI_DIR"
229 + echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> \
230 + "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
231 + dosym "../ext/opcache.ini" \
232 + "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
233 + fi
234 +
235 + # SAPI-specific handling
236 + if [[ "${sapi}" == "fpm" ]] ; then
237 + einfo "Installing FPM config files php-fpm.conf and www.conf"
238 + insinto "${PHP_INI_DIR#${EPREFIX}}"
239 + doins sapi/fpm/php-fpm.conf
240 + insinto "${PHP_INI_DIR#${EPREFIX}}/fpm.d"
241 + doins sapi/fpm/www.conf
242 + fi
243 +
244 + dodoc php.ini-{development,production}
245 +}
246 +
247 +php_set_ini_dir() {
248 + PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
249 + PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
250 + PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
251 +}
252 +
253 +src_prepare() {
254 + default
255 +
256 + # In php-7.x, the FPM pool configuration files have been split off
257 + # of the main config. By default the pool config files go in
258 + # e.g. /etc/php-fpm.d, which isn't slotted. So here we move the
259 + # include directory to a subdirectory "fpm.d" of $PHP_INI_DIR. Later
260 + # we'll install the pool configuration file "www.conf" there.
261 + php_set_ini_dir fpm
262 + sed -i "s~^include=.*$~include=${PHP_INI_DIR}/fpm.d/*.conf~" \
263 + sapi/fpm/php-fpm.conf.in \
264 + || die 'failed to move the include directory in php-fpm.conf'
265 +
266 + # Bug 669566 - necessary so that build tools are updated for commands like pecl
267 + # Force rebuilding aclocal.m4
268 + rm -f aclocal.m4 || die "failed to remove aclocal.m4 in src_prepare"
269 + eautoreconf
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 maintainer-zts)
289 + )
290 +
291 + our_conf+=(
292 + $(use_with argon2 password-argon2 "${EPREFIX}/usr")
293 + $(use_enable bcmath bcmath)
294 + $(use_with bzip2 bz2 "${EPREFIX}/usr")
295 + $(use_enable calendar calendar)
296 + $(use_enable coverage gcov)
297 + $(use_enable ctype ctype)
298 + $(use_with curl curl "${EPREFIX}/usr")
299 + $(use_enable xml dom)
300 + $(use_with enchant enchant "${EPREFIX}/usr")
301 + $(use_enable exif exif)
302 + $(use_enable fileinfo fileinfo)
303 + $(use_enable filter filter)
304 + $(use_enable ftp ftp)
305 + $(use_with nls gettext "${EPREFIX}/usr")
306 + $(use_with gmp gmp "${EPREFIX}/usr")
307 + $(use_enable hash hash)
308 + $(use_with mhash mhash "${EPREFIX}/usr")
309 + $(use_with iconv iconv \
310 + $(use elibc_glibc || use elibc_musl || use elibc_FreeBSD || echo "${EPREFIX}/usr"))
311 + $(use_enable intl intl)
312 + $(use_enable ipv6 ipv6)
313 + $(use_enable json json)
314 + $(use_with kerberos kerberos "${EPREFIX}/usr")
315 + $(use_enable xml libxml)
316 + $(use_with xml libxml-dir "${EPREFIX}/usr")
317 + $(use_enable unicode mbstring)
318 + $(use_with unicode onig "${EPREFIX}/usr")
319 + $(use_with ssl openssl "${EPREFIX}/usr")
320 + $(use_with ssl openssl-dir "${EPREFIX}/usr")
321 + $(use_enable pcntl pcntl)
322 + $(use_enable phar phar)
323 + $(use_enable pdo pdo)
324 + $(use_enable opcache opcache)
325 + $(use_with postgres pgsql "${EPREFIX}/usr")
326 + $(use_enable posix posix)
327 + $(use_with spell pspell "${EPREFIX}/usr")
328 + $(use_with recode recode "${EPREFIX}/usr")
329 + $(use_enable simplexml simplexml)
330 + $(use_enable sharedmem shmop)
331 + $(use_with snmp snmp "${EPREFIX}/usr")
332 + $(use_enable soap soap)
333 + $(use_enable sockets sockets)
334 + $(use_with sodium sodium "${EPREFIX}/usr")
335 + $(use_with sqlite sqlite3 "${EPREFIX}/usr")
336 + $(use_enable sysvipc sysvmsg)
337 + $(use_enable sysvipc sysvsem)
338 + $(use_enable sysvipc sysvshm)
339 + $(use_with tidy tidy "${EPREFIX}/usr")
340 + $(use_enable tokenizer tokenizer)
341 + $(use_enable wddx wddx)
342 + $(use_enable xml xml)
343 + $(use_enable xmlreader xmlreader)
344 + $(use_enable xmlwriter xmlwriter)
345 + $(use_with xmlrpc xmlrpc)
346 + $(use_with xslt xsl "${EPREFIX}/usr")
347 + $(use_enable zip zip)
348 + $(use_with zip-encryption libzip "${EPREFIX}/usr")
349 + $(use_with zlib zlib "${EPREFIX}/usr")
350 + $(use_enable debug debug)
351 + )
352 +
353 + # DBA support
354 + if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
355 + || use qdbm || use lmdb || use tokyocabinet ; then
356 + our_conf+=( "--enable-dba${shared}" )
357 + fi
358 +
359 + # DBA drivers support
360 + our_conf+=(
361 + $(use_with cdb cdb)
362 + $(use_with berkdb db4 "${EPREFIX}/usr")
363 + $(use_enable flatfile flatfile)
364 + $(use_with gdbm gdbm "${EPREFIX}/usr")
365 + $(use_enable inifile inifile)
366 + $(use_with qdbm qdbm "${EPREFIX}/usr")
367 + $(use_with lmdb lmdb "${EPREFIX}/usr")
368 + )
369 +
370 + # Support for the GD graphics library
371 + our_conf+=(
372 + $(use_with truetype freetype-dir "${EPREFIX}/usr")
373 + $(use_enable cjk gd-jis-conv)
374 + $(use_with gd jpeg-dir "${EPREFIX}/usr")
375 + $(use_with gd png-dir "${EPREFIX}/usr")
376 + $(use_with xpm xpm-dir "${EPREFIX}/usr")
377 + )
378 + if use webp; then
379 + our_conf+=( --with-webp-dir="${EPREFIX}/usr" )
380 + fi
381 + # enable gd last, so configure can pick up the previous settings
382 + our_conf+=( $(use_with gd gd) )
383 +
384 + # IMAP support
385 + if use imap ; then
386 + our_conf+=(
387 + $(use_with imap imap "${EPREFIX}/usr")
388 + $(use_with ssl imap-ssl "${EPREFIX}/usr")
389 + )
390 + fi
391 +
392 + # Interbase/firebird support
393 + our_conf+=( $(use_with firebird interbase "${EPREFIX}/usr") )
394 +
395 + # LDAP support
396 + if use ldap ; then
397 + our_conf+=(
398 + $(use_with ldap ldap "${EPREFIX}/usr")
399 + $(use_with ldap-sasl ldap-sasl "${EPREFIX}/usr")
400 + )
401 + fi
402 +
403 + # MySQL support
404 + local mysqllib="mysqlnd"
405 + local mysqlilib="mysqlnd"
406 +
407 + our_conf+=( $(use_with mysqli mysqli "${mysqlilib}") )
408 +
409 + local mysqlsock="${EPREFIX}/var/run/mysqld/mysqld.sock"
410 + if use mysql || use mysqli ; then
411 + our_conf+=( $(use_with mysql mysql-sock "${mysqlsock}") )
412 + fi
413 +
414 + # ODBC support
415 + our_conf+=(
416 + $(use_with odbc unixODBC "${EPREFIX}/usr")
417 + $(use_with iodbc iodbc "${EPREFIX}/usr")
418 + )
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 "${mysqllib}")
428 + $(use_with postgres pdo-pgsql)
429 + $(use_with sqlite pdo-sqlite "${EPREFIX}/usr")
430 + $(use_with firebird pdo-firebird "${EPREFIX}/usr")
431 + $(use_with odbc pdo-odbc "unixODBC,${EPREFIX}/usr")
432 + $(use_with oci8-instant-client pdo-oci)
433 + )
434 + fi
435 +
436 + # readline/libedit support
437 + our_conf+=(
438 + $(use_with readline readline "${EPREFIX}/usr")
439 + $(use_with libedit libedit "${EPREFIX}/usr")
440 + )
441 +
442 + # Session support
443 + if use session ; then
444 + our_conf+=( $(use_with session-mm mm "${EPREFIX}/usr") )
445 + else
446 + our_conf+=( $(use_enable session session) )
447 + fi
448 +
449 + # Use pic for shared modules such as apache2's mod_php
450 + our_conf+=( --with-pic )
451 +
452 + # we use the system copy of pcre
453 + # --with-pcre-regex affects ext/pcre
454 + # --with-pcre-dir affects ext/filter and ext/zip
455 + # --with-pcre-valgrind cannot be enabled with system pcre
456 + our_conf+=(
457 + --with-pcre-regex="${EPREFIX}/usr"
458 + --with-pcre-dir="${EPREFIX}/usr"
459 + --without-pcre-valgrind
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${PHP_MV}$(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${PHP_MV}$(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 + 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 +}