git: 88b6e6aa0e0b - main - www/chromium: unbreak on arm64 by not using linux specific code

From: Rene Ladan <rene_at_FreeBSD.org>
Date: Sun, 04 Sep 2022 12:19:07 UTC
The branch main has been updated by rene:

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

commit 88b6e6aa0e0b975f15090950736b9a6a9cb5e58d
Author:     Robert Nagy <robert@openbsd.org>
AuthorDate: 2022-09-04 11:58:11 +0000
Commit:     Rene Ladan <rene@FreeBSD.org>
CommitDate: 2022-09-04 12:18:37 +0000

    www/chromium: unbreak on arm64 by not using linux specific code
---
 .../files/patch-third__party_lzma__sdk_C_CpuArch.c | 44 ++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/www/chromium/files/patch-third__party_lzma__sdk_C_CpuArch.c b/www/chromium/files/patch-third__party_lzma__sdk_C_CpuArch.c
new file mode 100644
index 000000000000..e5faa231f03f
--- /dev/null
+++ b/www/chromium/files/patch-third__party_lzma__sdk_C_CpuArch.c
@@ -0,0 +1,44 @@
+--- third_party/lzma_sdk/C/CpuArch.c.orig	2022-09-04 11:56:14 UTC
++++ third_party/lzma_sdk/C/CpuArch.c
+@@ -412,12 +412,40 @@ BoolInt CPU_IsSupported_SHA1(void) { return APPLE_CRYP
+ BoolInt CPU_IsSupported_SHA2(void) { return APPLE_CRYPTO_SUPPORT_VAL; }
+ BoolInt CPU_IsSupported_AES (void) { return APPLE_CRYPTO_SUPPORT_VAL; }
+ 
++#elif defined(__OpenBSD__)
+ 
++#include <sys/param.h>
++#include <sys/sysctl.h>
++#include <machine/cpu.h>
++#include <machine/armreg.h>
++
++BoolInt CPU_IsSupported_NEON() { return 1; }
++
++#define MY_HWCAP_CHECK_FUNC_2(name1, name2) \
++  BoolInt CPU_IsSupported_ ## name1() { \
++    int isar0_mib[] = { CTL_MACHDEP, CPU_ID_AA64ISAR0 }; \
++    size_t len = sizeof(uint64_t); \
++    uint64_t cpu_id = 0; \
++    if (sysctl(isar0_mib, 2, &cpu_id, &len, NULL, 0) < 0) \
++      return 0; \
++    if (ID_AA64ISAR0_ ## name2(cpu_id) >= ID_AA64ISAR0_## name2 ##_BASE) \
++      return 1; \
++    return 0; \
++  }
++
++#define MY_HWCAP_CHECK_FUNC(name) \
++  MY_HWCAP_CHECK_FUNC_2(name, name)
++
++MY_HWCAP_CHECK_FUNC (CRC32)
++MY_HWCAP_CHECK_FUNC (SHA1)
++MY_HWCAP_CHECK_FUNC (SHA2)
++MY_HWCAP_CHECK_FUNC (AES)
++
+ #else // __APPLE__
+ 
+ #include <sys/auxv.h>
+ 
+-#if !defined(ARMV8_OS_FUCHSIA)
++#if !defined(ARMV8_OS_FUCHSIA) && !defined(__FreeBSD__)
+ #define USE_HWCAP
+ #endif // !defined(ARMV8_OS_FUCHSIA)
+