Gentoo Archives: gentoo-commits

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