Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/php/
Date: Thu, 03 Sep 2020 15:07:47
Message-Id: 1599145165.a9b2d857a44831b8dcb9ae3d0678a4f7d08bd3de.whissi@gentoo
1 commit: a9b2d857a44831b8dcb9ae3d0678a4f7d08bd3de
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Thu Sep 3 14:59:25 2020 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Thu Sep 3 14:59:25 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a9b2d857
7
8 dev-lang/php: bump to v7.3.22
9
10 Package-Manager: Portage-3.0.4, Repoman-3.0.1
11 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
12
13 dev-lang/php/Manifest | 1 +
14 dev-lang/php/php-7.3.22.ebuild | 760 +++++++++++++++++++++++++++++++++++++++++
15 2 files changed, 761 insertions(+)
16
17 diff --git a/dev-lang/php/Manifest b/dev-lang/php/Manifest
18 index 416f9abfac8..18170772b58 100644
19 --- a/dev-lang/php/Manifest
20 +++ b/dev-lang/php/Manifest
21 @@ -1,4 +1,5 @@
22 DIST php-7.2.33.tar.xz 12310624 BLAKE2B 3eca6a2aee79b791abb6b0427496e6041b63800ac1aeea86b4465e9326fdcde5d7a69e6323902b6874f27cf6197b705397381319d0b5ff6f93605e791bf0eb86 SHA512 1c28e741fc6de88a33e1307bc88ba8dddf1ba767ce6eb9c1f0da35482c7d3ee1154831b997fa746340c4b7ec8de9196b21a9b1cf319c8e69eca2c92602ceee4a
23 DIST php-7.3.21.tar.xz 12123192 BLAKE2B ff5fca092f6c4e92c009ade9f4bee01ec07686645a4844297cee0518f12b3ebc16a7322b64579d9ee2d3a3f7cd62ed9184d0afbe77dbcf2d24a11139242c88c5 SHA512 fc2b9a40c92a6e79522a49cd025e56c0a52c2c2bd3f7379aaf004ca6b67957cf4ad059c40a5daac45665710abd07962562870430338f700f573856d797df3ff4
24 +DIST php-7.3.22.tar.xz 12134212 BLAKE2B 2a299d0e1a69425e06b71fcdd471bc659747a1a4adce276c0d42715045ee81a5241982b2408daa8122b8737d9dccc898847406dd007ea583a76cf29b893bc555 SHA512 7f06473e394e3236dff1376c8c9e6d15b998eef8b8b1148b103bd13dfd27785c01e1c6b15414ff64ea511f3f5e59e925831a7546f235d7c58bd47dcf46f6ff00
25 DIST php-7.4.10.tar.xz 10298480 BLAKE2B ef5e051da37c0bddc6819459c2e2b00b28bbfe6efbdc7ad9651200d2e453c434e59cb91642d775334db86a95afd9255012c4a57d57dac4d6cf7e1692067d0f90 SHA512 c7beb2d821f4e28b0444c8653c360d210a924e0638cc4b4ebc71bf2c22ef83caedfc880275329c3ffa644adc5858ccff59d35bf36255d57218774089d3376a21
26 DIST php-7.4.9.tar.xz 10289560 BLAKE2B 0fd9d82539a46f7ce58857560f5aeb4be6dfe5f5a05f8b8c55c30d6000d19408b4ecc460c9135736298cdb8312ec958ab8358110b2b265bb8c185f80b1522dc6 SHA512 6179c2d867d6775d7f41785003c36d06ce620e7746ea7e6a4d275264e814a66d465776b47b04e2926ed1228cf58f2c15cdda74faf10372435c74ede7aeb79e18
27
28 diff --git a/dev-lang/php/php-7.3.22.ebuild b/dev-lang/php/php-7.3.22.ebuild
29 new file mode 100644
30 index 00000000000..705d68d153f
31 --- /dev/null
32 +++ b/dev-lang/php/php-7.3.22.ebuild
33 @@ -0,0 +1,760 @@
34 +# Copyright 1999-2020 Gentoo Authors
35 +# Distributed under the terms of the GNU General Public License v2
36 +
37 +EAPI="7"
38 +
39 +inherit flag-o-matic systemd autotools
40 +
41 +MY_PV=${PV/_rc/RC}
42 +DESCRIPTION="The PHP language runtime engine"
43 +HOMEPAGE="https://www.php.net/"
44 +SRC_URI="https://www.php.net/distributions/${P}.tar.xz"
45 +
46 +LICENSE="PHP-3.01
47 + BSD
48 + Zend-2.0
49 + bcmath? ( LGPL-2.1+ )
50 + fpm? ( BSD-2 )
51 + gd? ( gd )
52 + unicode? ( BSD-2 LGPL-2.1 )"
53 +
54 +SLOT="$(ver_cut 1-2)"
55 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
56 +
57 +S="${WORKDIR}/${PN}-${MY_PV}"
58 +
59 +# We can build the following SAPIs in the given order
60 +SAPIS="embed cli cgi fpm apache2 phpdbg"
61 +
62 +# SAPIs and SAPI-specific USE flags (cli SAPI is default on):
63 +IUSE="${IUSE}
64 + ${SAPIS/cli/+cli}
65 + threads"
66 +
67 +IUSE="${IUSE} acl argon2 bcmath berkdb bzip2 calendar cdb cjk
68 + coverage +ctype curl debug
69 + enchant exif +fileinfo +filter firebird
70 + +flatfile ftp gd gdbm gmp +hash +iconv imap inifile
71 + intl iodbc ipv6 +json kerberos ldap ldap-sasl libedit libressl lmdb
72 + mhash mssql mysql mysqli nls
73 + oci8-instant-client odbc +opcache pcntl pdo +phar +posix postgres qdbm
74 + readline recode selinux +session session-mm sharedmem
75 + +simplexml snmp soap sockets sodium spell sqlite ssl
76 + sysvipc systemd test tidy +tokenizer tokyocabinet truetype unicode wddx webp
77 + +xml xmlreader xmlwriter xmlrpc xpm xslt zip zip-encryption zlib"
78 +
79 +# The supported (that is, autodetected) versions of BDB are listed in
80 +# the ./configure script. Other versions *work*, but we need to stick to
81 +# the ones that can be detected to avoid a repeat of bug #564824.
82 +COMMON_DEPEND="
83 + >=app-eselect/eselect-php-0.9.1[apache2?,fpm?]
84 + >=dev-libs/libpcre2-10.30[unicode]
85 + fpm? ( acl? ( sys-apps/acl ) )
86 + apache2? ( www-servers/apache[apache2_modules_unixd(+),threads=] )
87 + argon2? ( app-crypt/argon2:= )
88 + berkdb? ( || ( sys-libs/db:5.3
89 + sys-libs/db:5.1
90 + sys-libs/db:4.8
91 + sys-libs/db:4.7
92 + sys-libs/db:4.6
93 + sys-libs/db:4.5 ) )
94 + bzip2? ( app-arch/bzip2:0= )
95 + cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
96 + coverage? ( dev-util/lcov )
97 + curl? ( >=net-misc/curl-7.10.5 )
98 + enchant? ( <app-text/enchant-2.0:0 )
99 + firebird? ( dev-db/firebird )
100 + gd? ( >=virtual/jpeg-0-r3:0 media-libs/libpng:0= >=sys-libs/zlib-1.2.0.4 )
101 + gdbm? ( >=sys-libs/gdbm-1.8.0:0= )
102 + gmp? ( dev-libs/gmp:0= )
103 + iconv? ( virtual/libiconv )
104 + imap? ( >=virtual/imap-c-client-2[kerberos=,ssl=] )
105 + intl? ( dev-libs/icu:= )
106 + iodbc? ( dev-db/libiodbc )
107 + kerberos? ( virtual/krb5 )
108 + ldap? ( >=net-nds/openldap-1.2.11 )
109 + ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 )
110 + libedit? ( dev-libs/libedit )
111 + lmdb? ( dev-db/lmdb:= )
112 + mssql? ( dev-db/freetds[mssql] )
113 + nls? ( sys-devel/gettext )
114 + oci8-instant-client? ( dev-db/oracle-instantclient-basic )
115 + odbc? ( >=dev-db/unixODBC-1.8.13 )
116 + postgres? ( dev-db/postgresql:* )
117 + qdbm? ( dev-db/qdbm )
118 + readline? ( sys-libs/readline:0= )
119 + recode? ( app-text/recode )
120 + session-mm? ( dev-libs/mm )
121 + simplexml? ( >=dev-libs/libxml2-2.6.8 )
122 + snmp? ( >=net-analyzer/net-snmp-5.2 )
123 + soap? ( >=dev-libs/libxml2-2.6.8 )
124 + sodium? ( dev-libs/libsodium:= )
125 + spell? ( >=app-text/aspell-0.50 )
126 + sqlite? ( >=dev-db/sqlite-3.7.6.3 )
127 + ssl? (
128 + !libressl? ( >=dev-libs/openssl-1.0.1:0= )
129 + libressl? ( dev-libs/libressl:0= )
130 + )
131 + tidy? ( || ( app-text/tidy-html5 app-text/htmltidy ) )
132 + tokyocabinet? ( dev-db/tokyocabinet )
133 + truetype? ( =media-libs/freetype-2* )
134 + unicode? ( dev-libs/oniguruma:= )
135 + wddx? ( >=dev-libs/libxml2-2.6.8 )
136 + webp? ( media-libs/libwebp:0= )
137 + xml? ( >=dev-libs/libxml2-2.6.8 )
138 + xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv )
139 + xmlreader? ( >=dev-libs/libxml2-2.6.8 )
140 + xmlwriter? ( >=dev-libs/libxml2-2.6.8 )
141 + xpm? ( x11-libs/libXpm )
142 + xslt? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
143 + zip? ( >=sys-libs/zlib-1.2.0.4:0= )
144 + zip-encryption? ( >=dev-libs/libzip-1.2.0:= )
145 + zlib? ( >=sys-libs/zlib-1.2.0.4:0= )
146 +"
147 +
148 +RDEPEND="${COMMON_DEPEND}
149 + virtual/mta
150 + fpm? (
151 + selinux? ( sec-policy/selinux-phpfpm )
152 + systemd? ( sys-apps/systemd ) )"
153 +
154 +# Bison isn't actually needed when building from a release tarball
155 +# However, the configure script will warn if it's absent or if you
156 +# have an incompatible version installed. See bug 593278.
157 +DEPEND="${COMMON_DEPEND}
158 + app-arch/xz-utils
159 + >=sys-devel/bison-3.0.1"
160 +
161 +BDEPEND="virtual/pkgconfig"
162 +
163 +# Without USE=readline or libedit, the interactive "php -a" CLI will hang.
164 +REQUIRED_USE="
165 + || ( cli cgi fpm apache2 embed phpdbg )
166 + cli? ( ^^ ( readline libedit ) )
167 + truetype? ( gd zlib )
168 + webp? ( gd zlib )
169 + cjk? ( gd zlib )
170 + exif? ( gd zlib )
171 + xpm? ( gd zlib )
172 + gd? ( zlib )
173 + simplexml? ( xml )
174 + soap? ( xml )
175 + wddx? ( xml )
176 + xmlrpc? ( || ( xml iconv ) )
177 + xmlreader? ( xml )
178 + xslt? ( xml )
179 + ldap-sasl? ( ldap )
180 + mhash? ( hash )
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 + # Many arches don't support pcre-jit
457 + our_conf+=(
458 + --with-pcre-regex="${EPREFIX}/usr"
459 + --with-pcre-dir="${EPREFIX}/usr"
460 + --without-pcre-valgrind
461 + --without-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${PHP_MV}$(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${PHP_MV}$(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 + 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 +}