Skip to contentSkip to conversation

package/libmad: bump to version 0.16.5

PATCH New Yegor Yefremov 1 participant 1 message Nov 11

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/libmad: bump to version 0.16.5

The original libmad upstream has been dead since the 0.15.1b release in 2004. Switch to the fork maintained by the Tenacity project, which is packaged by most distributions:

https://codeberg.org/tenacityteam/libmad

This fork uses CMake instead of autotools, so:
- convert the package to cmake-package;
- drop the hand-written mad.pc, as upstream installs its own;
- drop all patches: the MIPS and CVE-2017-8372/8373/8374 fixes are included upstream, and the configure.ac ones are no longer needed. The CVEs only apply to 0.15.1b, so the IGNORE_CVES entries go too.

Add two patches:
- a backport of upstream commit 9dd96b40c5ca ("CMake: case of AND test"), without which CMake fails to configure on 32-bit ARM:

CMake Error at CMakeLists.txt:86 (if):
if given arguments:
"ASO" "and" "FALSE"
Unknown arguments specified

- a pending upstream fix for the PowerPC detection, without which PowerPC falls back to the generic, less accurate, fixed-point math.

The CMake build only offers a speed vs. accuracy choice and the architecture-specific optimizations, so:
- the "Default" optimization choice is removed, as CMake always selects speed or accuracy; speed is the new default, as upstream;
- the subband synthesis optimization option is removed, as it is implied by the speed optimization;
- the strict ISO/IEC interpretations option is removed. Add legacy entries for these options.

The ARM assembly optimizations are disabled upstream, so the ASO option no longer needs to depend on the CPU supporting the ARM instruction set. The FPM_ARM inline assembly still needs ARM mode, so keep forcing -marm on Thumb builds.

Assisted-by Claude:claude-opus-5-5
---
 .checkpackageignore                           |   2 -
 Config.in.legacy                              |  23 +
 .../libmad/0001-CMake-case-of-AND-test.patch  |  32 +
 .../0001-mips-h-constraint-removal.patch      |  72 --
 ...CMake-Fix-PPC-Architecture-Detection.patch |  32 +
 .../0002-configure-ac-automake-foreign.patch  |  16 -
 .../0003-drop-GCC-fforce-mem-option.patch     |  18 -
 package/libmad/0004-md_size.patch             |  63 --
 package/libmad/0005-length-check.patch        | 821 ------------------
 package/libmad/Config.in                      |  24 +-
 package/libmad/libmad.hash                    |   5 +-
 package/libmad/libmad.mk                      |  41 +-
 package/libmad/mad.pc                         |  11 -
 13 files changed, 103 insertions(+), 1057 deletions(-)
 create mode 100644 package/libmad/0001-CMake-case-of-AND-test.patch
 delete mode 100644 package/libmad/0001-mips-h-constraint-removal.patch
 create mode 100644 package/libmad/0002-CMake-Fix-PPC-Architecture-Detection.patch
 delete mode 100644 package/libmad/0002-configure-ac-automake-foreign.patch
 delete mode 100644 package/libmad/0003-drop-GCC-fforce-mem-option.patch
 delete mode 100644 package/libmad/0004-md_size.patch
 delete mode 100644 package/libmad/0005-length-check.patch
 delete mode 100644 package/libmad/mad.pc
.checkpackageignore +0 -2
index 25c668db54..ead02d6e02 100644
@@ -481,8 +481,6 @@ package/liblog4c-localtime/0004-Add-AC_CONFIG_MACRO_DIR-to-configure.in.patch li
 package/liblog4c-localtime/0005-Fix-C-support.patch lib_patch.Upstream
 package/libloki/0001-allow-to-install-to-a-specific-location-using-DESTDI.patch lib_patch.Upstream
 package/libloki/0002-use-ln-snf.patch lib_patch.Upstream
-package/libmad/0001-mips-h-constraint-removal.patch lib_patch.Sob lib_patch.Upstream
-package/libmad/0002-configure-ac-automake-foreign.patch lib_patch.Upstream
 package/libmng/0001-jpeg-9a.patch lib_patch.Upstream
 package/libmodsecurity/0001-modsecurity.pc.in-add-lstdc.patch lib_patch.Upstream
 package/libmpeg2/0001-altivec.patch lib_patch.Upstream
Config.in.legacy +23 -0
index 0ee4d04751..9ef6e68310 100644
@@ -146,6 +146,29 @@ endif
 
 comment "Legacy options removed in 2026.11"
 
