From 3272bcfd5657c4b7ff2776d0697318ca265b32c7 Mon Sep 17 00:00:00 2001 From: 宋文武 Date: Tue, 26 Jun 2018 20:28:39 +0800 Subject: Revert "gnu: gnu: Make alsa find its plugins by setting ALSA_PLUGIN_DIR." This reverts commit 2101cc3fb691f443b830fdf5f846ded5fa018739. With commit 1e3861eb, we can do it without ALSA_PLUGIN_DIR. See for details. --- gnu/local.mk | 1 - gnu/packages/linux.scm | 9 +- .../alsa-lib-add-environment-variable.patch | 110 --------------------- 3 files changed, 1 insertion(+), 119 deletions(-) delete mode 100644 gnu/packages/patches/alsa-lib-add-environment-variable.patch (limited to 'gnu') diff --git a/gnu/local.mk b/gnu/local.mk index 5b915317d9..672c002eb6 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -563,7 +563,6 @@ dist_patch_DATA = \ %D%/packages/patches/aegis-test-fixup-1.patch \ %D%/packages/patches/aegis-test-fixup-2.patch \ %D%/packages/patches/agg-am_c_prototype.patch \ - %D%/packages/patches/alsa-lib-add-environment-variable.patch \ %D%/packages/patches/amule-crypto-6.patch \ %D%/packages/patches/ansible-wrap-program-hack.patch \ %D%/packages/patches/antiword-CVE-2014-8123.patch \ diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 7367b953f7..a28aa5a2ea 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -981,15 +981,8 @@ intercept and print the system calls executed by the program.") version ".tar.bz2")) (sha256 (base32 - "096pwrnhj36yndldvs2pj4r871zhcgisks0is78f1jkjn9sd4b2z")) - (patches (search-patches "alsa-lib-add-environment-variable.patch")))) + "096pwrnhj36yndldvs2pj4r871zhcgisks0is78f1jkjn9sd4b2z")))) (build-system gnu-build-system) - (native-search-paths - (list (search-path-specification - (variable "ALSA_PLUGIN_DIR") - (file-type 'regular) - (separator #f) ;single entry - (files '("lib/alsa-lib"))))) (home-page "https://www.alsa-project.org/") (synopsis "The Advanced Linux Sound Architecture libraries") (description diff --git a/gnu/packages/patches/alsa-lib-add-environment-variable.patch b/gnu/packages/patches/alsa-lib-add-environment-variable.patch deleted file mode 100644 index a468a7fc4f..0000000000 --- a/gnu/packages/patches/alsa-lib-add-environment-variable.patch +++ /dev/null @@ -1,110 +0,0 @@ -From 1822fb453128a1b5de93b4c590cd272d6488a077 Mon Sep 17 00:00:00 2001 -From: Julien Lepiller -Date: Fri, 25 May 2018 19:26:58 +0200 -Subject: [PATCH] Add support for a ALSA_PLUGIN_DIR environment variable. - -If it is not set, default to previous behavior. ---- - src/control/control.c | 6 +++++- - src/dlmisc.c | 9 +++++++-- - src/pcm/pcm.c | 9 +++++++-- - src/pcm/pcm_rate.c | 13 +++++++++---- - 4 files changed, 28 insertions(+), 9 deletions(-) - -diff --git a/src/control/control.c b/src/control/control.c -index 11f7815..9dba7dd 100644 ---- a/src/control/control.c -+++ b/src/control/control.c -@@ -1331,7 +1331,11 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name, - build_in++; - } - if (*build_in == NULL) { -- buf1 = malloc(strlen(str) + sizeof(ALSA_PLUGIN_DIR) + 32); -+ char* plugdir = ALSA_PLUGIN_DIR; -+ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); -+ if(envplugdir != NULL) -+ plugdir = envplugdir; -+ buf1 = malloc(strlen(str) + strlen(plugdir) + 32); - if (buf1 == NULL) { - err = -ENOMEM; - goto _err; -diff --git a/src/dlmisc.c b/src/dlmisc.c -index 3757d33..92aa864 100644 ---- a/src/dlmisc.c -+++ b/src/dlmisc.c -@@ -82,9 +82,14 @@ void *snd_dlopen(const char *name, int mode, char *errbuf, size_t errbuflen) - char *filename = NULL; - - if (name && name[0] != '/') { -- filename = alloca(sizeof(ALSA_PLUGIN_DIR) + 1 + strlen(name) + 1); -+ char* plugdir = ALSA_PLUGIN_DIR; -+ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); -+ if(envplugdir != NULL) -+ plugdir = envplugdir; -+ -+ filename = malloc(strlen(plugdir) + 1 + strlen(name) + 1); - if (filename) { -- strcpy(filename, ALSA_PLUGIN_DIR); -+ strcpy(filename, plugdir); - strcat(filename, "/"); - strcat(filename, name); - handle = dlopen(filename, mode); -diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c -index 11aec80..590e8b6 100644 ---- a/src/pcm/pcm.c -+++ b/src/pcm/pcm.c -@@ -2496,13 +2496,18 @@ 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); -+ char* plugdir = ALSA_PLUGIN_DIR; -+ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); -+ if(envplugdir != NULL) -+ plugdir = envplugdir; -+ buf1 = malloc(strlen(str) + strlen(plugdir) + 32); -+ - if (buf1 == NULL) { - err = -ENOMEM; - goto _err; - } - lib = buf1; -- sprintf(buf1, "%s/libasound_module_pcm_%s.so", ALSA_PLUGIN_DIR, str); -+ sprintf(buf1, "%s/libasound_module_pcm_%s.so", plugdir, str); - } - } - #ifndef PIC -diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c -index 4e0c7ca..8694a38 100644 ---- a/src/pcm/pcm_rate.c -+++ b/src/pcm/pcm_rate.c -@@ -1260,7 +1260,8 @@ static const char *const default_rate_plugins[] = { - - static int rate_open_func(snd_pcm_rate_t *rate, const char *type, const snd_config_t *converter_conf, int verbose) - { -- char open_name[64], open_conf_name[64], lib_name[128], *lib = NULL; -+ char open_name[64], open_conf_name[64], *lib = NULL; -+ char *buf1; - snd_pcm_rate_open_func_t open_func; - snd_pcm_rate_open_conf_func_t open_conf_func; - int err; -@@ -1268,9 +1269,13 @@ static int rate_open_func(snd_pcm_rate_t *rate, const char *type, const snd_conf - snprintf(open_name, sizeof(open_name), "_snd_pcm_rate_%s_open", type); - snprintf(open_conf_name, sizeof(open_conf_name), "_snd_pcm_rate_%s_open_conf", type); - if (!is_builtin_plugin(type)) { -- snprintf(lib_name, sizeof(lib_name), -- "%s/libasound_module_rate_%s.so", ALSA_PLUGIN_DIR, type); -- lib = lib_name; -+ char* plugdir = ALSA_PLUGIN_DIR; -+ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); -+ if(envplugdir != NULL) -+ plugdir = envplugdir; -+ buf1 = malloc(strlen(type) + strlen(plugdir) + 32); -+ sprintf(buf1, "%s/libasound_module_rate_%s.so", plugdir, type); -+ lib = buf1; - } - - rate->rate_min = SND_PCM_PLUGIN_RATE_MIN; --- -2.17.0 - -- cgit v1.2.3