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