Gentoo Archives: gentoo-commits

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