temp/alsa-lib: fork from Alpine (!794)

Added patch to support ALSA_PLUGIN_DIRS environment variable
This commit is contained in:
Daniele Debernardi 2019-12-07 01:07:50 +01:00 committed by Bart Ribbers
parent 6798ff9666
commit 62bc6bb2ec
No known key found for this signature in database
GPG key ID: 699D16185DAFAE61
3 changed files with 195 additions and 0 deletions

43
temp/alsa-lib/APKBUILD Normal file
View file

@ -0,0 +1,43 @@
# Forked from Alpine to support ALSA_PLUGIN_DIRS environment variable
pkgname=alsa-lib
pkgver=9999
_pkgver=1.2.1.2
pkgrel=0
pkgdesc="Advanced Linux Sound Architecture (ALSA) library"
url="http://www.alsa-project.org"
arch="all"
license="LGPL-2.1-or-later"
subpackages="$pkgname-dev $pkgname-dbg"
makedepends="linux-headers"
source="ftp://ftp.alsa-project.org/pub/lib/alsa-lib-$_pkgver.tar.bz2
remove-test.patch
alsa-plugin-dirs.patch"
builddir="$srcdir/$pkgname-$_pkgver"
build() {
./configure \
--build=$CBUILD \
--host=$CHOST \
--prefix=/usr \
--disable-python \
--disable-static \
--disable-resmgr \
--enable-rawmidi \
--enable-seq \
--enable-aload \
--disable-dependency-tracking \
--without-versioned
make
}
check() {
make check
}
package() {
make -j1 DESTDIR="$pkgdir" install
}
sha512sums="e8286fd55f63ee0d95513279d0885c287533de89b7af6c338413dec5d38ba4f5a15da1a4a4ce36e052614e4b730e3778782dab9979d82958283be17b48604913 alsa-lib-1.2.1.2.tar.bz2
e15318431fe2d5bd1e42ef793f223e3e5995890d7befe6daa3d7456ccf5cb2f51eb79171539cecae13032a9b8a798ea35e04c89b27c7ef9567e2c03fb8db4512 remove-test.patch
d7109e2c40a98b7fba321a4e4d6ce8cd8cd140ac7b2f68ef68c34aba1233de477f9d884d59e269e4c06d02a6dfcdebbe145560ddbddd3d8e90ac3df7c7d8e0e8 alsa-plugin-dirs.patch"

View file

@ -0,0 +1,67 @@
diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
index 1064044c..22d10a74 100644
--- a/src/pcm/pcm.c
+++ b/src/pcm/pcm.c
@@ -2479,6 +2479,18 @@ static const char *const build_in_pcms[] = {
NULL
};
+// helper funcion used below
+int file_exists(const char * filename)
+{
+ FILE * file;
+ if (file = fopen(filename, "r"))
+ {
+ fclose(file);
+ return 1;
+ }
+ return 0;
+}
+
static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
snd_config_t *pcm_root, snd_config_t *pcm_conf,
snd_pcm_stream_t stream, int mode)
@@ -2573,13 +2585,37 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
build_in++;
}
if (*build_in == NULL) {
- buf1 = malloc(strlen(str) + sizeof(ALSA_PLUGIN_DIR) + 32);
- if (buf1 == NULL) {
- err = -ENOMEM;
- goto _err;
+
+ // try to locate plugin in one of ALSA_PLUGIN_DIRS which is colon separated list of paths
+ char *pdirs = getenv("ALSA_PLUGIN_DIRS");
+ if (pdirs) { // env var set?
+ while (1) {
+ char *dir_tok = strtok(pdirs, ":");
+ if (dir_tok == NULL)
+ break;
+ buf1 = malloc(strlen(str) + strlen(dir_tok) + 32);
+ if (buf1 == NULL) {
+ err = -ENOMEM;
+ goto _err;
+ }
+
+ sprintf(buf1, "%s/libasound_module_pcm_%s.so", dir_tok, str);
+
+ if (file_exists(buf1)) {
+ lib = buf1;
+ break;
+ }
+ pdirs = NULL;
+ }
+ } else {
+ buf1 = malloc(strlen(str) + sizeof(ALSA_PLUGIN_DIR) + 32);
+ if (buf1 == NULL) {
+ err = -ENOMEM;
+ goto _err;
+ }
+ lib = buf1;
+ sprintf(buf1, "%s/libasound_module_pcm_%s.so", ALSA_PLUGIN_DIR, str);
}
- lib = buf1;
- sprintf(buf1, "%s/libasound_module_pcm_%s.so", ALSA_PLUGIN_DIR, str);
}
}
#ifndef PIC

View file

