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: Sat, 31 Oct 2015 00:26:56
Message-Id: 1446251057.981ab6fbef445aa9aa0e121fca6c2aff2fc977b6.mjo@gentoo
1 commit: 981ab6fbef445aa9aa0e121fca6c2aff2fc977b6
2 Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
3 AuthorDate: Fri Oct 30 22:55:14 2015 +0000
4 Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
5 CommitDate: Sat Oct 31 00:24:17 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=981ab6fb
7
8 dev-lang/php: version bump adding php-5.6.15.ebuild.
9
10 Package-Manager: portage-2.2.20.1
11
12 dev-lang/php/Manifest | 1 +
13 dev-lang/php/php-5.6.15.ebuild | 784 +++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 785 insertions(+)
15
16 diff --git a/dev-lang/php/Manifest b/dev-lang/php/Manifest
17 index 227fcb6..a6664e3 100644
18 --- a/dev-lang/php/Manifest
19 +++ b/dev-lang/php/Manifest
20 @@ -3,6 +3,7 @@ DIST php-5.5.29.tar.bz2 13698565 SHA256 fbcee579ecc77cad6960a541116aee669cf145c2
21 DIST php-5.5.30.tar.bz2 13699702 SHA256 e7332a713cecdd1cb44a1b1336739885c9789f633f0f51236b25e48ab03c3b29 SHA512 9458126f579ace9e2aebdfa7ad7f8d097f1fd502f443d8fd66263ba3c542d579ca9c705e227725fae57e452649a3be7cb717a0330d339b93d3c6c94fa80dbc1f WHIRLPOOL 2aa6c61a48a231d81f6c746f94e42589d87b93d0526f02d6d15f731cbbca4aecdee84b443f7ec1891f2a524939c542ac6f94e15db90a23a8b19523463025d395
22 DIST php-5.6.13.tar.bz2 14077633 SHA256 6358837c9cbab41b91ede59dbf0670ae0fb925a1369ecbc1a44a27212420f893 SHA512 80e89ae748255d40b466de6c61b4443432fd81ffb1510ae66f809ed0dd07eb4071ded5b7a975f997b2cb28553ac7e27c57b67734e268c894207e9efd78ae76bf WHIRLPOOL 9b0add1b05220f9ef60de2741dcd198d0b44a9813dc1a999e42700ddb1e879f3749056cdfb151a595bc7a14a65a38eca6d0f416ee36ebd013126a92878fd47db
23 DIST php-5.6.14.tar.bz2 14073920 SHA256 36f295f11641c1839a5df00e693f685fd134c65e8a1d46e8ee0abae8662b2eb0 SHA512 af0c7fa5c7be15839b1189b2544ff725b935228030087c206f83727e7885750030b10bf2bfbd27adea6f18af90d4ecd3ced9defec88c5f98f7ed26b4e4c57981 WHIRLPOOL 8e31fc3dbeb22fa2a59112d2dcbe28f8102c8d5a14fd716d17f909399c06d27a10ea32d43ebd1a12cea78d9fd949ae7c7882628ae0c3abd7354d165107fa0c9d
24 +DIST php-5.6.15.tar.bz2 14060562 SHA256 11a0645c4d4b749e256da1e0d6df89dd886b5b06b83c914d942653661dbd1c38 SHA512 3841b1b64bbe1b3bdbbbf2591f2ca81754f1e7391dae593f45302ea7a4157dd8032e0f525308a13769938aadbfca9e25cbe15ac9bf8eed1427263fefcbede2aa WHIRLPOOL 6d5a6b860d0db887c09d1bfb8304a39d44f1c5966bab3f881c277e3aa0331cd794f1bff02cbac2bdba23fd9bc4fe71a8e1d4b51cbb4c1dfe1ceadca15ec38665
25 DIST php-7.0.0RC4.tar.bz2 13973356 SHA256 5475a6856b600a7a4f31a0276339725140d64da31a8a363e0cdb45ed233f27cd SHA512 02a55ce90d66f6ee2019461658eeb7ce7fd2c78c5c32869a3882f0f6fd6a54454b26f3440266ed8e850da740633243f697086a5c0cf0d616f0029e6ba4ddd1bf WHIRLPOOL 7695a9e3b54470c456104e29082479d27c47806e86f739d9d01ffe57580d28b1130d3aaadd3d78f205b457ed4d3207a3ad52a95996cef6b70898ed948b1373a5
26 DIST php-7.0.0RC5.tar.bz2 13985797 SHA256 90e3f91c6781e6cdd198dd7b3f9bceff0c00be74a56ea0940b4ad9c6b312b4db SHA512 0deceb3bc33bf67076a9613cb150d5b036a4198429c46b49d92a172d0773980bd9df764e89c3f5c53f4e39069376f5cf6bca82b61851e138b30460087003b66b WHIRLPOOL a4228765601c28d88ecb5a298bb24c4b20d9f0559429c415a23dd4cb92847586223b124aecd958de718f6dfe45c314b82b63ed84d9143e94de9f967358be2d15
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-5.6.15.ebuild b/dev-lang/php/php-5.6.15.ebuild
30 new file mode 100644
31 index 0000000..dcf8362
32 --- /dev/null
33 +++ b/dev-lang/php/php-5.6.15.ebuild
34 @@ -0,0 +1,784 @@
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 db-use 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/dsp/${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 + mssql mysql libmysqlclient 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 + sybase-ct 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 + berkdb? ( =sys-libs/db-4* )
118 + bzip2? ( app-arch/bzip2 )
119 + cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
120 + cjk? ( !gd? (
121 + virtual/jpeg:0
122 + media-libs/libpng:0=
123 + sys-libs/zlib
124 + ) )
125 + crypt? ( >=dev-libs/libmcrypt-2.4 )
126 + curl? ( >=net-misc/curl-7.10.5 )
127 + enchant? ( app-text/enchant )
128 + exif? ( !gd? (
129 + virtual/jpeg:0
130 + media-libs/libpng:0=
131 + sys-libs/zlib
132 + ) )
133 + firebird? ( dev-db/firebird )
134 + gd? ( virtual/jpeg:0 media-libs/libpng:0= sys-libs/zlib )
135 + gdbm? ( >=sys-libs/gdbm-1.8.0 )
136 + gmp? ( >=dev-libs/gmp-4.1.2 )
137 + iconv? ( virtual/libiconv )
138 + imap? ( virtual/imap-c-client[ssl=] )
139 + intl? ( dev-libs/icu:= )
140 + iodbc? ( dev-db/libiodbc )
141 + kerberos? ( virtual/krb5 )
142 + ldap? ( >=net-nds/openldap-1.2.11 )
143 + ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 )
144 + libedit? ( || ( sys-freebsd/freebsd-lib dev-libs/libedit ) )
145 + mssql? ( dev-db/freetds[mssql] )
146 + libmysqlclient? (
147 + mysql? ( virtual/mysql )
148 + mysqli? ( >=virtual/mysql-4.1 )
149 + )
150 + nls? ( sys-devel/gettext )
151 + oci8-instant-client? ( dev-db/oracle-instantclient-basic )
152 + odbc? ( >=dev-db/unixODBC-1.8.13 )
153 + postgres? ( dev-db/postgresql )
154 + qdbm? ( dev-db/qdbm )
155 + readline? ( sys-libs/readline )
156 + recode? ( app-text/recode )
157 + sharedmem? ( dev-libs/mm )
158 + simplexml? ( >=dev-libs/libxml2-2.6.8 )
159 + snmp? ( >=net-analyzer/net-snmp-5.2 )
160 + soap? ( >=dev-libs/libxml2-2.6.8 )
161 + spell? ( >=app-text/aspell-0.50 )
162 + sqlite? ( >=dev-db/sqlite-3.7.6.3 )
163 + ssl? ( >=dev-libs/openssl-0.9.7 )
164 + sybase-ct? ( dev-db/freetds )
165 + tidy? ( app-text/htmltidy )
166 + truetype? (
167 + =media-libs/freetype-2*
168 + >=media-libs/t1lib-5.0.0
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 + libmysqlclient? ( || (
210 + mysql
211 + mysqli
212 + pdo
213 + ) )
214 +
215 + qdbm? ( !gdbm )
216 + readline? ( !libedit )
217 + recode? ( !imap !mysql !mysqli )
218 + sharedmem? ( !threads )
219 +
220 + !cli? ( !cgi? ( !fpm? ( !apache2? ( !embed? ( cli ) ) ) ) )"
221 +
222 +RDEPEND="${DEPEND}"
223 +
224 +RDEPEND="${RDEPEND}
225 + fpm? (
226 + selinux? ( sec-policy/selinux-phpfpm )
227 + systemd? ( sys-apps/systemd ) )"
228 +
229 +DEPEND="${DEPEND}
230 + sys-devel/flex
231 + >=sys-devel/m4-1.4.3
232 + >=sys-devel/libtool-1.5.18"
233 +
234 +# Allow users to install production version if they want to
235 +
236 +case "${PHP_INI_VERSION}" in
237 + production|development)
238 + ;;
239 + *)
240 + PHP_INI_VERSION="development"
241 + ;;
242 +esac
243 +
244 +PHP_INI_UPSTREAM="php.ini-${PHP_INI_VERSION}"
245 +PHP_INI_FILE="php.ini"
246 +
247 +want_apache
248 +
249 +pkg_setup() {
250 + depend.apache_pkg_setup
251 +}
252 +
253 +php_install_ini() {
254 + local phpsapi="${1}"
255 +
256 + # work out where we are installing the ini file
257 + php_set_ini_dir "${phpsapi}"
258 +
259 + local phpinisrc="${PHP_INI_UPSTREAM}-${phpsapi}"
260 + cp "${PHP_INI_UPSTREAM}" "${phpinisrc}"
261 +
262 + # default to /tmp for save_path, bug #282768
263 + sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}"
264 +
265 + # Set the extension dir
266 + sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" -i "${phpinisrc}"
267 +
268 + # Set the include path to point to where we want to find PEAR packages
269 + sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}"
270 +
271 + dodir "${PHP_INI_DIR#${EPREFIX}}"
272 + insinto "${PHP_INI_DIR#${EPREFIX}}"
273 + newins "${phpinisrc}" "${PHP_INI_FILE}"
274 +
275 + elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
276 + elog
277 +
278 + dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
279 + dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
280 +
281 + if use_if_iuse opcache; then
282 + elog "Adding opcache to $PHP_EXT_INI_DIR"
283 + echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
284 + dosym "${PHP_EXT_INI_DIR#${EPREFIX}}/opcache.ini" "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
285 + fi
286 +
287 + # SAPI-specific handling
288 +
289 + if [[ "${sapi}" == "fpm" ]] ; then
290 + [[ -z ${PHP_FPM_CONF_VER} ]] && PHP_FPM_CONF_VER=0
291 + einfo "Installing FPM CGI config file php-fpm.conf"
292 + insinto "${PHP_INI_DIR#${EPREFIX}}"
293 + newins "${FILESDIR}/php-fpm-r${PHP_FPM_CONF_VER}.conf" php-fpm.conf
294 +
295 + # Remove bogus /etc/php-fpm.conf.default (bug 359906)
296 + [[ -f "${ED}/etc/php-fpm.conf.default" ]] && rm "${ED}/etc/php-fpm.conf.default"
297 + fi
298 +
299 + # Install PHP ini files into /usr/share/php
300 +
301 + dodoc php.ini-development
302 + dodoc php.ini-production
303 +
304 +}
305 +
306 +php_set_ini_dir() {
307 + PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
308 + PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
309 + PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
310 +}
311 +
312 +src_prepare() {
313 + # USE=sharedmem (session/mod_mm to be exact) tries to mmap() this path
314 + # ([empty session.save_path]/session_mm_[sapi][gid].sem)
315 + # there is no easy way to circumvent that, all php calls during
316 + # install use -n, so no php.ini file will be used.
317 + # As such, this is the easiest way to get around
318 + addpredict /session_mm_cli250.sem
319 + addpredict /session_mm_cli0.sem
320 +
321 + # Change PHP branding
322 + # Get the alpha/beta/rc version
323 + sed -re "s|^(PHP_EXTRA_VERSION=\").*(\")|\1-pl${PR/r/}-gentoo\2|g" \
324 + -i configure.in || die "Unable to change PHP branding"
325 +
326 + # Patch PHP to show Gentoo as the server platform
327 + sed -e 's/PHP_UNAME=`uname -a | xargs`/PHP_UNAME=`uname -s -n -r -v | xargs`/g' \
328 + -i configure.in || die "Failed to fix server platform name"
329 +
330 + # Prevent PHP from activating the Apache config,
331 + # as we will do that ourselves
332 + sed -i \
333 + -e "s,-i -a -n php${PHP_MV},-i -n php${PHP_MV},g" \
334 + -e "s,-i -A -n php${PHP_MV},-i -n php${PHP_MV},g" \
335 + configure sapi/apache2filter/config.m4 sapi/apache2handler/config.m4
336 +
337 + # Patch PHP to support heimdal instead of mit-krb5
338 + if has_version "app-crypt/heimdal" ; then
339 + sed -e 's|gssapi_krb5|gssapi|g' -i acinclude.m4 \
340 + || die "Failed to fix heimdal libname"
341 + sed -e 's|PHP_ADD_LIBRARY(k5crypto, 1, $1)||g' -i acinclude.m4 \
342 + || die "Failed to fix heimdal crypt library reference"
343 + fi
344 +
345 + #Add user patches #357637
346 + epatch_user
347 +
348 + #force rebuilding aclocal.m4
349 + rm aclocal.m4
350 + eautoreconf
351 +
352 + if [[ ${CHOST} == *-darwin* ]] ; then
353 + # http://bugs.php.net/bug.php?id=48795, bug #343481
354 + sed -i -e '/BUILD_CGI="\\$(CC)/s/CC/CXX/' configure || die
355 + fi
356 +}
357 +
358 +src_configure() {
359 + addpredict /usr/share/snmp/mibs/.index
360 + addpredict /var/lib/net-snmp/mib_indexes
361 +
362 + PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
363 +
364 + # This is a global variable and should be in caps. It isn't because the
365 + # phpconfutils eclass relies on exactly this name...
366 + # for --with-libdir see bug #327025
367 + my_conf="
368 + --prefix="${PHP_DESTDIR}"
369 + --mandir="${PHP_DESTDIR}"/man
370 + --infodir="${PHP_DESTDIR}"/info
371 + --libdir="${PHP_DESTDIR}"/lib
372 + --with-libdir=$(get_libdir)
373 + --without-pear
374 + $(use_enable threads maintainer-zts)"
375 +
376 + # extension USE flag shared
377 + my_conf+="
378 + $(use_enable bcmath bcmath )
379 + $(use_with bzip2 bz2 "${EPREFIX}"/usr)
380 + $(use_enable calendar calendar )
381 + $(use_enable ctype ctype )
382 + $(use_with curl curl "${EPREFIX}"/usr)
383 + $(use_enable xml dom )
384 + $(use_with enchant enchant "${EPREFIX}"/usr)
385 + $(use_enable exif exif )
386 + $(use_enable fileinfo fileinfo )
387 + $(use_enable filter filter )
388 + $(use_enable ftp ftp )
389 + $(use_with nls gettext "${EPREFIX}"/usr)
390 + $(use_with gmp gmp "${EPREFIX}"/usr)
391 + $(use_enable hash hash )
392 + $(use_with mhash mhash "${EPREFIX}"/usr)
393 + $(use_with iconv iconv $(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 mssql mssql "${EPREFIX}"/usr)
403 + $(use_with unicode onig "${EPREFIX}"/usr)
404 + $(use_with ssl openssl "${EPREFIX}"/usr)
405 + $(use_with ssl openssl-dir "${EPREFIX}"/usr)
406 + $(use_enable pcntl pcntl )
407 + $(use_enable phar phar )
408 + $(use_enable pdo pdo )
409 + $(use_enable opcache opcache )
410 + $(use_with postgres pgsql "${EPREFIX}"/usr)
411 + $(use_enable posix posix )
412 + $(use_with spell pspell "${EPREFIX}"/usr)
413 + $(use_with recode recode "${EPREFIX}"/usr)
414 + $(use_enable simplexml simplexml )
415 + $(use_enable sharedmem shmop )
416 + $(use_with snmp snmp "${EPREFIX}"/usr)
417 + $(use_enable soap soap )
418 + $(use_enable sockets sockets )
419 + $(use_with sqlite sqlite3 "${EPREFIX}"/usr)
420 + $(use_with sybase-ct sybase-ct "${EPREFIX}"/usr)
421 + $(use_enable sysvipc sysvmsg )
422 + $(use_enable sysvipc sysvsem )
423 + $(use_enable sysvipc sysvshm )
424 + $(use_with systemd fpm-systemd)
425 + $(use_with tidy tidy "${EPREFIX}"/usr)
426 + $(use_enable tokenizer tokenizer )
427 + $(use_enable wddx wddx )
428 + $(use_enable xml xml )
429 + $(use_enable xmlreader xmlreader )
430 + $(use_enable xmlwriter xmlwriter )
431 + $(use_with xmlrpc xmlrpc)
432 + $(use_with xslt xsl "${EPREFIX}"/usr)
433 + $(use_enable zip zip )
434 + $(use_with zlib zlib "${EPREFIX}"/usr)
435 + $(use_enable debug debug )"
436 +
437 + # DBA support
438 + if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
439 + || use qdbm ; then
440 + my_conf="${my_conf} --enable-dba${shared}"
441 + fi
442 +
443 + # DBA drivers support
444 + my_conf+="
445 + $(use_with cdb cdb)
446 + $(use_with berkdb db4 ${EPREFIX}/usr)
447 + $(use_enable flatfile flatfile )
448 + $(use_with gdbm gdbm ${EPREFIX}/usr)
449 + $(use_enable inifile inifile )
450 + $(use_with qdbm qdbm ${EPREFIX}/usr)"
451 +
452 + # Support for the GD graphics library
453 + my_conf+="
454 + $(use_with truetype freetype-dir ${EPREFIX}/usr)
455 + $(use_with truetype t1lib ${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 +
474 + if use firebird ; then
475 + my_conf+="
476 + $(use_with firebird interbase ${EPREFIX}/usr)"
477 + fi
478 +
479 + # LDAP support
480 + if use ldap ; then
481 + my_conf+="
482 + $(use_with ldap ldap ${EPREFIX}/usr)
483 + $(use_with ldap-sasl ldap-sasl ${EPREFIX}/usr)"
484 + fi
485 +
486 + # MySQL support
487 + local mysqllib="mysqlnd"
488 + local mysqlilib="mysqlnd"
489 + use libmysqlclient && mysqllib="${EPREFIX}/usr"
490 + use libmysqlclient && mysqlilib="${EPREFIX}/usr/bin/mysql_config"
491 +
492 + my_conf+=" $(use_with mysql mysql $mysqllib)"
493 + my_conf+=" $(use_with mysqli mysqli $mysqlilib)"
494 +
495 + local mysqlsock=" $(use_with mysql mysql-sock ${EPREFIX}/var/run/mysqld/mysqld.sock)"
496 + if use mysql ; then
497 + my_conf+="${mysqlsock}"
498 + elif use mysqli ; then
499 + my_conf+="${mysqlsock}"
500 + fi
501 +
502 + # ODBC support
503 + if use odbc ; then
504 + my_conf+="
505 + $(use_with odbc unixODBC ${EPREFIX}/usr)"
506 + fi
507 +
508 + if use iodbc ; then
509 + my_conf+="
510 + $(use_with iodbc iodbc ${EPREFIX}/usr)"
511 + fi
512 +
513 + # Oracle support
514 + if use oci8-instant-client ; then
515 + my_conf+="
516 + $(use_with oci8-instant-client oci8)"
517 + fi
518 +
519 + # PDO support
520 + if use pdo ; then
521 + my_conf+="
522 + $(use_with mssql pdo-dblib )
523 + $(use_with mysql pdo-mysql ${mysqllib})
524 + $(use_with postgres pdo-pgsql )
525 + $(use_with sqlite pdo-sqlite ${EPREFIX}/usr)
526 + $(use_with odbc pdo-odbc unixODBC,${EPREFIX}/usr)"
527 + if use oci8-instant-client ; then
528 + my_conf+="
529 + $(use_with oci8-instant-client pdo-oci)"
530 + fi
531 + fi
532 +
533 + # readline/libedit support
534 + my_conf+="
535 + $(use_with readline readline ${EPREFIX}/usr)
536 + $(use_with libedit libedit ${EPREFIX}/usr)"
537 +
538 + # Session support
539 + if use session ; then
540 + my_conf+="
541 + $(use_with sharedmem mm ${EPREFIX}/usr)"
542 + else
543 + my_conf+="
544 + $(use_enable session session )"
545 + fi
546 +
547 + # Use pic for shared modules such as apache2's mod_php
548 + my_conf="${my_conf} --with-pic"
549 +
550 + # we use the system copy of pcre
551 + # --with-pcre-regex affects ext/pcre
552 + # --with-pcre-dir affects ext/filter and ext/zip
553 + my_conf="${my_conf} --with-pcre-regex=${EPREFIX}/usr --with-pcre-dir=${EPREFIX}/usr"
554 +
555 + # Catch CFLAGS problems
556 + # Fixes bug #14067.
557 + # Changed order to run it in reverse for bug #32022 and #12021.
558 + replace-cpu-flags "k6*" "i586"
559 +
560 + # Support user-passed configuration parameters
561 + my_conf="${my_conf} ${EXTRA_ECONF:-}"
562 +
563 + # Support the Apache2 extras, they must be set globally for all
564 + # SAPIs to work correctly, especially for external PHP extensions
565 +
566 + mkdir -p "${WORKDIR}/sapis-build"
567 + for one_sapi in $SAPIS ; do
568 + use "${one_sapi}" || continue
569 + php_set_ini_dir "${one_sapi}"
570 +
571 + cp -r "${S}" "${WORKDIR}/sapis-build/${one_sapi}"
572 + cd "${WORKDIR}/sapis-build/${one_sapi}"
573 +
574 + sapi_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR}
575 + --with-config-file-scan-dir=${PHP_EXT_INI_DIR_ACTIVE}"
576 +
577 + for sapi in $SAPIS ; do
578 + case "$sapi" in
579 + cli|cgi|embed|fpm)
580 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
581 + sapi_conf="${sapi_conf} --enable-${sapi}"
582 + else
583 + sapi_conf="${sapi_conf} --disable-${sapi}"
584 + fi
585 + ;;
586 +
587 + apache2)
588 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
589 + sapi_conf="${sapi_conf} --with-apxs2=${EPREFIX}/usr/sbin/apxs"
590 + else
591 + sapi_conf="${sapi_conf} --without-apxs2"
592 + fi
593 + ;;
594 + esac
595 + done
596 +
597 + econf ${sapi_conf}
598 + done
599 +}
600 +
601 +src_compile() {
602 + # snmp seems to run during src_compile, too (bug #324739)
603 + addpredict /usr/share/snmp/mibs/.index
604 + addpredict /var/lib/net-snmp/mib_indexes
605 +
606 + for sapi in ${SAPIS} ; do
607 + if use "${sapi}"; then
608 + cd "${WORKDIR}/sapis-build/$sapi" || "Failed to change dir to ${WORKDIR}/sapis-build/$1"
609 + emake || die "emake failed"
610 + fi
611 + done
612 +}
613 +
614 +src_install() {
615 + # see bug #324739 for what happens when we don't have that
616 + addpredict /usr/share/snmp/mibs/.index
617 +
618 + # grab the first SAPI that got built and install common files from there
619 + local first_sapi=""
620 + for sapi in $SAPIS ; do
621 + if use $sapi ; then
622 + first_sapi=$sapi
623 + break
624 + fi
625 + done
626 +
627 + # Makefile forgets to create this before trying to write to it...
628 + dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
629 +
630 + # Install php environment (without any sapis)
631 + cd "${WORKDIR}/sapis-build/$first_sapi"
632 + emake INSTALL_ROOT="${D}" \
633 + install-build install-headers install-programs \
634 + || die "emake install failed"
635 +
636 + local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
637 +
638 + # Create the directory where we'll put version-specific php scripts
639 + keepdir /usr/share/php${PHP_MV}
640 +
641 + local sapi="", file=""
642 + local sapi_list=""
643 +
644 + for sapi in ${SAPIS}; do
645 + if use "${sapi}" ; then
646 + einfo "Installing SAPI: ${sapi}"
647 + cd "${WORKDIR}/sapis-build/${sapi}"
648 +
649 + if [[ "${sapi}" == "apache2" ]] ; then
650 + # We're specifically not using emake install-sapi as libtool
651 + # may cause unnecessary relink failures (see bug #351266)
652 + insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
653 + newins ".libs/libphp5$(get_libname)" "libphp${PHP_MV}$(get_libname)"
654 + keepdir "/usr/$(get_libdir)/apache2/modules"
655 + else
656 + # needed each time, php_install_ini would reset it
657 + local dest="${PHP_DESTDIR#${EPREFIX}}"
658 + into "${dest}"
659 + case "$sapi" in
660 + cli)
661 + source="sapi/cli/php"
662 + ;;
663 + cgi)
664 + source="sapi/cgi/php-cgi"
665 + ;;
666 + fpm)
667 + source="sapi/fpm/php-fpm"
668 + ;;
669 + embed)
670 + source="libs/libphp${PHP_MV}$(get_libname)"
671 + ;;
672 + *)
673 + die "unhandled sapi in src_install"
674 + ;;
675 + esac
676 +
677 + if [[ "${source}" == *"$(get_libname)" ]]; then
678 + dolib.so "${source}" || die "Unable to install ${sapi} sapi"
679 + else
680 + dobin "${source}" || die "Unable to install ${sapi} sapi"
681 + local name="$(basename ${source})"
682 + dosym "${dest}/bin/${name}" "/usr/bin/${name}${SLOT}"
683 + fi
684 + fi
685 +
686 + php_install_ini "${sapi}"
687 +
688 + # construct correct SAPI string for php-config
689 + # thanks to ferringb for the bash voodoo
690 + if [[ "${sapi}" == "apache2" ]]; then
691 + sapi_list="${sapi_list:+${sapi_list} }apache2handler"
692 + else
693 + sapi_list="${sapi_list:+${sapi_list} }${sapi}"
694 + fi
695 + fi
696 + done
697 +
698 + # Installing opcache module
699 + if use_if_iuse opcache ; then
700 + dolib.so "modules/opcache$(get_libname)" || die "Unable to install opcache module"
701 + fi
702 +
703 + # Install env.d files
704 + newenvd "${FILESDIR}/20php5-envd" \
705 + "20php${SLOT}"
706 + sed -e "s|/lib/|/$(get_libdir)/|g" -i \
707 + "${ED}/etc/env.d/20php${SLOT}"
708 + sed -e "s|php5|php${SLOT}|g" -i \
709 + "${ED}/etc/env.d/20php${SLOT}"
710 +
711 + # set php-config variable correctly (bug #278439)
712 + sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
713 + "${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config"
714 +
715 + if use fpm ; then
716 + if use systemd; then
717 + systemd_newunit "${FILESDIR}/php-fpm_at.service" "php-fpm@${SLOT}.service"
718 + else
719 + systemd_newunit "${FILESDIR}/php-fpm_at-simple.service" "php-fpm@${SLOT}.service"
720 + fi
721 + fi
722 +}
723 +
724 +src_test() {
725 + echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
726 + PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php"
727 + if [[ ! -x "${PHP_BIN}" ]] ; then
728 + ewarn "Test phase requires USE=cli, skipping"
729 + return
730 + else
731 + export TEST_PHP_EXECUTABLE="${PHP_BIN}"
732 + fi
733 +
734 + if [[ -x "${WORKDIR}/sapis/cgi/php-cgi" ]] ; then
735 + export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis/cgi/php-cgi"
736 + fi
737 +
738 + REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d "session.save_path=${T}" \
739 + "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d "session.save_path=${T}"
740 +
741 + for name in ${EXPECTED_TEST_FAILURES}; do
742 + mv "${name}.out" "${name}.out.orig" 2>/dev/null
743 + done
744 +
745 + local failed="$(find -name '*.out')"
746 + if [[ ${failed} != "" ]] ; then
747 + ewarn "The following test cases failed unexpectedly:"
748 + for name in ${failed}; do
749 + ewarn " ${name/.out/}"
750 + done
751 + else
752 + einfo "No unexpected test failures, all fine"
753 + fi
754 +
755 + if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
756 + local passed=""
757 + for name in ${EXPECTED_TEST_FAILURES}; do
758 + [[ -f "${name}.diff" ]] && continue
759 + passed="${passed} ${name}"
760 + done
761 + if [[ ${passed} != "" ]] ; then
762 + einfo "The following test cases passed unexpectedly:"
763 + for name in ${passed}; do
764 + ewarn " ${passed}"
765 + done
766 + else
767 + einfo "None of the known-to-fail tests passed, all fine"
768 + fi
769 + fi
770 +}
771 +
772 +pkg_postinst() {
773 + # Output some general info to the user
774 + if use apache2 ; then
775 + APACHE2_MOD_DEFINE="PHP5"
776 + APACHE2_MOD_CONF="70_mod_php5" # actually provided by app-eselect/eselect-php
777 + apache-module_pkg_postinst
778 + fi
779 +
780 + # Create the symlinks for php
781 + for m in ${SAPIS}; do
782 + [[ ${m} == 'embed' ]] && continue;
783 + if use $m ; then
784 + local ci=$(eselect php show $m)
785 + if [[ -z $ci ]]; then
786 + eselect php set $m php${SLOT}
787 + einfo "Switched ${m} to use php:${SLOT}"
788 + einfo
789 + elif [[ $ci != "php${SLOT}" ]] ; then
790 + elog "To switch $m to use php:${SLOT}, run"
791 + elog " eselect php set $m php${SLOT}"
792 + elog
793 + fi
794 + fi
795 + done
796 +
797 + elog "Make sure that PHP_TARGETS in ${EPREFIX}/etc/make.conf includes php${SLOT/./-} in order"
798 + elog "to compile extensions for the ${SLOT} ABI"
799 + elog
800 + if ! use readline && use cli ; then
801 + ewarn "Note that in order to use php interactivly, you need to enable"
802 + ewarn "the readline USE flag or php -a will hang"
803 + fi
804 + elog
805 + elog "This ebuild installed a version of php.ini based on php.ini-${PHP_INI_VERSION} version."
806 + elog "You can chose which version of php.ini to install by default by setting PHP_INI_VERSION to either"
807 + elog "'production' or 'development' in ${EPREFIX}/etc/make.conf"
808 + elog "Both versions of php.ini can be found in ${EPREFIX}/usr/share/doc/${PF}"
809 +
810 + elog
811 + elog "For more details on how minor version slotting works (PHP_TARGETS) please read the upgrade guide:"
812 + elog "https://www.gentoo.org/proj/en/php/php-upgrading.xml"
813 + elog
814 +}
815 +
816 +pkg_prerm() {
817 + eselect php cleanup
818 +}