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