git: eedd4aeb9ae4 - main - graphics/blender: fix build on aarch64

From: Robert Clausecker <fuz_at_FreeBSD.org>
Date: Mon, 30 Sep 2024 14:08:36 UTC
The branch main has been updated by fuz:

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

commit eedd4aeb9ae454f0c63baa659394d83e8b959b3b
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2024-09-26 12:42:12 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2024-09-30 14:01:57 +0000

    graphics/blender: fix build on aarch64
    
     - add an extra path for CPU detection via elf_aux_info()
    
    Approved by:    portmgr (build fix blanket)
---
 graphics/blender/files/patch-extern_lzma_CpuArch.c | 37 ++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/graphics/blender/files/patch-extern_lzma_CpuArch.c b/graphics/blender/files/patch-extern_lzma_CpuArch.c
new file mode 100644
index 000000000000..d2a6b4d51b7d
--- /dev/null
+++ b/graphics/blender/files/patch-extern_lzma_CpuArch.c
@@ -0,0 +1,37 @@
+--- extern/lzma/CpuArch.c.orig	2024-09-26 11:32:05 UTC
++++ extern/lzma/CpuArch.c
+@@ -766,6 +766,25 @@ BoolInt CPU_IsSupported_AES (void) { return APPLE_CRYP
+ 
+ #ifdef USE_HWCAP
+ 
++#ifdef __FreeBSD__
++
++  #define MY_HWCAP_CHECK_FUNC_3(name1, name2, at) \
++  BoolInt CPU_IsSupported_ ## name1() { \
++    unsigned long vec = 0; \
++    elf_aux_info(AT_ ## at, &vec, sizeof(vec)); \
++    return (vec & (at ## _ ## name2)) ? 1 : 0; \
++  }
++
++#ifdef MY_CPU_ARM64
++  #define MY_HWCAP_CHECK_FUNC(name) MY_HWCAP_CHECK_FUNC_3(name, name, HWCAP)
++  MY_HWCAP_CHECK_FUNC_3(NEON, ASIMD, HWCAP)
++#elif defined(MY_CPU_ARM)
++  #define MY_HWCAP_CHECK_FUNC(name) MY_HWCAP_CHECK_FUNC_3(name, name, HWCAP2)
++  MY_HWCAP_CHECK_FUNC_3(NEON, NEON, HWCAP)
++#endif
++
++#else // __FreeBSD__
++
+ #include <asm/hwcap.h>
+ 
+   #define MY_HWCAP_CHECK_FUNC_2(name1, name2) \
+@@ -781,6 +800,8 @@ BoolInt CPU_IsSupported_AES (void) { return APPLE_CRYP
+   BoolInt CPU_IsSupported_ ## name() { return (getauxval(AT_HWCAP2) & (HWCAP2_ ## name)) ? 1 : 0; }
+   MY_HWCAP_CHECK_FUNC_2(NEON, NEON)
+ #endif
++
++#endif // __FreeBSD__
+ 
+ #else // USE_HWCAP
+