@ -0,0 +1,85 @@
diff --git a/test/Makefile.am b/test/Makefile.am
index 99c2c4f..ac7bae1 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -2,7 +2,7 @@ SUBDIRS=. lsb
check_PROGRAMS=control pcm pcm_min latency seq \
playmidi1 timer rawmidi midiloop \
- oldapi queue_timer namehint client_event_filter \
+ queue_timer namehint client_event_filter \
chmap audio_time user-ctl-element-set pcm-multi-thread
control_LDADD=../src/libasound.la
@@ -16,7 +16,6 @@ playmidi1_LDADD=../src/libasound.la
timer_LDADD=../src/libasound.la
rawmidi_LDADD=../src/libasound.la
midiloop_LDADD=../src/libasound.la
-oldapi_LDADD=../src/libasound.la
queue_timer_LDADD=../src/libasound.la
namehint_LDADD=../src/libasound.la
client_event_filter_LDADD=../src/libasound.la
diff --git a/test/Makefile.in b/test/Makefile.in
index d096226..699ae45 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -90,7 +90,7 @@ host_triplet = @host@
check_PROGRAMS = control$(EXEEXT) pcm$(EXEEXT) pcm_min$(EXEEXT) \
latency$(EXEEXT) seq$(EXEEXT) playmidi1$(EXEEXT) \
timer$(EXEEXT) rawmidi$(EXEEXT) midiloop$(EXEEXT) \
- oldapi$(EXEEXT) queue_timer$(EXEEXT) namehint$(EXEEXT) \
+ queue_timer$(EXEEXT) namehint$(EXEEXT) \
client_event_filter$(EXEEXT) chmap$(EXEEXT) \
audio_time$(EXEEXT) user-ctl-element-set$(EXEEXT) \
pcm-multi-thread$(EXEEXT)
@@ -136,9 +136,6 @@ midiloop_DEPENDENCIES = ../src/libasound.la
namehint_SOURCES = namehint.c
namehint_OBJECTS = namehint.$(OBJEXT)
namehint_DEPENDENCIES = ../src/libasound.la
-oldapi_SOURCES = oldapi.c
-oldapi_OBJECTS = oldapi.$(OBJEXT)
-oldapi_DEPENDENCIES = ../src/libasound.la
pcm_SOURCES = pcm.c
pcm_OBJECTS = pcm.$(OBJEXT)
pcm_DEPENDENCIES = ../src/libasound.la
@@ -222,11 +219,11 @@ am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = audio_time.c chmap.c client_event_filter.c control.c \
- latency.c midiloop.c namehint.c oldapi.c pcm.c \
+ latency.c midiloop.c namehint.c pcm.c \
pcm-multi-thread.c pcm_min.c playmidi1.c queue_timer.c \
rawmidi.c seq.c timer.c user-ctl-element-set.c
DIST_SOURCES = audio_time.c chmap.c client_event_filter.c control.c \
- latency.c midiloop.c namehint.c oldapi.c pcm.c \
+ latency.c midiloop.c namehint.c pcm.c \
pcm-multi-thread.c pcm_min.c playmidi1.c queue_timer.c \
rawmidi.c seq.c timer.c user-ctl-element-set.c
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
@@ -439,7 +436,6 @@ playmidi1_LDADD = ../src/libasound.la
timer_LDADD = ../src/libasound.la
rawmidi_LDADD = ../src/libasound.la
midiloop_LDADD = ../src/libasound.la
-oldapi_LDADD = ../src/libasound.la
queue_timer_LDADD = ../src/libasound.la
namehint_LDADD = ../src/libasound.la
client_event_filter_LDADD = ../src/libasound.la
@@ -524,10 +520,6 @@ namehint$(EXEEXT): $(namehint_OBJECTS) $(namehint_DEPENDENCIES) $(EXTRA_namehint
@rm -f namehint$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(namehint_OBJECTS) $(namehint_LDADD) $(LIBS)
-oldapi$(EXEEXT): $(oldapi_OBJECTS) $(oldapi_DEPENDENCIES) $(EXTRA_oldapi_DEPENDENCIES)
- @rm -f oldapi$(EXEEXT)
- $(AM_V_CCLD)$(LINK) $(oldapi_OBJECTS) $(oldapi_LDADD) $(LIBS)
-
pcm$(EXEEXT): $(pcm_OBJECTS) $(pcm_DEPENDENCIES) $(EXTRA_pcm_DEPENDENCIES)
@rm -f pcm$(EXEEXT)
$(AM_V_CCLD)$(pcm_LINK) $(pcm_OBJECTS) $(pcm_LDADD) $(LIBS)
@@ -577,7 +569,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/latency.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/midiloop.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/namehint.Po@am__quote@ # am--include-marker
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oldapi.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm-multi-thread.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_min.Po@am__quote@ # am--include-marker