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