Gentoo Archives: gentoo-commits

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