Gentoo Archives: gentoo-commits

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