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