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