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