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: Fri, 27 Aug 2021 13:16:22
Message-Id: 1630070162.855941efd60acbf30002dfbd9ca8744ce8249338.whissi@gentoo
1 commit: 855941efd60acbf30002dfbd9ca8744ce8249338
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Fri Aug 27 11:48:25 2021 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Fri Aug 27 13:16:02 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=855941ef
7
8 dev-lang/php: bump to v7.3.30
9
10 Package-Manager: Portage-3.0.22, Repoman-3.0.3
11 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
12
13 dev-lang/php/Manifest | 1 +
14 dev-lang/php/php-7.3.30.ebuild | 758 +++++++++++++++++++++++++++++++++++++++++
15 2 files changed, 759 insertions(+)
16
17 diff --git a/dev-lang/php/Manifest b/dev-lang/php/Manifest
18 index 2fbe4dc71ad..0f250661320 100644
19 --- a/dev-lang/php/Manifest
20 +++ b/dev-lang/php/Manifest
21 @@ -1,4 +1,5 @@
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.4.21.tar.xz 10346628 BLAKE2B f758d6bef60f5e0c99bd097533d1663640362c2b752a3bd54389acc3bd7d173c1ba5d4b1c119b6ad50f5029aabe2349bb4646a33212dc3cf34fd294f24def401 SHA512 778ddbfe614fdc6a00bc82c61f4c636bdbe815ce3398415a29bd24a2fd4ca2113b3b804303585d8830242e04b0c202bbc7c725a46c9bad79b070a0e896e5e681
25 DIST php-7.4.22.tar.xz 10348532 BLAKE2B 20e4bfb0362bb13ca8cacf9fb2500ffdd2db011d69cb82f113dd0c25e8a5fd4a017d77481732930afd24a8e092edbce3eafe9d45f27718ddf7567469f80c5642 SHA512 80587ba613b8a863a666f44a16ebb33cbb5a5d396601d1eaf063c8f7793a98abae903cb76fca4216860f1a043d5ee997464d479d53ffff6a1d6a6cd31da9100d
26 DIST php-7.4.23.tar.xz 10371160 BLAKE2B 5e9fc033f856132dd6b7b06fc5aedc72218f083779fd90a8c4c7a23fb4f8c248a7ff769f9d9f46e5143ddf88ce9289f5a8013c194aeaf22eca74d97846868611 SHA512 659b6bbf9be21a09640529bc088dfd7a494081188e37eb1f2dac2cab92a1084062fd06d550dc8c97bdd7dd9b57f4146e357447be2cb86643bda1d8dbc8a0d4a3
27
28 diff --git a/dev-lang/php/php-7.3.30.ebuild b/dev-lang/php/php-7.3.30.ebuild
29 new file mode 100644
30 index 00000000000..ca53010503c
31 --- /dev/null
32 +++ b/dev-lang/php/php-7.3.30.ebuild
33 @@ -0,0 +1,758 @@
34 +# Copyright 1999-2021 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"
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 +jit +json kerberos ldap ldap-sasl libedit 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[jit?,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[sdk] )
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:0= )
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:=[-minimal] )
125 + spell? ( >=app-text/aspell-0.50 )
126 + sqlite? ( >=dev-db/sqlite-3.7.6.3 )
127 + ssl? ( >=dev-libs/openssl-1.0.1:0= )
128 + tidy? ( || ( app-text/tidy-html5 app-text/htmltidy ) )
129 + tokyocabinet? ( dev-db/tokyocabinet )
130 + truetype? ( =media-libs/freetype-2* )
131 + unicode? ( dev-libs/oniguruma:= )
132 + wddx? ( >=dev-libs/libxml2-2.6.8 )
133 + webp? ( media-libs/libwebp:0= )
134 + xml? ( >=dev-libs/libxml2-2.6.8 )
135 + xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv )
136 + xmlreader? ( >=dev-libs/libxml2-2.6.8 )
137 + xmlwriter? ( >=dev-libs/libxml2-2.6.8 )
138 + xpm? ( x11-libs/libXpm )
139 + xslt? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
140 + zip? ( >=sys-libs/zlib-1.2.0.4:0= )
141 + zip-encryption? ( >=dev-libs/libzip-1.2.0:= )
142 + zlib? ( >=sys-libs/zlib-1.2.0.4:0= )
143 +"
144 +
145 +RDEPEND="${COMMON_DEPEND}
146 + virtual/mta
147 + fpm? (
148 + selinux? ( sec-policy/selinux-phpfpm )
149 + systemd? ( sys-apps/systemd ) )"
150 +
151 +# Bison isn't actually needed when building from a release tarball
152 +# However, the configure script will warn if it's absent or if you
153 +# have an incompatible version installed. See bug 593278.
154 +DEPEND="${COMMON_DEPEND}
155 + app-arch/xz-utils
156 + >=sys-devel/bison-3.0.1"
157 +
158 +BDEPEND="virtual/pkgconfig"
159 +
160 +# Without USE=readline or libedit, the interactive "php -a" CLI will hang.
161 +# The Oracle instant client provides its own incompatible ldap library.
162 +REQUIRED_USE="
163 + || ( cli cgi fpm apache2 embed phpdbg )
164 + cli? ( ^^ ( readline libedit ) )
165 + truetype? ( gd zlib )
166 + webp? ( gd zlib )
167 + cjk? ( gd zlib )
168 + exif? ( gd zlib )
169 + xpm? ( gd zlib )
170 + gd? ( zlib )
171 + simplexml? ( xml )
172 + soap? ( xml )
173 + wddx? ( xml )
174 + xmlrpc? ( || ( xml iconv ) )
175 + xmlreader? ( xml )
176 + xslt? ( xml )
177 + ldap-sasl? ( ldap )
178 + mhash? ( hash )
179 + oci8-instant-client? ( !ldap )
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 + our_conf+=(
456 + --with-pcre-regex="${EPREFIX}/usr"
457 + --with-pcre-dir="${EPREFIX}/usr"
458 + --without-pcre-valgrind
459 + $(use_with jit pcre-jit)
460 + )
461 +
462 + # Catch CFLAGS problems
463 + # Fixes bug #14067.
464 + # Changed order to run it in reverse for bug #32022 and #12021.
465 + replace-cpu-flags "k6*" "i586"
466 +
467 + # Cache the ./configure test results between SAPIs.
468 + our_conf+=( --cache-file="${T}/config.cache" )
469 +
470 + # Support user-passed configuration parameters
471 + our_conf+=( ${EXTRA_ECONF:-} )
472 +
473 + # Support the Apache2 extras, they must be set globally for all
474 + # SAPIs to work correctly, especially for external PHP extensions
475 +
476 + local one_sapi
477 + local sapi
478 + mkdir -p "${WORKDIR}/sapis-build" || die
479 + for one_sapi in $SAPIS ; do
480 + use "${one_sapi}" || continue
481 + php_set_ini_dir "${one_sapi}"
482 +
483 + # The BUILD_DIR variable is used to determine where to output
484 + # the files that autotools creates. This was all originally
485 + # based on the autotools-utils eclass.
486 + BUILD_DIR="${WORKDIR}/sapis-build/${one_sapi}"
487 + cp -a "${S}" "${BUILD_DIR}" || die
488 + cd "${BUILD_DIR}" || die
489 +
490 + local sapi_conf=(
491 + --with-config-file-path="${PHP_INI_DIR}"
492 + --with-config-file-scan-dir="${PHP_EXT_INI_DIR_ACTIVE}"
493 + )
494 +
495 + for sapi in $SAPIS ; do
496 + case "$sapi" in
497 + cli|cgi|embed|fpm|phpdbg)
498 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
499 + sapi_conf+=( "--enable-${sapi}" )
500 + if [[ "fpm" == "${sapi}" ]] ; then
501 + sapi_conf+=(
502 + $(use_with acl fpm-acl)
503 + $(use_with systemd fpm-systemd)
504 + )
505 + fi
506 + else
507 + sapi_conf+=( "--disable-${sapi}" )
508 + fi
509 + ;;
510 +
511 + apache2)
512 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
513 + sapi_conf+=( --with-apxs2="${EPREFIX}/usr/bin/apxs" )
514 + else
515 + sapi_conf+=( --without-apxs2 )
516 + fi
517 + ;;
518 + esac
519 + done
520 +
521 + # Construct the $myeconfargs array by concatenating $our_conf
522 + # (the common args) and $sapi_conf (the SAPI-specific args).
523 + local myeconfargs=( "${our_conf[@]}" )
524 + myeconfargs+=( "${sapi_conf[@]}" )
525 +
526 + pushd "${BUILD_DIR}" > /dev/null || die
527 + econf "${myeconfargs[@]}"
528 + popd > /dev/null || die
529 + done
530 +}
531 +
532 +src_compile() {
533 + # snmp seems to run during src_compile, too (bug #324739)
534 + addpredict /usr/share/snmp/mibs/.index #nowarn
535 + addpredict /var/lib/net-snmp/mib_indexes #nowarn
536 +
537 + local sapi
538 + for sapi in ${SAPIS} ; do
539 + if use "${sapi}"; then
540 + cd "${WORKDIR}/sapis-build/$sapi" || \
541 + die "Failed to change dir to ${WORKDIR}/sapis-build/$1"
542 + emake
543 + fi
544 + done
545 +}
546 +
547 +src_install() {
548 + # see bug #324739 for what happens when we don't have that
549 + addpredict /usr/share/snmp/mibs/.index #nowarn
550 +
551 + # grab the first SAPI that got built and install common files from there
552 + local first_sapi="", sapi=""
553 + for sapi in $SAPIS ; do
554 + if use $sapi ; then
555 + first_sapi=$sapi
556 + break
557 + fi
558 + done
559 +
560 + # Makefile forgets to create this before trying to write to it...
561 + dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
562 +
563 + # Install php environment (without any sapis)
564 + cd "${WORKDIR}/sapis-build/$first_sapi" || die
565 + emake INSTALL_ROOT="${D}" \
566 + install-build install-headers install-programs
567 +
568 + local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
569 +
570 + # Create the directory where we'll put version-specific php scripts
571 + keepdir "/usr/share/php${PHP_MV}"
572 +
573 + local file=""
574 + local sapi_list=""
575 +
576 + for sapi in ${SAPIS}; do
577 + if use "${sapi}" ; then
578 + einfo "Installing SAPI: ${sapi}"
579 + cd "${WORKDIR}/sapis-build/${sapi}" || die
580 +
581 + if [[ "${sapi}" == "apache2" ]] ; then
582 + # We're specifically not using emake install-sapi as libtool
583 + # may cause unnecessary relink failures (see bug #351266)
584 + insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
585 + newins ".libs/libphp${PHP_MV}$(get_libname)" \
586 + "libphp${PHP_MV}$(get_libname)"
587 + keepdir "/usr/$(get_libdir)/apache2/modules"
588 + else
589 + # needed each time, php_install_ini would reset it
590 + local dest="${PHP_DESTDIR#${EPREFIX}}"
591 + into "${dest}"
592 + case "$sapi" in
593 + cli)
594 + source="sapi/cli/php"
595 + # Install the "phar" archive utility.
596 + if use phar ; then
597 + emake INSTALL_ROOT="${D}" install-pharcmd
598 + dosym "..${dest#/usr}/bin/phar" "/usr/bin/phar${SLOT}"
599 + fi
600 + ;;
601 + cgi)
602 + source="sapi/cgi/php-cgi"
603 + ;;
604 + fpm)
605 + source="sapi/fpm/php-fpm"
606 + ;;
607 + embed)
608 + source="libs/libphp${PHP_MV}$(get_libname)"
609 + ;;
610 + phpdbg)
611 + source="sapi/phpdbg/phpdbg"
612 + ;;
613 + *)
614 + die "unhandled sapi in src_install"
615 + ;;
616 + esac
617 +
618 + if [[ "${source}" == *"$(get_libname)" ]]; then
619 + dolib.so "${source}"
620 + else
621 + dobin "${source}"
622 + local name="$(basename ${source})"
623 + dosym "..${dest#/usr}/bin/${name}" "/usr/bin/${name}${SLOT}"
624 + fi
625 + fi
626 +
627 + php_install_ini "${sapi}"
628 +
629 + # construct correct SAPI string for php-config
630 + # thanks to ferringb for the bash voodoo
631 + if [[ "${sapi}" == "apache2" ]]; then
632 + sapi_list="${sapi_list:+${sapi_list} }apache2handler"
633 + else
634 + sapi_list="${sapi_list:+${sapi_list} }${sapi}"
635 + fi
636 + fi
637 + done
638 +
639 + # Installing opcache module
640 + if use opcache ; then
641 + into "${PHP_DESTDIR#${EPREFIX}}"
642 + dolib.so "modules/opcache$(get_libname)"
643 + fi
644 +
645 + # Install env.d files
646 + newenvd "${FILESDIR}/20php5-envd" "20php${SLOT}"
647 + sed -e "s|/lib/|/$(get_libdir)/|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
648 + sed -e "s|php5|php${SLOT}|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
649 +
650 + # set php-config variable correctly (bug #278439)
651 + sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
652 + "${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config" || die
653 +
654 + if use fpm ; then
655 + if use systemd; then
656 + systemd_newunit "${FILESDIR}/php-fpm_at.service" \
657 + "php-fpm@${SLOT}.service"
658 + else
659 + systemd_newunit "${FILESDIR}/php-fpm_at-simple.service" \
660 + "php-fpm@${SLOT}.service"
661 + fi
662 + fi
663 +}
664 +
665 +src_test() {
666 + echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
667 + PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php"
668 + if [[ ! -x "${PHP_BIN}" ]] ; then
669 + ewarn "Test phase requires USE=cli, skipping"
670 + return
671 + else
672 + export TEST_PHP_EXECUTABLE="${PHP_BIN}"
673 + fi
674 +
675 + if [[ -x "${WORKDIR}/sapis-build/cgi/sapi/cgi/php-cgi" ]] ; then
676 + export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis-build/cgi/sapi/cgi/php-cgi"
677 + fi
678 +
679 + if [[ -x "${WORKDIR}/sapis-build/phpdbg/sapi/phpdbg/phpdbg" ]] ; then
680 + export TEST_PHPDBG_EXECUTABLE="${WORKDIR}/sapis-build/phpdbg/sapi/phpdbg/phpdbg"
681 + fi
682 +
683 + REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d \
684 + "session.save_path=${T}" \
685 + "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d \
686 + "session.save_path=${T}"
687 +
688 + for name in ${EXPECTED_TEST_FAILURES}; do
689 + mv "${name}.out" "${name}.out.orig" 2>/dev/null || die
690 + done
691 +
692 + local failed="$(find -name '*.out')"
693 + if [[ ${failed} != "" ]] ; then
694 + ewarn "The following test cases failed unexpectedly:"
695 + for name in ${failed}; do
696 + ewarn " ${name/.out/}"
697 + done
698 + else
699 + einfo "No unexpected test failures, all fine"
700 + fi
701 +
702 + if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
703 + local passed=""
704 + for name in ${EXPECTED_TEST_FAILURES}; do
705 + [[ -f "${name}.diff" ]] && continue
706 + passed="${passed} ${name}"
707 + done
708 + if [[ ${passed} != "" ]] ; then
709 + einfo "The following test cases passed unexpectedly:"
710 + for name in ${passed}; do
711 + ewarn " ${passed}"
712 + done
713 + else
714 + einfo "None of the known-to-fail tests passed, all fine"
715 + fi
716 + fi
717 +}
718 +
719 +pkg_postinst() {
720 + # Output some general info to the user
721 + if use apache2 ; then
722 + elog
723 + elog "To enable PHP in apache, you will need to add \"-D PHP\" to"
724 + elog "your apache2 command. OpenRC users can append that string to"
725 + elog "APACHE2_OPTS in /etc/conf.d/apache2."
726 + elog
727 + elog "The apache module configuration file 70_mod_php.conf is"
728 + elog "provided (and maintained) by eselect-php."
729 + elog
730 + fi
731 +
732 + # Create the symlinks for php
733 + local m
734 + for m in ${SAPIS}; do
735 + [[ ${m} == 'embed' ]] && continue;
736 + if use $m ; then
737 + local ci=$(eselect php show $m)
738 + if [[ -z $ci ]]; then
739 + eselect php set $m php${SLOT} || die
740 + einfo "Switched ${m} to use php:${SLOT}"
741 + einfo
742 + elif [[ $ci != "php${SLOT}" ]] ; then
743 + elog "To switch $m to use php:${SLOT}, run"
744 + elog " eselect php set $m php${SLOT}"
745 + elog
746 + fi
747 + fi
748 + done
749 +
750 + # Remove dead symlinks for SAPIs that were just disabled. For
751 + # example, if the user has the cgi SAPI enabled, then he has an
752 + # eselect-php symlink for it. If he later reinstalls PHP with
753 + # USE="-cgi", that symlink will break. This call to eselect is
754 + # supposed to remove that dead link per bug 572436.
755 + eselect php cleanup || die
756 +
757 + if ! has "php${SLOT/./-}" ${PHP_TARGETS}; then
758 + elog "To build extensions for this version of PHP, you will need to"
759 + elog "add php${SLOT/./-} to your PHP_TARGETS USE_EXPAND variable."
760 + elog
761 + fi
762 +
763 + # Warn about the removal of PHP_INI_VERSION if the user has it set.
764 + if [[ -n "${PHP_INI_VERSION}" ]]; then
765 + ewarn 'The PHP_INI_VERSION variable has been phased out. You may'
766 + ewarn 'remove it from your configuration at your convenience. See'
767 + ewarn
768 + ewarn ' https://bugs.gentoo.org/611214'
769 + ewarn
770 + ewarn 'for more information.'
771 + fi
772 +
773 + elog "For details on how version slotting works, please see"
774 + elog "the wiki:"
775 + elog
776 + elog " https://wiki.gentoo.org/wiki/PHP"
777 + elog
778 +}
779 +
780 +pkg_postrm() {
781 + # This serves two purposes. First, if we have just removed the last
782 + # installed version of PHP, then this will remove any dead symlinks
783 + # belonging to eselect-php. Second, if a user upgrades slots from
784 + # (say) 5.6 to 7.0 and depcleans the old slot, then this will update
785 + # his existing symlinks to point to the new 7.0 installation. The
786 + # latter is bug 432962.
787 + #
788 + # Note: the eselect-php package may not be installed at this point,
789 + # so we can't die() if this command fails.
790 + eselect php cleanup
791 +}