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