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