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