opus: update to 1.5.1
authorkrant <aleksey.vasilenko@gmail.com>
Wed, 20 Mar 2024 09:39:20 +0000 (11:39 +0200)
committerTianling Shen <cnsztl@gmail.com>
Fri, 22 Mar 2024 08:09:21 +0000 (16:09 +0800)
- Switch to Meson build system
- Update patch with Meson build fixes

Signed-off-by: krant <aleksey.vasilenko@gmail.com>
libs/opus/Makefile
libs/opus/patches/010-fix-arm-build.patch [deleted file]
libs/opus/patches/010-fix-meson.patch [new file with mode: 0644]

index 978198baa6bda51bba8d42699ca96ea81ea5b600..da931c6dbbc92321a74d4f8312f87bf88afa74f2 100644 (file)
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=opus
-PKG_VERSION:=1.4
+PKG_VERSION:=1.5.1
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://downloads.xiph.org/releases/opus
-PKG_HASH:=c9b32b4253be5ae63d1ff16eea06b94b5f0f2951b7a02aceef58e3a3ce49c51f
+PKG_HASH:=b84610959b8d417b611aa12a22565e0a3732097c6389d19098d844543e340f85
 
 PKG_MAINTAINER:=Ted Hess <thess@kitchensync.net>, Ian Leonard <antonlacon@gmail.com>
 PKG_LICENSE:=BSD-3-Clause
@@ -24,6 +24,7 @@ PKG_BUILD_PARALLEL:=1
 PKG_INSTALL:=1
 
 include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/meson.mk
 
 define Package/libopus
   SECTION:=libs
@@ -38,23 +39,23 @@ define Package/libopus/description
  is also intended for storage and streaming applications.
 endef
 
-CONFIGURE_ARGS+= \
-       --disable-doc \
-       --disable-extra-programs
+MESON_ARGS+= \
+       -Ddocs=disabled \
+       -Dextra-programs=disabled
 
 ifeq ($(CONFIG_SOFT_FLOAT),y)
-       CONFIGURE_ARGS+= \
-               --enable-fixed-point
+       MESON_ARGS+= \
+               -Dfixed-point=true
 endif
 
 ifneq ($(findstring neon,$(CONFIG_CPU_TYPE))$(findstring aarch64,$(CONFIG_ARCH)),)
-       CONFIGURE_ARGS+= \
-               --enable-fixed-point
+       MESON_ARGS+= \
+               -Dfixed-point=true
 endif
 
 CPU_ASM_BLACKLIST:=xscale arm926ej-s
 ifneq ($(findstring $(call qstrip,$(CONFIG_CPU_TYPE)),$(CPU_ASM_BLACKLIST)),)
-       CONFIGURE_ARGS+= --disable-asm
+       MESON_ARGS+= -Dasm=disabled
 endif
 
 define Build/InstallDev
diff --git a/libs/opus/patches/010-fix-arm-build.patch b/libs/opus/patches/010-fix-arm-build.patch
deleted file mode 100644 (file)
index 9ac74a5..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-From 20c032d27c59d65b19b8ffbb2608e5282fe817eb Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= <tim@centricular.com>
-Date: Thu, 20 Apr 2023 19:06:13 +0100
-Subject: [PATCH] meson: fix build on arm64
-
-Would fail like:
-
-Checking if "compiler supports ARMv7/AArch64 NEON intrinsics" : links: NO
-Checking if "compiler supports ARMv7/AArch64 NEON intrinsics with -mfpu=neon" : links: YES
-Checking if "compiler supports AArch64 NEON intrinsics" : links: NO
-Checking if "compiler supports AArch64 NEON intrinsics with -mfpu=neon" : links: NO
-Message: Compiler does not support AArch64 NEON intrinsics
-../silk/meson.build:28:45: ERROR: Unknown variable "have_arm_intrinsics_or_asm".
-
-since commit 08088411259056f63774befb2d00951fdd5c46ba.
----
- meson.build | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/meson.build
-+++ b/meson.build
-@@ -574,8 +574,8 @@ foreach l : lines
- endforeach
- subdir('include')
--subdir('silk')
- subdir('celt')
-+subdir('silk')
- subdir('src')
- configure_file(output: 'config.h', configuration: opus_conf)
diff --git a/libs/opus/patches/010-fix-meson.patch b/libs/opus/patches/010-fix-meson.patch
new file mode 100644 (file)
index 0000000..658937e
--- /dev/null
@@ -0,0 +1,106 @@
+From 49d4effeea9107d18f6897255139d30fc80204df Mon Sep 17 00:00:00 2001
+From: Rudi Heitbaum <rudi@heitbaum.com>
+Date: Wed, 6 Mar 2024 11:21:07 +0000
+Subject: [PATCH] fix arm asm meson source build
+
+meson does mot support output with paths; add a meson.build file in the arm
+directory. The output files were being incorrectly placed in the celt/ directory.
+
+Program arm/arm2gnu.pl found: YES (/var/media/DATA/home-rudi/LibreELEC.kernel11/build.LibreELEC-H3.arm-12.0-devel/build/opus-v1.5.1/celt/arm/arm2gnu.pl)
+Configuring celt_pitch_xcorr_arm-gnu.S with command
+
+../celt/meson.build:51:25: ERROR: configure_file keyword argument "output" Output 'arm/armopts.s' must not contain a path segment.
+
+before:
+celt/celt_pitch_xcorr_arm-gnu.S
+
+after:
+celt/arm/celt_pitch_xcorr_arm-gnu.S
+celt/arm/armopts.s
+celt/arm/armopts-gnu.S
+
+Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
+Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
+---
+ celt/arm/meson.build | 12 ++++++++++++
+ celt/meson.build     |  9 +--------
+ 2 files changed, 13 insertions(+), 8 deletions(-)
+ create mode 100644 celt/arm/meson.build
+
+--- /dev/null
++++ b/celt/arm/meson.build
+@@ -0,0 +1,12 @@
++arm2gnu = [find_program('arm2gnu.pl')] + arm2gnu_args
++celt_sources_arm_asm = configure_file(input: 'celt_pitch_xcorr_arm.s',
++  output: '@BASENAME@-gnu.S',
++  command: arm2gnu + ['@INPUT@'],
++  capture: true)
++celt_arm_armopts_s_in = configure_file(input: 'armopts.s.in',
++  output: 'armopts.s',
++  configuration: opus_conf)
++celt_arm_armopts_s = configure_file(input: [celt_arm_armopts_s_in],
++  output: '@BASENAME@-gnu.S',
++  command: arm2gnu + ['@INPUT@'],
++  capture: true)
+--- a/celt/meson.build
++++ b/celt/meson.build
+@@ -43,14 +43,7 @@ if host_cpu_family in ['arm', 'aarch64']
+     celt_sources += sources['CELT_SOURCES_ARM_NE10']
+   endif
+   if opus_arm_external_asm
+-    arm2gnu = [find_program('arm/arm2gnu.pl')] + arm2gnu_args
+-    celt_sources_arm_asm = configure_file(input: 'arm/celt_pitch_xcorr_arm.s',
+-      output: '@BASENAME@-gnu.S',
+-      command: arm2gnu + ['@INPUT@'],
+-      capture: true)
+-    celt_arm_armopts_s = configure_file(input: 'arm/armopts.s.in',
+-      output: 'arm/armopts.s',
+-      configuration: opus_conf)
++    subdir('arm')
+     celt_static_libs += static_library('celt-armasm',
+       celt_arm_armopts_s, celt_sources_arm_asm,
+       install: false)
+--- a/meson.build
++++ b/meson.build
+@@ -252,6 +252,13 @@ if not opt_asm.disabled()
+         opus_conf.set('OPUS_ARM_INLINE_NEON', 1)
+         inline_optimization += ['NEON']
+       endif
++
++      # AS_ASM_ARM_DOTPROD
++      if cc.compiles(asm_tmpl.format('udot v0.4s,v1.16b,v2.16b'),
++                     name : 'assembler supports DOTPROD instructions on ARM')
++        opus_conf.set('OPUS_ARM_INLINE_DOTPROD', 1)
++        inline_optimization += ['DOTPROD']
++      endif
+     endif
+     # We need Perl to translate RVCT-syntax asm to gas syntax
+@@ -273,21 +280,24 @@ if not opt_asm.disabled()
+       opus_arm_may_have_neon = opus_conf.has('OPUS_ARM_INLINE_NEON')
+       opus_arm_presume_neon = opus_arm_may_have_neon and opus_can_presume_simd
++      opus_arm_may_have_dotprod = opus_conf.has('OPUS_ARM_INLINE_DOTPROD')
++      opus_arm_presume_dotprod = opus_arm_may_have_dotprod and opus_can_presume_simd
++
+       if not opt_rtcd.disabled()
+         if not opus_arm_may_have_edsp
+           message('Trying to force-enable armv5e EDSP instructions...')
+           # AS_ASM_ARM_EDSP_FORCE
+-          opus_arm_may_have_edsp = cc.compiles(asm_tmpl.format('.arch armv5te\n.object_arch armv4t\nqadd r3,r3,r3'),
++          opus_arm_may_have_edsp = cc.compiles(asm_tmpl.format('.arch armv5te;.object_arch armv4t;qadd r3,r3,r3'),
+                                                name : 'Assembler supports EDSP instructions on ARM (forced)')
+         endif
+         if not opus_arm_may_have_media
+           message('Trying to force-enable ARMv6 media instructions...')
+-          opus_arm_may_have_media = cc.compiles(asm_tmpl.format('.arch armv6\n.object_arch armv4t\nshadd8 r3,r3,r3'),
++          opus_arm_may_have_media = cc.compiles(asm_tmpl.format('.arch armv6;.object_arch armv4t;shadd8 r3,r3,r3'),
+                                                 name : 'Assembler supports ARMv6 media instructions on ARM (forced)')
+         endif
+         if not opus_arm_may_have_neon
+           message('Trying to force-enable NEON instructions...')
+-          opus_arm_may_have_neon = cc.compiles(asm_tmpl.format('.arch armv7-a\n.fpu neon\n.object_arch armv4t\nvorr d0,d0,d0'),
++          opus_arm_may_have_neon = cc.compiles(asm_tmpl.format('.arch armv7-a;.fpu neon;.object_arch armv4t;vorr d0,d0,d0'),
+                                                name : 'Assembler supports NEON instructions on ARM (forced)')
+         endif
+       endif