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