1 |
commit: 501870ea8bf544b0082d7086daf3a842ddcea379 |
2 |
Author: Brian Evans <grknight <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Jan 21 15:04:56 2022 +0000 |
4 |
Commit: Brian Evans <grknight <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Jan 21 15:04:56 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=501870ea |
7 |
|
8 |
dev-lang/php: Backport GCC 11 rpath patch to 7.4.27 in revbump |
9 |
|
10 |
Signed-off-by: Brian Evans <grknight <AT> gentoo.org> |
11 |
|
12 |
dev-lang/php/files/bug81656-gcc-11.patch | 53 +++ |
13 |
dev-lang/php/php-7.4.27-r1.ebuild | 746 +++++++++++++++++++++++++++++++ |
14 |
2 files changed, 799 insertions(+) |
15 |
|
16 |
diff --git a/dev-lang/php/files/bug81656-gcc-11.patch b/dev-lang/php/files/bug81656-gcc-11.patch |
17 |
new file mode 100644 |
18 |
index 000000000000..8dfe1deb2b33 |
19 |
--- /dev/null |
20 |
+++ b/dev-lang/php/files/bug81656-gcc-11.patch |
21 |
@@ -0,0 +1,53 @@ |
22 |
+From bb00a649e0c1ac57718cd9971e7e6f933cb2dadd Mon Sep 17 00:00:00 2001 |
23 |
+From: Michael Wallner <mike@×××.net> |
24 |
+Date: Thu, 25 Nov 2021 07:43:14 +0100 |
25 |
+Subject: [PATCH] fix #81656: GCC-11 silently ignores -R |
26 |
+ |
27 |
+--- |
28 |
+ build/php.m4 | 28 ++++++++++++++-------------- |
29 |
+ 1 file changed, 14 insertions(+), 14 deletions(-) |
30 |
+ |
31 |
+diff --git a/build/php.m4 b/build/php.m4 |
32 |
+index 3af2b8b72d47..4697c5df9274 100644 |
33 |
+--- a/build/php.m4 |
34 |
++++ b/build/php.m4 |
35 |
+@@ -279,25 +279,25 @@ dnl |
36 |
+ dnl Checks for -R, etc. switch. |
37 |
+ dnl |
38 |
+ AC_DEFUN([PHP_RUNPATH_SWITCH],[ |
39 |
+-AC_MSG_CHECKING([if compiler supports -R]) |
40 |
+-AC_CACHE_VAL(php_cv_cc_dashr,[ |
41 |
++AC_MSG_CHECKING([if compiler supports -Wl,-rpath,]) |
42 |
++AC_CACHE_VAL(php_cv_cc_rpath,[ |
43 |
+ SAVE_LIBS=$LIBS |
44 |
+- LIBS="-R /usr/$PHP_LIBDIR $LIBS" |
45 |
+- AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],[php_cv_cc_dashr=yes],[php_cv_cc_dashr=no]) |
46 |
++ LIBS="-Wl,-rpath,/usr/$PHP_LIBDIR $LIBS" |
47 |
++ AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],[php_cv_cc_rpath=yes],[php_cv_cc_rpath=no]) |
48 |
+ LIBS=$SAVE_LIBS]) |
49 |
+-AC_MSG_RESULT([$php_cv_cc_dashr]) |
50 |
+-if test $php_cv_cc_dashr = "yes"; then |
51 |
+- ld_runpath_switch=-R |
52 |
++AC_MSG_RESULT([$php_cv_cc_rpath]) |
53 |
++if test $php_cv_cc_rpath = "yes"; then |
54 |
++ ld_runpath_switch=-Wl,-rpath, |
55 |
+ else |
56 |
+- AC_MSG_CHECKING([if compiler supports -Wl,-rpath,]) |
57 |
+- AC_CACHE_VAL(php_cv_cc_rpath,[ |
58 |
++ AC_MSG_CHECKING([if compiler supports -R]) |
59 |
++ AC_CACHE_VAL(php_cv_cc_dashr,[ |
60 |
+ SAVE_LIBS=$LIBS |
61 |
+- LIBS="-Wl,-rpath,/usr/$PHP_LIBDIR $LIBS" |
62 |
+- AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],[php_cv_cc_rpath=yes],[php_cv_cc_rpath=no]) |
63 |
++ LIBS="-R /usr/$PHP_LIBDIR $LIBS" |
64 |
++ AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],[php_cv_cc_dashr=yes],[php_cv_cc_dashr=no]) |
65 |
+ LIBS=$SAVE_LIBS]) |
66 |
+- AC_MSG_RESULT([$php_cv_cc_rpath]) |
67 |
+- if test $php_cv_cc_rpath = "yes"; then |
68 |
+- ld_runpath_switch=-Wl,-rpath, |
69 |
++ AC_MSG_RESULT([$php_cv_cc_dashr]) |
70 |
++ if test $php_cv_cc_dashr = "yes"; then |
71 |
++ ld_runpath_switch=-R |
72 |
+ else |
73 |
+ dnl Something innocuous. |
74 |
+ ld_runpath_switch=-L |
75 |
|
76 |
diff --git a/dev-lang/php/php-7.4.27-r1.ebuild b/dev-lang/php/php-7.4.27-r1.ebuild |
77 |
new file mode 100644 |
78 |
index 000000000000..9925c7527525 |
79 |
--- /dev/null |
80 |
+++ b/dev-lang/php/php-7.4.27-r1.ebuild |
81 |
@@ -0,0 +1,746 @@ |
82 |
+# Copyright 1999-2022 Gentoo Authors |
83 |
+# Distributed under the terms of the GNU General Public License v2 |
84 |
+ |
85 |
+EAPI="7" |
86 |
+ |
87 |
+WANT_AUTOMAKE="none" |
88 |
+ |
89 |
+inherit flag-o-matic systemd autotools |
90 |
+ |
91 |
+MY_PV=${PV/_rc/RC} |
92 |
+DESCRIPTION="The PHP language runtime engine" |
93 |
+HOMEPAGE="https://www.php.net/" |
94 |
+SRC_URI="https://www.php.net/distributions/${P}.tar.xz" |
95 |
+ |
96 |
+LICENSE="PHP-3.01 |
97 |
+ BSD |
98 |
+ Zend-2.0 |
99 |
+ bcmath? ( LGPL-2.1+ ) |
100 |
+ fpm? ( BSD-2 ) |
101 |
+ gd? ( gd ) |
102 |
+ unicode? ( BSD-2 LGPL-2.1 )" |
103 |
+ |
104 |
+SLOT="$(ver_cut 1-2)" |
105 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos" |
106 |
+ |
107 |
+S="${WORKDIR}/${PN}-${MY_PV}" |
108 |
+ |
109 |
+# We can build the following SAPIs in the given order |
110 |
+SAPIS="embed cli cgi fpm apache2 phpdbg" |
111 |
+ |
112 |
+# SAPIs and SAPI-specific USE flags (cli SAPI is default on): |
113 |
+IUSE="${IUSE} |
114 |
+ ${SAPIS/cli/+cli} |
115 |
+ threads" |
116 |
+ |
117 |
+IUSE="${IUSE} acl argon2 bcmath berkdb bzip2 calendar cdb cjk |
118 |
+ coverage +ctype curl debug |
119 |
+ enchant exif ffi +fileinfo +filter firebird |
120 |
+ +flatfile ftp gd gdbm gmp +iconv imap inifile |
121 |
+ intl iodbc ipv6 +jit +json kerberos ldap ldap-sasl libedit lmdb |
122 |
+ mhash mssql mysql mysqli nls |
123 |
+ oci8-instant-client odbc +opcache pcntl pdo +phar +posix postgres qdbm |
124 |
+ readline selinux +session session-mm sharedmem |
125 |
+ +simplexml snmp soap sockets sodium spell sqlite ssl |
126 |
+ sysvipc systemd test tidy +tokenizer tokyocabinet truetype unicode webp |
127 |
+ +xml xmlreader xmlwriter xmlrpc xpm xslt zip zlib" |
128 |
+ |
129 |
+# Without USE=readline or libedit, the interactive "php -a" CLI will hang. |
130 |
+# The Oracle instant client provides its own incompatible ldap library. |
131 |
+REQUIRED_USE=" |
132 |
+ || ( cli cgi fpm apache2 embed phpdbg ) |
133 |
+ cli? ( ^^ ( readline libedit ) ) |
134 |
+ !cli? ( ?? ( readline libedit ) ) |
135 |
+ truetype? ( gd zlib ) |
136 |
+ webp? ( gd zlib ) |
137 |
+ cjk? ( gd zlib ) |
138 |
+ exif? ( gd zlib ) |
139 |
+ xpm? ( gd zlib ) |
140 |
+ gd? ( zlib ) |
141 |
+ simplexml? ( xml ) |
142 |
+ soap? ( xml ) |
143 |
+ xmlrpc? ( xml iconv ) |
144 |
+ xmlreader? ( xml ) |
145 |
+ xmlwriter? ( xml ) |
146 |
+ xslt? ( xml ) |
147 |
+ ldap-sasl? ( ldap ) |
148 |
+ oci8-instant-client? ( !ldap ) |
149 |
+ qdbm? ( !gdbm ) |
150 |
+ session-mm? ( session !threads ) |
151 |
+ mysql? ( || ( mysqli pdo ) ) |
152 |
+ firebird? ( pdo ) |
153 |
+ mssql? ( pdo ) |
154 |
+" |
155 |
+ |
156 |
+RESTRICT="!test? ( test )" |
157 |
+ |
158 |
+# The supported (that is, autodetected) versions of BDB are listed in |
159 |
+# the ./configure script. Other versions *work*, but we need to stick to |
160 |
+# the ones that can be detected to avoid a repeat of bug #564824. |
161 |
+COMMON_DEPEND=" |
162 |
+ >=app-eselect/eselect-php-0.9.1[apache2?,fpm?] |
163 |
+ >=dev-libs/libpcre2-10.30[jit?,unicode] |
164 |
+ fpm? ( acl? ( sys-apps/acl ) ) |
165 |
+ apache2? ( www-servers/apache[apache2_modules_unixd(+),threads=] ) |
166 |
+ argon2? ( app-crypt/argon2:= ) |
167 |
+ berkdb? ( || ( sys-libs/db:5.3 sys-libs/db:4.8 ) ) |
168 |
+ bzip2? ( app-arch/bzip2:0= ) |
169 |
+ cdb? ( || ( dev-db/cdb dev-db/tinycdb ) ) |
170 |
+ coverage? ( dev-util/lcov ) |
171 |
+ curl? ( >=net-misc/curl-7.10.5 ) |
172 |
+ enchant? ( <app-text/enchant-2.0:0 ) |
173 |
+ ffi? ( >=dev-libs/libffi-3.0.11:= ) |
174 |
+ firebird? ( dev-db/firebird ) |
175 |
+ gd? ( >=virtual/jpeg-0-r3:0 media-libs/libpng:0= ) |
176 |
+ gdbm? ( >=sys-libs/gdbm-1.8.0:0= ) |
177 |
+ gmp? ( dev-libs/gmp:0= ) |
178 |
+ iconv? ( virtual/libiconv ) |
179 |
+ imap? ( >=virtual/imap-c-client-2[kerberos=,ssl=] ) |
180 |
+ intl? ( dev-libs/icu:= ) |
181 |
+ kerberos? ( virtual/krb5 ) |
182 |
+ ldap? ( >=net-nds/openldap-1.2.11 ) |
183 |
+ ldap-sasl? ( dev-libs/cyrus-sasl ) |
184 |
+ libedit? ( dev-libs/libedit ) |
185 |
+ lmdb? ( dev-db/lmdb:= ) |
186 |
+ mssql? ( dev-db/freetds[mssql] ) |
187 |
+ nls? ( sys-devel/gettext ) |
188 |
+ oci8-instant-client? ( dev-db/oracle-instantclient[sdk] ) |
189 |
+ odbc? ( iodbc? ( dev-db/libiodbc ) !iodbc? ( >=dev-db/unixODBC-1.8.13 ) ) |
190 |
+ postgres? ( dev-db/postgresql:* ) |
191 |
+ qdbm? ( dev-db/qdbm ) |
192 |
+ readline? ( sys-libs/readline:0= ) |
193 |
+ session-mm? ( dev-libs/mm ) |
194 |
+ snmp? ( >=net-analyzer/net-snmp-5.2 ) |
195 |
+ sodium? ( dev-libs/libsodium:=[-minimal] ) |
196 |
+ spell? ( >=app-text/aspell-0.50 ) |
197 |
+ sqlite? ( >=dev-db/sqlite-3.7.6.3 ) |
198 |
+ ssl? ( >=dev-libs/openssl-1.0.1:0= ) |
199 |
+ tidy? ( app-text/htmltidy ) |
200 |
+ tokyocabinet? ( dev-db/tokyocabinet ) |
201 |
+ truetype? ( =media-libs/freetype-2* ) |
202 |
+ unicode? ( dev-libs/oniguruma:= ) |
203 |
+ webp? ( media-libs/libwebp:0= ) |
204 |
+ xml? ( >=dev-libs/libxml2-2.7.6 ) |
205 |
+ xpm? ( x11-libs/libXpm ) |
206 |
+ xslt? ( dev-libs/libxslt ) |
207 |
+ zip? ( >=dev-libs/libzip-1.2.0:= ) |
208 |
+ zlib? ( >=sys-libs/zlib-1.2.0.4:0= ) |
209 |
+" |
210 |
+ |
211 |
+RDEPEND="${COMMON_DEPEND} |
212 |
+ virtual/mta |
213 |
+ fpm? ( |
214 |
+ selinux? ( sec-policy/selinux-phpfpm ) |
215 |
+ systemd? ( sys-apps/systemd ) )" |
216 |
+ |
217 |
+# Bison isn't actually needed when building from a release tarball |
218 |
+# However, the configure script will warn if it's absent or if you |
219 |
+# have an incompatible version installed. See bug 593278. |
220 |
+DEPEND="${COMMON_DEPEND} |
221 |
+ app-arch/xz-utils |
222 |
+ >=sys-devel/bison-3.0.1" |
223 |
+ |
224 |
+BDEPEND="virtual/pkgconfig" |
225 |
+ |
226 |
+PHP_MV="$(ver_cut 1)" |
227 |
+ |
228 |
+PATCHES=( |
229 |
+ "${FILESDIR}"/php-iodbc-header-location.patch |
230 |
+ "${FILESDIR}"/bug81656-gcc-11.patch |
231 |
+) |
232 |
+ |
233 |
+php_install_ini() { |
234 |
+ local phpsapi="${1}" |
235 |
+ |
236 |
+ # work out where we are installing the ini file |
237 |
+ php_set_ini_dir "${phpsapi}" |
238 |
+ |
239 |
+ # Always install the production INI file, bug 611214. |
240 |
+ local phpinisrc="php.ini-production-${phpsapi}" |
241 |
+ cp php.ini-production "${phpinisrc}" || die |
242 |
+ |
243 |
+ # default to /tmp for save_path, bug #282768 |
244 |
+ sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}" || die |
245 |
+ |
246 |
+ # Set the extension dir |
247 |
+ sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" \ |
248 |
+ -i "${phpinisrc}" || die |
249 |
+ |
250 |
+ # Set the include path to point to where we want to find PEAR packages |
251 |
+ sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}" || die |
252 |
+ |
253 |
+ insinto "${PHP_INI_DIR#${EPREFIX}}" |
254 |
+ newins "${phpinisrc}" php.ini |
255 |
+ |
256 |
+ elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}" |
257 |
+ elog |
258 |
+ |
259 |
+ dodir "${PHP_EXT_INI_DIR#${EPREFIX}}" |
260 |
+ dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}" |
261 |
+ |
262 |
+ if use opcache; then |
263 |
+ elog "Adding opcache to $PHP_EXT_INI_DIR" |
264 |
+ echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> \ |
265 |
+ "${D}/${PHP_EXT_INI_DIR}"/opcache.ini |
266 |
+ dosym "../ext/opcache.ini" \ |
267 |
+ "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini" |
268 |
+ fi |
269 |
+ |
270 |
+ # SAPI-specific handling |
271 |
+ if [[ "${sapi}" == "fpm" ]] ; then |
272 |
+ einfo "Installing FPM config files php-fpm.conf and www.conf" |
273 |
+ insinto "${PHP_INI_DIR#${EPREFIX}}" |
274 |
+ doins sapi/fpm/php-fpm.conf |
275 |
+ insinto "${PHP_INI_DIR#${EPREFIX}}/fpm.d" |
276 |
+ doins sapi/fpm/www.conf |
277 |
+ fi |
278 |
+ |
279 |
+ dodoc php.ini-{development,production} |
280 |
+} |
281 |
+ |
282 |
+php_set_ini_dir() { |
283 |
+ PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}" |
284 |
+ PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext" |
285 |
+ PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active" |
286 |
+} |
287 |
+ |
288 |
+src_prepare() { |
289 |
+ default |
290 |
+ |
291 |
+ # In php-7.x, the FPM pool configuration files have been split off |
292 |
+ # of the main config. By default the pool config files go in |
293 |
+ # e.g. /etc/php-fpm.d, which isn't slotted. So here we move the |
294 |
+ # include directory to a subdirectory "fpm.d" of $PHP_INI_DIR. Later |
295 |
+ # we'll install the pool configuration file "www.conf" there. |
296 |
+ php_set_ini_dir fpm |
297 |
+ sed -i "s~^include=.*$~include=${PHP_INI_DIR}/fpm.d/*.conf~" \ |
298 |
+ sapi/fpm/php-fpm.conf.in \ |
299 |
+ || die 'failed to move the include directory in php-fpm.conf' |
300 |
+ |
301 |
+ # Emulate buildconf to support cross-compilation |
302 |
+ rm -fr aclocal.m4 autom4te.cache config.cache \ |
303 |
+ configure main/php_config.h.in || die |
304 |
+ eautoconf --force |
305 |
+ eautoheader |
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_with argon2 password-argon2 "${EPREFIX}/usr") |
329 |
+ $(use_enable bcmath) |
330 |
+ $(use_with bzip2 bz2 "${EPREFIX}/usr") |
331 |
+ $(use_enable calendar) |
332 |
+ $(use_enable coverage gcov) |
333 |
+ $(use_enable ctype) |
334 |
+ $(use_with curl) |
335 |
+ $(use_enable xml dom) |
336 |
+ $(use_with enchant) |
337 |
+ $(use_enable exif) |
338 |
+ $(use_with ffi) |
339 |
+ $(use_enable fileinfo) |
340 |
+ $(use_enable filter) |
341 |
+ $(use_enable ftp) |
342 |
+ $(use_with nls gettext "${EPREFIX}/usr") |
343 |
+ $(use_with gmp gmp "${EPREFIX}/usr") |
344 |
+ $(use_with mhash mhash "${EPREFIX}/usr") |
345 |
+ $(use_with iconv iconv \ |
346 |
+ $(use elibc_glibc || use elibc_musl || echo "${EPREFIX}/usr")) |
347 |
+ $(use_enable intl) |
348 |
+ $(use_enable ipv6) |
349 |
+ $(use_enable json) |
350 |
+ $(use_with kerberos) |
351 |
+ $(use_with xml libxml) |
352 |
+ $(use_enable unicode mbstring) |
353 |
+ $(use_with ssl openssl) |
354 |
+ $(use_enable pcntl) |
355 |
+ $(use_enable phar) |
356 |
+ $(use_enable pdo) |
357 |
+ $(use_enable opcache) |
358 |
+ $(use_with postgres pgsql "${EPREFIX}/usr") |
359 |
+ $(use_enable posix) |
360 |
+ $(use_with spell pspell "${EPREFIX}/usr") |
361 |
+ $(use_enable simplexml) |
362 |
+ $(use_enable sharedmem shmop) |
363 |
+ $(use_with snmp snmp "${EPREFIX}/usr") |
364 |
+ $(use_enable soap) |
365 |
+ $(use_enable sockets) |
366 |
+ $(use_with sodium) |
367 |
+ $(use_with sqlite sqlite3) |
368 |
+ $(use_enable sysvipc sysvmsg) |
369 |
+ $(use_enable sysvipc sysvsem) |
370 |
+ $(use_enable sysvipc sysvshm) |
371 |
+ $(use_with tidy tidy "${EPREFIX}/usr") |
372 |
+ $(use_enable tokenizer) |
373 |
+ $(use_enable xml) |
374 |
+ $(use_enable xmlreader) |
375 |
+ $(use_enable xmlwriter) |
376 |
+ $(use_with xmlrpc) |
377 |
+ $(use_with xslt xsl) |
378 |
+ $(use_with zip) |
379 |
+ $(use_with zlib zlib "${EPREFIX}/usr") |
380 |
+ $(use_enable debug) |
381 |
+ ) |
382 |
+ |
383 |
+ # DBA support |
384 |
+ if use cdb || use berkdb || use flatfile || use gdbm || use inifile \ |
385 |
+ || use qdbm || use lmdb || use tokyocabinet ; then |
386 |
+ our_conf+=( "--enable-dba" ) |
387 |
+ fi |
388 |
+ |
389 |
+ # DBA drivers support |
390 |
+ our_conf+=( |
391 |
+ $(use_with cdb) |
392 |
+ $(use_with berkdb db4 "${EPREFIX}/usr") |
393 |
+ $(use_enable flatfile) |
394 |
+ $(use_with gdbm gdbm "${EPREFIX}/usr") |
395 |
+ $(use_enable inifile) |
396 |
+ $(use_with qdbm qdbm "${EPREFIX}/usr") |
397 |
+ $(use_with tokyocabinet tcadb "${EPREFIX}/usr") |
398 |
+ $(use_with lmdb lmdb "${EPREFIX}/usr") |
399 |
+ ) |
400 |
+ |
401 |
+ # Support for the GD graphics library |
402 |
+ our_conf+=( |
403 |
+ $(use_with truetype freetype) |
404 |
+ $(use_enable cjk gd-jis-conv) |
405 |
+ $(use_with gd jpeg) |
406 |
+ $(use_with xpm) |
407 |
+ $(use_with webp) |
408 |
+ ) |
409 |
+ # enable gd last, so configure can pick up the previous settings |
410 |
+ our_conf+=( $(use_enable gd) ) |
411 |
+ |
412 |
+ # IMAP support |
413 |
+ if use imap ; then |
414 |
+ our_conf+=( |
415 |
+ $(use_with imap imap "${EPREFIX}/usr") |
416 |
+ $(use_with ssl imap-ssl "${EPREFIX}/usr") |
417 |
+ ) |
418 |
+ fi |
419 |
+ |
420 |
+ # LDAP support |
421 |
+ if use ldap ; then |
422 |
+ our_conf+=( |
423 |
+ $(use_with ldap ldap "${EPREFIX}/usr") |
424 |
+ $(use_with ldap-sasl) |
425 |
+ ) |
426 |
+ fi |
427 |
+ |
428 |
+ # MySQL support |
429 |
+ local mysqllib="mysqlnd" |
430 |
+ local mysqlilib="mysqlnd" |
431 |
+ |
432 |
+ our_conf+=( $(use_with mysqli mysqli "${mysqlilib}") ) |
433 |
+ |
434 |
+ local mysqlsock="${EPREFIX}/var/run/mysqld/mysqld.sock" |
435 |
+ if use mysql || use mysqli ; then |
436 |
+ our_conf+=( $(use_with mysql mysql-sock "${mysqlsock}") ) |
437 |
+ fi |
438 |
+ |
439 |
+ # ODBC support |
440 |
+ if use odbc && use iodbc ; then |
441 |
+ our_conf+=( |
442 |
+ --without-unixODBC |
443 |
+ --with-iodbc |
444 |
+ $(use_with pdo pdo-odbc "iODBC,${EPREFIX}/usr") |
445 |
+ ) |
446 |
+ elif use odbc ; then |
447 |
+ our_conf+=( |
448 |
+ --with-unixODBC="${EPREFIX}/usr" |
449 |
+ --without-iodbc |
450 |
+ $(use_with pdo pdo-odbc "unixODBC,${EPREFIX}/usr") |
451 |
+ ) |
452 |
+ else |
453 |
+ our_conf+=( |
454 |
+ --without-unixODBC |
455 |
+ --without-iodbc |
456 |
+ --without-pdo-odbc |
457 |
+ ) |
458 |
+ fi |
459 |
+ |
460 |
+ # Oracle support |
461 |
+ our_conf+=( $(use_with oci8-instant-client oci8) ) |
462 |
+ |
463 |
+ # PDO support |
464 |
+ if use pdo ; then |
465 |
+ our_conf+=( |
466 |
+ $(use_with mssql pdo-dblib "${EPREFIX}/usr") |
467 |
+ $(use_with mysql pdo-mysql "${mysqllib}") |
468 |
+ $(use_with postgres pdo-pgsql) |
469 |
+ $(use_with sqlite pdo-sqlite) |
470 |
+ $(use_with firebird pdo-firebird "${EPREFIX}/usr") |
471 |
+ $(use_with oci8-instant-client pdo-oci) |
472 |
+ ) |
473 |
+ fi |
474 |
+ |
475 |
+ # readline/libedit support |
476 |
+ our_conf+=( |
477 |
+ $(use_with readline readline "${EPREFIX}/usr") |
478 |
+ $(use_with libedit) |
479 |
+ ) |
480 |
+ |
481 |
+ # Session support |
482 |
+ if use session ; then |
483 |
+ our_conf+=( $(use_with session-mm mm "${EPREFIX}/usr") ) |
484 |
+ else |
485 |
+ our_conf+=( $(use_enable session) ) |
486 |
+ fi |
487 |
+ |
488 |
+ # Use pic for shared modules such as apache2's mod_php |
489 |
+ our_conf+=( --with-pic ) |
490 |
+ |
491 |
+ # we use the system copy of pcre |
492 |
+ # --with-external-pcre affects ext/pcre |
493 |
+ our_conf+=( |
494 |
+ --with-external-pcre |
495 |
+ $(use_with jit pcre-jit) |
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 |
+ local one_sapi |
513 |
+ local sapi |
514 |
+ mkdir -p "${WORKDIR}/sapis-build" || die |
515 |
+ for one_sapi in $SAPIS ; do |
516 |
+ use "${one_sapi}" || continue |
517 |
+ php_set_ini_dir "${one_sapi}" |
518 |
+ |
519 |
+ # The BUILD_DIR variable is used to determine where to output |
520 |
+ # the files that autotools creates. This was all originally |
521 |
+ # based on the autotools-utils eclass. |
522 |
+ BUILD_DIR="${WORKDIR}/sapis-build/${one_sapi}" |
523 |
+ cp -a "${S}" "${BUILD_DIR}" || die |
524 |
+ cd "${BUILD_DIR}" || die |
525 |
+ |
526 |
+ local sapi_conf=( |
527 |
+ --with-config-file-path="${PHP_INI_DIR}" |
528 |
+ --with-config-file-scan-dir="${PHP_EXT_INI_DIR_ACTIVE}" |
529 |
+ ) |
530 |
+ |
531 |
+ for sapi in $SAPIS ; do |
532 |
+ case "$sapi" in |
533 |
+ cli|cgi|embed|fpm|phpdbg) |
534 |
+ if [[ "${one_sapi}" == "${sapi}" ]] ; then |
535 |
+ sapi_conf+=( "--enable-${sapi}" ) |
536 |
+ if [[ "fpm" == "${sapi}" ]] ; then |
537 |
+ sapi_conf+=( |
538 |
+ $(use_with acl fpm-acl) |
539 |
+ $(use_with systemd fpm-systemd) |
540 |
+ ) |
541 |
+ fi |
542 |
+ else |
543 |
+ sapi_conf+=( "--disable-${sapi}" ) |
544 |
+ fi |
545 |
+ ;; |
546 |
+ |
547 |
+ apache2) |
548 |
+ if [[ "${one_sapi}" == "${sapi}" ]] ; then |
549 |
+ sapi_conf+=( --with-apxs2="${EPREFIX}/usr/bin/apxs" ) |
550 |
+ else |
551 |
+ sapi_conf+=( --without-apxs2 ) |
552 |
+ fi |
553 |
+ ;; |
554 |
+ esac |
555 |
+ done |
556 |
+ |
557 |
+ # Construct the $myeconfargs array by concatenating $our_conf |
558 |
+ # (the common args) and $sapi_conf (the SAPI-specific args). |
559 |
+ local myeconfargs=( "${our_conf[@]}" ) |
560 |
+ myeconfargs+=( "${sapi_conf[@]}" ) |
561 |
+ |
562 |
+ pushd "${BUILD_DIR}" > /dev/null || die |
563 |
+ econf "${myeconfargs[@]}" |
564 |
+ popd > /dev/null || die |
565 |
+ done |
566 |
+} |
567 |
+ |
568 |
+src_compile() { |
569 |
+ # snmp seems to run during src_compile, too (bug #324739) |
570 |
+ addpredict /usr/share/snmp/mibs/.index #nowarn |
571 |
+ addpredict /var/lib/net-snmp/mib_indexes #nowarn |
572 |
+ |
573 |
+ local sapi |
574 |
+ for sapi in ${SAPIS} ; do |
575 |
+ if use "${sapi}"; then |
576 |
+ cd "${WORKDIR}/sapis-build/$sapi" || \ |
577 |
+ die "Failed to change dir to ${WORKDIR}/sapis-build/$1" |
578 |
+ emake |
579 |
+ fi |
580 |
+ done |
581 |
+} |
582 |
+ |
583 |
+src_install() { |
584 |
+ # see bug #324739 for what happens when we don't have that |
585 |
+ addpredict /usr/share/snmp/mibs/.index #nowarn |
586 |
+ |
587 |
+ # grab the first SAPI that got built and install common files from there |
588 |
+ local first_sapi="", sapi="" |
589 |
+ for sapi in $SAPIS ; do |
590 |
+ if use $sapi ; then |
591 |
+ first_sapi=$sapi |
592 |
+ break |
593 |
+ fi |
594 |
+ done |
595 |
+ |
596 |
+ # Makefile forgets to create this before trying to write to it... |
597 |
+ dodir "${PHP_DESTDIR#${EPREFIX}}/bin" |
598 |
+ |
599 |
+ # Install php environment (without any sapis) |
600 |
+ cd "${WORKDIR}/sapis-build/$first_sapi" || die |
601 |
+ emake INSTALL_ROOT="${D}" \ |
602 |
+ install-build install-headers install-programs |
603 |
+ |
604 |
+ local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)" |
605 |
+ |
606 |
+ # Create the directory where we'll put version-specific php scripts |
607 |
+ keepdir "/usr/share/php${PHP_MV}" |
608 |
+ |
609 |
+ local file="" |
610 |
+ local sapi_list="" |
611 |
+ |
612 |
+ for sapi in ${SAPIS}; do |
613 |
+ if use "${sapi}" ; then |
614 |
+ einfo "Installing SAPI: ${sapi}" |
615 |
+ cd "${WORKDIR}/sapis-build/${sapi}" || die |
616 |
+ |
617 |
+ if [[ "${sapi}" == "apache2" ]] ; then |
618 |
+ # We're specifically not using emake install-sapi as libtool |
619 |
+ # may cause unnecessary relink failures (see bug #351266) |
620 |
+ insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/" |
621 |
+ newins ".libs/libphp${PHP_MV}$(get_libname)" \ |
622 |
+ "libphp${PHP_MV}$(get_libname)" |
623 |
+ keepdir "/usr/$(get_libdir)/apache2/modules" |
624 |
+ else |
625 |
+ # needed each time, php_install_ini would reset it |
626 |
+ local dest="${PHP_DESTDIR#${EPREFIX}}" |
627 |
+ into "${dest}" |
628 |
+ case "$sapi" in |
629 |
+ cli) |
630 |
+ source="sapi/cli/php" |
631 |
+ # Install the "phar" archive utility. |
632 |
+ if use phar ; then |
633 |
+ emake INSTALL_ROOT="${D}" install-pharcmd |
634 |
+ dosym "..${dest#/usr}/bin/phar" "/usr/bin/phar${SLOT}" |
635 |
+ fi |
636 |
+ ;; |
637 |
+ cgi) |
638 |
+ source="sapi/cgi/php-cgi" |
639 |
+ ;; |
640 |
+ fpm) |
641 |
+ source="sapi/fpm/php-fpm" |
642 |
+ ;; |
643 |
+ embed) |
644 |
+ source="libs/libphp${PHP_MV}$(get_libname)" |
645 |
+ ;; |
646 |
+ phpdbg) |
647 |
+ source="sapi/phpdbg/phpdbg" |
648 |
+ ;; |
649 |
+ *) |
650 |
+ die "unhandled sapi in src_install" |
651 |
+ ;; |
652 |
+ esac |
653 |
+ |
654 |
+ if [[ "${source}" == *"$(get_libname)" ]]; then |
655 |
+ dolib.so "${source}" |
656 |
+ else |
657 |
+ dobin "${source}" |
658 |
+ local name="$(basename ${source})" |
659 |
+ dosym "..${dest#/usr}/bin/${name}" "/usr/bin/${name}${SLOT}" |
660 |
+ fi |
661 |
+ fi |
662 |
+ |
663 |
+ php_install_ini "${sapi}" |
664 |
+ |
665 |
+ # construct correct SAPI string for php-config |
666 |
+ # thanks to ferringb for the bash voodoo |
667 |
+ if [[ "${sapi}" == "apache2" ]]; then |
668 |
+ sapi_list="${sapi_list:+${sapi_list} }apache2handler" |
669 |
+ else |
670 |
+ sapi_list="${sapi_list:+${sapi_list} }${sapi}" |
671 |
+ fi |
672 |
+ fi |
673 |
+ done |
674 |
+ |
675 |
+ # Installing opcache module |
676 |
+ if use opcache ; then |
677 |
+ into "${PHP_DESTDIR#${EPREFIX}}" |
678 |
+ dolib.so "modules/opcache$(get_libname)" |
679 |
+ fi |
680 |
+ |
681 |
+ # Install env.d files |
682 |
+ newenvd "${FILESDIR}/20php5-envd" "20php${SLOT}" |
683 |
+ sed -e "s|/lib/|/$(get_libdir)/|g" -i "${ED}/etc/env.d/20php${SLOT}" || die |
684 |
+ sed -e "s|php5|php${SLOT}|g" -i "${ED}/etc/env.d/20php${SLOT}" || die |
685 |
+ |
686 |
+ # set php-config variable correctly (bug #278439) |
687 |
+ sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \ |
688 |
+ "${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config" || die |
689 |
+ |
690 |
+ if use fpm ; then |
691 |
+ if use systemd; then |
692 |
+ systemd_newunit "${FILESDIR}/php-fpm_at.service" \ |
693 |
+ "php-fpm@${SLOT}.service" |
694 |
+ else |
695 |
+ systemd_newunit "${FILESDIR}/php-fpm_at-simple.service" \ |
696 |
+ "php-fpm@${SLOT}.service" |
697 |
+ fi |
698 |
+ fi |
699 |
+} |
700 |
+ |
701 |
+src_test() { |
702 |
+ echo ">>> Test phase [test]: ${CATEGORY}/${PF}" |
703 |
+ PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php" |
704 |
+ if [[ ! -x "${PHP_BIN}" ]] ; then |
705 |
+ ewarn "Test phase requires USE=cli, skipping" |
706 |
+ return |
707 |
+ else |
708 |
+ export TEST_PHP_EXECUTABLE="${PHP_BIN}" |
709 |
+ fi |
710 |
+ |
711 |
+ if [[ -x "${WORKDIR}/sapis-build/cgi/sapi/cgi/php-cgi" ]] ; then |
712 |
+ export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis-build/cgi/sapi/cgi/php-cgi" |
713 |
+ fi |
714 |
+ |
715 |
+ if [[ -x "${WORKDIR}/sapis-build/phpdbg/sapi/phpdbg/phpdbg" ]] ; then |
716 |
+ export TEST_PHPDBG_EXECUTABLE="${WORKDIR}/sapis-build/phpdbg/sapi/phpdbg/phpdbg" |
717 |
+ fi |
718 |
+ |
719 |
+ REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d \ |
720 |
+ "session.save_path=${T}" \ |
721 |
+ "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d \ |
722 |
+ "session.save_path=${T}" |
723 |
+ |
724 |
+ for name in ${EXPECTED_TEST_FAILURES}; do |
725 |
+ mv "${name}.out" "${name}.out.orig" 2>/dev/null || die |
726 |
+ done |
727 |
+ |
728 |
+ local failed="$(find -name '*.out')" |
729 |
+ if [[ ${failed} != "" ]] ; then |
730 |
+ ewarn "The following test cases failed unexpectedly:" |
731 |
+ for name in ${failed}; do |
732 |
+ ewarn " ${name/.out/}" |
733 |
+ done |
734 |
+ else |
735 |
+ einfo "No unexpected test failures, all fine" |
736 |
+ fi |
737 |
+ |
738 |
+ if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then |
739 |
+ local passed="" |
740 |
+ for name in ${EXPECTED_TEST_FAILURES}; do |
741 |
+ [[ -f "${name}.diff" ]] && continue |
742 |
+ passed="${passed} ${name}" |
743 |
+ done |
744 |
+ if [[ ${passed} != "" ]] ; then |
745 |
+ einfo "The following test cases passed unexpectedly:" |
746 |
+ for name in ${passed}; do |
747 |
+ ewarn " ${passed}" |
748 |
+ done |
749 |
+ else |
750 |
+ einfo "None of the known-to-fail tests passed, all fine" |
751 |
+ fi |
752 |
+ fi |
753 |
+} |
754 |
+ |
755 |
+pkg_postinst() { |
756 |
+ # Output some general info to the user |
757 |
+ if use apache2 ; then |
758 |
+ elog |
759 |
+ elog "To enable PHP in apache, you will need to add \"-D PHP\" to" |
760 |
+ elog "your apache2 command. OpenRC users can append that string to" |
761 |
+ elog "APACHE2_OPTS in /etc/conf.d/apache2." |
762 |
+ elog |
763 |
+ elog "The apache module configuration file 70_mod_php.conf is" |
764 |
+ elog "provided (and maintained) by eselect-php." |
765 |
+ elog |
766 |
+ fi |
767 |
+ |
768 |
+ # Create the symlinks for php |
769 |
+ local m |
770 |
+ for m in ${SAPIS}; do |
771 |
+ [[ ${m} == 'embed' ]] && continue; |
772 |
+ if use $m ; then |
773 |
+ local ci=$(eselect php show $m) |
774 |
+ if [[ -z $ci ]]; then |
775 |
+ eselect php set $m php${SLOT} || die |
776 |
+ einfo "Switched ${m} to use php:${SLOT}" |
777 |
+ einfo |
778 |
+ elif [[ $ci != "php${SLOT}" ]] ; then |
779 |
+ elog "To switch $m to use php:${SLOT}, run" |
780 |
+ elog " eselect php set $m php${SLOT}" |
781 |
+ elog |
782 |
+ fi |
783 |
+ fi |
784 |
+ done |
785 |
+ |
786 |
+ # Remove dead symlinks for SAPIs that were just disabled. For |
787 |
+ # example, if the user has the cgi SAPI enabled, then he has an |
788 |
+ # eselect-php symlink for it. If he later reinstalls PHP with |
789 |
+ # USE="-cgi", that symlink will break. This call to eselect is |
790 |
+ # supposed to remove that dead link per bug 572436. |
791 |
+ eselect php cleanup || die |
792 |
+ |
793 |
+ if ! has "php${SLOT/./-}" ${PHP_TARGETS}; then |
794 |
+ elog "To build extensions for this version of PHP, you will need to" |
795 |
+ elog "add php${SLOT/./-} to your PHP_TARGETS USE_EXPAND variable." |
796 |
+ elog |
797 |
+ fi |
798 |
+ |
799 |
+ # Warn about the removal of PHP_INI_VERSION if the user has it set. |
800 |
+ if [[ -n "${PHP_INI_VERSION}" ]]; then |
801 |
+ ewarn 'The PHP_INI_VERSION variable has been phased out. You may' |
802 |
+ ewarn 'remove it from your configuration at your convenience. See' |
803 |
+ ewarn |
804 |
+ ewarn ' https://bugs.gentoo.org/611214' |
805 |
+ ewarn |
806 |
+ ewarn 'for more information.' |
807 |
+ fi |
808 |
+ |
809 |
+ elog "For details on how version slotting works, please see" |
810 |
+ elog "the wiki:" |
811 |
+ elog |
812 |
+ elog " https://wiki.gentoo.org/wiki/PHP" |
813 |
+ elog |
814 |
+} |
815 |
+ |
816 |
+pkg_postrm() { |
817 |
+ # This serves two purposes. First, if we have just removed the last |
818 |
+ # installed version of PHP, then this will remove any dead symlinks |
819 |
+ # belonging to eselect-php. Second, if a user upgrades slots from |
820 |
+ # (say) 5.6 to 7.0 and depcleans the old slot, then this will update |
821 |
+ # his existing symlinks to point to the new 7.0 installation. The |
822 |
+ # latter is bug 432962. |
823 |
+ # |
824 |
+ # Note: the eselect-php package may not be installed at this point, |
825 |
+ # so we can't die() if this command fails. |
826 |
+ eselect php cleanup |
827 |
+} |