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