summaryrefslogtreecommitdiff
path: root/repo/sbc
diff options
context:
space:
mode:
Diffstat (limited to 'repo/sbc')
-rw-r--r--repo/sbc/fix-build-on-non-x86.patch45
-rw-r--r--repo/sbc/sbc.xibuild31
2 files changed, 76 insertions, 0 deletions
diff --git a/repo/sbc/fix-build-on-non-x86.patch b/repo/sbc/fix-build-on-non-x86.patch
new file mode 100644
index 0000000..0d54ae2
--- /dev/null
+++ b/repo/sbc/fix-build-on-non-x86.patch
@@ -0,0 +1,45 @@
+From 909a9bdf7ab143e1f0baaf9736baebd3cd79aacf Mon Sep 17 00:00:00 2001
+From: Marius Bakke <marius@gnu.org>
+Date: Tue, 22 Dec 2020 11:04:26 +0000
+Subject: [PATCH] sbc_primitives: Fix build on non-x86.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Don't call __builtin_cpu_init unless targeting i386 or x86_64.
+Otherwise we get an error at link time:
+
+ CC sbc/sbc_primitives.lo
+sbc/sbc_primitives.c: In function ‘sbc_init_primitives_x86’:
+sbc/sbc_primitives.c:596:2: warning: implicit declaration of function ‘__builtin_cpu_init’; did you mean ‘__builtin_irint’? [-Wimplicit-function-declaration]
+[...]
+ CCLD src/sbcdec
+ld: sbc/.libs/libsbc-private.a(sbc_primitives.o): in function `sbc_init_primitives':
+sbc_primitives.c:(.text+0x3a30): undefined reference to `__builtin_cpu_init'
+---
+ sbc/sbc_primitives.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/sbc/sbc_primitives.c b/sbc/sbc_primitives.c
+index 97a75be..09c214a 100644
+--- a/sbc/sbc_primitives.c
++++ b/sbc/sbc_primitives.c
+@@ -593,6 +593,7 @@ static int sbc_calc_scalefactors_j(
+
+ static void sbc_init_primitives_x86(struct sbc_encoder_state *state)
+ {
++#if defined(__x86_64__) || defined(__i386__)
+ __builtin_cpu_init();
+
+ #ifdef SBC_BUILD_WITH_MMX_SUPPORT
+@@ -604,6 +605,7 @@ static void sbc_init_primitives_x86(struct sbc_encoder_state *state)
+ if (__builtin_cpu_supports("sse4.2"))
+ sbc_init_primitives_sse(state);
+ #endif
++#endif
+ }
+
+ /*
+--
+2.30.1
+
diff --git a/repo/sbc/sbc.xibuild b/repo/sbc/sbc.xibuild
new file mode 100644
index 0000000..39e618f
--- /dev/null
+++ b/repo/sbc/sbc.xibuild
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+NAME="sbc"
+DESC="Bluetooth Subband Codec (SBC) library"
+
+MAKEDEPS="libsndfile linux-headers flac libvorbis libogg opus"
+
+PKG_VER=1.5
+SOURCE="https://www.kernel.org/pub/linux/bluetooth/sbc-$PKG_VER.tar.xz"
+
+ADDITIONAL="
+fix-build-on-non-x86.patch
+"
+prepare () {
+ apply_patches
+}
+
+build() {
+ ./configure \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --localstatedir=/var \
+ --disable-static
+ make
+}
+
+package() {
+ make DESTDIR="$PKG_DEST" install
+}