From 0a8c5c2acd334e499247c6f3b629152797e16ccd Mon Sep 17 00:00:00 2001
From: Carlo Landmeter <clandmeter@gmail.com>
Date: Tue, 31 Mar 2015 10:25:27 +0000
Subject: [PATCH] testing/squeezelite: new aport

---
 ...ly-run-glibc-specific-hacks-on-glibc.patch | 25 ++++++++
 .../squeezelite/0001-respect-LDFLAGS.patch    | 61 +++++++++++++++++++
 testing/squeezelite/APKBUILD                  | 51 ++++++++++++++++
 3 files changed, 137 insertions(+)
 create mode 100644 testing/squeezelite/0001-only-run-glibc-specific-hacks-on-glibc.patch
 create mode 100644 testing/squeezelite/0001-respect-LDFLAGS.patch
 create mode 100644 testing/squeezelite/APKBUILD

diff --git a/testing/squeezelite/0001-only-run-glibc-specific-hacks-on-glibc.patch b/testing/squeezelite/0001-only-run-glibc-specific-hacks-on-glibc.patch
new file mode 100644
index 000000000000..5dbe25493c58
--- /dev/null
+++ b/testing/squeezelite/0001-only-run-glibc-specific-hacks-on-glibc.patch
@@ -0,0 +1,25 @@
+From d898fac929cd093bb39af3f517158777c21c06ef Mon Sep 17 00:00:00 2001
+From: Carlo Landmeter <clandmeter@gmail.com>
+Date: Tue, 31 Mar 2015 10:07:14 +0000
+Subject: [PATCH] only run glibc specific hacks on glibc
+
+---
+ output_alsa.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/output_alsa.c b/output_alsa.c
+index aa01560..c1b5435 100644
+--- a/output_alsa.c
++++ b/output_alsa.c
+@@ -853,7 +853,7 @@ void output_init_alsa(log_level level, const char *device, unsigned output_buf_s
+ 		set_mixer(output.device, volume_mixer_name, volume_mixer_index ? atoi(volume_mixer_index) : 0, true, 0, 0);
+ 	}
+ 
+-#if LINUX
++#if defined(__GLIBC__)
+ 	// RT linux - aim to avoid pagefaults by locking memory: 
+ 	// https://rt.wiki.kernel.org/index.php/Threaded_RT-application_with_memory_locking_and_stack_handling_example
+ 	if (mlockall(MCL_CURRENT | MCL_FUTURE) == -1) {
+-- 
+2.3.4
+
diff --git a/testing/squeezelite/0001-respect-LDFLAGS.patch b/testing/squeezelite/0001-respect-LDFLAGS.patch
new file mode 100644
index 000000000000..8ce873d39c2b
--- /dev/null
+++ b/testing/squeezelite/0001-respect-LDFLAGS.patch
@@ -0,0 +1,61 @@
+From 1c53ed7db5b49ebf347efe65dbf9b740f9d54557 Mon Sep 17 00:00:00 2001
+From: Carlo Landmeter <clandmeter@gmail.com>
+Date: Tue, 31 Mar 2015 09:52:53 +0000
+Subject: [PATCH] respect LDFLAGS
+
+---
+ Makefile | 17 +++++++++--------
+ 1 file changed, 9 insertions(+), 8 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index dca2abd..119c751 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,6 +1,7 @@
+ # Cross compile support - create a Makefile which defines these three variables and then includes this Makefile...
+-CFLAGS  ?= -Wall -fPIC -O2 $(OPTS)
+-LDFLAGS ?= -lasound -lpthread -lm -lrt
++CFLAGS  ?= -Wall -O2
++CFLAGS  += -fPIC $(OPTS)
++LIBS ?= -lasound -lpthread -lm -lrt
+ EXECUTABLE ?= squeezelite
+ 
+ # passing one or more of these in $(OPTS) enables optional feature inclusion
+@@ -52,20 +53,20 @@ endif
+ 
+ # add optional link options
+ ifneq (,$(findstring $(OPT_LINKALL), $(CFLAGS)))
+-	LDFLAGS += $(LINKALL)
++	LIBS += $(LINKALL)
+ ifneq (,$(findstring $(OPT_FF), $(CFLAGS)))
+-	LDFLAGS += $(LINKALL_FF)
++	LIBS += $(LINKALL_FF)
+ endif
+ ifneq (,$(findstring $(OPT_RESAMPLE), $(CFLAGS)))
+-	LDFLAGS += $(LINKALL_RESAMPLE)
++	LIBS += $(LINKALL_RESAMPLE)
+ endif
+ ifneq (,$(findstring $(OPT_IR), $(CFLAGS)))
+-	LDFLAGS += $(LINKALL_IR)
++	LIBS += $(LINKALL_IR)
+ endif
+ else
+ # if not LINKALL and linux add LINK_LINUX
+ ifeq ($(UNAME), Linux)
+-	LDFLAGS += $(LINK_LINUX)
++	LIBS += $(LINK_LINUX)
+ endif
+ endif
+ 
+@@ -74,7 +75,7 @@ OBJECTS = $(SOURCES:.c=.o)
+ all: $(EXECUTABLE)
+ 
+ $(EXECUTABLE): $(OBJECTS)
+-	$(CC) $(OBJECTS) $(LDFLAGS) -o $@
++	$(CC) $(OBJECTS) $(LDFLAGS) $(LIBS) -o $@
+ 
+ $(OBJECTS): $(DEPS)
+ 
+-- 
+2.3.4
+
diff --git a/testing/squeezelite/APKBUILD b/testing/squeezelite/APKBUILD
new file mode 100644
index 000000000000..aceeccb2bd67
--- /dev/null
+++ b/testing/squeezelite/APKBUILD
@@ -0,0 +1,51 @@
+# Contributor: Carlo Landmeter <clandmeter@gmail.com>
+# Maintainer:
+pkgname=squeezelite
+pkgver=1.8
+pkgrel=0
+pkgdesc="lightweight headless squeezebox emulator"
+url="https://code.google.com/p/squeezelite"
+arch="all"
+license="GPLv3"
+depends=""
+depends_dev="alsa-lib-dev faad2-dev flac-dev libmad-dev soxr-dev
+	libvorbis-dev mpg123-dev"
+makedepends="$depends_dev"
+install=""
+subpackages=""
+source="$pkgname-$pkgver.tar.gz::https://squeezelite.googlecode.com/archive/v1.8.tar.gz
+	0001-only-run-glibc-specific-hacks-on-glibc.patch
+	0001-respect-LDFLAGS.patch"
+
+_builddir="$srcdir/$pkgname-v$pkgver"
+
+prepare() {
+	local i
+	cd "$_builddir"
+	for i in $source; do
+		case $i in
+		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+		esac
+	done
+}
+
+build() {
+	cd "$_builddir"
+	OPTS="-DLINKALL -DRESAMPLE -DDSD" make || return 1 
+}
+
+package() {
+	cd "$_builddir"
+	install -m755 -D $pkgname \
+		$pkgdir/usr/bin/$pkgname || return 1
+}
+
+md5sums="35e3fa189019e41ba156286ea332794f  squeezelite-1.8.tar.gz
+14bc562281e8c5e8faf947d3f9f65cf0  0001-only-run-glibc-specific-hacks-on-glibc.patch
+06dbeeeb3941f64ba29925a8ada76597  0001-respect-LDFLAGS.patch"
+sha256sums="8d0d5434b594243b753d2f65c886202f1290efeef83fb31c2872db83f1102cd1  squeezelite-1.8.tar.gz
+d0929efb834d80d5f6616607d4b883bf75094c37a687d05a1cbdaeb6db68e79d  0001-only-run-glibc-specific-hacks-on-glibc.patch
+6bc4ac51359dce464e3489fa5823cb009bad2253365f999fcda979be236b5d8e  0001-respect-LDFLAGS.patch"
+sha512sums="26ad54a6520955f55222b69a2f2fcb34dccca5f0846a5b001456fbe17e0817331343728f0df6a677932a7b52428649b78f10f7f6e057798732b1477211dbd1af  squeezelite-1.8.tar.gz
+2146c7878f693cddb6b6cbce496946a38f7b3454b67789010a001942def5eacf7af79afb9745859c3ee047706beebec988fc50405eeceb59e0b743be59495786  0001-only-run-glibc-specific-hacks-on-glibc.patch
+5aeb611275df9b09c562fef9c85392b829c48d498f8c683bafae215d9ca81fbe54c7d68c737930c2f9d7d7017b981057cd55d786af909c252a975206083efaff  0001-respect-LDFLAGS.patch"
-- 
GitLab