[alsa-devel] [alsa-lib] Assorted patches for building on Android
Hello, This patch series is required for building alsa-lib on Android (I'm using this for my current PulseAudio-on-Android work). None of these changes introduce anything Android-specific, though. These could likely also be useful for other, non-GNU userspace implementations.
I'll eventually clean up and send in the build-system changes that I have, but this will likely need some more dialogue, since the CyanogenMod folks have a completely different approach from what we've taken (and I believe their solution, while simpler, is less complete).
Regards, Arun
This allows us to build in environments that don't provide stpcpy(). This makes it necessary to traverse the string twice, but should not be noticeable in clients since this function is very unlikely to be part of a performance-critical path.
Signed-off-by: Arun Raghavan arun.raghavan@collabora.co.uk --- src/control/control.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/control/control.c b/src/control/control.c index a0965c6..7ff59e6 100644 --- a/src/control/control.c +++ b/src/control/control.c @@ -417,8 +417,10 @@ int snd_ctl_elem_add_enumerated(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, info->value.enumerated.names_ptr = (uintptr_t)buf; info->value.enumerated.names_length = bytes; p = buf; - for (i = 0; i < items; ++i) - p = stpcpy(p, names[i]) + 1; + for (i = 0; i < items; ++i) { + strcpy(p, names[i]); + p += strlen(names[i]) + 1; + }
err = ctl->ops->element_add(ctl, info);
versionsort() is a GNU-ism and can't be relied on for non-GNU systems.
Signed-off-by: Arun Raghavan arun.raghavan@collabora.co.uk --- src/conf.c | 4 ++++ src/ucm/parser.c | 4 ++++ 2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/conf.c b/src/conf.c index 32446a2..2a3a03c 100644 --- a/src/conf.c +++ b/src/conf.c @@ -3505,7 +3505,11 @@ int snd_config_hook_load(snd_config_t *root, snd_config_t *config, snd_config_t struct dirent **namelist; int n;
+#ifdef _GNU_SOURCE n = scandir(fi[idx].name, &namelist, config_filename_filter, versionsort); +#else + n = scandir(fi[idx].name, &namelist, config_filename_filter, alphasort); +#endif if (n > 0) { int j; err = 0; diff --git a/src/ucm/parser.c b/src/ucm/parser.c index b93d832..e999619 100644 --- a/src/ucm/parser.c +++ b/src/ucm/parser.c @@ -1254,7 +1254,11 @@ int uc_mgr_scan_master_configs(const char **_list[]) "%s", env ? env : ALSA_USE_CASE_DIR); filename[MAX_FILE-1] = '\0';
+#ifdef _GNU_SOURCE err = scandir(filename, &namelist, filename_filter, versionsort); +#else + err = scandir(filename, &namelist, filename_filter, alphasort); +#endif if (err < 0) { err = -errno; uc_error("error: could not scan directory %s: %s",
Needed for the use of pthread_mutex_t
Signed-off-by: Arun Raghavan arun.raghavan@collabora.co.uk --- src/ucm/ucm_local.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/ucm/ucm_local.h b/src/ucm/ucm_local.h index 03d3ace..87f14a2 100644 --- a/src/ucm/ucm_local.h +++ b/src/ucm/ucm_local.h @@ -36,6 +36,7 @@ #define UC_MGR_DEBUG #endif
+#include <pthread.h> #include "local.h" #include "use-case.h"
Signed-off-by: Arun Raghavan arun.raghavan@collabora.co.uk --- utils/alsa.m4 | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/utils/alsa.m4 b/utils/alsa.m4 index 79a24ef..e12310d 100644 --- a/utils/alsa.m4 +++ b/utils/alsa.m4 @@ -57,6 +57,7 @@ LIBS="$ALSA_LIBS $LIBS" AC_MSG_RESULT($ALSA_LIBS)
dnl Check for a working version of libasound that is of the right version. +if test "x$enable_alsatest" = "xyes"; then min_alsa_version=ifelse([$1], ,0.1.1,$1) AC_MSG_CHECKING(for libasound headers version >= $min_alsa_version) no_alsa="" @@ -110,6 +111,7 @@ exit(0); alsa_found=no] ) AC_LANG_RESTORE +fi
dnl Now that we know that we have the right version, let's see if we have the library and not just the headers. if test "x$enable_alsatest" = "xyes"; then
At Tue, 17 Jul 2012 15:30:13 +0530, Arun Raghavan wrote:
Hello, This patch series is required for building alsa-lib on Android (I'm using this for my current PulseAudio-on-Android work). None of these changes introduce anything Android-specific, though. These could likely also be useful for other, non-GNU userspace implementations.
I'll eventually clean up and send in the build-system changes that I have, but this will likely need some more dialogue, since the CyanogenMod folks have a completely different approach from what we've taken (and I believe their solution, while simpler, is less complete).
Thanks for the patches. Applied now (with a few fix for coding style and minor clean up).
Takashi
participants (2)
-
Arun Raghavan
-
Takashi Iwai