+config BR2_PACKAGE_LIBMAD_OPTIMIZATION_DEFAULT
+	bool "libmad balanced optimization option removed"
+	select BR2_LEGACY
+	help
+	  libmad, since its switch to the CMake build system, no
+	  longer supports a balanced optimization mode. Choose between
+	  optimizing for speed or for accuracy instead.
+
+config BR2_PACKAGE_LIBMAD_SSO
+	bool "libmad subband synthesis optimization option removed"
+	select BR2_LEGACY
+	help
+	  libmad, since its switch to the CMake build system, no
+	  longer offers a separate option for the subband synthesis
+	  optimization. It is enabled when optimizing for speed.
+
+config BR2_PACKAGE_LIBMAD_STRICT_ISO
+	bool "libmad strict ISO/IEC interpretations option removed"
+	select BR2_LEGACY
+	help
+	  libmad, since its switch to the CMake build system, no
+	  longer offers an option for strict ISO/IEC interpretations.
+
 config BR2_KERNEL_HEADERS_7_2
 	bool "kernel headers version 7.2.x are no longer supported"
 	select BR2_LEGACY
package/libmad/0001-CMake-case-of-AND-test.patch new file +32 -0
new file mode 100644
index 0000000000..e01ef4b6da
@@ -0,0 +1,32 @@
+From 9dd96b40c5caf76fd1c6ef9dcc80ba330eb57a79 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <[email protected]>
+Date: Mon, 12 Oct 2026 12:50:15 +0200
+Subject: [PATCH] CMake: case of AND test
+
+Older cmake (3.17) reports an error:
+
+```
+CMake Error at CMakeLists.txt:86 (if):
+  if given arguments:
+    "ASO" "and" "FALSE"
+```
+
+Upstream: https://codeberg.org/tenacityteam/libmad/commit/9dd96b40c5caf76fd1c6ef9dcc80ba330eb57a79
+Signed-off-by: Yegor Yefremov <[email protected]>
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 3c4bf9f..4655feb 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -83,7 +83,7 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(x|i[3456])86")
+ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES ".*(arm|ARM).*")
+   message(STATUS "Using ARM fixed point math")
+   option (FPM_ARM "ARM fixed point math" ON)
+-  if(ASO and FALSE)
++  if(ASO AND FALSE)
+     enable_language(ASM)
+     list(APPEND MAD_CONFIG_DEFS ASO_INTERLEAVE1 ASO_IMDCT)
+     if (BUILD_SHARED_LIBS)
package/libmad/0001-mips-h-constraint-removal.patch deleted +0 -72

72 lines not on this page · raw message

package/libmad/0002-CMake-Fix-PPC-Architecture-Detection.patch new file +32 -0
new file mode 100644
index 0000000000..3004f58834
@@ -0,0 +1,32 @@
+From 755474a3a5bb32d50bfe5e36661ba022eec946a8 Mon Sep 17 00:00:00 2001
+From: Avery King <[email protected]>
+Date: Wed, 28 Oct 2026 08:03:47 -0700
+Subject: [PATCH] CMake: Fix PPC Architecture Detection
+
+Fix the regex for detecting PowerPC when determining which optimizations
+to enable.
+
+Reference-to: https://codeberg.org/tenacityteam/libmad/issues/44
+Upstream: https://codeberg.org/tenacityteam/libmad/pulls/45
+Signed-off-by: Avery King <[email protected]>
+Signed-off-by: Yegor Yefremov <[email protected]>
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 02df386..c10310c 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -100,7 +100,7 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES ".*(mips|MIPS).*")
+ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES ".*(sparc|SPARC).*")
+   message(STATUS "Using SPARC fixed point math")
+   option(FPM_SPARC "SPARC fixed point math" ON)
+-elseif(CMAKE_SYSTEM_PROCESSOR MATCHES ".(ppc|PPC|powerpc).*")
++elseif(CMAKE_SYSTEM_PROCESSOR MATCHES ".*(ppc|PPC|powerpc).*")
+   message(STATUS "Using PowerPC fixed point math")
+   option(FPM_PPC "PowerPC fixed point math" ON)
+ else()
+-- 
+2.56.0
+
package/libmad/0002-configure-ac-automake-foreign.patch deleted +0 -16
deleted file mode 100644
index 828ad0c152..0000000000
@@ -1,16 +0,0 @@
-configure.ac: don't require GNU-specific files when running automake
-
-Signed-off-by: Fabrice Fontaine <[email protected]>
-
-diff -ur libmad-0.15.1b-orig/configure.ac libmad-0.15.1b/configure.ac
---- libmad-0.15.1b-orig/configure.ac	2019-01-17 21:24:52.259194527 +0100
-+++ libmad-0.15.1b/configure.ac	2019-01-17 21:25:32.779481058 +0100
-@@ -26,7 +26,7 @@
- 
- AC_CONFIG_SRCDIR([decoder.h])
- 
--AM_INIT_AUTOMAKE
-+AM_INIT_AUTOMAKE([foreign])
- 
- AM_CONFIG_HEADER([config.h])
- 
package/libmad/0003-drop-GCC-fforce-mem-option.patch deleted +0 -18
deleted file mode 100644
index 25b685efd0..0000000000
@@ -1,18 +0,0 @@
-configure.ac: drop GCC "-fforce-mem" option 
-
-As reported at [1], the option has been removed from version 4.3 of GCC.
-
-[1] https://ez.analog.com/dsp/software-and-development-tools/linux-blackfin/linux-bug-archive/w/documents/7460/5626-build-lib-mad-fail-at-option--fforce-mem-with-gcc-4-3
-Signed-off-by: Dario Binacchi <[email protected]>
-Upstream: Dead
-
---- libmad-0.15.1b-orig/configure.ac	2024-07-02 14:26:40.657984791 +0200
-+++ libmad-0.15.1b/configure.ac	2024-07-02 14:27:07.098198997 +0200
-@@ -140,7 +140,6 @@
-     case "$optimize" in
- 	-O|"-O "*)
- 	    optimize="-O"
--	    optimize="$optimize -fforce-mem"
- 	    optimize="$optimize -fforce-addr"
- 	    : #x optimize="$optimize -finline-functions"
- 	    : #- optimize="$optimize -fstrength-reduce"
package/libmad/0004-md_size.patch deleted +0 -63

