git: ff3ca68472c8 - main - audio/opus: update to 1.5.1

From: Christian Weisgerber <naddy_at_FreeBSD.org>
Date: Sun, 10 Mar 2024 16:19:26 UTC
The branch main has been updated by naddy:

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

commit ff3ca68472c8562c0008b68c9244b523c7543619
Author:     Christian Weisgerber <naddy@FreeBSD.org>
AuthorDate: 2024-03-10 16:10:50 +0000
Commit:     Christian Weisgerber <naddy@FreeBSD.org>
CommitDate: 2024-03-10 16:18:34 +0000

    audio/opus: update to 1.5.1
    
    This update enables the new machine learning features:
    https://opus-codec.org/demo/opus-1.5/
    
    Runtime detection patches for ARMv6, ARMv7 and Aarch64 by fuz@
    
    PR:             277537
---
 audio/opus/Makefile                      |  5 ++-
 audio/opus/distinfo                      |  6 ++--
 audio/opus/files/patch-celt_arm_armcpu.c | 57 ++++++++++++++++++++++++++++++++
 audio/opus/files/patch-configure         | 11 ------
 audio/opus/pkg-plist                     |  2 +-
 5 files changed, 65 insertions(+), 16 deletions(-)

diff --git a/audio/opus/Makefile b/audio/opus/Makefile
index 70abf5edd7b0..f5fa1e8c8dc8 100644
--- a/audio/opus/Makefile
+++ b/audio/opus/Makefile
@@ -1,5 +1,5 @@
 PORTNAME=	opus
-DISTVERSION=	1.4
+DISTVERSION=	1.5.1
 CATEGORIES=	audio
 MASTER_SITES=	https://downloads.xiph.org/releases/opus/ \
 		https://github.com/xiph/opus/releases/download/v${DISTVERSION}/
@@ -17,7 +17,10 @@ USE_LDCONFIG=	yes
 
 GNU_CONFIGURE=	yes
 CONFIGURE_ARGS=	--enable-custom-modes \
+		--enable-dred \
+		--enable-osce \
 		--disable-doc   # requires doxygen
+CONFIGURE_TARGET=${ARCH:S/amd64/x86_64/}-portbld-${OPSYS:tl}${OSREL}
 INSTALL_TARGET=	install-strip
 TEST_TARGET=	check
 
diff --git a/audio/opus/distinfo b/audio/opus/distinfo
index 99676246378c..03b8b35f6d4f 100644
--- a/audio/opus/distinfo
+++ b/audio/opus/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1682429725
-SHA256 (opus-1.4.tar.gz) = c9b32b4253be5ae63d1ff16eea06b94b5f0f2951b7a02aceef58e3a3ce49c51f
-SIZE (opus-1.4.tar.gz) = 1063408
+TIMESTAMP = 1710082536
+SHA256 (opus-1.5.1.tar.gz) = b84610959b8d417b611aa12a22565e0a3732097c6389d19098d844543e340f85
+SIZE (opus-1.5.1.tar.gz) = 7834540
diff --git a/audio/opus/files/patch-celt_arm_armcpu.c b/audio/opus/files/patch-celt_arm_armcpu.c
new file mode 100644
index 000000000000..479c34e83b0d
--- /dev/null
+++ b/audio/opus/files/patch-celt_arm_armcpu.c
@@ -0,0 +1,57 @@
+--- celt/arm/armcpu.c.orig	2024-03-01 07:55:09 UTC
++++ celt/arm/armcpu.c
+@@ -191,6 +191,54 @@ opus_uint32 opus_cpu_capabilities(void)
+   return flags;
+ }
+ 
++#elif defined(__FreeBSD__)
++#include <sys/auxv.h>
++
++opus_uint32 opus_cpu_capabilities(void)
++{
++  long hwcap = 0;
++  opus_uint32 flags = 0;
++
++# if defined(OPUS_ARM_MAY_HAVE_MEDIA) \
++ || defined(OPUS_ARM_MAY_HAVE_NEON) || defined(OPUS_ARM_MAY_HAVE_NEON_INTR)
++  /* FreeBSD required armv6+, always supported media instructions */
++  flags |= OPUS_CPU_ARM_MEDIA_FLAG;
++# endif
++
++  elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap);
++
++# if defined(OPUS_ARM_MAY_HAVE_EDSP) || defined(OPUS_ARM_MAY_HAVE_MEDIA) \
++ || defined(OPUS_ARM_MAY_HAVE_NEON) || defined(OPUS_ARM_MAY_HAVE_NEON_INTR)
++#  ifdef HWCAP_EDSP
++  if (hwcap & HWCAP_EDSP)
++    flags |= OPUS_CPU_ARM_EDSP_FLAG;
++#  endif
++
++#  if defined(OPUS_ARM_MAY_HAVE_NEON) || defined(OPUS_ARM_MAY_HAVE_NEON_INTR)
++#   ifdef HWCAP_NEON
++  if (hwcap & HWCAP_NEON)
++    flags |= OPUS_CPU_ARM_NEON_FLAG;
++#   elif defined(HWCAP_ASIMD)
++  if (hwcap & HWCAP_ASIMD)
++    flags |= OPUS_CPU_ARM_NEON_FLAG | OPUS_CPU_ARM_MEDIA_FLAG | OPUS_CPU_ARM_EDSP_FLAG;
++#   endif
++#  endif
++#  if defined(OPUS_ARM_MAY_HAVE_DOTPROD) && defined(HWCAP_ASIMDDP)
++  if (hwcap & HWCAP_ASIMDDP)
++    flags |= OPUS_CPU_ARM_DOTPROD_FLAG;
++#  endif
++# endif
++
++#if defined(OPUS_ARM_PRESUME_AARCH64_NEON_INTR)
++    flags |= OPUS_CPU_ARM_EDSP_FLAG | OPUS_CPU_ARM_MEDIA_FLAG | OPUS_CPU_ARM_NEON_FLAG;
++# if defined(OPUS_ARM_PRESUME_DOTPROD)
++    flags |= OPUS_CPU_ARM_DOTPROD_FLAG;
++# endif
++#endif
++
++  return (flags);
++}
++
+ #else
+ /* The feature registers which can tell us what the processor supports are
+  * accessible in priveleged modes only, so we can't have a general user-space
diff --git a/audio/opus/files/patch-configure b/audio/opus/files/patch-configure
deleted file mode 100644
index 867efc968d0a..000000000000
--- a/audio/opus/files/patch-configure
+++ /dev/null
@@ -1,11 +0,0 @@
---- configure.orig	2016-01-12 18:17:49 UTC
-+++ configure
-@@ -13251,7 +13251,7 @@ $as_echo "$as_me: WARNING: Compiler does
- 
- fi
-     ;; #(
--  i?86|x86_64) :
-+  i?86|x86_64|amd64) :
- 
- 
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports SSE intrinsics" >&5
diff --git a/audio/opus/pkg-plist b/audio/opus/pkg-plist
index 3807ee6ea18e..365844de3aa7 100644
--- a/audio/opus/pkg-plist
+++ b/audio/opus/pkg-plist
@@ -7,6 +7,6 @@ include/opus/opus_types.h
 lib/libopus.a
 lib/libopus.so
 lib/libopus.so.0
-lib/libopus.so.0.9.0
+lib/libopus.so.0.10.0
 libdata/pkgconfig/opus.pc
 share/aclocal/opus.m4