git: 3110b518c792 - main - lang/php81: fix build on powerpc64le

From: Piotr Kubaj <pkubaj_at_FreeBSD.org>
Date: Tue, 04 Jan 2022 18:45:25 UTC
The branch main has been updated by pkubaj:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3110b518c792952d1124a64d866e3118215b75e2

commit 3110b518c792952d1124a64d866e3118215b75e2
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2022-01-04 18:42:59 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2022-01-04 18:42:59 +0000

    lang/php81: fix build on powerpc64le
    
    In file included from /wrkdirs/usr/ports/lang/php81/work/php-8.1.1/ext/hash/hash_xxhash.c:18:
    In file included from ext/hash/php_hash_xxhash.h:21:
    In file included from /wrkdirs/usr/ports/lang/php81/work/php-8.1.1/ext/hash/xxhash/xxhash.h:2412:
    /usr/lib/clang/11.0.1/include/altivec.h:55:19: error: unknown type name 'vector'
    static __inline__ vector bool char __ATTRS_o_ai
                      ^
    /usr/lib/clang/11.0.1/include/altivec.h:56:10: error: unknown type name 'vector'
    vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c);
             ^
    /usr/lib/clang/11.0.1/include/altivec.h:56:32: error: unknown type name 'vector'
    vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c);
                                   ^
    /usr/lib/clang/11.0.1/include/altivec.h:66:19: error: unknown type name 'vector'
    static __inline__ vector bool short __ATTRS_o_ai vec_perm(
    
    Patch from https://github.com/Cyan4973/xxHash/pull/672
---
 lang/php81/files/patch-ext_hash_xxhash_xxhash.h | 46 +++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/lang/php81/files/patch-ext_hash_xxhash_xxhash.h b/lang/php81/files/patch-ext_hash_xxhash_xxhash.h
new file mode 100644
index 000000000000..27abdbc2af76
--- /dev/null
+++ b/lang/php81/files/patch-ext_hash_xxhash_xxhash.h
@@ -0,0 +1,46 @@
+--- ext/hash/xxhash/xxhash.h.orig	2022-01-04 18:37:17 UTC
++++ ext/hash/xxhash/xxhash.h
+@@ -2395,22 +2395,32 @@ XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(co
+  * inconsistent intrinsics, spotty coverage, and multiple endiannesses.
+  */
+ #if XXH_VECTOR == XXH_VSX
++/* Annoyingly, these headers _may_ define three macros: `bool`, `vector`,
++ * and `pixel`. This is a problem for obvious reasons.
++ *
++ * These keywords are unnecessary; the spec literally says they are
++ * equivalent to `__bool`, `__vector`, and `__pixel` and may be undef'd
++ * after including the header.
++ *
++ * We use pragma push_macro/pop_macro to keep the namespace clean. */
++#  pragma push_macro("bool")
++#  pragma push_macro("vector")
++#  pragma push_macro("pixel")
++/* silence potential macro redefined warnings */
++#  undef bool
++#  undef vector
++#  undef pixel
++
+ #  if defined(__s390x__)
+ #    include <s390intrin.h>
+ #  else
+-/* gcc's altivec.h can have the unwanted consequence to unconditionally
+- * #define bool, vector, and pixel keywords,
+- * with bad consequences for programs already using these keywords for other purposes.
+- * The paragraph defining these macros is skipped when __APPLE_ALTIVEC__ is defined.
+- * __APPLE_ALTIVEC__ is _generally_ defined automatically by the compiler,
+- * but it seems that, in some cases, it isn't.
+- * Force the build macro to be defined, so that keywords are not altered.
+- */
+-#    if defined(__GNUC__) && !defined(__APPLE_ALTIVEC__)
+-#      define __APPLE_ALTIVEC__
+-#    endif
+ #    include <altivec.h>
+ #  endif
++
++/* Restore the original macro values, if applicable. */
++#  pragma pop_macro("pixel")
++#  pragma pop_macro("vector")
++#  pragma pop_macro("bool")
+ 
+ typedef __vector unsigned long long xxh_u64x2;
+ typedef __vector unsigned char xxh_u8x16;