Skip to content

Commit

Permalink
od: Add FLAC v1.3 for binary backwards compat
Browse files Browse the repository at this point in the history
ScummVM 2.6.1 gcw0 release is linked against libFLAC.so.8.
FLAC 1.4 so version is 12.

Signed-off-by: Gleb Mazovetskiy <[email protected]>
  • Loading branch information
glebm authored and pcercuei committed Dec 19, 2022
1 parent 976f473 commit 9c33974
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 0 deletions.
1 change: 1 addition & 0 deletions board/opendingux/Config.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
menu "OpenDingux packages"

source "$BR2_EXTERNAL_OPENDINGUX_PATH/package/bennugd/Config.in"
source "$BR2_EXTERNAL_OPENDINGUX_PATH/package/flac13/Config.in"
source "$BR2_EXTERNAL_OPENDINGUX_PATH/package/fonts-droid/Config.in"
source "$BR2_EXTERNAL_OPENDINGUX_PATH/package/gcwconnect/Config.in"
source "$BR2_EXTERNAL_OPENDINGUX_PATH/package/gl4es/Config.in"
Expand Down
81 changes: 81 additions & 0 deletions board/opendingux/package/flac13/0001-Fix-uclibc-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
From 4c62082f64132bfcbcb6569aa914c5ec283303f9 Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <[email protected]>
Date: Mon, 21 Feb 2022 18:21:11 +0100
Subject: [PATCH] Fix uclibc build

Commit 4fbb6d4f2ecf2a96c17ea9880108409f852c08a9 reverted commit
44036c9a9b45d03373fe90e9c112852bfc054c51 and so broke again the build on
uclibc

So put back the sys/auxv.h check as well as a getauxval check in a way
that doesn't break iOS