63 lines not on this page · raw message

package/libmad/0005-length-check.patch deleted +0 -821

821 lines not on this page · raw message

package/libmad/Config.in +4 -20
index 1d6bdd86e9..5a51b2ecff 100644
@@ -5,23 +5,19 @@ config BR2_PACKAGE_LIBMAD
 	  performed with fixed-point integer arithmetic, making it ideal
 	  for systems without a floating-point unit.
 
-	  http://www.underbit.com/products/mad/
+	  https://codeberg.org/tenacityteam/libmad
 
 if BR2_PACKAGE_LIBMAD
 
 choice
 	prompt "Speed vs. accuracy"
-	default BR2_PACKAGE_LIBMAD_OPTIMIZATION_DEFAULT
-
-config BR2_PACKAGE_LIBMAD_OPTIMIZATION_DEFAULT
-	bool "Default"
-	help
-	  Keep optimizations balanced between speed and accuracy.
+	default BR2_PACKAGE_LIBMAD_OPTIMIZATION_SPEED
 
 config BR2_PACKAGE_LIBMAD_OPTIMIZATION_SPEED
 	bool "Optimize for speed over accuracy"
 	help
-	  Compromise accuracy for speed.
+	  Compromise accuracy for speed. This also enables the
+	  subband synthesis optimization.
 
 config BR2_PACKAGE_LIBMAD_OPTIMIZATION_ACCURACY
 	bool "Optimize for accuracy over speed"
@@ -30,22 +26,10 @@ config BR2_PACKAGE_LIBMAD_OPTIMIZATION_ACCURACY
 
 endchoice
 
-config BR2_PACKAGE_LIBMAD_SSO
-	bool "Subband synthesis optimization"
-	help
-	  Use the subband synthesis optimization, with reduced accuracy.
-
 config BR2_PACKAGE_LIBMAD_ASO
 	bool "Architecture-specific optimizations"
 	default y
-	# arm optimization needs classic arm instructions support
-	depends on !(BR2_arm && !BR2_ARM_CPU_HAS_ARM)
 	help
 	  Use certain architecture-specific optimizations.
 
-config BR2_PACKAGE_LIBMAD_STRICT_ISO
-	bool "Strict ISO/IEC interpretations"
-	help
-	  Use strict ISO/IEC interpretations.
-
 endif
package/libmad/libmad.hash +2 -3
index 2be1a8a3a8..4fc5954b9d 100644
@@ -1,6 +1,5 @@
-# From http://snapshot.debian.org/archive/debian/20190310T213528Z/pool/main/libm/libmad/libmad_0.15.1b-10.dsc
-sha256  bbfac3ed6bfbc2823d3775ebb931087371e142bb0e9bb1bee51a76a6e0078690  libmad_0.15.1b.orig.tar.gz
-sha256  dfeabd5d2398bf902660edc31f87ad40600f0aa732b946f864d8ee6bbf56a99c  libmad_0.15.1b-10.diff.gz
+# From https://codeberg.org/tenacityteam/libmad/releases/tag/0.16.5
+sha256  f401b2ccf49c26ad0c3a6ef0179b1cbbff2406338b0603bb2033e6dcaf706114  libmad-0.16.5.tar.gz
 
 # Hash for license file:
 sha256  32b1062f7da84967e7019d01ab805935caa7ab7321a7ced0e30ebe75e5df1670  COPYING
package/libmad/libmad.mk +10 -31

54 lines not on this page · raw message

package/libmad/mad.pc deleted +0 -11
deleted file mode 100644
index 14af388661..0000000000
@@ -1,11 +0,0 @@
-prefix=/usr
-exec_prefix=${prefix}
-libdir=${exec_prefix}/lib
-includedir=${prefix}/include
-
-Name: mad
-Description: MPEG Audio Decoder
-Requires:
-Version: 0.15.1b
-Libs: -L${libdir} -lmad
-Cflags: -I${includedir}
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot