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, 18 Dec 2015 05:13:32
Message-Id: 1450415599.a8f4af228442eb4c1edb66e673f45d1d45fe36ee.grknight@gentoo
1 commit: a8f4af228442eb4c1edb66e673f45d1d45fe36ee
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Fri Dec 18 05:06:52 2015 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Fri Dec 18 05:13:19 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a8f4af22
7
8 dev-lang/php: Version bump including phpdbg support
9
10 Package-Manager: portage-2.2.26
11
12 dev-lang/php/Manifest | 1 +
13 dev-lang/php/metadata.xml | 1 +
14 dev-lang/php/php-7.0.1.ebuild | 779 ++++++++++++++++++++++++++++++++++++++++++
15 3 files changed, 781 insertions(+)
16
17 diff --git a/dev-lang/php/Manifest b/dev-lang/php/Manifest
18 index 39a298a..2a3513d 100644
19 --- a/dev-lang/php/Manifest
20 +++ b/dev-lang/php/Manifest
21 @@ -3,4 +3,5 @@ DIST php-5.5.30.tar.bz2 13699702 SHA256 e7332a713cecdd1cb44a1b1336739885c9789f63
22 DIST php-5.6.14.tar.bz2 14073920 SHA256 36f295f11641c1839a5df00e693f685fd134c65e8a1d46e8ee0abae8662b2eb0 SHA512 af0c7fa5c7be15839b1189b2544ff725b935228030087c206f83727e7885750030b10bf2bfbd27adea6f18af90d4ecd3ced9defec88c5f98f7ed26b4e4c57981 WHIRLPOOL 8e31fc3dbeb22fa2a59112d2dcbe28f8102c8d5a14fd716d17f909399c06d27a10ea32d43ebd1a12cea78d9fd949ae7c7882628ae0c3abd7354d165107fa0c9d
23 DIST php-5.6.16.tar.bz2 14066209 SHA256 4fe6f40964c1bfaba05fc144ba20a2cdad33e11685f4f101ea5a48b98bbcd2ae SHA512 08ceb48277785e2075a1bd8035cb32eb8bdddeff6695734d3f1f0721415beddc58413257a490852a93df445d2d342badea46801e46d96f0b85517124ba4020c9 WHIRLPOOL d8669398d03288e9cf0f519a2e76eeb6b7e79f85f60b9f9fbdcc40ae313a3d9fa01b9f173cd354ab8b328b7178a433f54e4f0cf06152ec023c11f00bb98cc5b0
24 DIST php-7.0.0.tar.bz2 13975832 SHA256 a92a54306832167a39f7c0ec00524fc6f3f7d985c806caa7632561d0ddedfcea SHA512 850d1c8c1d66e70caa801520bc1824e17c0a64190e3e3776af422cd3148847dc99b20bff12cecdd679b724b417458aaddb20b899487cf0c7463cac3b5dbf0c12 WHIRLPOOL cf081676f86ff6ea32c3c16ac11470046767e20541a7b986a3499cb4baadb46d06f98bb0026debff0ed10200556fcc80c61c41341340b20e119bf9c21baa46a3
25 +DIST php-7.0.1.tar.bz2 13987040 SHA256 04ce3bd1da001397b342c2219a5093be9ecbbc97f022e1e6a0ec2fedc3d93e42 SHA512 7a157561da7438620d06304e82d459aea843fe89521f11c9e9941afa85f1a8393a98f25f697f22907da2ee79e228f2d27d9a3f9de209a521ad44a1f9a49e57ca WHIRLPOOL fb0c423035b9f96c485dd5e7e8f1275d4932b5394162478ea831d7f195f05503db5d92d7c20cd2cfcd72bbda266ab77dfd6dcb8261bb9a1b36ec81e44e325f1a
26 DIST php-patchset-5.4-r2.tar.bz2 5824 SHA256 4a47f4d31f50a244f85349486cdb3474cf315562e097ed4c116c2b9b5730ecef SHA512 3c2523458a627373da7acb93fb2cd621f50b19fe2ba1d30beb62eeaaa39045262b917cfd0b631046fec9c8027cfa99bd0426a079ab45eb172b21d25d6e085dde WHIRLPOOL fe4f015e2f0dc66cc23ef16fb5bb33117952593ae0770d4bcd37ecc1c431cbcc7874189d265696305c60b4e395e7ce902667e38203db46867304868271affdea
27
28 diff --git a/dev-lang/php/metadata.xml b/dev-lang/php/metadata.xml
29 index 1acc971..2224016 100644
30 --- a/dev-lang/php/metadata.xml
31 +++ b/dev-lang/php/metadata.xml
32 @@ -19,6 +19,7 @@
33 <flag name='opcache'>Enables built-in opcode cache, replacing pecl-apc et.al</flag>
34 <flag name='pdo'>Enable the bundled PDO extensions</flag>
35 <flag name='phar'>Enables the phar extension to provide phar archive support</flag>
36 + <flag name='phpdbg'>Enable the PHP Debug Command Line SAPI (like gdb for php)</flag>
37 <flag name='xmlreader'>Enable XMLReader support</flag>
38 <flag name='xmlwriter'>Enable XMLWriter support</flag>
39 <flag name='xslt'>Enable the XSL extension</flag>
40
41 diff --git a/dev-lang/php/php-7.0.1.ebuild b/dev-lang/php/php-7.0.1.ebuild
42 new file mode 100644
43 index 0000000..a085f97
44 --- /dev/null
45 +++ b/dev-lang/php/php-7.0.1.ebuild
46 @@ -0,0 +1,779 @@
47 +# Copyright 1999-2015 Gentoo Foundation
48 +# Distributed under the terms of the GNU General Public License v2
49 +# $Id$
50 +
51 +EAPI=5
52 +
53 +inherit eutils autotools flag-o-matic versionator depend.apache apache-module libtool systemd
54 +
55 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
56 +
57 +function php_get_uri ()
58 +{
59 + case "${1}" in
60 + "php-pre")
61 + echo "http://downloads.php.net/ab/${2}"
62 + ;;
63 + "php")
64 + echo "http://www.php.net/distributions/${2}"
65 + ;;
66 + "olemarkus")
67 + echo "https://dev.gentoo.org/~olemarkus/php/${2}"
68 + ;;
69 + "gentoo")
70 + echo "mirror://gentoo/${2}"
71 + ;;
72 + *)
73 + die "unhandled case in php_get_uri"
74 + ;;
75 + esac
76 +}
77 +
78 +PHP_MV="$(get_major_version)"
79 +SLOT="$(get_version_component_range 1-2)"
80 +
81 +# alias, so we can handle different types of releases (finals, rcs, alphas,
82 +# betas, ...) w/o changing the whole ebuild
83 +PHP_PV="${PV/_rc/RC}"
84 +PHP_PV="${PHP_PV/_alpha/alpha}"
85 +PHP_PV="${PHP_PV/_beta/beta}"
86 +PHP_RELEASE="php"
87 +[[ ${PV} == ${PV/_alpha/} ]] || PHP_RELEASE="php-pre"
88 +[[ ${PV} == ${PV/_beta/} ]] || PHP_RELEASE="php-pre"
89 +[[ ${PV} == ${PV/_rc/} ]] || PHP_RELEASE="php-pre"
90 +PHP_P="${PN}-${PHP_PV}"
91 +
92 +PHP_SRC_URI="$(php_get_uri "${PHP_RELEASE}" "${PHP_P}.tar.bz2")"
93 +
94 +PHP_FPM_CONF_VER="1"
95 +
96 +SRC_URI="${PHP_SRC_URI}"
97 +
98 +DESCRIPTION="The PHP language runtime engine: CLI, CGI, FPM/FastCGI, Apache2 and embed SAPIs"
99 +HOMEPAGE="http://php.net/"
100 +LICENSE="PHP-3"
101 +
102 +S="${WORKDIR}/${PHP_P}"
103 +
104 +# We can build the following SAPIs in the given order
105 +SAPIS="embed cli cgi fpm apache2 phpdbg"
106 +
107 +# SAPIs and SAPI-specific USE flags (cli SAPI is default on):
108 +IUSE="${IUSE}
109 + ${SAPIS/cli/+cli}
110 + threads"
111 +
112 +IUSE="${IUSE} bcmath berkdb bzip2 calendar cdb cjk
113 + crypt +ctype curl debug
114 + enchant exif frontbase +fileinfo +filter firebird
115 + flatfile ftp gd gdbm gmp +hash +iconv imap inifile
116 + intl iodbc ipv6 +json kerberos ldap ldap-sasl libedit mhash
117 + mysql mysqli nls
118 + oci8-instant-client odbc +opcache pcntl pdo +phar +posix postgres qdbm
119 + readline recode selinux +session sharedmem
120 + +simplexml snmp soap sockets spell sqlite ssl
121 + sysvipc systemd tidy +tokenizer truetype unicode vpx wddx
122 + +xml xmlreader xmlwriter xmlrpc xpm xslt zip zlib"
123 +
124 +DEPEND="
125 + >=app-eselect/eselect-php-0.8.2[apache2?,fpm?]
126 + >=dev-libs/libpcre-8.32[unicode]
127 + apache2? ( || ( >=www-servers/apache-2.4[apache2_modules_unixd,threads=]
128 + <www-servers/apache-2.4[threads=] ) )"
129 +
130 +# The supported (that is, autodetected) versions of BDB are listed in
131 +# the ./configure script. Other versions *work*, but we need to stick to
132 +# the ones that can be detected to avoid a repeat of bug #564824.
133 +DEPEND="${DEPEND}
134 + berkdb? ( || ( sys-libs/db:5.1
135 + sys-libs/db:4.8
136 + sys-libs/db:4.7
137 + sys-libs/db:4.6
138 + sys-libs/db:4.5 ) )
139 + bzip2? ( app-arch/bzip2 )
140 + cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
141 + cjk? ( !gd? (
142 + virtual/jpeg:0
143 + media-libs/libpng:0=
144 + sys-libs/zlib
145 + ) )
146 + crypt? ( >=dev-libs/libmcrypt-2.4 )
147 + curl? ( >=net-misc/curl-7.10.5 )
148 + enchant? ( app-text/enchant )
149 + exif? ( !gd? (
150 + virtual/jpeg:0
151 + media-libs/libpng:0=
152 + sys-libs/zlib
153 + ) )
154 + firebird? ( dev-db/firebird )
155 + gd? ( virtual/jpeg:0 media-libs/libpng:0= sys-libs/zlib )
156 + gdbm? ( >=sys-libs/gdbm-1.8.0 )
157 + gmp? ( dev-libs/gmp:0 )
158 + iconv? ( virtual/libiconv )
159 + imap? ( virtual/imap-c-client[ssl=] )
160 + intl? ( dev-libs/icu:= )
161 + iodbc? ( dev-db/libiodbc )
162 + kerberos? ( virtual/krb5 )
163 + ldap? ( >=net-nds/openldap-1.2.11 )
164 + ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 )
165 + libedit? ( || ( sys-freebsd/freebsd-lib dev-libs/libedit ) )
166 + nls? ( sys-devel/gettext )
167 + oci8-instant-client? ( dev-db/oracle-instantclient-basic )
168 + odbc? ( >=dev-db/unixODBC-1.8.13 )
169 + postgres? ( dev-db/postgresql:* )
170 + qdbm? ( dev-db/qdbm )
171 + readline? ( sys-libs/readline:0 )
172 + recode? ( app-text/recode )
173 + sharedmem? ( dev-libs/mm )
174 + simplexml? ( >=dev-libs/libxml2-2.6.8 )
175 + snmp? ( >=net-analyzer/net-snmp-5.2 )
176 + soap? ( >=dev-libs/libxml2-2.6.8 )
177 + spell? ( >=app-text/aspell-0.50 )
178 + sqlite? ( >=dev-db/sqlite-3.7.6.3 )
179 + ssl? ( dev-libs/openssl:0 )
180 + tidy? ( app-text/htmltidy )
181 + truetype? (
182 + =media-libs/freetype-2*
183 + !gd? (
184 + virtual/jpeg:0 media-libs/libpng:0= sys-libs/zlib )
185 + )
186 + unicode? ( dev-libs/oniguruma )
187 + vpx? ( media-libs/libvpx )
188 + wddx? ( >=dev-libs/libxml2-2.6.8 )
189 + xml? ( >=dev-libs/libxml2-2.6.8 )
190 + xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv )
191 + xmlreader? ( >=dev-libs/libxml2-2.6.8 )
192 + xmlwriter? ( >=dev-libs/libxml2-2.6.8 )
193 + xpm? (
194 + x11-libs/libXpm
195 + virtual/jpeg:0
196 + media-libs/libpng:0= sys-libs/zlib
197 + )
198 + xslt? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
199 + zip? ( sys-libs/zlib )
200 + zlib? ( sys-libs/zlib )
201 + virtual/mta
202 +"
203 +
204 +php="=${CATEGORY}/${PF}"
205 +
206 +REQUIRED_USE="
207 + truetype? ( gd )
208 + vpx? ( gd )
209 + cjk? ( gd )
210 + exif? ( gd )
211 +
212 + xpm? ( gd )
213 + gd? ( zlib )
214 + simplexml? ( xml )
215 + soap? ( xml )
216 + wddx? ( xml )
217 + xmlrpc? ( || ( xml iconv ) )
218 + xmlreader? ( xml )
219 + xslt? ( xml )
220 + ldap-sasl? ( ldap )
221 + mhash? ( hash )
222 + phar? ( hash )
223 +
224 + qdbm? ( !gdbm )
225 + readline? ( !libedit )
226 + recode? ( !imap !mysqli )
227 + sharedmem? ( !threads )
228 +
229 + mysql? ( || ( mysqli pdo ) )
230 +
231 + || ( cli cgi fpm apache2 embed phpdbg )"
232 +
233 +RDEPEND="${DEPEND}"
234 +
235 +RDEPEND="${RDEPEND}
236 + fpm? (
237 + selinux? ( sec-policy/selinux-phpfpm )
238 + systemd? ( sys-apps/systemd ) )"
239 +
240 +DEPEND="${DEPEND}
241 + sys-devel/flex
242 + >=sys-devel/m4-1.4.3
243 + >=sys-devel/libtool-1.5.18"
244 +
245 +# Allow users to install production version if they want to
246 +
247 +case "${PHP_INI_VERSION}" in
248 + production|development)
249 + ;;
250 + *)
251 + PHP_INI_VERSION="development"
252 + ;;
253 +esac
254 +
255 +PHP_INI_UPSTREAM="php.ini-${PHP_INI_VERSION}"
256 +PHP_INI_FILE="php.ini"
257 +
258 +want_apache
259 +
260 +pkg_setup() {
261 + depend.apache_pkg_setup
262 +}
263 +
264 +php_install_ini() {
265 + local phpsapi="${1}"
266 +
267 + # work out where we are installing the ini file
268 + php_set_ini_dir "${phpsapi}"
269 +
270 + local phpinisrc="${PHP_INI_UPSTREAM}-${phpsapi}"
271 + cp "${PHP_INI_UPSTREAM}" "${phpinisrc}" || die
272 +
273 + # default to /tmp for save_path, bug #282768
274 + sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}" || die
275 +
276 + # Set the extension dir
277 + sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" -i "${phpinisrc}" || die
278 +
279 + # Set the include path to point to where we want to find PEAR packages
280 + sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}" || die
281 +
282 + dodir "${PHP_INI_DIR#${EPREFIX}}"
283 + insinto "${PHP_INI_DIR#${EPREFIX}}"
284 + newins "${phpinisrc}" "${PHP_INI_FILE}"
285 +
286 + elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
287 + elog
288 +
289 + dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
290 + dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
291 +
292 + if use_if_iuse opcache; then
293 + elog "Adding opcache to $PHP_EXT_INI_DIR"
294 + echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> \
295 + "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
296 + dosym "${PHP_EXT_INI_DIR#${EPREFIX}}/opcache.ini" \
297 + "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
298 + fi
299 +
300 + # SAPI-specific handling
301 + if [[ "${sapi}" == "fpm" ]] ; then
302 + einfo "Installing FPM config files php-fpm.conf and www.conf"
303 + insinto "${PHP_INI_DIR#${EPREFIX}}"
304 + doins sapi/fpm/php-fpm.conf
305 + insinto "${PHP_INI_DIR#${EPREFIX}}/fpm.d"
306 + doins sapi/fpm/www.conf
307 + fi
308 +
309 + dodoc php.ini-development
310 + dodoc php.ini-production
311 +}
312 +
313 +php_set_ini_dir() {
314 + PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
315 + PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
316 + PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
317 +}
318 +
319 +src_prepare() {
320 + # Change PHP branding
321 + # Get the alpha/beta/rc version
322 + sed -re "s|^(PHP_EXTRA_VERSION=\").*(\")|\1-pl${PR/r/}-gentoo\2|g" \
323 + -i configure.in || die "Unable to change PHP branding"
324 +
325 + # Patch PHP to show Gentoo as the server platform
326 + sed -e 's/PHP_UNAME=`uname -a | xargs`/PHP_UNAME=`uname -s -n -r -v | xargs`/g' \
327 + -i configure.in || die "Failed to fix server platform name"
328 +
329 + # Patch PHP to support heimdal instead of mit-krb5
330 + if has_version "app-crypt/heimdal" ; then
331 + sed -e 's|gssapi_krb5|gssapi|g' -i acinclude.m4 \
332 + || die "Failed to fix heimdal libname"
333 + sed -e 's|PHP_ADD_LIBRARY(k5crypto, 1, $1)||g' -i acinclude.m4 \
334 + || die "Failed to fix heimdal crypt library reference"
335 + fi
336 +
337 + # Add user patches #357637
338 + epatch_user
339 +
340 + # Force rebuilding aclocal.m4
341 + rm -f aclocal.m4 || die
342 + eautoreconf
343 +
344 + if [[ ${CHOST} == *-darwin* ]] ; then
345 + # http://bugs.php.net/bug.php?id=48795, bug #343481
346 + sed -i -e '/BUILD_CGI="\\$(CC)/s/CC/CXX/' configure || die
347 + fi
348 +
349 + # In php-7.x, the FPM pool configuration files have been split off
350 + # of the main config. By default the pool config files go in
351 + # e.g. /etc/php-fpm.d, which isn't slotted. So here we move the
352 + # include directory to a subdirectory "fpm.d" of $PHP_INI_DIR. Later
353 + # we'll install the pool configuration file "www.conf" there.
354 + php_set_ini_dir fpm
355 + sed -i "s~^include=.*$~include=${PHP_INI_DIR}/fpm.d/*.conf~" \
356 + sapi/fpm/php-fpm.conf.in \
357 + || die 'failed to move the include directory in php-fpm.conf'
358 +}
359 +
360 +src_configure() {
361 + addpredict /usr/share/snmp/mibs/.index
362 + addpredict /var/lib/net-snmp/mib_indexes
363 +
364 + PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
365 +
366 + local our_conf=(
367 + --prefix="${PHP_DESTDIR}"
368 + --mandir="${PHP_DESTDIR}/man"
369 + --infodir="${PHP_DESTDIR}/info"
370 + --libdir="${PHP_DESTDIR}/lib"
371 + --with-libdir="$(get_libdir)"
372 + --without-pear
373 + $(use_enable threads maintainer-zts)
374 + )
375 +
376 + our_conf+=(
377 + $(use_enable bcmath bcmath)
378 + $(use_with bzip2 bz2 "${EPREFIX}/usr")
379 + $(use_enable calendar calendar)
380 + $(use_enable ctype ctype)
381 + $(use_with curl curl "${EPREFIX}/usr")
382 + $(use_enable xml dom)
383 + $(use_with enchant enchant "${EPREFIX}/usr")
384 + $(use_enable exif exif)
385 + $(use_enable fileinfo fileinfo)
386 + $(use_enable filter filter)
387 + $(use_enable ftp ftp)
388 + $(use_with nls gettext "${EPREFIX}/usr")
389 + $(use_with gmp gmp "${EPREFIX}/usr")
390 + $(use_enable hash hash)
391 + $(use_with mhash mhash "${EPREFIX}/usr")
392 + $(use_with iconv iconv \
393 + $(use elibc_glibc || use elibc_musl || echo "${EPREFIX}/usr"))
394 + $(use_enable intl intl)
395 + $(use_enable ipv6 ipv6)
396 + $(use_enable json json)
397 + $(use_with kerberos kerberos "${EPREFIX}/usr")
398 + $(use_enable xml libxml)
399 + $(use_with xml libxml-dir "${EPREFIX}/usr")
400 + $(use_enable unicode mbstring)
401 + $(use_with crypt mcrypt "${EPREFIX}/usr")
402 + $(use_with unicode onig "${EPREFIX}/usr")
403 + $(use_with ssl openssl "${EPREFIX}/usr")
404 + $(use_with ssl openssl-dir "${EPREFIX}/usr")
405 + $(use_enable pcntl pcntl)
406 + $(use_enable phar phar)
407 + $(use_enable pdo pdo)
408 + $(use_enable opcache opcache)
409 + $(use_with postgres pgsql "${EPREFIX}/usr")
410 + $(use_enable posix posix)
411 + $(use_with spell pspell "${EPREFIX}/usr")
412 + $(use_with recode recode "${EPREFIX}/usr")
413 + $(use_enable simplexml simplexml)
414 + $(use_enable sharedmem shmop)
415 + $(use_with snmp snmp "${EPREFIX}/usr")
416 + $(use_enable soap soap)
417 + $(use_enable sockets sockets)
418 + $(use_with sqlite sqlite3 "${EPREFIX}/usr")
419 + $(use_enable sysvipc sysvmsg)
420 + $(use_enable sysvipc sysvsem)
421 + $(use_enable sysvipc sysvshm)
422 + $(use_with systemd fpm-systemd)
423 + $(use_with tidy tidy "${EPREFIX}/usr")
424 + $(use_enable tokenizer tokenizer)
425 + $(use_enable wddx wddx)
426 + $(use_enable xml xml)
427 + $(use_enable xmlreader xmlreader)
428 + $(use_enable xmlwriter xmlwriter)
429 + $(use_with xmlrpc xmlrpc)
430 + $(use_with xslt xsl "${EPREFIX}/usr")
431 + $(use_enable zip zip)
432 + $(use_with zlib zlib "${EPREFIX}/usr")
433 + $(use_enable debug debug)
434 + )
435 +
436 + # DBA support
437 + if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
438 + || use qdbm ; then
439 + our_conf+=( "--enable-dba${shared}" )
440 + fi
441 +
442 + # DBA drivers support
443 + our_conf+=(
444 + $(use_with cdb cdb)
445 + $(use_with berkdb db4 "${EPREFIX}/usr")
446 + $(use_enable flatfile flatfile)
447 + $(use_with gdbm gdbm "${EPREFIX}/usr")
448 + $(use_enable inifile inifile)
449 + $(use_with qdbm qdbm "${EPREFIX}/usr")
450 + )
451 +
452 + # Support for the GD graphics library
453 + our_conf+=(
454 + $(use_with truetype freetype-dir "${EPREFIX}/usr")
455 + $(use_enable cjk gd-jis-conv)
456 + $(use_with gd jpeg-dir "${EPREFIX}/usr")
457 + $(use_with gd png-dir "${EPREFIX}/usr")
458 + $(use_with xpm xpm-dir "${EPREFIX}/usr")
459 + )
460 + if use vpx; then
461 + our_conf+=( --with-vpx-dir="${EPREFIX}/usr" )
462 + fi
463 + # enable gd last, so configure can pick up the previous settings
464 + our_conf+=( $(use_with gd gd) )
465 +
466 + # IMAP support
467 + if use imap ; then
468 + our_conf+=(
469 + $(use_with imap imap "${EPREFIX}/usr")
470 + $(use_with ssl imap-ssl "${EPREFIX}/usr")
471 + )
472 + fi
473 +
474 + # Interbase/firebird support
475 + our_conf+=( $(use_with firebird interbase "${EPREFIX}/usr") )
476 +
477 + # LDAP support
478 + if use ldap ; then
479 + our_conf+=(
480 + $(use_with ldap ldap "${EPREFIX}/usr")
481 + $(use_with ldap-sasl ldap-sasl "${EPREFIX}/usr")
482 + )
483 + fi
484 +
485 + # MySQL support
486 + local mysqllib="mysqlnd"
487 + local mysqlilib="mysqlnd"
488 +
489 + our_conf+=( $(use_with mysqli mysqli "${mysqlilib}") )
490 +
491 + local mysqlsock="${EPREFIX}/var/run/mysqld/mysqld.sock"
492 + if use mysql || use mysqli ; then
493 + our_conf+=( $(use_with mysql mysql-sock "${mysqlsock}") )
494 + fi
495 +
496 + # ODBC support
497 + our_conf+=(
498 + $(use_with odbc unixODBC "${EPREFIX}/usr")
499 + $(use_with iodbc iodbc "${EPREFIX}/usr")
500 + )
501 +
502 + # Oracle support
503 + our_conf+=( $(use_with oci8-instant-client oci8) )
504 +
505 + # PDO support
506 + if use pdo ; then
507 + our_conf+=(
508 + $(use_with mysql pdo-mysql "${mysqllib}")
509 + $(use_with postgres pdo-pgsql)
510 + $(use_with sqlite pdo-sqlite "${EPREFIX}/usr")
511 + $(use_with odbc pdo-odbc "unixODBC,${EPREFIX}/usr")
512 + $(use_with oci8-instant-client pdo-oci)
513 + )
514 + fi
515 +
516 + # readline/libedit support
517 + our_conf+=(
518 + $(use_with readline readline "${EPREFIX}/usr")
519 + $(use_with libedit libedit "${EPREFIX}/usr")
520 + )
521 +
522 + # Session support
523 + if use session ; then
524 + our_conf+=( $(use_with sharedmem mm "${EPREFIX}/usr") )
525 + else
526 + our_conf+=( $(use_enable session session) )
527 + fi
528 +
529 + # Use pic for shared modules such as apache2's mod_php
530 + our_conf+=( --with-pic )
531 +
532 + # we use the system copy of pcre
533 + # --with-pcre-regex affects ext/pcre
534 + # --with-pcre-dir affects ext/filter and ext/zip
535 + our_conf+=(
536 + --with-pcre-regex="${EPREFIX}/usr"
537 + --with-pcre-dir="${EPREFIX}/usr"
538 + )
539 +
540 + # Catch CFLAGS problems
541 + # Fixes bug #14067.
542 + # Changed order to run it in reverse for bug #32022 and #12021.
543 + replace-cpu-flags "k6*" "i586"
544 +
545 + # Support user-passed configuration parameters
546 + our_conf+=( ${EXTRA_ECONF:-} )
547 +
548 + # Support the Apache2 extras, they must be set globally for all
549 + # SAPIs to work correctly, especially for external PHP extensions
550 +
551 + mkdir -p "${WORKDIR}/sapis-build" || die
552 + for one_sapi in $SAPIS ; do
553 + use "${one_sapi}" || continue
554 + php_set_ini_dir "${one_sapi}"
555 +
556 + # The BUILD_DIR variable is used to determine where to output
557 + # the files that autotools creates. This was all originally
558 + # based on the autotools-utils eclass.
559 + BUILD_DIR="${WORKDIR}/sapis-build/${one_sapi}"
560 + cp -r "${S}" "${BUILD_DIR}" || die
561 + cd "${BUILD_DIR}" || die
562 +
563 + local sapi_conf=(
564 + --with-config-file-path="${PHP_INI_DIR}"
565 + --with-config-file-scan-dir="${PHP_EXT_INI_DIR_ACTIVE}"
566 + )
567 +
568 + for sapi in $SAPIS ; do
569 + case "$sapi" in
570 + cli|cgi|embed|fpm|phpdbg)
571 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
572 + sapi_conf+=( "--enable-${sapi}" )
573 + else
574 + sapi_conf+=( "--disable-${sapi}" )
575 + fi
576 + ;;
577 +
578 + apache2)
579 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
580 + sapi_conf+=( --with-apxs2="${EPREFIX}/usr/sbin/apxs" )
581 + else
582 + sapi_conf+=( --without-apxs2 )
583 + fi
584 + ;;
585 + esac
586 + done
587 +
588 + # Construct the $myeconfargs array by concatenating $our_conf
589 + # (the common args) and $sapi_conf (the SAPI-specific args).
590 + local myeconfargs=( "${our_conf[@]}" )
591 + myeconfargs+=( "${sapi_conf[@]}" )
592 +
593 + pushd "${BUILD_DIR}" > /dev/null || die
594 + econf "${myeconfargs[@]}"
595 + popd > /dev/null || die
596 + done
597 +}
598 +
599 +src_compile() {
600 + # snmp seems to run during src_compile, too (bug #324739)
601 + addpredict /usr/share/snmp/mibs/.index
602 + addpredict /var/lib/net-snmp/mib_indexes
603 +
604 + for sapi in ${SAPIS} ; do
605 + if use "${sapi}"; then
606 + cd "${WORKDIR}/sapis-build/$sapi" || \
607 + die "Failed to change dir to ${WORKDIR}/sapis-build/$1"
608 + emake
609 + fi
610 + done
611 +}
612 +
613 +src_install() {
614 + # see bug #324739 for what happens when we don't have that
615 + addpredict /usr/share/snmp/mibs/.index
616 +
617 + # grab the first SAPI that got built and install common files from there
618 + local first_sapi=""
619 + for sapi in $SAPIS ; do
620 + if use $sapi ; then
621 + first_sapi=$sapi
622 + break
623 + fi
624 + done
625 +
626 + # Makefile forgets to create this before trying to write to it...
627 + dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
628 +
629 + # Install php environment (without any sapis)
630 + cd "${WORKDIR}/sapis-build/$first_sapi" || die
631 + emake INSTALL_ROOT="${D}" \
632 + install-build install-headers install-programs
633 +
634 + local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
635 +
636 + # Create the directory where we'll put version-specific php scripts
637 + keepdir "/usr/share/php${PHP_MV}"
638 +
639 + local sapi="", file=""
640 + local sapi_list=""
641 +
642 + for sapi in ${SAPIS}; do
643 + if use "${sapi}" ; then
644 + einfo "Installing SAPI: ${sapi}"
645 + cd "${WORKDIR}/sapis-build/${sapi}" || die
646 +
647 + if [[ "${sapi}" == "apache2" ]] ; then
648 + # We're specifically not using emake install-sapi as libtool
649 + # may cause unnecessary relink failures (see bug #351266)
650 + insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
651 + newins ".libs/libphp${PHP_MV}$(get_libname)" \
652 + "libphp${PHP_MV}$(get_libname)"
653 + keepdir "/usr/$(get_libdir)/apache2/modules"
654 + else
655 + # needed each time, php_install_ini would reset it
656 + local dest="${PHP_DESTDIR#${EPREFIX}}"
657 + into "${dest}"
658 + case "$sapi" in
659 + cli)
660 + source="sapi/cli/php"
661 + ;;
662 + cgi)
663 + source="sapi/cgi/php-cgi"
664 + ;;
665 + fpm)
666 + source="sapi/fpm/php-fpm"
667 + ;;
668 + embed)
669 + source="libs/libphp${PHP_MV}$(get_libname)"
670 + ;;
671 + phpdbg)
672 + source="sapi/phpdbg/phpdbg"
673 + ;;
674 + *)
675 + die "unhandled sapi in src_install"
676 + ;;
677 + esac
678 +
679 + if [[ "${source}" == *"$(get_libname)" ]]; then
680 + dolib.so "${source}"
681 + else
682 + dobin "${source}"
683 + local name="$(basename ${source})"
684 + dosym "${dest}/bin/${name}" "/usr/bin/${name}${SLOT}"
685 + fi
686 + fi
687 +
688 + php_install_ini "${sapi}"
689 +
690 + # construct correct SAPI string for php-config
691 + # thanks to ferringb for the bash voodoo
692 + if [[ "${sapi}" == "apache2" ]]; then
693 + sapi_list="${sapi_list:+${sapi_list} }apache2handler"
694 + else
695 + sapi_list="${sapi_list:+${sapi_list} }${sapi}"
696 + fi
697 + fi
698 + done
699 +
700 + # Installing opcache module
701 + if use_if_iuse opcache ; then
702 + dolib.so "modules/opcache$(get_libname)"
703 + fi
704 +
705 + # Install env.d files
706 + newenvd "${FILESDIR}/20php5-envd" "20php${SLOT}"
707 + sed -e "s|/lib/|/$(get_libdir)/|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
708 + sed -e "s|php5|php${SLOT}|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
709 +
710 + # set php-config variable correctly (bug #278439)
711 + sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
712 + "${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config" || die
713 +
714 + if use fpm ; then
715 + if use systemd; then
716 + systemd_newunit "${FILESDIR}/php-fpm_at.service" \
717 + "php-fpm@${SLOT}.service"
718 + else
719 + systemd_newunit "${FILESDIR}/php-fpm_at-simple.service" \
720 + "php-fpm@${SLOT}.service"
721 + fi
722 + fi
723 +}
724 +
725 +src_test() {
726 + echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
727 + PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php"
728 + if [[ ! -x "${PHP_BIN}" ]] ; then
729 + ewarn "Test phase requires USE=cli, skipping"
730 + return
731 + else
732 + export TEST_PHP_EXECUTABLE="${PHP_BIN}"
733 + fi
734 +
735 + if [[ -x "${WORKDIR}/sapis/cgi/php-cgi" ]] ; then
736 + export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis/cgi/php-cgi"
737 + fi
738 +
739 + REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d \
740 + "session.save_path=${T}" \
741 + "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d \
742 + "session.save_path=${T}"
743 +
744 + for name in ${EXPECTED_TEST_FAILURES}; do
745 + mv "${name}.out" "${name}.out.orig" 2>/dev/null || die
746 + done
747 +
748 + local failed="$(find -name '*.out')"
749 + if [[ ${failed} != "" ]] ; then
750 + ewarn "The following test cases failed unexpectedly:"
751 + for name in ${failed}; do
752 + ewarn " ${name/.out/}"
753 + done
754 + else
755 + einfo "No unexpected test failures, all fine"
756 + fi
757 +
758 + if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
759 + local passed=""
760 + for name in ${EXPECTED_TEST_FAILURES}; do
761 + [[ -f "${name}.diff" ]] && continue
762 + passed="${passed} ${name}"
763 + done
764 + if [[ ${passed} != "" ]] ; then
765 + einfo "The following test cases passed unexpectedly:"
766 + for name in ${passed}; do
767 + ewarn " ${passed}"
768 + done
769 + else
770 + einfo "None of the known-to-fail tests passed, all fine"
771 + fi
772 + fi
773 +}
774 +
775 +pkg_postinst() {
776 + # Output some general info to the user
777 + if use apache2 ; then
778 + APACHE2_MOD_DEFINE="PHP5"
779 + APACHE2_MOD_CONF="70_mod_php5" # Provided by app-eselect/eselect-php
780 + apache-module_pkg_postinst
781 + fi
782 +
783 + # Create the symlinks for php
784 + for m in ${SAPIS}; do
785 + [[ ${m} == 'embed' ]] && continue;
786 + if use $m ; then
787 + local ci=$(eselect php show $m)
788 + if [[ -z $ci ]]; then
789 + eselect php set $m php${SLOT} || die
790 + einfo "Switched ${m} to use php:${SLOT}"
791 + einfo
792 + elif [[ $ci != "php${SLOT}" ]] ; then
793 + elog "To switch $m to use php:${SLOT}, run"
794 + elog " eselect php set $m php${SLOT}"
795 + elog
796 + fi
797 + fi
798 + done
799 +
800 + elog "Make sure that PHP_TARGETS in ${EPREFIX}/etc/make.conf includes"
801 + elog "php${SLOT/./-} in order to compile extensions for the ${SLOT} ABI."
802 + elog
803 + if ! use readline && use cli ; then
804 + ewarn "Note that in order to use php interactivly, you need to"
805 + ewarn "enable the readline USE flag or php -a will hang."
806 + elog
807 + fi
808 + elog "This ebuild installed a version of php.ini based on"
809 + elog "php.ini-${PHP_INI_VERSION}. You can choose which version of"
810 + elog "php.ini to install by default by setting PHP_INI_VERSION"
811 + elog "to either 'production' or 'development' in your make.conf."
812 + elog "Both versions of php.ini can be found with the PHP docs in"
813 + elog "${EPREFIX}/usr/share/doc/${PF}"
814 + elog
815 + elog "For more details on how minor version slotting works,"
816 + elog "please see the wiki:"
817 + elog
818 + elog " https://wiki.gentoo.org/wiki/PHP"
819 + elog
820 +}
821 +
822 +pkg_prerm() {
823 + # This returns "1" on success so we can't "|| die" here.
824 + eselect php cleanup
825 +}