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, 30 Mar 2018 16:57:46
Message-Id: 1522429041.f1634e82c6eb8490b5cc5ebd59207533daadcfcd.grknight@gentoo
1 commit: f1634e82c6eb8490b5cc5ebd59207533daadcfcd
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Fri Mar 30 16:57:21 2018 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Fri Mar 30 16:57:21 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f1634e82
7
8 dev-lang/php: Version bump for 7.1.16
9
10 Package-Manager: Portage-2.3.27, Repoman-2.3.9
11
12 dev-lang/php/Manifest | 1 +
13 dev-lang/php/php-7.1.16.ebuild | 725 +++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 726 insertions(+)
15
16 diff --git a/dev-lang/php/Manifest b/dev-lang/php/Manifest
17 index 20a43f96e3a..2606ae4b12b 100644
18 --- a/dev-lang/php/Manifest
19 +++ b/dev-lang/php/Manifest
20 @@ -7,4 +7,5 @@ DIST php-7.0.29.tar.xz 12400192 BLAKE2B 0bd1bd9450b87437e539ec5131cb4f7e4dbf76d5
21 DIST php-7.1.13.tar.xz 12194780 BLAKE2B 0bac1cb3ec46cd4206d71b0d8ec3058fff455bc7e3febb33dcb8e14d5a8b16918d3e4679e0691b8ba29b95ab90be2a3dc3a73bade45c1ca4eaf692d6d3c2db3d SHA512 f5357ffcbcaab1ba03d70edc0f1329b530f9f9c7779ac57d6fd2bd0bb730162f8d107025e5ff66592077d1bf504ee6816ec0379f50ceb1fac36cea90b0fc4fa2
22 DIST php-7.1.14.tar.xz 12198612 BLAKE2B 6ceb307423f07dafb75992b021d94259452fa4f08a9122c6d5e0da95dca1bcd88c7795effabefa7bddd06b398eca8093881a5ddb6d66fa91fc63a56c3a0fa4cc SHA512 7604e490aef95ae9c87bc4230491328c4cbcce42653234906885f9aa323f867ea941a7dbe80424aa4c4872392559ff5fa2acf1605c402055b6e428e6fe79ece6
23 DIST php-7.1.15.tar.xz 12201380 BLAKE2B 4387382daf3883962eb0e47d86c983a65c293e89aa71239977bb1c6fdaa99b3a76eacb71a30f134fcc47f4ca6fea95687f3e405c1ecc7a737c8cf40489e8e7a3 SHA512 2b23795ffcb9d741adafe8a1e01e6988bb86ce7c6380bdbe822f8f6485e217ed2e95a27daf5ba11f0bf10317f1e1f4e37068e40d0bf322de5625d38b430d37c2
24 +DIST php-7.1.16.tar.xz 12211512 BLAKE2B bf242e2438b2dc363368a9ef4478349a291f483477ccedf988abd0fbb78a6f1b31e3b86dcb39ed9a9a8151674a8373ae77d8420e77efd6a2e05d5cfc778ed40f SHA512 98e96f06a4912cfa6926be2f292ce7120ca893c9b779b2efef4120c1df3580fa427cd58f5e4977edb01a0ae3b85660d6ca79b2bd79b6cd830cd77f6c6588b5ea
25 DIST php-7.2.4.tar.xz 12031892 BLAKE2B f76b3ccbfed4d309639ac5e35a12aa70a194f8cecde98634d7bff9123eb45ff3a4f0b3297149a44357bbc3287a9a3c1393d86b12bd53f38ff844db9498ee3452 SHA512 d1d0720f0d4bb28f7ce0ec7c859b14c1e74e9d0e7c73de6988d5ce737d7ccb7308c0a7a2651ee012c630be2cd53e6531505df0a03f0efbb6359176b446982244
26
27 diff --git a/dev-lang/php/php-7.1.16.ebuild b/dev-lang/php/php-7.1.16.ebuild
28 new file mode 100644
29 index 00000000000..34ff2d2648d
30 --- /dev/null
31 +++ b/dev-lang/php/php-7.1.16.ebuild
32 @@ -0,0 +1,725 @@
33 +# Copyright 1999-2018 Gentoo Foundation
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=6
37 +
38 +inherit flag-o-matic versionator systemd
39 +
40 +DESCRIPTION="The PHP language runtime engine"
41 +HOMEPAGE="https://secure.php.net/"
42 +SRC_URI="https://secure.php.net/distributions/${P}.tar.xz"
43 +
44 +LICENSE="PHP-3.01
45 + BSD
46 + Zend-2.0
47 + bcmath? ( LGPL-2.1+ )
48 + fpm? ( BSD-2 )
49 + gd? ( gd )
50 + unicode? ( BSD-2 LGPL-2.1 )"
51 +
52 +SLOT="$(get_version_component_range 1-2)"
53 +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"
54 +
55 +# We can build the following SAPIs in the given order
56 +SAPIS="embed cli cgi fpm apache2 phpdbg"
57 +
58 +# SAPIs and SAPI-specific USE flags (cli SAPI is default on):
59 +IUSE="${IUSE}
60 + ${SAPIS/cli/+cli}
61 + threads"
62 +
63 +IUSE="${IUSE} acl bcmath berkdb bzip2 calendar cdb cjk
64 + coverage crypt +ctype curl debug
65 + enchant exif +fileinfo +filter firebird
66 + flatfile ftp gd gdbm gmp +hash +iconv imap inifile
67 + intl iodbc ipv6 +json kerberos ldap ldap-sasl libedit libressl
68 + mhash mssql mysql mysqli nls
69 + oci8-instant-client odbc +opcache pcntl pdo +phar +posix postgres qdbm
70 + readline recode selinux +session session-mm sharedmem
71 + +simplexml snmp soap sockets spell sqlite ssl
72 + sysvipc systemd test tidy +tokenizer truetype unicode wddx webp
73 + +xml xmlreader xmlwriter xmlrpc xpm xslt zip zlib"
74 +
75 +# The supported (that is, autodetected) versions of BDB are listed in
76 +# the ./configure script. Other versions *work*, but we need to stick to
77 +# the ones that can be detected to avoid a repeat of bug #564824.
78 +COMMON_DEPEND="
79 + >=app-eselect/eselect-php-0.9.1[apache2?,fpm?]
80 + >=dev-libs/libpcre-8.32[unicode]
81 + fpm? ( acl? ( sys-apps/acl ) )
82 + apache2? ( || ( >=www-servers/apache-2.4[apache2_modules_unixd,threads=]
83 + <www-servers/apache-2.4[threads=] ) )
84 + berkdb? ( || ( sys-libs/db:5.3
85 + sys-libs/db:5.1
86 + sys-libs/db:4.8
87 + sys-libs/db:4.7
88 + sys-libs/db:4.6
89 + sys-libs/db:4.5 ) )
90 + bzip2? ( app-arch/bzip2:0= )
91 + cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
92 + coverage? ( dev-util/lcov )
93 + crypt? ( >=dev-libs/libmcrypt-2.4 )
94 + curl? ( >=net-misc/curl-7.10.5 )
95 + enchant? ( app-text/enchant )
96 + firebird? ( dev-db/firebird )
97 + gd? ( virtual/jpeg:0 media-libs/libpng:0= sys-libs/zlib )
98 + gdbm? ( >=sys-libs/gdbm-1.8.0:0= )
99 + gmp? ( dev-libs/gmp:0= )
100 + iconv? ( virtual/libiconv )
101 + imap? ( virtual/imap-c-client[kerberos=,ssl=] )
102 + intl? ( dev-libs/icu:= )
103 + iodbc? ( dev-db/libiodbc )
104 + kerberos? ( virtual/krb5 )
105 + ldap? ( >=net-nds/openldap-1.2.11 )
106 + ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 )
107 + libedit? ( || ( sys-freebsd/freebsd-lib dev-libs/libedit ) )
108 + mssql? ( dev-db/freetds[mssql] )
109 + nls? ( sys-devel/gettext )
110 + oci8-instant-client? ( dev-db/oracle-instantclient-basic )
111 + odbc? ( >=dev-db/unixODBC-1.8.13 )
112 + postgres? ( dev-db/postgresql:* )
113 + qdbm? ( dev-db/qdbm )
114 + readline? ( sys-libs/readline:0= )
115 + recode? ( app-text/recode )
116 + session-mm? ( dev-libs/mm )
117 + simplexml? ( >=dev-libs/libxml2-2.6.8 )
118 + snmp? ( >=net-analyzer/net-snmp-5.2 )
119 + soap? ( >=dev-libs/libxml2-2.6.8 )
120 + spell? ( >=app-text/aspell-0.50 )
121 + sqlite? ( >=dev-db/sqlite-3.7.6.3 )
122 + ssl? (
123 + !libressl? ( dev-libs/openssl:0= )
124 + libressl? ( dev-libs/libressl:0= )
125 + )
126 + tidy? ( || ( app-text/tidy-html5 app-text/htmltidy ) )
127 + truetype? ( =media-libs/freetype-2* )
128 + unicode? ( dev-libs/oniguruma:= )
129 + wddx? ( >=dev-libs/libxml2-2.6.8 )
130 + webp? ( media-libs/libwebp:0= )
131 + xml? ( >=dev-libs/libxml2-2.6.8 )
132 + xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv )
133 + xmlreader? ( >=dev-libs/libxml2-2.6.8 )
134 + xmlwriter? ( >=dev-libs/libxml2-2.6.8 )
135 + xpm? ( x11-libs/libXpm )
136 + xslt? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
137 + zip? ( sys-libs/zlib:0= )
138 + zlib? ( sys-libs/zlib:0= )
139 +"
140 +
141 +RDEPEND="${COMMON_DEPEND}
142 + virtual/mta
143 + fpm? (
144 + selinux? ( sec-policy/selinux-phpfpm )
145 + systemd? ( sys-apps/systemd ) )"
146 +
147 +# Bison isn't actually needed when building from a release tarball
148 +# However, the configure script will warn if it's absent or if you
149 +# have an incompatible version installed. See bug 593278.
150 +DEPEND="${COMMON_DEPEND}
151 + app-arch/xz-utils
152 + >=sys-devel/bison-3.0.1"
153 +
154 +# Without USE=readline or libedit, the interactive "php -a" CLI will hang.
155 +REQUIRED_USE="
156 + || ( cli cgi fpm apache2 embed phpdbg )
157 + cli? ( ^^ ( readline libedit ) )
158 + truetype? ( gd )
159 + webp? ( gd )
160 + cjk? ( gd )
161 + exif? ( gd )
162 + xpm? ( gd )
163 + gd? ( zlib )
164 + simplexml? ( xml )
165 + soap? ( xml )
166 + wddx? ( xml )
167 + xmlrpc? ( || ( xml iconv ) )
168 + xmlreader? ( xml )
169 + xslt? ( xml )
170 + ldap-sasl? ( ldap )
171 + mhash? ( hash )
172 + phar? ( hash )
173 + qdbm? ( !gdbm )
174 + readline? ( !libedit )
175 + recode? ( !imap !mysqli !mysql )
176 + session-mm? ( session !threads )
177 + mysql? ( || ( mysqli pdo ) )
178 +"
179 +
180 +PHP_MV="$(get_major_version)"
181 +
182 +php_install_ini() {
183 + local phpsapi="${1}"
184 +
185 + # work out where we are installing the ini file
186 + php_set_ini_dir "${phpsapi}"
187 +
188 + # Always install the production INI file, bug 611214.
189 + local phpinisrc="php.ini-production-${phpsapi}"
190 + cp php.ini-production "${phpinisrc}" || die
191 +
192 + # default to /tmp for save_path, bug #282768
193 + sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}" || die
194 +
195 + # Set the extension dir
196 + sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" \
197 + -i "${phpinisrc}" || die
198 +
199 + # Set the include path to point to where we want to find PEAR packages
200 + sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}" || die
201 +
202 + dodir "${PHP_INI_DIR#${EPREFIX}}"
203 + insinto "${PHP_INI_DIR#${EPREFIX}}"
204 + newins "${phpinisrc}" php.ini
205 +
206 + elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
207 + elog
208 +
209 + dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
210 + dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
211 +
212 + if use opcache; then
213 + elog "Adding opcache to $PHP_EXT_INI_DIR"
214 + echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> \
215 + "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
216 + dosym "${PHP_EXT_INI_DIR#${EPREFIX}}/opcache.ini" \
217 + "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
218 + fi
219 +
220 + # SAPI-specific handling
221 + if [[ "${sapi}" == "fpm" ]] ; then
222 + einfo "Installing FPM config files php-fpm.conf and www.conf"
223 + insinto "${PHP_INI_DIR#${EPREFIX}}"
224 + doins sapi/fpm/php-fpm.conf
225 + insinto "${PHP_INI_DIR#${EPREFIX}}/fpm.d"
226 + doins sapi/fpm/www.conf
227 + fi
228 +
229 + dodoc php.ini-{development,production}
230 +}
231 +
232 +php_set_ini_dir() {
233 + PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
234 + PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
235 + PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
236 +}
237 +
238 +src_prepare() {
239 + default
240 +
241 + # In php-7.x, the FPM pool configuration files have been split off
242 + # of the main config. By default the pool config files go in
243 + # e.g. /etc/php-fpm.d, which isn't slotted. So here we move the
244 + # include directory to a subdirectory "fpm.d" of $PHP_INI_DIR. Later
245 + # we'll install the pool configuration file "www.conf" there.
246 + php_set_ini_dir fpm
247 + sed -i "s~^include=.*$~include=${PHP_INI_DIR}/fpm.d/*.conf~" \
248 + sapi/fpm/php-fpm.conf.in \
249 + || die 'failed to move the include directory in php-fpm.conf'
250 +}
251 +
252 +src_configure() {
253 + addpredict /usr/share/snmp/mibs/.index
254 + addpredict /var/lib/net-snmp/mib_indexes
255 +
256 + PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
257 +
258 + # The php-fpm config file wants localstatedir to be ${EPREFIX}/var
259 + # and not the Gentoo default ${EPREFIX}/var/lib. See bug 572002.
260 + local our_conf=(
261 + --prefix="${PHP_DESTDIR}"
262 + --mandir="${PHP_DESTDIR}/man"
263 + --infodir="${PHP_DESTDIR}/info"
264 + --libdir="${PHP_DESTDIR}/lib"
265 + --with-libdir="$(get_libdir)"
266 + --localstatedir="${EPREFIX}/var"
267 + --without-pear
268 + $(use_enable threads maintainer-zts)
269 + )
270 +
271 + our_conf+=(
272 + $(use_enable bcmath bcmath)
273 + $(use_with bzip2 bz2 "${EPREFIX}/usr")
274 + $(use_enable calendar calendar)
275 + $(use_enable coverage gcov)
276 + $(use_enable ctype ctype)
277 + $(use_with curl curl "${EPREFIX}/usr")
278 + $(use_enable xml dom)
279 + $(use_with enchant enchant "${EPREFIX}/usr")
280 + $(use_enable exif exif)
281 + $(use_enable fileinfo fileinfo)
282 + $(use_enable filter filter)
283 + $(use_enable ftp ftp)
284 + $(use_with nls gettext "${EPREFIX}/usr")
285 + $(use_with gmp gmp "${EPREFIX}/usr")
286 + $(use_enable hash hash)
287 + $(use_with mhash mhash "${EPREFIX}/usr")
288 + $(use_with iconv iconv \
289 + $(use elibc_glibc || use elibc_musl || use elibc_FreeBSD || echo "${EPREFIX}/usr"))
290 + $(use_enable intl intl)
291 + $(use_enable ipv6 ipv6)
292 + $(use_enable json json)
293 + $(use_with kerberos kerberos "${EPREFIX}/usr")
294 + $(use_enable xml libxml)
295 + $(use_with xml libxml-dir "${EPREFIX}/usr")
296 + $(use_enable unicode mbstring)
297 + $(use_with crypt mcrypt "${EPREFIX}/usr")
298 + $(use_with unicode onig "${EPREFIX}/usr")
299 + $(use_with ssl openssl "${EPREFIX}/usr")
300 + $(use_with ssl openssl-dir "${EPREFIX}/usr")
301 + $(use_enable pcntl pcntl)
302 + $(use_enable phar phar)
303 + $(use_enable pdo pdo)
304 + $(use_enable opcache opcache)
305 + $(use_with postgres pgsql "${EPREFIX}/usr")
306 + $(use_enable posix posix)
307 + $(use_with spell pspell "${EPREFIX}/usr")
308 + $(use_with recode recode "${EPREFIX}/usr")
309 + $(use_enable simplexml simplexml)
310 + $(use_enable sharedmem shmop)
311 + $(use_with snmp snmp "${EPREFIX}/usr")
312 + $(use_enable soap soap)
313 + $(use_enable sockets sockets)
314 + $(use_with sqlite sqlite3 "${EPREFIX}/usr")
315 + $(use_enable sysvipc sysvmsg)
316 + $(use_enable sysvipc sysvsem)
317 + $(use_enable sysvipc sysvshm)
318 + $(use_with tidy tidy "${EPREFIX}/usr")
319 + $(use_enable tokenizer tokenizer)
320 + $(use_enable wddx wddx)
321 + $(use_enable xml xml)
322 + $(use_enable xmlreader xmlreader)
323 + $(use_enable xmlwriter xmlwriter)
324 + $(use_with xmlrpc xmlrpc)
325 + $(use_with xslt xsl "${EPREFIX}/usr")
326 + $(use_enable zip zip)
327 + $(use_with zlib zlib "${EPREFIX}/usr")
328 + $(use_enable debug debug)
329 + )
330 +
331 + # DBA support
332 + if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
333 + || use qdbm ; then
334 + our_conf+=( "--enable-dba${shared}" )
335 + fi
336 +
337 + # DBA drivers support
338 + our_conf+=(
339 + $(use_with cdb cdb)
340 + $(use_with berkdb db4 "${EPREFIX}/usr")
341 + $(use_enable flatfile flatfile)
342 + $(use_with gdbm gdbm "${EPREFIX}/usr")
343 + $(use_enable inifile inifile)
344 + $(use_with qdbm qdbm "${EPREFIX}/usr")
345 + )
346 +
347 + # Support for the GD graphics library
348 + our_conf+=(
349 + $(use_with truetype freetype-dir "${EPREFIX}/usr")
350 + $(use_enable cjk gd-jis-conv)
351 + $(use_with gd jpeg-dir "${EPREFIX}/usr")
352 + $(use_with gd png-dir "${EPREFIX}/usr")
353 + $(use_with xpm xpm-dir "${EPREFIX}/usr")
354 + )
355 + if use webp; then
356 + our_conf+=( --with-webp-dir="${EPREFIX}/usr" )
357 + fi
358 + # enable gd last, so configure can pick up the previous settings
359 + our_conf+=( $(use_with gd gd) )
360 +
361 + # IMAP support
362 + if use imap ; then
363 + our_conf+=(
364 + $(use_with imap imap "${EPREFIX}/usr")
365 + $(use_with ssl imap-ssl "${EPREFIX}/usr")
366 + )
367 + fi
368 +
369 + # Interbase/firebird support
370 + our_conf+=( $(use_with firebird interbase "${EPREFIX}/usr") )
371 +
372 + # LDAP support
373 + if use ldap ; then
374 + our_conf+=(
375 + $(use_with ldap ldap "${EPREFIX}/usr")
376 + $(use_with ldap-sasl ldap-sasl "${EPREFIX}/usr")
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 iodbc "${EPREFIX}/usr")
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 "${EPREFIX}/usr")
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 libedit "${EPREFIX}/usr")
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 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-pcre-regex affects ext/pcre
431 + # --with-pcre-dir affects ext/filter and ext/zip
432 + our_conf+=(
433 + --with-pcre-regex="${EPREFIX}/usr"
434 + --with-pcre-dir="${EPREFIX}/usr"
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
508 + addpredict /var/lib/net-snmp/mib_indexes
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
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 +}