Signed-off-by: Fabrice Fontaine <[email protected]>
[Upstream status: https://github.com/xiph/flac/pull/292]
---
configure.ac | 5 ++++-
src/libFLAC/cpu.c | 9 ++++-----
2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index 4d7dc2e4..6f32fa45 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,7 +69,7 @@ AC_C_INLINE
AC_C_VARARRAYS
AC_C_TYPEOF

-AC_CHECK_HEADERS([stdint.h inttypes.h byteswap.h sys/param.h sys/ioctl.h termios.h x86intrin.h cpuid.h])
+AC_CHECK_HEADERS([stdint.h inttypes.h byteswap.h sys/auxv.h sys/param.h sys/ioctl.h termios.h x86intrin.h cpuid.h])

XIPH_C_BSWAP32
XIPH_C_BSWAP16
@@ -101,6 +101,9 @@ fi
# For the XMMS plugin.
AC_CHECK_TYPES(socklen_t, [], [])

+dnl check for getauxval in standard library
+AC_CHECK_FUNCS(getauxval)
+
dnl check for getopt in standard library
dnl AC_CHECK_FUNCS(getopt_long , , [LIBOBJS="$LIBOBJS getopt.o getopt1.o"] )
AC_CHECK_FUNCS(getopt_long, [], [])
diff --git a/src/libFLAC/cpu.c b/src/libFLAC/cpu.c
index 8b92f4c7..64c6acad 100644
--- a/src/libFLAC/cpu.c
+++ b/src/libFLAC/cpu.c
@@ -53,11 +53,9 @@
#define dfprintf(file, format, ...)
#endif

-#if defined FLAC__CPU_PPC
-#if defined(__linux__) || (defined(__FreeBSD__) && (__FreeBSD__ >= 12))
+#if defined(HAVE_SYS_AUXV_H)
#include <sys/auxv.h>
#endif
-#endif

#if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && (defined FLAC__HAS_NASM || FLAC__HAS_X86INTRIN) && !defined FLAC__NO_ASM

@@ -247,7 +245,7 @@ ppc_cpu_info (FLAC__CPUInfo *info)
#define PPC_FEATURE2_ARCH_2_07 0x80000000
#endif

-#ifdef __linux__
+#if defined (__linux__) && defined(HAVE_GETAUXVAL)
if (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_3_00) {
info->ppc.arch_3_00 = true;
} else if (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07) {
@@ -267,7 +265,8 @@ ppc_cpu_info (FLAC__CPUInfo *info)
info->ppc.arch_2_07 = false;
info->ppc.arch_3_00 = false;
#else
-#error Unsupported platform! Please add support for reading ppc hwcaps.
+ info->ppc.arch_2_07 = false;
+ info->ppc.arch_3_00 = false;
#endif

#else
--
2.34.1

10 changes: 10 additions & 0 deletions board/opendingux/package/flac13/Config.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
config BR2_PACKAGE_FLAC13
bool "flac13"
depends on BR2_USE_WCHAR
help
FLAC is an Open Source lossless audio codec.

http://flac.sourceforge.net/

comment "flac13 needs a toolchain w/ wchar"
depends on !BR2_USE_WCHAR
8 changes: 8 additions & 0 deletions board/opendingux/package/flac13/flac13.hash
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# From https://ftp.osuosl.org/pub/xiph/releases/flac/SHA1SUMS
sha1 99c28482a8b2d81deaf740639e4cb55658427420 flac-1.3.4.tar.xz
# From http://downloads.xiph.org/releases/flac/SHA256SUMS.txt
sha256 8ff0607e75a322dd7cd6ec48f4f225471404ae2730d0ea945127b1355155e737 flac-1.3.4.tar.xz
# Locally computed
sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643 COPYING.GPL
sha256 5df07007198989c622f5d41de8d703e7bef3d0e79d62e24332ee739a452af62a COPYING.LGPL
sha256 fa27cb11f13f97b0c5f3ff363b1e2610c6efe87ed175779cb2a78e44eb19d34c COPYING.Xiph
40 changes: 40 additions & 0 deletions board/opendingux/package/flac13/flac13.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
################################################################################
#
# flac13
#
################################################################################

FLAC13_VERSION = 1.3.4
FLAC13_SITE = http://downloads.xiph.org/releases/flac
FLAC13_SOURCE = flac-$(FLAC13_VERSION).tar.xz
FLAC13_INSTALL_STAGING = YES
FLAC13_DEPENDENCIES = $(if $(BR2_PACKAGE_LIBICONV),libiconv)
FLAC13_LICENSE = Xiph BSD-like (libFLAC), GPL-2.0+ (tools), LGPL-2.1+ (other libraries)
FLAC13_LICENSE_FILES = COPYING.Xiph COPYING.GPL COPYING.LGPL
FLAC13_CPE_ID_VENDOR = flac_project

# patch touching configure.ac
FLAC13_AUTORECONF = YES

FLAC13_CONF_OPTS = \
$(if $(BR2_POWERPC_CPU_HAS_ALTIVEC),--enable-altivec,--disable-altivec) \
$(if $(BR2_INSTALL_LIBSTDCPP),--enable-cpplibs,--disable-cpplibs) \
$(if $(BR2_POWERPC_CPU_HAS_VSX),--enable-vsx,--disable-vsx) \
--disable-xmms-plugin \
--disable-stack-smash-protection

ifeq ($(BR2_PACKAGE_LIBOGG),y)
FLAC13_CONF_OPTS += --with-ogg=$(STAGING_DIR)/usr
FLAC13_DEPENDENCIES += libogg
else
FLAC13_CONF_OPTS += --disable-ogg
endif

ifeq ($(BR2_X86_CPU_HAS_SSE),y)
FLAC13_DEPENDENCIES += host-nasm
FLAC13_CONF_OPTS += --enable-sse
else
FLAC13_CONF_OPTS += --disable-sse
endif

$(eval $(autotools-package))
1 change: 1 addition & 0 deletions configs/od_gcw0_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ BR2_TARGET_ROOTFS_SQUASHFS4_ZSTD=y
# BR2_TARGET_ROOTFS_TAR is not set
BR2_PACKAGE_HOST_MKPASSWD=y
BR2_PACKAGE_BENNUGD=y
BR2_PACKAGE_FLAC13=y
BR2_PACKAGE_GCWCONNECT=y
BR2_PACKAGE_GL4ES=y
BR2_PACKAGE_GMENU2X=y
Expand Down

0 comments on commit 9c33974

Please sign in to comment.