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