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: Thu, 04 Jan 2018 17:33:18
Message-Id: 1515087177.fac125d4e89e6b4292a5138895a47ecd5941eee3.grknight@gentoo
1 commit: fac125d4e89e6b4292a5138895a47ecd5941eee3
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jan 4 17:32:57 2018 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Thu Jan 4 17:32:57 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fac125d4
7
8 dev-lang/php: Version bump for 7.0.27
9
10 Package-Manager: Portage-2.3.19, Repoman-2.3.6
11
12 dev-lang/php/Manifest | 1 +
13 dev-lang/php/php-7.0.27.ebuild | 739 +++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 740 insertions(+)
15
16 diff --git a/dev-lang/php/Manifest b/dev-lang/php/Manifest
17 index e9e718b0a83..fccb9516d2f 100644
18 --- a/dev-lang/php/Manifest
19 +++ b/dev-lang/php/Manifest
20 @@ -1,6 +1,7 @@
21 DIST php-5.6.32.tar.xz 12464512 BLAKE2B ef54f9a30e15f16f456973c4e0ef0bcb9402b206f944b1b2838b10b0c5c985fe9d9966ecd5569d9f4dbb1c5dd3ff63dbbe79be7009da8379942f442a1a0ad1f2 SHA512 f0556a23f2a2711cda25dd25e63996c9315e7da13555a7169ee701406454e4d372ffca82476b4a474a96b2f3d3b783f6827042df71bb245514884d7c3d23530b
22 DIST php-7.0.25.tar.xz 11963668 BLAKE2B 8d20ce3574d72c39b4e90b466d7d06800458e9ab95724b92c07da7689a69014ec5924355399651b63b3cef7261ba8778bb29dc65712acf47fd4bd000ab6d2180 SHA512 7a31fe48f3843a5380a7ab7b04ba2006e739f96d314b662beb337a8e76fbb2f3c1e1e22a8c9d5209bad61deb0ccc21706f0dedd12d15766f7795497549b4cae4
23 DIST php-7.0.26.tar.xz 11966888 BLAKE2B 4d7ceefa2226aa8a7f2a62511504f63d4d22a59fa2953edcca9b086b1ce5ec1a5cb111c37678fc24b32bcd67d53cdd127a728eb4340c24c64f8042e6ee6e2b88 SHA512 314062acb2e1c860ba616dae15254fcb25d73784e976a1a4dd1de200e4a457f4fd167d2e6c8400f37156839e474ff484fddd35d7ea57a9c923b39ad529449c38
24 +DIST php-7.0.27.tar.xz 11916824 BLAKE2B 9d2881a611435b3f9607e04d1f271ca497b8543792608f3690f00aa767fe8cc1f442822ae702076d21df0b56005d7b4e8e88b11ec6dd50d0bc198197b48cafda SHA512 1987ad5573fdcbd5c8d92fdbf5ba8dca6e9621d89d30f66a003338467e31f09f9e8ceb5cdcb2ddf24ec7aa5acf0c8e33c3774e586e7682667eb3ed148237d1bb
25 DIST php-7.1.11.tar.xz 12169884 BLAKE2B e7ec69cdf5e0e985a9d48b90308e1e4a97967239f9fac3d503fc0639af474bfc933c90861137f31c4b0685e850e5eb5813e755dd4587cb7eea5dddc61105161b SHA512 400bc75d938f49754586d2b14b8f300c5a1e961489c02c968c7560ea0edc3765992580306c6185ecee57734775f8abaf7525a2aaa5110db2d8efacf2701c0101
26 DIST php-7.1.12.tar.xz 12194772 BLAKE2B de7a81caa66043ed057c217b0059e5e4de9e6adb3ea4491519c88df2e3b282c7082f6ec7f04df9c94a68b6c9d5e88dca340acf9a80a8df242eaae0c20fbeb123 SHA512 75fc376faaf20500cadc0da03baac1676a151a033df4724c2a69dd601969e37c2638d24c27880cf020f53d6a44e17c2a06f621f2fcaa416de6230253e73a6763
27 DIST php-7.2.0.tar.xz 12014940 BLAKE2B e34c5bfb076e62afc54c8e35e0e35491b803ec753a1e62a0d8e78dd5bb6c28b95a9434228e211b76913f721bd0d8009527c95d2ab7990780819f5d3b8d822c6f SHA512 828d38727edde0dbc6483add6cdc21d33527b887bffaedad2d7f53e25d58a6f661ac341a23db02741bc37248d161aaffd72026dd8ef85ac851594c127d6c0133
28
29 diff --git a/dev-lang/php/php-7.0.27.ebuild b/dev-lang/php/php-7.0.27.ebuild
30 new file mode 100644
31 index 00000000000..dde911b26c6
32 --- /dev/null
33 +++ b/dev-lang/php/php-7.0.27.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 + 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_with acl fpm-acl)
293 + $(use_enable bcmath bcmath)
294 + $(use_with bzip2 bz2 "${EPREFIX}/usr")
295 + $(use_enable calendar calendar)
296 + $(use_enable coverage gcov)
297 + $(use_enable ctype ctype)
298 + $(use_with curl curl "${EPREFIX}/usr")
299 + $(use_enable xml dom)
300 + $(use_with enchant enchant "${EPREFIX}/usr")
301 + $(use_enable exif exif)
302 + $(use_enable fileinfo fileinfo)
303 + $(use_enable filter filter)
304 + $(use_enable ftp ftp)
305 + $(use_with nls gettext "${EPREFIX}/usr")
306 + $(use_with gmp gmp "${EPREFIX}/usr")
307 + $(use_enable hash hash)
308 + $(use_with mhash mhash "${EPREFIX}/usr")
309 + $(use_with iconv iconv \
310 + $(use elibc_glibc || use elibc_musl || echo "${EPREFIX}/usr"))
311 + $(use_enable intl intl)
312 + $(use_enable ipv6 ipv6)
313 + $(use_enable json json)
314 + $(use_with kerberos kerberos "${EPREFIX}/usr")
315 + $(use_enable xml libxml)
316 + $(use_with xml libxml-dir "${EPREFIX}/usr")
317 + $(use_enable unicode mbstring)
318 + $(use_with crypt mcrypt "${EPREFIX}/usr")
319 + $(use_with unicode onig "${EPREFIX}/usr")
320 + $(use_with ssl openssl "${EPREFIX}/usr")
321 + $(use_with ssl openssl-dir "${EPREFIX}/usr")
322 + $(use_enable pcntl pcntl)
323 + $(use_enable phar phar)
324 + $(use_enable pdo pdo)
325 + $(use_enable opcache opcache)
326 + $(use_with postgres pgsql "${EPREFIX}/usr")
327 + $(use_enable posix posix)
328 + $(use_with spell pspell "${EPREFIX}/usr")
329 + $(use_with recode recode "${EPREFIX}/usr")
330 + $(use_enable simplexml simplexml)
331 + $(use_enable sharedmem shmop)
332 + $(use_with snmp snmp "${EPREFIX}/usr")
333 + $(use_enable soap soap)
334 + $(use_enable sockets sockets)
335 + $(use_with sqlite sqlite3 "${EPREFIX}/usr")
336 + $(use_enable sysvipc sysvmsg)
337 + $(use_enable sysvipc sysvsem)
338 + $(use_enable sysvipc sysvshm)
339 + $(use_with systemd fpm-systemd)
340 + $(use_with tidy tidy "${EPREFIX}/usr")
341 + $(use_enable tokenizer tokenizer)
342 + $(use_enable wddx wddx)
343 + $(use_enable xml xml)
344 + $(use_enable xmlreader xmlreader)
345 + $(use_enable xmlwriter xmlwriter)
346 + $(use_with xmlrpc xmlrpc)
347 + $(use_with xslt xsl "${EPREFIX}/usr")
348 + $(use_enable zip zip)
349 + $(use_with zlib zlib "${EPREFIX}/usr")
350 + $(use_enable debug debug)
351 + )
352 +
353 + # DBA support
354 + if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
355 + || use qdbm ; then
356 + our_conf+=( "--enable-dba${shared}" )
357 + fi
358 +
359 + # DBA drivers support
360 + our_conf+=(
361 + $(use_with cdb cdb)
362 + $(use_with berkdb db4 "${EPREFIX}/usr")
363 + $(use_enable flatfile flatfile)
364 + $(use_with gdbm gdbm "${EPREFIX}/usr")
365 + $(use_enable inifile inifile)
366 + $(use_with qdbm qdbm "${EPREFIX}/usr")
367 + )
368 +
369 + # Support for the GD graphics library
370 + our_conf+=(
371 + $(use_with truetype freetype-dir "${EPREFIX}/usr")
372 + $(use_enable cjk gd-jis-conv)
373 + $(use_with gd jpeg-dir "${EPREFIX}/usr")
374 + $(use_with gd png-dir "${EPREFIX}/usr")
375 + $(use_with xpm xpm-dir "${EPREFIX}/usr")
376 + )
377 + if use webp; then
378 + our_conf+=( --with-webp-dir="${EPREFIX}/usr" )
379 + fi
380 + # enable gd last, so configure can pick up the previous settings
381 + our_conf+=( $(use_with gd gd) )
382 +
383 + # IMAP support
384 + if use imap ; then
385 + our_conf+=(
386 + $(use_with imap imap "${EPREFIX}/usr")
387 + $(use_with ssl imap-ssl "${EPREFIX}/usr")
388 + )
389 + fi
390 +
391 + # Interbase/firebird support
392 + our_conf+=( $(use_with firebird interbase "${EPREFIX}/usr") )
393 +
394 + # LDAP support
395 + if use ldap ; then
396 + our_conf+=(
397 + $(use_with ldap ldap "${EPREFIX}/usr")
398 + $(use_with ldap-sasl ldap-sasl "${EPREFIX}/usr")
399 + )
400 + fi
401 +
402 + # MySQL support
403 + local mysqllib="mysqlnd"
404 + local mysqlilib="mysqlnd"
405 +
406 + our_conf+=( $(use_with mysqli mysqli "${mysqlilib}") )
407 +
408 + local mysqlsock="${EPREFIX}/var/run/mysqld/mysqld.sock"
409 + if use mysql || use mysqli ; then
410 + our_conf+=( $(use_with mysql mysql-sock "${mysqlsock}") )
411 + fi
412 +
413 + # ODBC support
414 + our_conf+=(
415 + $(use_with odbc unixODBC "${EPREFIX}/usr")
416 + $(use_with iodbc iodbc "${EPREFIX}/usr")
417 + )
418 +
419 + # Oracle support
420 + our_conf+=( $(use_with oci8-instant-client oci8) )
421 +
422 + # PDO support
423 + if use pdo ; then
424 + our_conf+=(
425 + $(use_with mssql pdo-dblib "${EPREFIX}/usr")
426 + $(use_with mysql pdo-mysql "${mysqllib}")
427 + $(use_with postgres pdo-pgsql)
428 + $(use_with sqlite pdo-sqlite "${EPREFIX}/usr")
429 + $(use_with firebird pdo-firebird "${EPREFIX}/usr")
430 + $(use_with odbc pdo-odbc "unixODBC,${EPREFIX}/usr")
431 + $(use_with oci8-instant-client pdo-oci)
432 + )
433 + fi
434 +
435 + # readline/libedit support
436 + our_conf+=(
437 + $(use_with readline readline "${EPREFIX}/usr")
438 + $(use_with libedit libedit "${EPREFIX}/usr")
439 + )
440 +
441 + # Session support
442 + if use session ; then
443 + our_conf+=( $(use_with sharedmem mm "${EPREFIX}/usr") )
444 + else
445 + our_conf+=( $(use_enable session session) )
446 + fi
447 +
448 + # Use pic for shared modules such as apache2's mod_php
449 + our_conf+=( --with-pic )
450 +
451 + # we use the system copy of pcre
452 + # --with-pcre-regex affects ext/pcre
453 + # --with-pcre-dir affects ext/filter and ext/zip
454 + our_conf+=(
455 + --with-pcre-regex="${EPREFIX}/usr"
456 + --with-pcre-dir="${EPREFIX}/usr"
457 + )
458 +
459 + # Catch CFLAGS problems
460 + # Fixes bug #14067.
461 + # Changed order to run it in reverse for bug #32022 and #12021.
462 + replace-cpu-flags "k6*" "i586"
463 +
464 + # Cache the ./configure test results between SAPIs.
465 + our_conf+=( --cache-file="${T}/config.cache" )
466 +
467 + # Support user-passed configuration parameters
468 + our_conf+=( ${EXTRA_ECONF:-} )
469 +
470 + # Support the Apache2 extras, they must be set globally for all
471 + # SAPIs to work correctly, especially for external PHP extensions
472 +
473 + mkdir -p "${WORKDIR}/sapis-build" || die
474 + for one_sapi in $SAPIS ; do
475 + use "${one_sapi}" || continue
476 + php_set_ini_dir "${one_sapi}"
477 +
478 + # The BUILD_DIR variable is used to determine where to output
479 + # the files that autotools creates. This was all originally
480 + # based on the autotools-utils eclass.
481 + BUILD_DIR="${WORKDIR}/sapis-build/${one_sapi}"
482 + cp -a "${S}" "${BUILD_DIR}" || die
483 + cd "${BUILD_DIR}" || die
484 +
485 + local sapi_conf=(
486 + --with-config-file-path="${PHP_INI_DIR}"
487 + --with-config-file-scan-dir="${PHP_EXT_INI_DIR_ACTIVE}"
488 + )
489 +
490 + for sapi in $SAPIS ; do
491 + case "$sapi" in
492 + cli|cgi|embed|fpm|phpdbg)
493 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
494 + sapi_conf+=( "--enable-${sapi}" )
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 +}