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