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