Convert over to using elf_aux_info().

Index: aom/Makefile
===================================================================
RCS file: /cvs/ports/multimedia/aom/Makefile,v
retrieving revision 1.25
diff -u -p -u -p -r1.25 Makefile
--- aom/Makefile        22 Jun 2024 09:32:46 -0000      1.25
+++ aom/Makefile        18 Aug 2024 00:03:38 -0000
@@ -3,6 +3,7 @@ COMMENT=        Alliance for Open Media AV1 vid
 V=             3.9.1
 DISTNAME=      libaom-$V
 PKGNAME=       aom-$V
+REVISION=      0
 CATEGORIES=    multimedia
 
 SHARED_LIBS=   aom     4.2
Index: aom/patches/patch-aom_ports_aarch32_cpudetect_c
===================================================================
RCS file: 
/cvs/ports/multimedia/aom/patches/patch-aom_ports_aarch32_cpudetect_c,v
retrieving revision 1.1
diff -u -p -u -p -r1.1 patch-aom_ports_aarch32_cpudetect_c
--- aom/patches/patch-aom_ports_aarch32_cpudetect_c     28 Feb 2024 18:05:34 
-0000      1.1
+++ aom/patches/patch-aom_ports_aarch32_cpudetect_c     18 Aug 2024 00:03:38 
-0000
@@ -3,21 +3,25 @@ Allow ARM CPU runtime detection code to 
 Index: aom_ports/aarch32_cpudetect.c
 --- aom_ports/aarch32_cpudetect.c.orig
 +++ aom_ports/aarch32_cpudetect.c
