$NetBSD: patch-src_3rdparty_chromium_third__party_webrtc_rtc__base_cpu__info.cc,v 1.1 2026/04/30 06:39:44 adam Exp $

* Part of patchset to build chromium on NetBSD
* Based on OpenBSD's chromium patches, and
  pkgsrc's qt5-qtwebengine patches

--- src/3rdparty/chromium/third_party/webrtc/rtc_base/cpu_info.cc.orig	2026-03-16 11:40:07.000000000 +0000
+++ src/3rdparty/chromium/third_party/webrtc/rtc_base/cpu_info.cc
@@ -37,9 +37,13 @@
 #include <intrin.h>
 #endif
 #if defined(WEBRTC_ARCH_ARM_FAMILY) && defined(WEBRTC_LINUX)
+#if !defined(WEBRTC_BSD)
 #include <asm/hwcap.h>
+#endif
+#if !defined(__NetBSD__)
 #include <sys/auxv.h>
 #endif
+#endif
 
 // Parts of this file derived from Chromium's base/cpu.cc.
 
@@ -178,11 +182,21 @@ bool Supports(ISA instruction_set_architecture) {
     return 0 != (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON);
 #elif defined(WEBRTC_LINUX)
     uint64_t hwcap = 0;
+#if defined(WEBRTC_BSD) && defined(__NetBSD__)
+    hwcap = 0;
+#elif defined(WEBRTC_BSD)
+    elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap));
+#else
     hwcap = getauxval(AT_HWCAP);
+#endif
 #if defined(__aarch64__)
+#if defined(__NetBSD__)
+    return true; /* No need to check. ASIMD/NEON mandatory in ARMV8.0-A */
+#else
     if ((hwcap & HWCAP_ASIMD) != 0) {
       return true;
     }
+#endif
 #else
     if ((hwcap & HWCAP_NEON) != 0) {
       return true;
