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, 15 Sep 2018 03:40:30
Message-Id: 1536982813.dabb3bb1e65d446b7c664a4787bf520bb7b63ef8.grknight@gentoo
1 commit: dabb3bb1e65d446b7c664a4787bf520bb7b63ef8
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Sat Sep 15 02:56:00 2018 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Sat Sep 15 03:40:13 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dabb3bb1
7
8 dev-lang/php: Version bump to 7.2.10
9
10 Package-Manager: Portage-2.3.49, Repoman-2.3.10
11
12 dev-lang/php/Manifest | 1 +
13 dev-lang/php/php-7.2.10.ebuild | 740 +++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 741 insertions(+)
15
16 diff --git a/dev-lang/php/Manifest b/dev-lang/php/Manifest
17 index 93179bd26a9..ec1c4d301f7 100644
18 --- a/dev-lang/php/Manifest
19 +++ b/dev-lang/php/Manifest
20 @@ -8,5 +8,6 @@ DIST php-7.1.18.tar.xz 12213396 BLAKE2B f851c6eb261b8b532e84e73e6f173deb6ac00cd5
21 DIST php-7.1.20.tar.xz 12227052 BLAKE2B c9872ffd1f8eb1a51a24d669965b0b908c3d233ad3eac86284e1edf7c6fa5e8099d5706bd1dd740cea039aeac2f66e60f96ccd15f1956eefe5635142b75857f1 SHA512 1f84ba63df45b0d32d704b74217b509807976e88ea953a330c06372491d6ca6e41891cf14bd16524b76f4b2f9007f1243845af7e652917de9325c022135ed9cf
22 DIST php-7.1.21.tar.xz 12227636 BLAKE2B a7451d0f7d8d788ee9d2950170364bdd552dd35bf962b6591618dcda163ea26677c22e26342072b17573182bfd91b7f3f55cade3432c3e9800e36264ba72150a SHA512 92266ae2a1880a497e828ec8972fef6a1c20505a1eb39c77590d9469b2ae047c86d3e84c65871475e36fa3f7e9e872e25aca241b33c3d7ed8fa5dc8d511af2cf
23 DIST php-7.1.22.tar.xz 12227848 BLAKE2B 72fab94b1c7ecfd3479f6d6c9a76a9d8813f7789402664201615d79ab8b5bb26fb1b7273769c4898a36f0336e0ce4d50bf2f17b81ddb54acc9583e39623e3a5b SHA512 0fc0907d303711dbc4ba0a18618e3e73550c73d13988c769f8d50066017b1efe3feb0d22d5539f69271ea4e9532a3d997e22841cb59bdbf96313169e1c03538d
24 +DIST php-7.2.10.tar.xz 12160864 BLAKE2B f1959a00622c1bd11fa87c61d152c802b307f0b9e89b51ed86b40086cda03eeb6652d47b59df8cc7c9b4e79ab687ae1292b978f453e9f07ac352d209b64c62d8 SHA512 aa90fce17034b2649012d66461626ae74c21ea938b1c71c7eb12419e562c641b432df87a7e900c245ad28df39624cf64a1b2f8ffb123608d94cd35e41f09c0fe
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.2.10.ebuild b/dev-lang/php/php-7.2.10.ebuild
29 new file mode 100644
30 index 00000000000..fb1c7c8293c
31 --- /dev/null
32 +++ b/dev-lang/php/php-7.2.10.ebuild
33 @@ -0,0 +1,740 @@
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 argon2 bcmath berkdb bzip2 calendar cdb cjk
65 + coverage +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 lmdb
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 sodium spell sqlite ssl
73 + sysvipc systemd test tidy +tokenizer tokyocabinet truetype unicode wddx webp
74 + +xml xmlreader xmlwriter xmlrpc xpm xslt zip zip-encryption 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 + argon2? ( app-crypt/argon2:= )
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 + coverage? ( dev-util/lcov )
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 + lmdb? ( dev-db/lmdb:= )
110 + mssql? ( dev-db/freetds[mssql] )
111 + nls? ( sys-devel/gettext )
112 + oci8-instant-client? ( dev-db/oracle-instantclient-basic )
113 + odbc? ( >=dev-db/unixODBC-1.8.13 )
114 + postgres? ( dev-db/postgresql:* )
115 + qdbm? ( dev-db/qdbm )
116 + readline? ( sys-libs/readline:0= )
117 + recode? ( app-text/recode )
118 + session-mm? ( dev-libs/mm )
119 + simplexml? ( >=dev-libs/libxml2-2.6.8 )
120 + snmp? ( >=net-analyzer/net-snmp-5.2 )
121 + soap? ( >=dev-libs/libxml2-2.6.8 )
122 + sodium? ( dev-libs/libsodium:= )
123 + spell? ( >=app-text/aspell-0.50 )
124 + sqlite? ( >=dev-db/sqlite-3.7.6.3 )
125 + ssl? (
126 + !libressl? ( dev-libs/openssl:0= )
127 + libressl? ( dev-libs/libressl:0= )
128 + )
129 + tidy? ( || ( app-text/tidy-html5 app-text/htmltidy ) )
130 + tokyocabinet? ( dev-db/tokyocabinet )
131 + truetype? ( =media-libs/freetype-2* )
132 + unicode? ( dev-libs/oniguruma:= )
133 + wddx? ( >=dev-libs/libxml2-2.6.8 )
134 + webp? ( media-libs/libwebp:0= )
135 + xml? ( >=dev-libs/libxml2-2.6.8 )
136 + xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv )
137 + xmlreader? ( >=dev-libs/libxml2-2.6.8 )
138 + xmlwriter? ( >=dev-libs/libxml2-2.6.8 )
139 + xpm? ( x11-libs/libXpm )
140 + xslt? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
141 + zip? ( sys-libs/zlib:0= )
142 + zip-encryption? ( >=dev-libs/libzip-1.2.0:= )
143 + zlib? ( sys-libs/zlib:0= )
144 +"
145 +
146 +RDEPEND="${COMMON_DEPEND}
147 + virtual/mta
148 + fpm? (
149 + selinux? ( sec-policy/selinux-phpfpm )
150 + systemd? ( sys-apps/systemd ) )"
151 +
152 +# Bison isn't actually needed when building from a release tarball
153 +# However, the configure script will warn if it's absent or if you
154 +# have an incompatible version installed. See bug 593278.
155 +DEPEND="${COMMON_DEPEND}
156 + app-arch/xz-utils
157 + >=sys-devel/bison-3.0.1"
158 +
159 +# Without USE=readline or libedit, the interactive "php -a" CLI will hang.
160 +REQUIRED_USE="
161 + || ( cli cgi fpm apache2 embed phpdbg )
162 + cli? ( ^^ ( readline libedit ) )
163 + truetype? ( gd zlib )
164 + webp? ( gd zlib )
165 + cjk? ( gd zlib )
166 + exif? ( gd zlib )
167 + xpm? ( gd zlib )
168 + gd? ( zlib )
169 + simplexml? ( xml )
170 + soap? ( xml )
171 + wddx? ( xml )
172 + xmlrpc? ( || ( xml iconv ) )
173 + xmlreader? ( xml )
174 + xslt? ( xml )
175 + ldap-sasl? ( ldap )
176 + mhash? ( hash )
177 + phar? ( hash )
178 + qdbm? ( !gdbm )
179 + readline? ( !libedit )
180 + recode? ( !imap !mysqli !mysql )
181 + session-mm? ( session !threads )
182 + mysql? ( || ( mysqli pdo ) )
183 + zip-encryption? ( zip )
184 +"
185 +PATCHES=(
186 + "${FILESDIR}/php-freetype-2.9.1.patch"
187 +)
188 +
189 +PHP_MV="$(ver_cut 1)"
190 +
191 +php_install_ini() {
192 + local phpsapi="${1}"
193 +
194 + # work out where we are installing the ini file
195 + php_set_ini_dir "${phpsapi}"
196 +
197 + # Always install the production INI file, bug 611214.
198 + local phpinisrc="php.ini-production-${phpsapi}"
199 + cp php.ini-production "${phpinisrc}" || die
200 +
201 + # default to /tmp for save_path, bug #282768
202 + sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}" || die
203 +
204 + # Set the extension dir
205 + sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" \
206 + -i "${phpinisrc}" || die
207 +
208 + # Set the include path to point to where we want to find PEAR packages
209 + sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}" || die
210 +
211 + dodir "${PHP_INI_DIR#${EPREFIX}}"
212 + insinto "${PHP_INI_DIR#${EPREFIX}}"
213 + newins "${phpinisrc}" php.ini
214 +
215 + elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
216 + elog
217 +
218 + dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
219 + dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
220 +
221 + if use opcache; then
222 + elog "Adding opcache to $PHP_EXT_INI_DIR"
223 + echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> \
224 + "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
225 + dosym "${PHP_EXT_INI_DIR#${EPREFIX}}/opcache.ini" \
226 + "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
227 + fi
228 +
229 + # SAPI-specific handling
230 + if [[ "${sapi}" == "fpm" ]] ; then
231 + einfo "Installing FPM config files php-fpm.conf and www.conf"
232 + insinto "${PHP_INI_DIR#${EPREFIX}}"
233 + doins sapi/fpm/php-fpm.conf
234 + insinto "${PHP_INI_DIR#${EPREFIX}}/fpm.d"
235 + doins sapi/fpm/www.conf
236 + fi
237 +
238 + dodoc php.ini-{development,production}
239 +}
240 +
241 +php_set_ini_dir() {
242 + PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
243 + PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
244 + PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
245 +}
246 +
247 +src_prepare() {
248 + default
249 +
250 + # In php-7.x, the FPM pool configuration files have been split off
251 + # of the main config. By default the pool config files go in
252 + # e.g. /etc/php-fpm.d, which isn't slotted. So here we move the
253 + # include directory to a subdirectory "fpm.d" of $PHP_INI_DIR. Later
254 + # we'll install the pool configuration file "www.conf" there.
255 + php_set_ini_dir fpm
256 + sed -i "s~^include=.*$~include=${PHP_INI_DIR}/fpm.d/*.conf~" \
257 + sapi/fpm/php-fpm.conf.in \
258 + || die 'failed to move the include directory in php-fpm.conf'
259 +}
260 +
261 +src_configure() {
262 + addpredict /usr/share/snmp/mibs/.index #nowarn
263 + addpredict /var/lib/net-snmp/mib_indexes #nowarn
264 +
265 + PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
266 +
267 + # The php-fpm config file wants localstatedir to be ${EPREFIX}/var
268 + # and not the Gentoo default ${EPREFIX}/var/lib. See bug 572002.
269 + local our_conf=(
270 + --prefix="${PHP_DESTDIR}"
271 + --mandir="${PHP_DESTDIR}/man"
272 + --infodir="${PHP_DESTDIR}/info"
273 + --libdir="${PHP_DESTDIR}/lib"
274 + --with-libdir="$(get_libdir)"
275 + --localstatedir="${EPREFIX}/var"
276 + --without-pear
277 + $(use_enable threads maintainer-zts)
278 + )
279 +
280 + our_conf+=(
281 + $(use_with argon2 password-argon2 "${EPREFIX}/usr")
282 + $(use_enable bcmath bcmath)
283 + $(use_with bzip2 bz2 "${EPREFIX}/usr")
284 + $(use_enable calendar calendar)
285 + $(use_enable coverage gcov)
286 + $(use_enable ctype ctype)
287 + $(use_with curl curl "${EPREFIX}/usr")
288 + $(use_enable xml dom)
289 + $(use_with enchant enchant "${EPREFIX}/usr")
290 + $(use_enable exif exif)
291 + $(use_enable fileinfo fileinfo)
292 + $(use_enable filter filter)
293 + $(use_enable ftp ftp)
294 + $(use_with nls gettext "${EPREFIX}/usr")
295 + $(use_with gmp gmp "${EPREFIX}/usr")
296 + $(use_enable hash hash)
297 + $(use_with mhash mhash "${EPREFIX}/usr")
298 + $(use_with iconv iconv \
299 + $(use elibc_glibc || use elibc_musl || use elibc_FreeBSD || echo "${EPREFIX}/usr"))
300 + $(use_enable intl intl)
301 + $(use_enable ipv6 ipv6)
302 + $(use_enable json json)
303 + $(use_with kerberos kerberos "${EPREFIX}/usr")
304 + $(use_enable xml libxml)
305 + $(use_with xml libxml-dir "${EPREFIX}/usr")
306 + $(use_enable unicode mbstring)
307 + $(use_with unicode onig "${EPREFIX}/usr")
308 + $(use_with ssl openssl "${EPREFIX}/usr")
309 + $(use_with ssl openssl-dir "${EPREFIX}/usr")
310 + $(use_enable pcntl pcntl)
311 + $(use_enable phar phar)
312 + $(use_enable pdo pdo)
313 + $(use_enable opcache opcache)
314 + $(use_with postgres pgsql "${EPREFIX}/usr")
315 + $(use_enable posix posix)
316 + $(use_with spell pspell "${EPREFIX}/usr")
317 + $(use_with recode recode "${EPREFIX}/usr")
318 + $(use_enable simplexml simplexml)
319 + $(use_enable sharedmem shmop)
320 + $(use_with snmp snmp "${EPREFIX}/usr")
321 + $(use_enable soap soap)
322 + $(use_enable sockets sockets)
323 + $(use_with sodium sodium "${EPREFIX}/usr")
324 + $(use_with sqlite sqlite3 "${EPREFIX}/usr")
325 + $(use_enable sysvipc sysvmsg)
326 + $(use_enable sysvipc sysvsem)
327 + $(use_enable sysvipc sysvshm)
328 + $(use_with tidy tidy "${EPREFIX}/usr")
329 + $(use_enable tokenizer tokenizer)
330 + $(use_enable wddx wddx)
331 + $(use_enable xml xml)
332 + $(use_enable xmlreader xmlreader)
333 + $(use_enable xmlwriter xmlwriter)
334 + $(use_with xmlrpc xmlrpc)
335 + $(use_with xslt xsl "${EPREFIX}/usr")
336 + $(use_enable zip zip)
337 + $(use_with zip-encryption libzip "${EPREFIX}/usr")
338 + $(use_with zlib zlib "${EPREFIX}/usr")
339 + $(use_enable debug debug)
340 + )
341 +
342 + # DBA support
343 + if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
344 + || use qdbm || use lmdb || use tokyocabinet ; then
345 + our_conf+=( "--enable-dba${shared}" )
346 + fi
347 +
348 + # DBA drivers support
349 + our_conf+=(
350 + $(use_with cdb cdb)
351 + $(use_with berkdb db4 "${EPREFIX}/usr")
352 + $(use_enable flatfile flatfile)
353 + $(use_with gdbm gdbm "${EPREFIX}/usr")
354 + $(use_enable inifile inifile)
355 + $(use_with qdbm qdbm "${EPREFIX}/usr")
356 + $(use_with lmdb lmdb "${EPREFIX}/usr")
357 + )
358 +
359 + # Support for the GD graphics library
360 + our_conf+=(
361 + $(use_with truetype freetype-dir "${EPREFIX}/usr")
362 + $(use_enable cjk gd-jis-conv)
363 + $(use_with gd jpeg-dir "${EPREFIX}/usr")
364 + $(use_with gd png-dir "${EPREFIX}/usr")
365 + $(use_with xpm xpm-dir "${EPREFIX}/usr")
366 + )
367 + if use webp; then
368 + our_conf+=( --with-webp-dir="${EPREFIX}/usr" )
369 + fi
370 + # enable gd last, so configure can pick up the previous settings
371 + our_conf+=( $(use_with gd gd) )
372 +
373 + # IMAP support
374 + if use imap ; then
375 + our_conf+=(
376 + $(use_with imap imap "${EPREFIX}/usr")
377 + $(use_with ssl imap-ssl "${EPREFIX}/usr")
378 + )
379 + fi
380 +
381 + # Interbase/firebird support
382 + our_conf+=( $(use_with firebird interbase "${EPREFIX}/usr") )
383 +
384 + # LDAP support
385 + if use ldap ; then
386 + our_conf+=(
387 + $(use_with ldap ldap "${EPREFIX}/usr")
388 + $(use_with ldap-sasl ldap-sasl "${EPREFIX}/usr")
389 + )
390 + fi
391 +
392 + # MySQL support
393 + local mysqllib="mysqlnd"
394 + local mysqlilib="mysqlnd"
395 +
396 + our_conf+=( $(use_with mysqli mysqli "${mysqlilib}") )
397 +
398 + local mysqlsock="${EPREFIX}/var/run/mysqld/mysqld.sock"
399 + if use mysql || use mysqli ; then
400 + our_conf+=( $(use_with mysql mysql-sock "${mysqlsock}") )
401 + fi
402 +
403 + # ODBC support
404 + our_conf+=(
405 + $(use_with odbc unixODBC "${EPREFIX}/usr")
406 + $(use_with iodbc iodbc "${EPREFIX}/usr")
407 + )
408 +
409 + # Oracle support
410 + our_conf+=( $(use_with oci8-instant-client oci8) )
411 +
412 + # PDO support
413 + if use pdo ; then
414 + our_conf+=(
415 + $(use_with mssql pdo-dblib "${EPREFIX}/usr")
416 + $(use_with mysql pdo-mysql "${mysqllib}")
417 + $(use_with postgres pdo-pgsql)
418 + $(use_with sqlite pdo-sqlite "${EPREFIX}/usr")
419 + $(use_with firebird pdo-firebird "${EPREFIX}/usr")
420 + $(use_with odbc pdo-odbc "unixODBC,${EPREFIX}/usr")
421 + $(use_with oci8-instant-client pdo-oci)
422 + )
423 + fi
424 +
425 + # readline/libedit support
426 + our_conf+=(
427 + $(use_with readline readline "${EPREFIX}/usr")
428 + $(use_with libedit libedit "${EPREFIX}/usr")
429 + )
430 +
431 + # Session support
432 + if use session ; then
433 + our_conf+=( $(use_with session-mm mm "${EPREFIX}/usr") )
434 + else
435 + our_conf+=( $(use_enable session session) )
436 + fi
437 +
438 + # Use pic for shared modules such as apache2's mod_php
439 + our_conf+=( --with-pic )
440 +
441 + # we use the system copy of pcre
442 + # --with-pcre-regex affects ext/pcre
443 + # --with-pcre-dir affects ext/filter and ext/zip
444 + # --with-pcre-valgrind cannot be enabled with system pcre
445 + # Many arches don't support pcre-jit
446 + our_conf+=(
447 + --with-pcre-regex="${EPREFIX}/usr"
448 + --with-pcre-dir="${EPREFIX}/usr"
449 + --without-pcre-valgrind
450 + --without-pcre-jit
451 + )
452 +
453 + # Catch CFLAGS problems
454 + # Fixes bug #14067.
455 + # Changed order to run it in reverse for bug #32022 and #12021.
456 + replace-cpu-flags "k6*" "i586"
457 +
458 + # Cache the ./configure test results between SAPIs.
459 + our_conf+=( --cache-file="${T}/config.cache" )
460 +
461 + # Support user-passed configuration parameters
462 + our_conf+=( ${EXTRA_ECONF:-} )
463 +
464 + # Support the Apache2 extras, they must be set globally for all
465 + # SAPIs to work correctly, especially for external PHP extensions
466 +
467 + mkdir -p "${WORKDIR}/sapis-build" || die
468 + for one_sapi in $SAPIS ; do
469 + use "${one_sapi}" || continue
470 + php_set_ini_dir "${one_sapi}"
471 +
472 + # The BUILD_DIR variable is used to determine where to output
473 + # the files that autotools creates. This was all originally
474 + # based on the autotools-utils eclass.
475 + BUILD_DIR="${WORKDIR}/sapis-build/${one_sapi}"
476 + cp -a "${S}" "${BUILD_DIR}" || die
477 + cd "${BUILD_DIR}" || die
478 +
479 + local sapi_conf=(
480 + --with-config-file-path="${PHP_INI_DIR}"
481 + --with-config-file-scan-dir="${PHP_EXT_INI_DIR_ACTIVE}"
482 + )
483 +
484 + for sapi in $SAPIS ; do
485 + case "$sapi" in
486 + cli|cgi|embed|fpm|phpdbg)
487 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
488 + sapi_conf+=( "--enable-${sapi}" )
489 + if [[ "fpm" == "${sapi}" ]] ; then
490 + sapi_conf+=(
491 + $(use_with acl fpm-acl)
492 + $(use_with systemd fpm-systemd)
493 + )
494 + fi
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 #nowarn
524 + addpredict /var/lib/net-snmp/mib_indexes #nowarn
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 #nowarn
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 +}