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