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, 10 Jan 2019 11:42:14
Message-Id: 1547120519.9a783923d0d79224db8f85b1dd5d17525c99c56c.whissi@gentoo
1 commit: 9a783923d0d79224db8f85b1dd5d17525c99c56c
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jan 10 11:27:23 2019 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Thu Jan 10 11:41:59 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9a783923
7
8 dev-lang/php: bump to v7.1.26
9
10 Package-Manager: Portage-2.3.54, 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.26.ebuild | 736 +++++++++++++++++++++++++++++++++++++++++
15 2 files changed, 737 insertions(+)
16
17 diff --git a/dev-lang/php/Manifest b/dev-lang/php/Manifest
18 index 1028a17ea8c..c807e97aad4 100644
19 --- a/dev-lang/php/Manifest
20 +++ b/dev-lang/php/Manifest
21 @@ -7,6 +7,7 @@ DIST php-7.1.22.tar.xz 12227848 BLAKE2B 72fab94b1c7ecfd3479f6d6c9a76a9d8813f7789
22 DIST php-7.1.23.tar.xz 12227528 BLAKE2B d03470b07ae041c4677e100c1b4f7994d3e15d4830eccba3c654c1f3546345c8205cac057011d2d43ab962ebbc01652f6748270daa40aa1e540453923500288c SHA512 d5a451f1a48415175e3117ffa84ef3504275a407698b59c13eeb403958aa27342e04dc4ffea9791b923ac0cc5d6fdacf2e8672f0e19755bae858707c7fc3627f
23 DIST php-7.1.24.tar.xz 12205112 BLAKE2B d4dd8bdd980cbb2c8cd813cad44da7a322d75641bb5f4eb986f6be44acf61898e64e43a3206da08b6c68fb1213a95cf5c6bf28bc75356d9abd9711330fa04554 SHA512 ee54d04fa1bb049807e7876baf6a4d12ab8360367bb44ac77c71e53ee8ca078342b4a86f2bc4587838ead27fb8204fea8e739bd582a9e146513ae5d465e59202
24 DIST php-7.1.25.tar.xz 12205972 BLAKE2B 3d69cc87d75ee45dc85e5e672ddb6c312fcba12882e227d28e397e1e796e0149588b9519beeb990111315a747a07fa5349ad5f9662c0725b4551478f9e95b51d SHA512 10a75b96d5fa104bc1d5b63f4606d9cfacfc594f7d6ab34f9c5e9e8f209b896516c4121b9cbd323a862724d6dfbd275ef902993cfab619d9a4b9518790b9147c
25 +DIST php-7.1.26.tar.xz 12206956 BLAKE2B af78f764349a05905d7db22260c8a6415a2755b29e0dd01225160235b3b38ea76c8910d79c69798aa2de3fc6d4d41e45ab951161b54e62753111f81ac9d85bc2 SHA512 3c80dce2d5dcbf6f253ca4ca4e4ce01fdd3a3d31a6e6045f539fefadc1ea3c391d4d4995600a4ff758ab0361e0ec2244e2eaa6591ecb3e9b8e8a9c44f67a5b32
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.2.12.tar.xz 12141472 BLAKE2B 25d55fcbe63aab64c658e9c4ab52b552831d5c03a8887e1c64f0cadbb8b0d9f3c38cd5d15dac89002c328b737ad864fce392baa0891292ee77d1975562a2bc17 SHA512 bbeaed1278d0d2f1ecb2249dab1ebaab1489ef43be0797dac57d8b523d8e5d284166e6cbf52095f5d34eef447fbdeb0c6916caaa5770221a180ec064f4ffcad8
29
30 diff --git a/dev-lang/php/php-7.1.26.ebuild b/dev-lang/php/php-7.1.26.ebuild
31 new file mode 100644
32 index 00000000000..4b508c147df
33 --- /dev/null
34 +++ b/dev-lang/php/php-7.1.26.ebuild
35 @@ -0,0 +1,736 @@
36 +# Copyright 1999-2019 Gentoo Authors
37 +# Distributed under the terms of the GNU General Public License v2
38 +
39 +EAPI=7
40 +
41 +inherit flag-o-matic 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 + "${FILESDIR}/php-7.1.25-intl-detect-icu-via-pkg-config.patch"
186 + "${FILESDIR}/php-7.1.25-intl-use-icu-namespace.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 + # Bug 669566 - necessary so that build tools are updated for commands like pecl
261 + # Force rebuilding aclocal.m4
262 + rm -f aclocal.m4 || die "failed to remove aclocal.m4 in src_prepare"
263 + eautoreconf
264 +}
265 +
266 +src_configure() {
267 + addpredict /usr/share/snmp/mibs/.index #nowarn
268 + addpredict /var/lib/net-snmp/mib_indexes #nowarn
269 +
270 + PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
271 +
272 + # The php-fpm config file wants localstatedir to be ${EPREFIX}/var
273 + # and not the Gentoo default ${EPREFIX}/var/lib. See bug 572002.
274 + local our_conf=(
275 + --prefix="${PHP_DESTDIR}"
276 + --mandir="${PHP_DESTDIR}/man"
277 + --infodir="${PHP_DESTDIR}/info"
278 + --libdir="${PHP_DESTDIR}/lib"
279 + --with-libdir="$(get_libdir)"
280 + --localstatedir="${EPREFIX}/var"
281 + --without-pear
282 + $(use_enable threads maintainer-zts)
283 + )
284 +
285 + our_conf+=(
286 + $(use_enable bcmath bcmath)
287 + $(use_with bzip2 bz2 "${EPREFIX}/usr")
288 + $(use_enable calendar calendar)
289 + $(use_enable coverage gcov)
290 + $(use_enable ctype ctype)
291 + $(use_with curl curl "${EPREFIX}/usr")
292 + $(use_enable xml dom)
293 + $(use_with enchant enchant "${EPREFIX}/usr")
294 + $(use_enable exif exif)
295 + $(use_enable fileinfo fileinfo)
296 + $(use_enable filter filter)
297 + $(use_enable ftp ftp)
298 + $(use_with nls gettext "${EPREFIX}/usr")
299 + $(use_with gmp gmp "${EPREFIX}/usr")
300 + $(use_enable hash hash)
301 + $(use_with mhash mhash "${EPREFIX}/usr")
302 + $(use_with iconv iconv \
303 + $(use elibc_glibc || use elibc_musl || use elibc_FreeBSD || echo "${EPREFIX}/usr"))
304 + $(use_enable intl intl)
305 + $(use_enable ipv6 ipv6)
306 + $(use_enable json json)
307 + $(use_with kerberos kerberos "${EPREFIX}/usr")
308 + $(use_enable xml libxml)
309 + $(use_with xml libxml-dir "${EPREFIX}/usr")
310 + $(use_enable unicode mbstring)
311 + $(use_with crypt mcrypt "${EPREFIX}/usr")
312 + $(use_with unicode onig "${EPREFIX}/usr")
313 + $(use_with ssl openssl "${EPREFIX}/usr")
314 + $(use_with ssl openssl-dir "${EPREFIX}/usr")
315 + $(use_enable pcntl pcntl)
316 + $(use_enable phar phar)
317 + $(use_enable pdo pdo)
318 + $(use_enable opcache opcache)
319 + $(use_with postgres pgsql "${EPREFIX}/usr")
320 + $(use_enable posix posix)
321 + $(use_with spell pspell "${EPREFIX}/usr")
322 + $(use_with recode recode "${EPREFIX}/usr")
323 + $(use_enable simplexml simplexml)
324 + $(use_enable sharedmem shmop)
325 + $(use_with snmp snmp "${EPREFIX}/usr")
326 + $(use_enable soap soap)
327 + $(use_enable sockets sockets)
328 + $(use_with sqlite sqlite3 "${EPREFIX}/usr")
329 + $(use_enable sysvipc sysvmsg)
330 + $(use_enable sysvipc sysvsem)
331 + $(use_enable sysvipc sysvshm)
332 + $(use_with tidy tidy "${EPREFIX}/usr")
333 + $(use_enable tokenizer tokenizer)
334 + $(use_enable wddx wddx)
335 + $(use_enable xml xml)
336 + $(use_enable xmlreader xmlreader)
337 + $(use_enable xmlwriter xmlwriter)
338 + $(use_with xmlrpc xmlrpc)
339 + $(use_with xslt xsl "${EPREFIX}/usr")
340 + $(use_enable zip zip)
341 + $(use_with zlib zlib "${EPREFIX}/usr")
342 + $(use_enable debug debug)
343 + )
344 +
345 + # DBA support
346 + if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
347 + || use qdbm ; then
348 + our_conf+=( "--enable-dba${shared}" )
349 + fi
350 +
351 + # DBA drivers support
352 + our_conf+=(
353 + $(use_with cdb cdb)
354 + $(use_with berkdb db4 "${EPREFIX}/usr")
355 + $(use_enable flatfile flatfile)
356 + $(use_with gdbm gdbm "${EPREFIX}/usr")
357 + $(use_enable inifile inifile)
358 + $(use_with qdbm qdbm "${EPREFIX}/usr")
359 + )
360 +
361 + # Support for the GD graphics library
362 + our_conf+=(
363 + $(use_with truetype freetype-dir "${EPREFIX}/usr")
364 + $(use_enable cjk gd-jis-conv)
365 + $(use_with gd jpeg-dir "${EPREFIX}/usr")
366 + $(use_with gd png-dir "${EPREFIX}/usr")
367 + $(use_with xpm xpm-dir "${EPREFIX}/usr")
368 + )
369 + if use webp; then
370 + our_conf+=( --with-webp-dir="${EPREFIX}/usr" )
371 + fi
372 + # enable gd last, so configure can pick up the previous settings
373 + our_conf+=( $(use_with gd gd) )
374 +
375 + # IMAP support
376 + if use imap ; then
377 + our_conf+=(
378 + $(use_with imap imap "${EPREFIX}/usr")
379 + $(use_with ssl imap-ssl "${EPREFIX}/usr")
380 + )
381 + fi
382 +
383 + # Interbase/firebird support
384 + our_conf+=( $(use_with firebird interbase "${EPREFIX}/usr") )
385 +
386 + # LDAP support
387 + if use ldap ; then
388 + our_conf+=(
389 + $(use_with ldap ldap "${EPREFIX}/usr")
390 + $(use_with ldap-sasl ldap-sasl "${EPREFIX}/usr")
391 + )
392 + fi
393 +
394 + # MySQL support
395 + local mysqllib="mysqlnd"
396 + local mysqlilib="mysqlnd"
397 +
398 + our_conf+=( $(use_with mysqli mysqli "${mysqlilib}") )
399 +
400 + local mysqlsock="${EPREFIX}/var/run/mysqld/mysqld.sock"
401 + if use mysql || use mysqli ; then
402 + our_conf+=( $(use_with mysql mysql-sock "${mysqlsock}") )
403 + fi
404 +
405 + # ODBC support
406 + our_conf+=(
407 + $(use_with odbc unixODBC "${EPREFIX}/usr")
408 + $(use_with iodbc iodbc "${EPREFIX}/usr")
409 + )
410 +
411 + # Oracle support
412 + our_conf+=( $(use_with oci8-instant-client oci8) )
413 +
414 + # PDO support
415 + if use pdo ; then
416 + our_conf+=(
417 + $(use_with mssql pdo-dblib "${EPREFIX}/usr")
418 + $(use_with mysql pdo-mysql "${mysqllib}")
419 + $(use_with postgres pdo-pgsql)
420 + $(use_with sqlite pdo-sqlite "${EPREFIX}/usr")
421 + $(use_with firebird pdo-firebird "${EPREFIX}/usr")
422 + $(use_with odbc pdo-odbc "unixODBC,${EPREFIX}/usr")
423 + $(use_with oci8-instant-client pdo-oci)
424 + )
425 + fi
426 +
427 + # readline/libedit support
428 + our_conf+=(
429 + $(use_with readline readline "${EPREFIX}/usr")
430 + $(use_with libedit libedit "${EPREFIX}/usr")
431 + )
432 +
433 + # Session support
434 + if use session ; then
435 + our_conf+=( $(use_with session-mm mm "${EPREFIX}/usr") )
436 + else
437 + our_conf+=( $(use_enable session session) )
438 + fi
439 +
440 + # Use pic for shared modules such as apache2's mod_php
441 + our_conf+=( --with-pic )
442 +
443 + # we use the system copy of pcre
444 + # --with-pcre-regex affects ext/pcre
445 + # --with-pcre-dir affects ext/filter and ext/zip
446 + our_conf+=(
447 + --with-pcre-regex="${EPREFIX}/usr"
448 + --with-pcre-dir="${EPREFIX}/usr"
449 + )
450 +
451 + # Catch CFLAGS problems
452 + # Fixes bug #14067.
453 + # Changed order to run it in reverse for bug #32022 and #12021.
454 + replace-cpu-flags "k6*" "i586"
455 +
456 + # Cache the ./configure test results between SAPIs.
457 + our_conf+=( --cache-file="${T}/config.cache" )
458 +
459 + # Support user-passed configuration parameters
460 + our_conf+=( ${EXTRA_ECONF:-} )
461 +
462 + # Support the Apache2 extras, they must be set globally for all
463 + # SAPIs to work correctly, especially for external PHP extensions
464 +
465 + mkdir -p "${WORKDIR}/sapis-build" || die
466 + for one_sapi in $SAPIS ; do
467 + use "${one_sapi}" || continue
468 + php_set_ini_dir "${one_sapi}"
469 +
470 + # The BUILD_DIR variable is used to determine where to output
471 + # the files that autotools creates. This was all originally
472 + # based on the autotools-utils eclass.
473 + BUILD_DIR="${WORKDIR}/sapis-build/${one_sapi}"
474 + cp -a "${S}" "${BUILD_DIR}" || die
475 + cd "${BUILD_DIR}" || die
476 +
477 + local sapi_conf=(
478 + --with-config-file-path="${PHP_INI_DIR}"
479 + --with-config-file-scan-dir="${PHP_EXT_INI_DIR_ACTIVE}"
480 + )
481 +
482 + for sapi in $SAPIS ; do
483 + case "$sapi" in
484 + cli|cgi|embed|fpm|phpdbg)
485 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
486 + sapi_conf+=( "--enable-${sapi}" )
487 + if [[ "fpm" == "${sapi}" ]] ; then
488 + sapi_conf+=(
489 + $(use_with acl fpm-acl)
490 + $(use_with systemd fpm-systemd)
491 + )
492 + fi
493 + else
494 + sapi_conf+=( "--disable-${sapi}" )
495 + fi
496 + ;;
497 +
498 + apache2)
499 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
500 + sapi_conf+=( --with-apxs2="${EPREFIX}/usr/bin/apxs" )
501 + else
502 + sapi_conf+=( --without-apxs2 )
503 + fi
504 + ;;
505 + esac
506 + done
507 +
508 + # Construct the $myeconfargs array by concatenating $our_conf
509 + # (the common args) and $sapi_conf (the SAPI-specific args).
510 + local myeconfargs=( "${our_conf[@]}" )
511 + myeconfargs+=( "${sapi_conf[@]}" )
512 +
513 + pushd "${BUILD_DIR}" > /dev/null || die
514 + econf "${myeconfargs[@]}"
515 + popd > /dev/null || die
516 + done
517 +}
518 +
519 +src_compile() {
520 + # snmp seems to run during src_compile, too (bug #324739)
521 + addpredict /usr/share/snmp/mibs/.index #nowarn
522 + addpredict /var/lib/net-snmp/mib_indexes #nowarn
523 +
524 + for sapi in ${SAPIS} ; do
525 + if use "${sapi}"; then
526 + cd "${WORKDIR}/sapis-build/$sapi" || \
527 + die "Failed to change dir to ${WORKDIR}/sapis-build/$1"
528 + emake
529 + fi
530 + done
531 +}
532 +
533 +src_install() {
534 + # see bug #324739 for what happens when we don't have that
535 + addpredict /usr/share/snmp/mibs/.index #nowarn
536 +
537 + # grab the first SAPI that got built and install common files from there
538 + local first_sapi=""
539 + for sapi in $SAPIS ; do
540 + if use $sapi ; then
541 + first_sapi=$sapi
542 + break
543 + fi
544 + done
545 +
546 + # Makefile forgets to create this before trying to write to it...
547 + dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
548 +
549 + # Install php environment (without any sapis)
550 + cd "${WORKDIR}/sapis-build/$first_sapi" || die
551 + emake INSTALL_ROOT="${D}" \
552 + install-build install-headers install-programs
553 +
554 + local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
555 +
556 + # Create the directory where we'll put version-specific php scripts
557 + keepdir "/usr/share/php${PHP_MV}"
558 +
559 + local sapi="", file=""
560 + local sapi_list=""
561 +
562 + for sapi in ${SAPIS}; do
563 + if use "${sapi}" ; then
564 + einfo "Installing SAPI: ${sapi}"
565 + cd "${WORKDIR}/sapis-build/${sapi}" || die
566 +
567 + if [[ "${sapi}" == "apache2" ]] ; then
568 + # We're specifically not using emake install-sapi as libtool
569 + # may cause unnecessary relink failures (see bug #351266)
570 + insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
571 + newins ".libs/libphp${PHP_MV}$(get_libname)" \
572 + "libphp${PHP_MV}$(get_libname)"
573 + keepdir "/usr/$(get_libdir)/apache2/modules"
574 + else
575 + # needed each time, php_install_ini would reset it
576 + local dest="${PHP_DESTDIR#${EPREFIX}}"
577 + into "${dest}"
578 + case "$sapi" in
579 + cli)
580 + source="sapi/cli/php"
581 + ;;
582 + cgi)
583 + source="sapi/cgi/php-cgi"
584 + ;;
585 + fpm)
586 + source="sapi/fpm/php-fpm"
587 + ;;
588 + embed)
589 + source="libs/libphp${PHP_MV}$(get_libname)"
590 + ;;
591 + phpdbg)
592 + source="sapi/phpdbg/phpdbg"
593 + ;;
594 + *)
595 + die "unhandled sapi in src_install"
596 + ;;
597 + esac
598 +
599 + if [[ "${source}" == *"$(get_libname)" ]]; then
600 + dolib.so "${source}"
601 + else
602 + dobin "${source}"
603 + local name="$(basename ${source})"
604 + dosym "${dest}/bin/${name}" "/usr/bin/${name}${SLOT}"
605 + fi
606 + fi
607 +
608 + php_install_ini "${sapi}"
609 +
610 + # construct correct SAPI string for php-config
611 + # thanks to ferringb for the bash voodoo
612 + if [[ "${sapi}" == "apache2" ]]; then
613 + sapi_list="${sapi_list:+${sapi_list} }apache2handler"
614 + else
615 + sapi_list="${sapi_list:+${sapi_list} }${sapi}"
616 + fi
617 + fi
618 + done
619 +
620 + # Installing opcache module
621 + if use opcache ; then
622 + into "${PHP_DESTDIR#${EPREFIX}}"
623 + dolib.so "modules/opcache$(get_libname)"
624 + fi
625 +
626 + # Install env.d files
627 + newenvd "${FILESDIR}/20php5-envd" "20php${SLOT}"
628 + sed -e "s|/lib/|/$(get_libdir)/|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
629 + sed -e "s|php5|php${SLOT}|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
630 +
631 + # set php-config variable correctly (bug #278439)
632 + sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
633 + "${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config" || die
634 +
635 + if use fpm ; then
636 + if use systemd; then
637 + systemd_newunit "${FILESDIR}/php-fpm_at.service" \
638 + "php-fpm@${SLOT}.service"
639 + else
640 + systemd_newunit "${FILESDIR}/php-fpm_at-simple.service" \
641 + "php-fpm@${SLOT}.service"
642 + fi
643 + fi
644 +}
645 +
646 +src_test() {
647 + echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
648 + PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php"
649 + if [[ ! -x "${PHP_BIN}" ]] ; then
650 + ewarn "Test phase requires USE=cli, skipping"
651 + return
652 + else
653 + export TEST_PHP_EXECUTABLE="${PHP_BIN}"
654 + fi
655 +
656 + if [[ -x "${WORKDIR}/sapis-build/cgi/sapi/cgi/php-cgi" ]] ; then
657 + export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis-build/cgi/sapi/cgi/php-cgi"
658 + fi
659 +
660 + if [[ -x "${WORKDIR}/sapis-build/phpdbg/sapi/phpdbg/phpdbg" ]] ; then
661 + export TEST_PHPDBG_EXECUTABLE="${WORKDIR}/sapis-build/phpdbg/sapi/phpdbg/phpdbg"
662 + fi
663 +
664 + REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d \
665 + "session.save_path=${T}" \
666 + "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d \
667 + "session.save_path=${T}"
668 +
669 + for name in ${EXPECTED_TEST_FAILURES}; do
670 + mv "${name}.out" "${name}.out.orig" 2>/dev/null || die
671 + done
672 +
673 + local failed="$(find -name '*.out')"
674 + if [[ ${failed} != "" ]] ; then
675 + ewarn "The following test cases failed unexpectedly:"
676 + for name in ${failed}; do
677 + ewarn " ${name/.out/}"
678 + done
679 + else
680 + einfo "No unexpected test failures, all fine"
681 + fi
682 +
683 + if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
684 + local passed=""
685 + for name in ${EXPECTED_TEST_FAILURES}; do
686 + [[ -f "${name}.diff" ]] && continue
687 + passed="${passed} ${name}"
688 + done
689 + if [[ ${passed} != "" ]] ; then
690 + einfo "The following test cases passed unexpectedly:"
691 + for name in ${passed}; do
692 + ewarn " ${passed}"
693 + done
694 + else
695 + einfo "None of the known-to-fail tests passed, all fine"
696 + fi
697 + fi
698 +}
699 +
700 +pkg_postinst() {
701 + # Output some general info to the user
702 + if use apache2 ; then
703 + elog
704 + elog "To enable PHP in apache, you will need to add \"-D PHP\" to"
705 + elog "your apache2 command. OpenRC users can append that string to"
706 + elog "APACHE2_OPTS in /etc/conf.d/apache2."
707 + elog
708 + elog "The apache module configuration file 70_mod_php.conf is"
709 + elog "provided (and maintained) by eselect-php."
710 + elog
711 + fi
712 +
713 + # Create the symlinks for php
714 + for m in ${SAPIS}; do
715 + [[ ${m} == 'embed' ]] && continue;
716 + if use $m ; then
717 + local ci=$(eselect php show $m)
718 + if [[ -z $ci ]]; then
719 + eselect php set $m php${SLOT} || die
720 + einfo "Switched ${m} to use php:${SLOT}"
721 + einfo
722 + elif [[ $ci != "php${SLOT}" ]] ; then
723 + elog "To switch $m to use php:${SLOT}, run"
724 + elog " eselect php set $m php${SLOT}"
725 + elog
726 + fi
727 + fi
728 + done
729 +
730 + # Remove dead symlinks for SAPIs that were just disabled. For
731 + # example, if the user has the cgi SAPI enabled, then he has an
732 + # eselect-php symlink for it. If he later reinstalls PHP with
733 + # USE="-cgi", that symlink will break. This call to eselect is
734 + # supposed to remove that dead link per bug 572436.
735 + eselect php cleanup || die
736 +
737 + if ! has "php${SLOT/./-}" ${PHP_TARGETS}; then
738 + elog "To build extensions for this version of PHP, you will need to"
739 + elog "add php${SLOT/./-} to your PHP_TARGETS USE_EXPAND variable."
740 + elog
741 + fi
742 +
743 + # Warn about the removal of PHP_INI_VERSION if the user has it set.
744 + if [[ -n "${PHP_INI_VERSION}" ]]; then
745 + ewarn 'The PHP_INI_VERSION variable has been phased out. You may'
746 + ewarn 'remove it from your configuration at your convenience. See'
747 + ewarn
748 + ewarn ' https://bugs.gentoo.org/611214'
749 + ewarn
750 + ewarn 'for more information.'
751 + fi
752 +
753 + elog "For details on how version slotting works, please see"
754 + elog "the wiki:"
755 + elog
756 + elog " https://wiki.gentoo.org/wiki/PHP"
757 + elog
758 +}
759 +
760 +pkg_postrm() {
761 + # This serves two purposes. First, if we have just removed the last
762 + # installed version of PHP, then this will remove any dead symlinks
763 + # belonging to eselect-php. Second, if a user upgrades slots from
764 + # (say) 5.6 to 7.0 and depcleans the old slot, then this will update
765 + # his existing symlinks to point to the new 7.0 installation. The
766 + # latter is bug 432962.
767 + #
768 + # Note: the eselect-php package may not be installed at this point,
769 + # so we can't die() if this command fails.
770 + eselect php cleanup
771 +}