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