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, 05 Apr 2019 14:13:21
Message-Id: 1554473585.2fd5d70f4ad0a76b08a6e8a2f9cb386b8ccc00aa.whissi@gentoo
1 commit: 2fd5d70f4ad0a76b08a6e8a2f9cb386b8ccc00aa
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Fri Apr 5 13:37:31 2019 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Fri Apr 5 14:13:05 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2fd5d70f
7
8 dev-lang/php: bump to v7.3.4
9
10 Package-Manager: Portage-2.3.62, Repoman-2.3.12
11 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
12
13 dev-lang/php/Manifest | 1 +
14 dev-lang/php/php-7.3.4.ebuild | 750 ++++++++++++++++++++++++++++++++++++++++++
15 2 files changed, 751 insertions(+)
16
17 diff --git a/dev-lang/php/Manifest b/dev-lang/php/Manifest
18 index 4a1e7c15617..4d6642bae9d 100644
19 --- a/dev-lang/php/Manifest
20 +++ b/dev-lang/php/Manifest
21 @@ -2,4 +2,5 @@ DIST php-5.6.40.tar.xz 12472236 BLAKE2B f41147eaec9b15e965540f9e871691cc88848dd6
22 DIST php-7.1.27.tar.xz 12219868 BLAKE2B 9de4902504e50b53aab28eac2252aa79302541352b1323a17e68cc58e22cd3b6108b3f7d6ba4779a7f87a561442cf3c44c5660418a354d3b48b6df270a761f8b SHA512 a7019788b02f624e19f804cb0c34578443fc2e0a582a32e72d1340f3cd7bb866631497fe61d18f31f92bad5aa7667847e21bd3916fcdd6f04a3b8f88c805f544
23 DIST php-7.2.16.tar.xz 12166372 BLAKE2B c59ac69b717a8ee88f229baa94c43f9ee1d9c7161c767a95c3a9719ee70cdc9b61aaff75504aca09bba10d224d9a717cb7c985060b6912491857a003e6cbc349 SHA512 cd2ea3c68d7ed20317800f4b838b0dd9ae2fde508c79662b296dacdacf6c7e35b6ef30a6564516d7b22e82749a6e9e2ffcfd95b05cd79a9f227fbfaf9e25bc31
24 DIST php-7.3.3.tar.xz 11972184 BLAKE2B e6404d8af6d0196f27a8939e995e317307287e2110b3cdc436659eb074087ac545a4253d86c4ee7374dffbe4348004bd257ec0e2b7169e8c125e664c56f9dfe7 SHA512 bad5fa35f5962fa23dbe01fe85f76ce80e431cf2f9719284c082bb1fa32af26407407a97d3bf999165a6158f83a9669e3dd641f6d70028ec644b74a414fb803d
25 +DIST php-7.3.4.tar.xz 11977004 BLAKE2B 7a3a805a55272a7d641b6cf26965ff6fccca607f035c0e40be8d83cf4aa79ee246ec906e0f1352b7c654744a618d1c1a1e60dfea56b6b0be06ef9811efe22126 SHA512 fc45cd6cb273ca7a959a3ab0d2d15febedc60e9e289803f5f4340149b5fe8f52ca23119b128513194d769c842cd0941f8086c338db115d585c2f4e791e83b141
26 DIST php-patches-20190307-r1.tar.xz 20796 BLAKE2B 251f0d8b222e4a6a339a3b1d4aff39fab8bd7203ec34295b7316a366a7d0015bb9e6665614005949da9decbca53aa9ac0aab63845638a6b4d3d462eabff4ea35 SHA512 d7a412ec1bc6002c458c6bc3cb53faf4e95a852a6cdad337f6a81a978dd56ba72801cccbe866857d6c5b7e95dfe558878133e44a4e9f9b6efd38e679acc82af9
27
28 diff --git a/dev-lang/php/php-7.3.4.ebuild b/dev-lang/php/php-7.3.4.ebuild
29 new file mode 100644
30 index 00000000000..1e66c720846
31 --- /dev/null
32 +++ b/dev-lang/php/php-7.3.4.ebuild
33 @@ -0,0 +1,750 @@
34 +# Copyright 1999-2019 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://php.net/"
44 +SRC_URI="https://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 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~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-2.4[apache2_modules_unixd,threads=]
87 + <www-servers/apache-2.4[threads=] ) )
88 + argon2? ( app-crypt/argon2:= )
89 + berkdb? ( || ( sys-libs/db:5.3
90 + sys-libs/db:5.1
91 + sys-libs/db:4.8
92 + sys-libs/db:4.7
93 + sys-libs/db:4.6
94 + sys-libs/db:4.5 ) )
95 + bzip2? ( app-arch/bzip2:0= )
96 + cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
97 + coverage? ( dev-util/lcov )
98 + curl? ( >=net-misc/curl-7.10.5 )
99 + enchant? ( <app-text/enchant-2.0:0 )
100 + firebird? ( dev-db/firebird )
101 + gd? ( virtual/jpeg:0 media-libs/libpng:0= >=sys-libs/zlib-1.2.0.4 )
102 + gdbm? ( >=sys-libs/gdbm-1.8.0:0= )
103 + gmp? ( dev-libs/gmp:0= )
104 + iconv? ( virtual/libiconv )
105 + imap? ( virtual/imap-c-client[kerberos=,ssl=] )
106 + intl? ( dev-libs/icu:= )
107 + iodbc? ( dev-db/libiodbc )
108 + kerberos? ( virtual/krb5 )
109 + ldap? ( >=net-nds/openldap-1.2.11 )
110 + ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 )
111 + libedit? ( || ( sys-freebsd/freebsd-lib dev-libs/libedit ) )
112 + lmdb? ( dev-db/lmdb:= )
113 + mssql? ( dev-db/freetds[mssql] )
114 + nls? ( sys-devel/gettext )
115 + oci8-instant-client? ( dev-db/oracle-instantclient-basic )
116 + odbc? ( >=dev-db/unixODBC-1.8.13 )
117 + postgres? ( dev-db/postgresql:* )
118 + qdbm? ( dev-db/qdbm )
119 + readline? ( sys-libs/readline:0= )
120 + recode? ( app-text/recode )
121 + session-mm? ( dev-libs/mm )
122 + simplexml? ( >=dev-libs/libxml2-2.6.8 )
123 + snmp? ( >=net-analyzer/net-snmp-5.2 )
124 + soap? ( >=dev-libs/libxml2-2.6.8 )
125 + sodium? ( dev-libs/libsodium:= )
126 + spell? ( >=app-text/aspell-0.50 )
127 + sqlite? ( >=dev-db/sqlite-3.7.6.3 )
128 + ssl? (
129 + !libressl? ( >=dev-libs/openssl-1.0.1:0= )
130 + libressl? ( dev-libs/libressl:0= )
131 + )
132 + tidy? ( || ( app-text/tidy-html5 app-text/htmltidy ) )
133 + tokyocabinet? ( dev-db/tokyocabinet )
134 + truetype? ( =media-libs/freetype-2* )
135 + unicode? ( dev-libs/oniguruma:= )
136 + wddx? ( >=dev-libs/libxml2-2.6.8 )
137 + webp? ( media-libs/libwebp:0= )
138 + xml? ( >=dev-libs/libxml2-2.6.8 )
139 + xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv )
140 + xmlreader? ( >=dev-libs/libxml2-2.6.8 )
141 + xmlwriter? ( >=dev-libs/libxml2-2.6.8 )
142 + xpm? ( x11-libs/libXpm )
143 + xslt? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
144 + zip? ( >=sys-libs/zlib-1.2.0.4:0= )
145 + zip-encryption? ( >=dev-libs/libzip-1.2.0:= )
146 + zlib? ( >=sys-libs/zlib-1.2.0.4:0= )
147 +"
148 +
149 +RDEPEND="${COMMON_DEPEND}
150 + virtual/mta
151 + fpm? (
152 + selinux? ( sec-policy/selinux-phpfpm )
153 + systemd? ( sys-apps/systemd ) )"
154 +
155 +# Bison isn't actually needed when building from a release tarball
156 +# However, the configure script will warn if it's absent or if you
157 +# have an incompatible version installed. See bug 593278.
158 +DEPEND="${COMMON_DEPEND}
159 + app-arch/xz-utils
160 + >=sys-devel/bison-3.0.1"
161 +
162 +BDEPEND="virtual/pkgconfig"
163 +
164 +# Without USE=readline or libedit, the interactive "php -a" CLI will hang.
165 +REQUIRED_USE="
166 + || ( cli cgi fpm apache2 embed phpdbg )
167 + cli? ( ^^ ( readline libedit ) )
168 + truetype? ( gd zlib )
169 + webp? ( gd zlib )
170 + cjk? ( gd zlib )
171 + exif? ( gd zlib )
172 + xpm? ( gd zlib )
173 + gd? ( zlib )
174 + simplexml? ( xml )
175 + soap? ( xml )
176 + wddx? ( xml )
177 + xmlrpc? ( || ( xml iconv ) )
178 + xmlreader? ( xml )
179 + xslt? ( xml )
180 + ldap-sasl? ( ldap )
181 + mhash? ( hash )
182 + phar? ( hash )
183 + qdbm? ( !gdbm )
184 + readline? ( !libedit )
185 + recode? ( !imap !mysqli !mysql )
186 + session-mm? ( session !threads )
187 + mysql? ( || ( mysqli pdo ) )
188 + zip-encryption? ( zip )
189 +"
190 +PATCHES=(
191 + "${FILESDIR}/php-freetype-2.9.1.patch"
192 +)
193 +
194 +PHP_MV="$(ver_cut 1)"
195 +
196 +php_install_ini() {
197 + local phpsapi="${1}"
198 +
199 + # work out where we are installing the ini file
200 + php_set_ini_dir "${phpsapi}"
201 +
202 + # Always install the production INI file, bug 611214.
203 + local phpinisrc="php.ini-production-${phpsapi}"
204 + cp php.ini-production "${phpinisrc}" || die
205 +
206 + # default to /tmp for save_path, bug #282768
207 + sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}" || die
208 +
209 + # Set the extension dir
210 + sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" \
211 + -i "${phpinisrc}" || die
212 +
213 + # Set the include path to point to where we want to find PEAR packages
214 + sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}" || die
215 +
216 + dodir "${PHP_INI_DIR#${EPREFIX}}"
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 "${PHP_EXT_INI_DIR#${EPREFIX}}/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 + mkdir -p "${WORKDIR}/sapis-build" || die
478 + for one_sapi in $SAPIS ; do
479 + use "${one_sapi}" || continue
480 + php_set_ini_dir "${one_sapi}"
481 +
482 + # The BUILD_DIR variable is used to determine where to output
483 + # the files that autotools creates. This was all originally
484 + # based on the autotools-utils eclass.
485 + BUILD_DIR="${WORKDIR}/sapis-build/${one_sapi}"
486 + cp -a "${S}" "${BUILD_DIR}" || die
487 + cd "${BUILD_DIR}" || die
488 +
489 + local sapi_conf=(
490 + --with-config-file-path="${PHP_INI_DIR}"
491 + --with-config-file-scan-dir="${PHP_EXT_INI_DIR_ACTIVE}"
492 + )
493 +
494 + for sapi in $SAPIS ; do
495 + case "$sapi" in
496 + cli|cgi|embed|fpm|phpdbg)
497 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
498 + sapi_conf+=( "--enable-${sapi}" )
499 + if [[ "fpm" == "${sapi}" ]] ; then
500 + sapi_conf+=(
501 + $(use_with acl fpm-acl)
502 + $(use_with systemd fpm-systemd)
503 + )
504 + fi
505 + else
506 + sapi_conf+=( "--disable-${sapi}" )
507 + fi
508 + ;;
509 +
510 + apache2)
511 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
512 + sapi_conf+=( --with-apxs2="${EPREFIX}/usr/bin/apxs" )
513 + else
514 + sapi_conf+=( --without-apxs2 )
515 + fi
516 + ;;
517 + esac
518 + done
519 +
520 + # Construct the $myeconfargs array by concatenating $our_conf
521 + # (the common args) and $sapi_conf (the SAPI-specific args).
522 + local myeconfargs=( "${our_conf[@]}" )
523 + myeconfargs+=( "${sapi_conf[@]}" )
524 +
525 + pushd "${BUILD_DIR}" > /dev/null || die
526 + econf "${myeconfargs[@]}"
527 + popd > /dev/null || die
528 + done
529 +}
530 +
531 +src_compile() {
532 + # snmp seems to run during src_compile, too (bug #324739)
533 + addpredict /usr/share/snmp/mibs/.index #nowarn
534 + addpredict /var/lib/net-snmp/mib_indexes #nowarn
535 +
536 + for sapi in ${SAPIS} ; do
537 + if use "${sapi}"; then
538 + cd "${WORKDIR}/sapis-build/$sapi" || \
539 + die "Failed to change dir to ${WORKDIR}/sapis-build/$1"
540 + emake
541 + fi
542 + done
543 +}
544 +
545 +src_install() {
546 + # see bug #324739 for what happens when we don't have that
547 + addpredict /usr/share/snmp/mibs/.index #nowarn
548 +
549 + # grab the first SAPI that got built and install common files from there
550 + local first_sapi=""
551 + for sapi in $SAPIS ; do
552 + if use $sapi ; then
553 + first_sapi=$sapi
554 + break
555 + fi
556 + done
557 +
558 + # Makefile forgets to create this before trying to write to it...
559 + dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
560 +
561 + # Install php environment (without any sapis)
562 + cd "${WORKDIR}/sapis-build/$first_sapi" || die
563 + emake INSTALL_ROOT="${D}" \
564 + install-build install-headers install-programs
565 +
566 + local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
567 +
568 + # Create the directory where we'll put version-specific php scripts
569 + keepdir "/usr/share/php${PHP_MV}"
570 +
571 + local sapi="", file=""
572 + local sapi_list=""
573 +
574 + for sapi in ${SAPIS}; do
575 + if use "${sapi}" ; then
576 + einfo "Installing SAPI: ${sapi}"
577 + cd "${WORKDIR}/sapis-build/${sapi}" || die
578 +
579 + if [[ "${sapi}" == "apache2" ]] ; then
580 + # We're specifically not using emake install-sapi as libtool
581 + # may cause unnecessary relink failures (see bug #351266)
582 + insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
583 + newins ".libs/libphp${PHP_MV}$(get_libname)" \
584 + "libphp${PHP_MV}$(get_libname)"
585 + keepdir "/usr/$(get_libdir)/apache2/modules"
586 + else
587 + # needed each time, php_install_ini would reset it
588 + local dest="${PHP_DESTDIR#${EPREFIX}}"
589 + into "${dest}"
590 + case "$sapi" in
591 + cli)
592 + source="sapi/cli/php"
593 + ;;
594 + cgi)
595 + source="sapi/cgi/php-cgi"
596 + ;;
597 + fpm)
598 + source="sapi/fpm/php-fpm"
599 + ;;
600 + embed)
601 + source="libs/libphp${PHP_MV}$(get_libname)"
602 + ;;
603 + phpdbg)
604 + source="sapi/phpdbg/phpdbg"
605 + ;;
606 + *)
607 + die "unhandled sapi in src_install"
608 + ;;
609 + esac
610 +
611 + if [[ "${source}" == *"$(get_libname)" ]]; then
612 + dolib.so "${source}"
613 + else
614 + dobin "${source}"
615 + local name="$(basename ${source})"
616 + dosym "${dest}/bin/${name}" "/usr/bin/${name}${SLOT}"
617 + fi
618 + fi
619 +
620 + php_install_ini "${sapi}"
621 +
622 + # construct correct SAPI string for php-config
623 + # thanks to ferringb for the bash voodoo
624 + if [[ "${sapi}" == "apache2" ]]; then
625 + sapi_list="${sapi_list:+${sapi_list} }apache2handler"
626 + else
627 + sapi_list="${sapi_list:+${sapi_list} }${sapi}"
628 + fi
629 + fi
630 + done
631 +
632 + # Installing opcache module
633 + if use opcache ; then
634 + into "${PHP_DESTDIR#${EPREFIX}}"
635 + dolib.so "modules/opcache$(get_libname)"
636 + fi
637 +
638 + # Install env.d files
639 + newenvd "${FILESDIR}/20php5-envd" "20php${SLOT}"
640 + sed -e "s|/lib/|/$(get_libdir)/|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
641 + sed -e "s|php5|php${SLOT}|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
642 +
643 + # set php-config variable correctly (bug #278439)
644 + sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
645 + "${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config" || die
646 +
647 + if use fpm ; then
648 + if use systemd; then
649 + systemd_newunit "${FILESDIR}/php-fpm_at.service" \
650 + "php-fpm@${SLOT}.service"
651 + else
652 + systemd_newunit "${FILESDIR}/php-fpm_at-simple.service" \
653 + "php-fpm@${SLOT}.service"
654 + fi
655 + fi
656 +}
657 +
658 +src_test() {
659 + echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
660 + PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php"
661 + if [[ ! -x "${PHP_BIN}" ]] ; then
662 + ewarn "Test phase requires USE=cli, skipping"
663 + return
664 + else
665 + export TEST_PHP_EXECUTABLE="${PHP_BIN}"
666 + fi
667 +
668 + if [[ -x "${WORKDIR}/sapis-build/cgi/sapi/cgi/php-cgi" ]] ; then
669 + export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis-build/cgi/sapi/cgi/php-cgi"
670 + fi
671 +
672 + if [[ -x "${WORKDIR}/sapis-build/phpdbg/sapi/phpdbg/phpdbg" ]] ; then
673 + export TEST_PHPDBG_EXECUTABLE="${WORKDIR}/sapis-build/phpdbg/sapi/phpdbg/phpdbg"
674 + fi
675 +
676 + REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d \
677 + "session.save_path=${T}" \
678 + "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d \
679 + "session.save_path=${T}"
680 +
681 + for name in ${EXPECTED_TEST_FAILURES}; do
682 + mv "${name}.out" "${name}.out.orig" 2>/dev/null || die
683 + done
684 +
685 + local failed="$(find -name '*.out')"
686 + if [[ ${failed} != "" ]] ; then
687 + ewarn "The following test cases failed unexpectedly:"
688 + for name in ${failed}; do
689 + ewarn " ${name/.out/}"
690 + done
691 + else
692 + einfo "No unexpected test failures, all fine"
693 + fi
694 +
695 + if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
696 + local passed=""
697 + for name in ${EXPECTED_TEST_FAILURES}; do
698 + [[ -f "${name}.diff" ]] && continue
699 + passed="${passed} ${name}"
700 + done
701 + if [[ ${passed} != "" ]] ; then
702 + einfo "The following test cases passed unexpectedly:"
703 + for name in ${passed}; do
704 + ewarn " ${passed}"
705 + done
706 + else
707 + einfo "None of the known-to-fail tests passed, all fine"
708 + fi
709 + fi
710 +}
711 +
712 +pkg_postinst() {
713 + # Output some general info to the user
714 + if use apache2 ; then
715 + elog
716 + elog "To enable PHP in apache, you will need to add \"-D PHP\" to"
717 + elog "your apache2 command. OpenRC users can append that string to"
718 + elog "APACHE2_OPTS in /etc/conf.d/apache2."
719 + elog
720 + elog "The apache module configuration file 70_mod_php.conf is"
721 + elog "provided (and maintained) by eselect-php."
722 + elog
723 + fi
724 +
725 + # Create the symlinks for php
726 + for m in ${SAPIS}; do
727 + [[ ${m} == 'embed' ]] && continue;
728 + if use $m ; then
729 + local ci=$(eselect php show $m)
730 + if [[ -z $ci ]]; then
731 + eselect php set $m php${SLOT} || die
732 + einfo "Switched ${m} to use php:${SLOT}"
733 + einfo
734 + elif [[ $ci != "php${SLOT}" ]] ; then
735 + elog "To switch $m to use php:${SLOT}, run"
736 + elog " eselect php set $m php${SLOT}"
737 + elog
738 + fi
739 + fi
740 + done
741 +
742 + # Remove dead symlinks for SAPIs that were just disabled. For
743 + # example, if the user has the cgi SAPI enabled, then he has an
744 + # eselect-php symlink for it. If he later reinstalls PHP with
745 + # USE="-cgi", that symlink will break. This call to eselect is
746 + # supposed to remove that dead link per bug 572436.
747 + eselect php cleanup || die
748 +
749 + if ! has "php${SLOT/./-}" ${PHP_TARGETS}; then
750 + elog "To build extensions for this version of PHP, you will need to"
751 + elog "add php${SLOT/./-} to your PHP_TARGETS USE_EXPAND variable."
752 + elog
753 + fi
754 +
755 + # Warn about the removal of PHP_INI_VERSION if the user has it set.
756 + if [[ -n "${PHP_INI_VERSION}" ]]; then
757 + ewarn 'The PHP_INI_VERSION variable has been phased out. You may'
758 + ewarn 'remove it from your configuration at your convenience. See'
759 + ewarn
760 + ewarn ' https://bugs.gentoo.org/611214'
761 + ewarn
762 + ewarn 'for more information.'
763 + fi
764 +
765 + elog "For details on how version slotting works, please see"
766 + elog "the wiki:"
767 + elog
768 + elog " https://wiki.gentoo.org/wiki/PHP"
769 + elog
770 +}
771 +
772 +pkg_postrm() {
773 + # This serves two purposes. First, if we have just removed the last
774 + # installed version of PHP, then this will remove any dead symlinks
775 + # belonging to eselect-php. Second, if a user upgrades slots from
776 + # (say) 5.6 to 7.0 and depcleans the old slot, then this will update
777 + # his existing symlinks to point to the new 7.0 installation. The
778 + # latter is bug 432962.
779 + #
780 + # Note: the eselect-php package may not be installed at this point,
781 + # so we can't die() if this command fails.
782 + eselect php cleanup
783 +}