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