-@@ -12,7 +12,7 @@
- 
- #include "arm_cpudetect.h"
- 
--#if !CONFIG_RUNTIME_CPU_DETECT
-+#if !CONFIG_RUNTIME_CPU_DETECT || defined(__OpenBSD__)
- 
- static int arm_get_cpu_caps(void) {
-   // This function should actually be a no-op. There is no way to adjust any 
of
-@@ -25,7 +25,7 @@ static int arm_get_cpu_caps(void) {
+@@ -55,7 +55,7 @@ static int arm_get_cpu_caps(void) {
    return flags;
  }
  
--#elif defined(_MSC_VER)  // end !CONFIG_RUNTIME_CPU_DETECT
-+#elif defined(_MSC_VER)  // end !CONFIG_RUNTIME_CPU_DETECT || __OpenBSD__
+-#elif defined(__linux__)  // end defined(AOM_USE_ANDROID_CPU_FEATURES)
++#elif defined(__linux__) || defined(__OpenBSD__)  // end 
defined(AOM_USE_ANDROID_CPU_FEATURES)
+ 
+ #include <sys/auxv.h>
+ 
+@@ -65,7 +65,12 @@ static int arm_get_cpu_caps(void) {
  
  static int arm_get_cpu_caps(void) {
    int flags = 0;
++#ifdef __OpenBSD__
++  unsigned long hwcap = 0;
++  elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap));
++#else
+   unsigned long hwcap = getauxval(AT_HWCAP);
++#else
+ #if HAVE_NEON
+   if (hwcap & AOM_AARCH32_HWCAP_NEON) flags |= HAS_NEON;
+ #endif  // HAVE_NEON
Index: aom/patches/patch-aom_ports_aarch64_cpudetect_c
===================================================================
RCS file: 
/cvs/ports/multimedia/aom/patches/patch-aom_ports_aarch64_cpudetect_c,v
retrieving revision 1.3
diff -u -p -u -p -r1.3 patch-aom_ports_aarch64_cpudetect_c
--- aom/patches/patch-aom_ports_aarch64_cpudetect_c     28 May 2024 11:26:50 
-0000      1.3
+++ aom/patches/patch-aom_ports_aarch64_cpudetect_c     18 Aug 2024 00:03:39 
-0000
@@ -3,51 +3,33 @@ Add AArch64 CPU feature detection suppor
 Index: aom_ports/aarch64_cpudetect.c
 --- aom_ports/aarch64_cpudetect.c.orig
 +++ aom_ports/aarch64_cpudetect.c
-@@ -178,7 +178,46 @@ static int arm_get_cpu_caps(void) {
+@@ -99,7 +99,7 @@ static int arm_get_cpu_caps(void) {
    return flags;
  }
  
--#else  // end __Fuchsia__
-+#elif defined(__OpenBSD__)  // end __Fuchsia__
-+
-+#include <machine/armreg.h>
-+#include <machine/cpu.h>
-+#include <sys/types.h>
-+#include <sys/sysctl.h>
-+
-+static int arm_get_cpu_caps(void) {
-+  int flags = 0;
-+  int mib[2];
-+  uint64_t isar0;
-+  uint64_t isar1;
-+  size_t len;
-+
-+  flags |= HAS_NEON;  // Neon is mandatory in Armv8.0-A.
-+
-+  mib[0] = CTL_MACHDEP;
-+  mib[1] = CPU_ID_AA64ISAR0;
-+  len = sizeof(isar0);
-+  if (sysctl(mib, 2, &isar0, &len, NULL, 0) != -1) {
-+    if (ID_AA64ISAR0_CRC32(isar0) >= ID_AA64ISAR0_CRC32_BASE)
-+      flags |= HAS_ARM_CRC32;
-+    if (ID_AA64ISAR0_DP(isar0) >= ID_AA64ISAR0_DP_IMPL)
-+      flags |= HAS_NEON_DOTPROD;
-+  }
-+
-+  mib[0] = CTL_MACHDEP;
-+  mib[1] = CPU_ID_AA64ISAR1;
-+  len = sizeof(isar1);
-+  if (sysctl(mib, 2, &isar1, &len, NULL, 0) != -1) {
-+#ifdef ID_AA64ISAR1_I8MM_IMPL
-+    if (ID_AA64ISAR1_I8MM(isar1) >= ID_AA64ISAR1_I8MM_IMPL)
-+      flags |= HAS_NEON_I8MM;
+-#elif defined(__linux__)  // end defined(AOM_USE_ANDROID_CPU_FEATURES)
++#elif defined(__linux__) || defined(__OpenBSD__)  // end 
defined(AOM_USE_ANDROID_CPU_FEATURES)
+ 
+ #include <sys/auxv.h>
+ 
+@@ -114,10 +114,20 @@ static int arm_get_cpu_caps(void) {
+ static int arm_get_cpu_caps(void) {
+   int flags = 0;
+ #if HAVE_ARM_CRC32 || HAVE_NEON_DOTPROD || HAVE_SVE
++#ifdef __OpenBSD__
++  unsigned long hwcap = 0;
++  elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap));
++#else
+   unsigned long hwcap = getauxval(AT_HWCAP);
+ #endif
 +#endif
-+  }
-+
-+  return flags;
-+}
-+
-+#else  // end __OpenBSD__
- #error \
-     "Runtime CPU detection selected, but no CPU detection method " \
- "available for your platform. Rerun cmake with -DCONFIG_RUNTIME_CPU_DETECT=0."
+ #if HAVE_NEON_I8MM || HAVE_SVE2
++#ifdef __OpenBSD__
++  unsigned long hwcap2 = 0;
++  elf_aux_info(AT_HWCAP2, &hwcap2, sizeof(hwcap2));
++#else
+   unsigned long hwcap2 = getauxval(AT_HWCAP2);
++#endif
+ #endif
+ 
+ #if HAVE_NEON
Index: libvpx/Makefile
===================================================================
RCS file: /cvs/ports/multimedia/libvpx/Makefile,v
retrieving revision 1.59
diff -u -p -u -p -r1.59 Makefile
--- libvpx/Makefile     22 Jun 2024 09:33:22 -0000      1.59
+++ libvpx/Makefile     18 Aug 2024 00:03:39 -0000
@@ -3,6 +3,7 @@ COMMENT=        Google VP8/VP9 video codec
 GH_ACCOUNT=    webmproject
 GH_PROJECT=    libvpx
 GH_TAGNAME=    v1.14.1
+REVISION=      0
 EPOCH=         0
 CATEGORIES=    multimedia
 
Index: libvpx/patches/patch-vpx_ports_aarch32_cpudetect_c
===================================================================
RCS file: 
/cvs/ports/multimedia/libvpx/patches/patch-vpx_ports_aarch32_cpudetect_c,v
retrieving revision 1.1
diff -u -p -u -p -r1.1 patch-vpx_ports_aarch32_cpudetect_c
--- libvpx/patches/patch-vpx_ports_aarch32_cpudetect_c  29 Feb 2024 09:43:31 
-0000      1.1
+++ libvpx/patches/patch-vpx_ports_aarch32_cpudetect_c  18 Aug 2024 00:03:39 
-0000
@@ -3,21 +3,25 @@ Allow ARM CPU runtime detection code to 
 Index: vpx_ports/aarch32_cpudetect.c
 --- vpx_ports/aarch32_cpudetect.c.orig
 +++ vpx_ports/aarch32_cpudetect.c
-@@ -12,7 +12,7 @@
- #include "./vpx_config.h"
- #include "arm_cpudetect.h"
- 
--#if !CONFIG_RUNTIME_CPU_DETECT
-+#if !CONFIG_RUNTIME_CPU_DETECT || defined(__OpenBSD__)
- 
- static int arm_get_cpu_caps(void) {
-   // This function should actually be a no-op. There is no way to adjust any 
of
-@@ -25,7 +25,7 @@ static int arm_get_cpu_caps(void) {
+@@ -57,7 +57,7 @@ static int arm_get_cpu_caps(void) {
    return flags;
  }
  
--#elif defined(_MSC_VER)  // end !CONFIG_RUNTIME_CPU_DETECT
-+#elif defined(_MSC_VER)  // end !CONFIG_RUNTIME_CPU_DETECT || __OpenBSD__
+-#elif defined(__linux__)  // end defined(AOM_USE_ANDROID_CPU_FEATURES)
++#elif defined(__linux__) || defined(__OpenBSD__)  // end 
defined(AOM_USE_ANDROID_CPU_FEATURES)
+ 
+ #include <sys/auxv.h>
+ 
+@@ -67,7 +67,12 @@ static int arm_get_cpu_caps(void) {
  
  static int arm_get_cpu_caps(void) {
    int flags = 0;
++#ifdef __OpenBSD__
++  unsigned long hwcap = 0;
++  elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap));
++#else
+   unsigned long hwcap = getauxval(AT_HWCAP);
++#endif
+ #if HAVE_NEON || HAVE_NEON_ASM
+   if (hwcap & VPX_AARCH32_HWCAP_NEON) {
+     flags |= HAS_NEON;
Index: libvpx/patches/patch-vpx_ports_aarch64_cpudetect_c
===================================================================
RCS file: 
/cvs/ports/multimedia/libvpx/patches/patch-vpx_ports_aarch64_cpudetect_c,v
retrieving revision 1.2
diff -u -p -u -p -r1.2 patch-vpx_ports_aarch64_cpudetect_c
--- libvpx/patches/patch-vpx_ports_aarch64_cpudetect_c  28 May 2024 11:26:44 
-0000      1.2
+++ libvpx/patches/patch-vpx_ports_aarch64_cpudetect_c  18 Aug 2024 00:03:39 
-0000
@@ -3,49 +3,32 @@ Add AArch64 CPU feature detection suppor
 Index: vpx_ports/aarch64_cpudetect.c
 --- vpx_ports/aarch64_cpudetect.c.orig
 +++ vpx_ports/aarch64_cpudetect.c
-@@ -170,7 +170,44 @@ static int arm_get_cpu_caps(void) {
+@@ -91,7 +91,7 @@ static int arm_get_cpu_caps(void) {
    return flags;
  }
  
--#else  // end __Fuchsia__
-+#elif defined(__OpenBSD__)  // end __Fuchsia__
-+
-+#include <machine/armreg.h>
-+#include <machine/cpu.h>
-+#include <sys/types.h>
-+#include <sys/sysctl.h>
-+
-+static int arm_get_cpu_caps(void) {
-+  int flags = 0;
-+  int mib[2];
-+  uint64_t isar0;
-+  uint64_t isar1;
-+  size_t len;
-+
-+  flags |= HAS_NEON;  // Neon is mandatory in Armv8.0-A.
-+
-+  mib[0] = CTL_MACHDEP;
-+  mib[1] = CPU_ID_AA64ISAR0;
-+  len = sizeof(isar0);
-+  if (sysctl(mib, 2, &isar0, &len, NULL, 0) != -1) {
-+    if (ID_AA64ISAR0_DP(isar0) >= ID_AA64ISAR0_DP_IMPL)
-+      flags |= HAS_NEON_DOTPROD;
-+  }
-+
-+  mib[0] = CTL_MACHDEP;
-+  mib[1] = CPU_ID_AA64ISAR1;
-+  len = sizeof(isar1);
-+  if (sysctl(mib, 2, &isar1, &len, NULL, 0) != -1) {
-+#ifdef ID_AA64ISAR1_I8MM_IMPL
-+    if (ID_AA64ISAR1_I8MM(isar1) >= ID_AA64ISAR1_I8MM_IMPL)
-+      flags |= HAS_NEON_I8MM;
+-#elif defined(__linux__)  // end defined(VPX_USE_ANDROID_CPU_FEATURES)
++#elif defined(__linux__) || defined(__OpenBSD__)  // end 
defined(VPX_USE_ANDROID_CPU_FEATURES)
+ 
+ #include <sys/auxv.h>
+ 
+@@ -103,9 +103,19 @@ static int arm_get_cpu_caps(void) {
+ 
+ static int arm_get_cpu_caps(void) {
+   int flags = 0;
++#ifdef __OpenBSD__
++  unsigned long hwcap = 0;
++  elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap));
++#else
+   unsigned long hwcap = getauxval(AT_HWCAP);
++#endif
+ #if HAVE_NEON_I8MM
++#ifdef __OpenBSD__
++  unsigned long hwcap2 = 0;
++  elf_aux_info(AT_HWCAP2, &hwcap2, sizeof(hwcap2));
++#else
+   unsigned long hwcap2 = getauxval(AT_HWCAP2);
 +#endif
-+  }
-+
-+  return flags;
-+}
-+
-+#else  // end __OpenBSD__
- #error \
-     "Runtime CPU detection selected, but no CPU detection method available" \
- "for your platform. Rerun configure with --disable-runtime-cpu-detect."
+ #endif  // HAVE_NEON_I8MM
+ #if HAVE_NEON
+   flags |= HAS_NEON;  // Neon is mandatory in Armv8.0-A.

Reply via email to