1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-21 13:10:33 +00:00

second part of alsaLib patch + comment

svn path=/nixpkgs/branches/stdenv-updates/; revision=19529
This commit is contained in:
Marc Weber 2010-01-18 19:15:36 +00:00
parent 907be69b26
commit 3b37933dd4
2 changed files with 50 additions and 1 deletions

View file

@ -62,3 +62,49 @@ index 74d1d1a..17ffb12 100644
}
}
#ifndef PIC
diff --git a/src/control/control.c b/src/control/control.c
index c090797..137fe57 100644
--- a/src/control/control.c
+++ b/src/control/control.c
@@ -854,8 +854,38 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name,
err = -ENOMEM;
goto _err;
}
+ sprintf(buf1, "%s/libasound_module_pcm_%s.so", ALSA_PLUGIN_DIR, str);
+ if (!file_exists(buf1)){
+ // 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?
+ char * saveptr;
+ while (1) {
+ char * dir_tok = strtok_r(pdirs, "::::", &saveptr); // "::::" to work around bug in glibc and -O2 ? ":" seems to cause a segfault
+ if (dir_tok == NULL)
+ break;
+ char * so_file = malloc(strlen(str) + strlen(dir_tok) + 32);
+ if (so_file == NULL) {
+ err = -ENOMEM;
+ goto _err;
+ }
+
+ sprintf(so_file, "%s/libasound_module_ctl_%s.so", dir_tok, str);
+
+ if (file_exists(so_file)){
+
+ free(buf1);
+ buf1 = so_file;
+ break;
+ } else {
+ free (so_file);
+ }
+ pdirs = NULL;
+ }
+ }
+ }
lib = buf1;
- sprintf(buf1, "%s/libasound_module_ctl_%s.so", ALSA_PLUGIN_DIR, str);
}
}
#ifndef PIC

View file

@ -28,7 +28,10 @@ stdenv.mkDerivation rec {
patches = [
/* allow specifying alternatives alsa plugin locations using
export ALSA_PLUGIN_DIRS=$(nix-build -A alsaPlugins)/lib/alsa-lib */
export ALSA_PLUGIN_DIRS=$(nix-build -A alsaPlugins)/lib/alsa-lib
This patch should be improved:
See http://thread.gmane.org/gmane.linux.distributions.nixos/3435
*/
./alsa-plugin-dirs.patch
];
}