Gentoo Archives: gentoo-commits

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