[alsa] Handle plugin_dir for debian-based distro (#28287)

This commit is contained in:
nfarid 2023-01-12 07:20:50 +00:00 committed by GitHub
parent 23ceeba7ab
commit 5b750ad16b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 55 additions and 11 deletions

View File

@ -1,13 +1,47 @@
diff --git a/src/dlmisc.c b/src/dlmisc.c
index 1dd91356..19ee9cfa 100644
index f64c716..a413233 100644
--- a/src/dlmisc.c
+++ b/src/dlmisc.c
@@ -95,7 +95,7 @@ int snd_dlpath(char *path, size_t path_len, const char *name)
@@ -34,6 +34,9 @@
#endif
#include <limits.h>
+#include <sys/types.h>
+#include <dirent.h>
+
#if defined(HAVE_LIBDL) && defined(__GLIBC__) && !defined(__UCLIBC__)
#define DL_ORIGIN_AVAILABLE 1
#endif
@@ -79,6 +82,16 @@ static void snd_dlinfo_origin(char *path, size_t path_len)
#endif
}
+static unsigned int checkExist(const char* dirName) {
+ DIR* dir = opendir(dirName);
+ if(dir) {
+ closedir(dir);
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
/**
*
* \brief Compose the dynamic path
@@ -94,8 +107,14 @@ int snd_dlpath(char *path, size_t path_len, const char *name)
const char *env = getenv("ALSA_PLUGIN_DIR");
if (env) {
snd_plugin_dir = strdup(env);
+ } else if(checkExist(ALSA_PLUGIN_DIR) ) {
+ snd_plugin_dir = strdup(ALSA_PLUGIN_DIR);
+ } else if(sizeof(void*) == 8 && checkExist("/usr/lib64/alsa-lib") ) {
+ snd_plugin_dir = strdup("/usr/lib64/alsa-lib");
+ } else if(sizeof(void*) == 4 && checkExist("/usr/lib32/alsa-lib") ) {
+ snd_plugin_dir = strdup("/usr/lib32/alsa-lib");
} else {
- snd_dlinfo_origin(path, path_len);
+ snd_plugin_dir = strdup(ALSA_PLUGIN_DIR);
+ snd_plugin_dir = strdup("/usr/lib/alsa-lib");
}
snd_plugin_dir_set = 1;
}

View File

@ -25,12 +25,17 @@ else()
endif()
set(ARCH64 "x64;arm64")
set(ARCH32 "x86;arm")
if( (VCPKG_TARGET_ARCHITECTURE IN_LIST ARCH64) AND (EXISTS "/usr/lib64/alsa-lib") )
set(ALSA_PLUGIN_DIR "/usr/lib64/alsa-lib")
elseif( (VCPKG_TARGET_ARCHITECTURE IN_LIST ARCH32) AND (EXISTS "/usr/lib32/alsa-lib") )
set(ALSA_PLUGIN_DIR "/usr/lib32/alsa-lib")
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(ALSA_PLUGIN_DIR "/usr/lib/x86_64-linux-gnu/alsa-lib")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
set(ALSA_PLUGIN_DIR "/usr/lib/aarch64-linux-gnu/alsa-lib")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
set(ALSA_PLUGIN_DIR "/usr/lib/arm-linux-gnueabihf/alsa-lib")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "s390x")
set(ALSA_PLUGIN_DIR "/usr/lib/s390x-linux-gnu/alsa-lib")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "ppc64le")
set(ALSA_PLUGIN_DIR "/usr/lib/powerpc64le-linux-gnu/alsa-lib")
else()
set(ALSA_PLUGIN_DIR "/usr/lib/alsa-lib")
endif()

View File

@ -1,7 +1,7 @@
{
"name": "alsa",
"version": "1.2.6.1",
"port-version": 1,
"port-version": 2,
"description": "The Advanced Linux Sound Architecture (ALSA) - library",
"homepage": "https://www.alsa-project.org/",
"license": "LGPL-2.1-or-later",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "658bd201adf1ade8dcfceacc5678f4b790a799c8",
"version": "1.2.6.1",
"port-version": 2
},
{
"git-tree": "66750ac0b1a786a2fec12e88ca0e110b3f41d75e",
"version": "1.2.6.1",

View File

@ -82,7 +82,7 @@
},
"alsa": {
"baseline": "1.2.6.1",
"port-version": 1
"port-version": 2
},
"amd-amf": {
"baseline": "1.4.26",