Gentoo Archives: gentoo-commits

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