All of lore.kernel.org
 help / color / mirror / Atom feed
* Android porting of alsa-lib
@ 2019-03-15  9:17 Chih-Wei Huang
  2019-03-15  9:17 ` [PATCH 1/5] Android: avoid using versionsort Chih-Wei Huang
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Chih-Wei Huang @ 2019-03-15  9:17 UTC (permalink / raw)
  To: patch; +Cc: alsa-devel

Tested OK on Android-x86 pie-x86 branch.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/5] Android: avoid using versionsort
  2019-03-15  9:17 Android porting of alsa-lib Chih-Wei Huang
@ 2019-03-15  9:17 ` Chih-Wei Huang
  2019-03-15  9:17 ` [PATCH 2/5] pcm: add the missing <strings.h> include Chih-Wei Huang
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Chih-Wei Huang @ 2019-03-15  9:17 UTC (permalink / raw)
  To: patch; +Cc: alsa-devel, Chih-Wei Huang

Android doesn't have versionsort yet.

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
---
 src/conf.c       | 2 +-
 src/ucm/parser.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/conf.c b/src/conf.c
index b8db490c..cda5518e 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -3750,7 +3750,7 @@ int snd_config_hook_load(snd_config_t *root, snd_config_t *config, snd_config_t
 			int n;
 
 #ifndef DOC_HIDDEN
-#if defined(_GNU_SOURCE) && !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__sun)
+#if defined(_GNU_SOURCE) && !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__sun) && !defined(ANDROID)
 #define SORTFUNC	versionsort
 #else
 #define SORTFUNC	alphasort
diff --git a/src/ucm/parser.c b/src/ucm/parser.c
index 5e1a8862..ad6bcec7 100644
--- a/src/ucm/parser.c
+++ b/src/ucm/parser.c
@@ -1532,7 +1532,7 @@ int uc_mgr_scan_master_configs(const char **_list[])
 			 snd_config_topdir());
 	filename[MAX_FILE-1] = '\0';
 
-#if defined(_GNU_SOURCE) && !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__sun)
+#if defined(_GNU_SOURCE) && !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__sun) && !defined(ANDROID)
 #define SORTFUNC	versionsort
 #else
 #define SORTFUNC	alphasort
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/5] pcm: add the missing <strings.h> include
  2019-03-15  9:17 Android porting of alsa-lib Chih-Wei Huang
  2019-03-15  9:17 ` [PATCH 1/5] Android: avoid using versionsort Chih-Wei Huang
@ 2019-03-15  9:17 ` Chih-Wei Huang
  2019-03-15  9:17 ` [PATCH 3/5] alisp: add the missing include Chih-Wei Huang
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Chih-Wei Huang @ 2019-03-15  9:17 UTC (permalink / raw)
  To: patch; +Cc: alsa-devel, Chih-Wei Huang

To define the prototype of ffs. See 'man ffs'.

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
---
 src/pcm/mask_inline.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/pcm/mask_inline.h b/src/pcm/mask_inline.h
index e9fb9f81..75ad3594 100644
--- a/src/pcm/mask_inline.h
+++ b/src/pcm/mask_inline.h
@@ -19,6 +19,7 @@
  *
  */
   
+#include <strings.h>
 #include <sys/types.h>
 
 #define MASK_INLINE static inline
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/5] alisp: add the missing include
  2019-03-15  9:17 Android porting of alsa-lib Chih-Wei Huang
  2019-03-15  9:17 ` [PATCH 1/5] Android: avoid using versionsort Chih-Wei Huang
  2019-03-15  9:17 ` [PATCH 2/5] pcm: add the missing <strings.h> include Chih-Wei Huang
@ 2019-03-15  9:17 ` Chih-Wei Huang
  2019-03-15  9:17 ` [PATCH 4/5] Android: avoid link_warning Chih-Wei Huang
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Chih-Wei Huang @ 2019-03-15  9:17 UTC (permalink / raw)
  To: patch; +Cc: alsa-devel, Chih-Wei Huang

Commit d4e08c5e865 changed to use internal versioned functions.
However, the header is not included. It generates the errors:

 In file included from external/alsa-lib/src/alisp/alisp.c:3038:
 external/alsa-lib/src/alisp/alisp_snd.c:583:64: error: implicit declaration of function '__snd_ctl_elem_info_get_dimension' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                         p2 = add_cons2(instance, p2, idx > 0, new_integer(instance, INTERNAL(snd_ctl_elem_info_get_dimension)(&info, idx)));
                                                                                    ^
 external/alsa-lib/include/alsa-symbols.h:30:24: note: expanded from macro 'INTERNAL'
 #define INTERNAL(Name) INTERNAL_CONCAT2_2(__, Name)
                        ^
 external/alsa-lib/include/alsa-symbols.h:29:39: note: expanded from macro 'INTERNAL_CONCAT2_2'
 #define INTERNAL_CONCAT2_2(Pre, Post) Pre##Post
                                      ^
 <scratch space>:396:1: note: expanded from here
 __snd_ctl_elem_info_get_dimension
 ^
 external/alsa-lib/src/alisp/alisp_snd.c:583:64: note: did you mean '__snd_ctl_elem_info_get_dimensions'?
 external/alsa-lib/include/alsa-symbols.h:30:24: note: expanded from macro 'INTERNAL'
 #define INTERNAL(Name) INTERNAL_CONCAT2_2(__, Name)
                       ^
 external/alsa-lib/include/alsa-symbols.h:29:39: note: expanded from macro 'INTERNAL_CONCAT2_2'
 #define INTERNAL_CONCAT2_2(Pre, Post) Pre##Post
                                      ^
 <scratch space>:396:1: note: expanded from here
 __snd_ctl_elem_info_get_dimension
 ^
 external/alsa-lib/src/alisp/alisp_snd.c:578:8: note: '__snd_ctl_elem_info_get_dimensions' declared here
         err = INTERNAL(snd_ctl_elem_info_get_dimensions)(&info);
               ^
 external/alsa-lib/include/alsa-symbols.h:30:24: note: expanded from macro 'INTERNAL'
 #define INTERNAL(Name) INTERNAL_CONCAT2_2(__, Name)
                        ^
 external/alsa-lib/include/alsa-symbols.h:29:39: note: expanded from macro 'INTERNAL_CONCAT2_2'
 #define INTERNAL_CONCAT2_2(Pre, Post) Pre##Post
                                       ^
 <scratch space>:395:1: note: expanded from here
 __snd_ctl_elem_info_get_dimensions
 ^
 2 errors generated.

Fixes: d4e08c5e865 ("control: Proper reference of internal versioned functions")
Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
---
 src/alisp/alisp_snd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/alisp/alisp_snd.c b/src/alisp/alisp_snd.c
index 16115236..744dce90 100644
--- a/src/alisp/alisp_snd.c
+++ b/src/alisp/alisp_snd.c
@@ -19,6 +19,8 @@
  *
  */
 
+#include "../control/control_local.h"
+
 struct acall_table {
 	const char *name;
 	struct alisp_object * (*func) (struct alisp_instance *instance, struct acall_table * item, struct alisp_object * args);
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 4/5] Android: avoid link_warning
  2019-03-15  9:17 Android porting of alsa-lib Chih-Wei Huang
                   ` (2 preceding siblings ...)
  2019-03-15  9:17 ` [PATCH 3/5] alisp: add the missing include Chih-Wei Huang
@ 2019-03-15  9:17 ` Chih-Wei Huang
  2019-03-15 12:18   ` Jaroslav Kysela
  2019-03-15  9:17 ` [PATCH 5/5] Android: add makefile and config.h Chih-Wei Huang
  2019-03-15 12:22 ` Android porting of alsa-lib Jaroslav Kysela
  5 siblings, 1 reply; 12+ messages in thread
From: Chih-Wei Huang @ 2019-03-15  9:17 UTC (permalink / raw)
  To: patch; +Cc: alsa-devel, Chih-Wei Huang

It will be treated as an error.

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
---
 src/pcm/pcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
index 11aec805..4bb5fe5f 100644
--- a/src/pcm/pcm.c
+++ b/src/pcm/pcm.c
@@ -1053,7 +1053,7 @@ int snd_pcm_hwsync(snd_pcm_t *pcm)
 	snd_pcm_unlock(pcm);
 	return err;
 }
-#ifndef DOC_HIDDEN
+#if !defined(DOC_HIDDEN) && !defined(ANDROID)
 link_warning(snd_pcm_hwsync, "Warning: snd_pcm_hwsync() is deprecated, consider to use snd_pcm_avail()");
 #endif
 
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 5/5] Android: add makefile and config.h
  2019-03-15  9:17 Android porting of alsa-lib Chih-Wei Huang
                   ` (3 preceding siblings ...)
  2019-03-15  9:17 ` [PATCH 4/5] Android: avoid link_warning Chih-Wei Huang
@ 2019-03-15  9:17 ` Chih-Wei Huang
  2019-03-15 12:20   ` Jaroslav Kysela
  2019-03-15 12:22 ` Android porting of alsa-lib Jaroslav Kysela
  5 siblings, 1 reply; 12+ messages in thread
From: Chih-Wei Huang @ 2019-03-15  9:17 UTC (permalink / raw)
  To: patch; +Cc: alsa-devel, Chih-Wei Huang

This is the initial porting of alsa-lib 1.1.8 to Android.

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
---
 android/Android.mk |  55 ++++++++++++
 android/config.h   | 217 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 272 insertions(+)
 create mode 100644 android/Android.mk
 create mode 100644 android/config.h

diff --git a/android/Android.mk b/android/Android.mk
new file mode 100644
index 00000000..e12fd3a6
--- /dev/null
+++ b/android/Android.mk
@@ -0,0 +1,55 @@
+#
+# Copyright (C) 2019 The Android-x86 Open Source Project
+#
+# Licensed under the GNU Lesser General Public License Version 2.1.
+# You may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.gnu.org/licenses/lgpl.html
+#
+
+LOCAL_PATH := $(dir $(call my-dir))
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libasound
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_CLASS := SHARED_LIBRARIES
+
+intermediates := $(call local-generated-sources-dir)
+
+LOCAL_C_INCLUDES := $(LOCAL_PATH)include $(LOCAL_PATH)android
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(intermediates)
+
+LOCAL_CFLAGS := -DPIC \
+	-Wno-absolute-value -Wno-address-of-packed-member -Wno-missing-braces \
+	-Wno-pointer-arith -Wno-sign-compare -Wno-unused-function \
+	-Wno-unused-const-variable -Wno-unused-parameter -Wno-unused-variable \
+	-finline-limit=300 -finline-functions -fno-inline-functions-called-once
+
+# list of files to be excluded
+EXCLUDE_SRC_FILES := \
+	src/alisp/alisp_snd.c \
+	src/compat/hsearch_r.c \
+	src/control/control_shm.c \
+	src/pcm/pcm_d%.c \
+	src/pcm/pcm_ladspa.c \
+	src/pcm/pcm_shm.c \
+	src/pcm/scopes/level.c \
+
+LOCAL_SRC_FILES := $(filter-out $(EXCLUDE_SRC_FILES),$(call all-c-files-under,src))
+
+GEN := $(intermediates)/alsa/asoundlib.h
+$(GEN): $(LOCAL_PATH)configure.ac $(wildcard $(LOCAL_PATH)include/*.h)
+	rm -rf $(@D); mkdir -p $(@D); cd $(@D); \
+	ln -s ../../../../../../../../$(<D)/include/*.h .
+	cat $(@D)/asoundlib-head.h > $@; \
+	sed -n "/.*\(#include <[ae].*.h>\).*/s//\1/p" $< >> $@; \
+	cat $(@D)/asoundlib-tail.h >> $@
+	sed -n "/^AC_INIT.* \([0-9.]*\))/s//\#define SND_LIB_VERSION_STR \"\1\"/p" $< > $(@D)/version.h; \
+	ln -sf alsa/version.h $(@D)/..
+
+LOCAL_GENERATED_SOURCES := $(GEN)
+
+LOCAL_SHARED_LIBRARIES := libdl
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/android/config.h b/android/config.h
new file mode 100644
index 00000000..53d50396
--- /dev/null
+++ b/android/config.h
@@ -0,0 +1,217 @@
+/* include/config.h.  Generated from config.h.in by configure.  */
+/* include/config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Directory with aload* device files */
+#define ALOAD_DEVICE_DIRECTORY "/dev/"
+
+/* directory containing ALSA configuration database */
+#define ALSA_CONFIG_DIR "/system/usr/share/alsa"
+
+/* Enable assert at error message handler */
+/* #undef ALSA_DEBUG_ASSERT */
+
+/* Directory with ALSA device files */
+#define ALSA_DEVICE_DIRECTORY "/dev/snd/"
+
+/* directory containing ALSA add-on modules */
+#define ALSA_PLUGIN_DIR "/system/usr/lib/alsa-lib"
+
+/* Build hwdep component */
+#define BUILD_HWDEP "1"
+
+/* Build mixer component */
+#define BUILD_MIXER "1"
+
+/* Build PCM component */
+#define BUILD_PCM "1"
+
+/* Build PCM adpcm plugin */
+#define BUILD_PCM_PLUGIN_ADPCM "1"
+
+/* Build PCM alaw plugin */
+#define BUILD_PCM_PLUGIN_ALAW "1"
+
+/* Build PCM lfloat plugin */
+#define BUILD_PCM_PLUGIN_LFLOAT "1"
+
+/* Build PCM mmap-emul plugin */
+#define BUILD_PCM_PLUGIN_MMAP_EMUL "1"
+
+/* Build PCM mulaw plugin */
+#define BUILD_PCM_PLUGIN_MULAW "1"
+
+/* Build PCM rate plugin */
+#define BUILD_PCM_PLUGIN_RATE "1"
+
+/* Build PCM route plugin */
+#define BUILD_PCM_PLUGIN_ROUTE "1"
+
+/* Build raw MIDI component */
+/* #undef BUILD_RAWMIDI */
+
+/* Build sequencer component */
+/* #undef BUILD_SEQ */
+
+/* Build DSP Topology component */
+#define BUILD_TOPOLOGY "1"
+
+/* Build UCM component */
+#define BUILD_UCM "1"
+
+/* Have clock gettime */
+#define HAVE_CLOCK_GETTIME 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the <endian.h> header file. */
+#define HAVE_ENDIAN_H 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Have libdl */
+#define HAVE_LIBDL 1
+
+/* Have libpthread */
+#define HAVE_LIBPTHREAD 1
+
+/* Define to 1 if you have the `resmgr' library (-lresmgr). */
+/* #undef HAVE_LIBRESMGR */
+
+/* Have librt */
+/* #undef HAVE_LIBRT */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define if your pthreads implementation have PTHREAD_MUTEX_RECURSIVE */
+#define HAVE_PTHREAD_MUTEX_RECURSIVE /**/
+
+/* Avoid calculation in float */
+/* #undef HAVE_SOFT_FLOAT */
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/endian.h> header file. */
+/* #undef HAVE_SYS_ENDIAN_H */
+
+/* Define to 1 if you have the <sys/shm.h> header file. */
+#define HAVE_SYS_SHM_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `uselocale' function. */
+#define HAVE_USELOCALE 1
+
+/* Enable use of wordexp */
+/* #undef HAVE_WORDEXP */
+
+/* Define to 1 if compiler supports __thread */
+#define HAVE___THREAD 1
+
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
+#define LT_OBJDIR ".libs/"
+
+/* No assert debug */
+/* #undef NDEBUG */
+
+/* Name of package */
+#define PACKAGE "alsa-lib"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "alsa-lib"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "alsa-lib"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Max number of cards */
+#define SND_MAX_CARDS 32
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Support /dev/aload* access for auto-loading */
+/* #undef SUPPORT_ALOAD */
+
+/* Support resmgr with alsa-lib */
+/* #undef SUPPORT_RESMGR */
+
+/* Disable thread-safe API functions */
+#define THREAD_SAFE_API "1"
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+
+/* directory to put tmp socket files */
+#define TMPDIR "/tmp"
+
+/* Enable extensions on AIX 3, Interix.  */
+#ifndef _ALL_SOURCE
+# define _ALL_SOURCE 1
+#endif
+/* Enable GNU extensions on systems that have them.  */
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+#endif
+/* Enable threading extensions on Solaris.  */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# define _POSIX_PTHREAD_SEMANTICS 1
+#endif
+/* Enable extensions on HP NonStop.  */
+#ifndef _TANDEM_SOURCE
+# define _TANDEM_SOURCE 1
+#endif
+/* Enable general extensions on Solaris.  */
+#ifndef __EXTENSIONS__
+# define __EXTENSIONS__ 1
+#endif
+
+
+/* compiled with versioned symbols */
+/* #undef VERSIONED_SYMBOLS */
+
+/* Define to 1 if on MINIX. */
+/* #undef _MINIX */
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+   this defined. */
+/* #undef _POSIX_1_SOURCE */
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+/* #undef _POSIX_SOURCE */
+
+/* Toolchain Symbol Prefix */
+#define __SYMBOL_PREFIX ""
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 4/5] Android: avoid link_warning
  2019-03-15  9:17 ` [PATCH 4/5] Android: avoid link_warning Chih-Wei Huang
@ 2019-03-15 12:18   ` Jaroslav Kysela
  2019-03-15 16:19     ` Chih-Wei Huang
  0 siblings, 1 reply; 12+ messages in thread
From: Jaroslav Kysela @ 2019-03-15 12:18 UTC (permalink / raw)
  To: Chih-Wei Huang; +Cc: alsa-devel, Chih-Wei Huang

Dne 15. 03. 19 v 10:17 Chih-Wei Huang napsal(a):
> It will be treated as an error.
> 
> Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
> ---
>  src/pcm/pcm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
> index 11aec805..4bb5fe5f 100644
> --- a/src/pcm/pcm.c
> +++ b/src/pcm/pcm.c
> @@ -1053,7 +1053,7 @@ int snd_pcm_hwsync(snd_pcm_t *pcm)
>  	snd_pcm_unlock(pcm);
>  	return err;
>  }
> -#ifndef DOC_HIDDEN
> +#if !defined(DOC_HIDDEN) && !defined(ANDROID)
>  link_warning(snd_pcm_hwsync, "Warning: snd_pcm_hwsync() is deprecated, consider to use snd_pcm_avail()");
>  #endif

Create a new option in the configure script (--disable-hwsync-warning or
so). I don't think that this should be Android only specific case.

					Jaroslav

-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 5/5] Android: add makefile and config.h
  2019-03-15  9:17 ` [PATCH 5/5] Android: add makefile and config.h Chih-Wei Huang
@ 2019-03-15 12:20   ` Jaroslav Kysela
  2019-03-15 15:55     ` Chih-Wei Huang
  2019-03-16  9:39     ` Takashi Iwai
  0 siblings, 2 replies; 12+ messages in thread
From: Jaroslav Kysela @ 2019-03-15 12:20 UTC (permalink / raw)
  To: Chih-Wei Huang; +Cc: alsa-devel, Chih-Wei Huang

Dne 15. 03. 19 v 10:17 Chih-Wei Huang napsal(a):
> This is the initial porting of alsa-lib 1.1.8 to Android.
> 
> Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
> ---
>  android/Android.mk |  55 ++++++++++++
>  android/config.h   | 217 +++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 272 insertions(+)
>  create mode 100644 android/Android.mk
>  create mode 100644 android/config.h
> 
> diff --git a/android/Android.mk b/android/Android.mk
> new file mode 100644
> index 00000000..e12fd3a6
> --- /dev/null
> +++ b/android/Android.mk
> @@ -0,0 +1,55 @@
> +#
> +# Copyright (C) 2019 The Android-x86 Open Source Project
> +#
> +# Licensed under the GNU Lesser General Public License Version 2.1.
> +# You may not use this file except in compliance with the License.
> +# You may obtain a copy of the License at
> +#
> +#      http://www.gnu.org/licenses/lgpl.html
> +#
> +
> +LOCAL_PATH := $(dir $(call my-dir))
> +include $(CLEAR_VARS)
> +
> +LOCAL_MODULE := libasound
> +LOCAL_MODULE_TAGS := optional
> +LOCAL_MODULE_CLASS := SHARED_LIBRARIES
> +
> +intermediates := $(call local-generated-sources-dir)
> +
> +LOCAL_C_INCLUDES := $(LOCAL_PATH)include $(LOCAL_PATH)android
> +LOCAL_EXPORT_C_INCLUDE_DIRS := $(intermediates)
> +
> +LOCAL_CFLAGS := -DPIC \
> +	-Wno-absolute-value -Wno-address-of-packed-member -Wno-missing-braces \
> +	-Wno-pointer-arith -Wno-sign-compare -Wno-unused-function \
> +	-Wno-unused-const-variable -Wno-unused-parameter -Wno-unused-variable \
> +	-finline-limit=300 -finline-functions -fno-inline-functions-called-once
> +
> +# list of files to be excluded
> +EXCLUDE_SRC_FILES := \
> +	src/alisp/alisp_snd.c \
> +	src/compat/hsearch_r.c \
> +	src/control/control_shm.c \
> +	src/pcm/pcm_d%.c \
> +	src/pcm/pcm_ladspa.c \
> +	src/pcm/pcm_shm.c \
> +	src/pcm/scopes/level.c \
> +
> +LOCAL_SRC_FILES := $(filter-out $(EXCLUDE_SRC_FILES),$(call all-c-files-under,src))
> +
> +GEN := $(intermediates)/alsa/asoundlib.h
> +$(GEN): $(LOCAL_PATH)configure.ac $(wildcard $(LOCAL_PATH)include/*.h)
> +	rm -rf $(@D); mkdir -p $(@D); cd $(@D); \
> +	ln -s ../../../../../../../../$(<D)/include/*.h .
> +	cat $(@D)/asoundlib-head.h > $@; \
> +	sed -n "/.*\(#include <[ae].*.h>\).*/s//\1/p" $< >> $@; \
> +	cat $(@D)/asoundlib-tail.h >> $@
> +	sed -n "/^AC_INIT.* \([0-9.]*\))/s//\#define SND_LIB_VERSION_STR \"\1\"/p" $< > $(@D)/version.h; \
> +	ln -sf alsa/version.h $(@D)/..
> +
> +LOCAL_GENERATED_SOURCES := $(GEN)
> +
> +LOCAL_SHARED_LIBRARIES := libdl
> +
> +include $(BUILD_SHARED_LIBRARY)
> diff --git a/android/config.h b/android/config.h
> new file mode 100644
> index 00000000..53d50396
> --- /dev/null
> +++ b/android/config.h
> @@ -0,0 +1,217 @@
> +/* include/config.h.  Generated from config.h.in by configure.  */
> +/* include/config.h.in.  Generated from configure.ac by autoheader.  */
> +
> +/* Directory with aload* device files */
> +#define ALOAD_DEVICE_DIRECTORY "/dev/"
> +
> +/* directory containing ALSA configuration database */
> +#define ALSA_CONFIG_DIR "/system/usr/share/alsa"
> +
> +/* Enable assert at error message handler */
> +/* #undef ALSA_DEBUG_ASSERT */
> +
> +/* Directory with ALSA device files */
> +#define ALSA_DEVICE_DIRECTORY "/dev/snd/"
> +
> +/* directory containing ALSA add-on modules */
> +#define ALSA_PLUGIN_DIR "/system/usr/lib/alsa-lib"
> +
> +/* Build hwdep component */
> +#define BUILD_HWDEP "1"
> +
> +/* Build mixer component */
> +#define BUILD_MIXER "1"
> +
> +/* Build PCM component */
> +#define BUILD_PCM "1"
> +
> +/* Build PCM adpcm plugin */
> +#define BUILD_PCM_PLUGIN_ADPCM "1"
> +
> +/* Build PCM alaw plugin */
> +#define BUILD_PCM_PLUGIN_ALAW "1"
> +
> +/* Build PCM lfloat plugin */
> +#define BUILD_PCM_PLUGIN_LFLOAT "1"
> +
> +/* Build PCM mmap-emul plugin */
> +#define BUILD_PCM_PLUGIN_MMAP_EMUL "1"
> +
> +/* Build PCM mulaw plugin */
> +#define BUILD_PCM_PLUGIN_MULAW "1"
> +
> +/* Build PCM rate plugin */
> +#define BUILD_PCM_PLUGIN_RATE "1"
> +
> +/* Build PCM route plugin */
> +#define BUILD_PCM_PLUGIN_ROUTE "1"
> +
> +/* Build raw MIDI component */
> +/* #undef BUILD_RAWMIDI */
> +
> +/* Build sequencer component */
> +/* #undef BUILD_SEQ */
> +
> +/* Build DSP Topology component */
> +#define BUILD_TOPOLOGY "1"
> +
> +/* Build UCM component */
> +#define BUILD_UCM "1"
> +
> +/* Have clock gettime */
> +#define HAVE_CLOCK_GETTIME 1
> +
> +/* Define to 1 if you have the <dlfcn.h> header file. */
> +#define HAVE_DLFCN_H 1
> +
> +/* Define to 1 if you have the <endian.h> header file. */
> +#define HAVE_ENDIAN_H 1
> +
> +/* Define to 1 if you have the <inttypes.h> header file. */
> +#define HAVE_INTTYPES_H 1
> +
> +/* Have libdl */
> +#define HAVE_LIBDL 1
> +
> +/* Have libpthread */
> +#define HAVE_LIBPTHREAD 1
> +
> +/* Define to 1 if you have the `resmgr' library (-lresmgr). */
> +/* #undef HAVE_LIBRESMGR */
> +
> +/* Have librt */
> +/* #undef HAVE_LIBRT */
> +
> +/* Define to 1 if you have the <memory.h> header file. */
> +#define HAVE_MEMORY_H 1
> +
> +/* Define if your pthreads implementation have PTHREAD_MUTEX_RECURSIVE */
> +#define HAVE_PTHREAD_MUTEX_RECURSIVE /**/
> +
> +/* Avoid calculation in float */
> +/* #undef HAVE_SOFT_FLOAT */
> +
> +/* Define to 1 if you have the <stdint.h> header file. */
> +#define HAVE_STDINT_H 1
> +
> +/* Define to 1 if you have the <stdlib.h> header file. */
> +#define HAVE_STDLIB_H 1
> +
> +/* Define to 1 if you have the <strings.h> header file. */
> +#define HAVE_STRINGS_H 1
> +
> +/* Define to 1 if you have the <string.h> header file. */
> +#define HAVE_STRING_H 1
> +
> +/* Define to 1 if you have the <sys/endian.h> header file. */
> +/* #undef HAVE_SYS_ENDIAN_H */
> +
> +/* Define to 1 if you have the <sys/shm.h> header file. */
> +#define HAVE_SYS_SHM_H 1
> +
> +/* Define to 1 if you have the <sys/stat.h> header file. */
> +#define HAVE_SYS_STAT_H 1
> +
> +/* Define to 1 if you have the <sys/types.h> header file. */
> +#define HAVE_SYS_TYPES_H 1
> +
> +/* Define to 1 if you have the <unistd.h> header file. */
> +#define HAVE_UNISTD_H 1
> +
> +/* Define to 1 if you have the `uselocale' function. */
> +#define HAVE_USELOCALE 1
> +
> +/* Enable use of wordexp */
> +/* #undef HAVE_WORDEXP */
> +
> +/* Define to 1 if compiler supports __thread */
> +#define HAVE___THREAD 1
> +
> +/* Define to the sub-directory where libtool stores uninstalled libraries. */
> +#define LT_OBJDIR ".libs/"
> +
> +/* No assert debug */
> +/* #undef NDEBUG */
> +
> +/* Name of package */
> +#define PACKAGE "alsa-lib"
> +
> +/* Define to the address where bug reports for this package should be sent. */
> +#define PACKAGE_BUGREPORT ""
> +
> +/* Define to the full name of this package. */
> +#define PACKAGE_NAME "alsa-lib"
> +
> +/* Define to the one symbol short name of this package. */
> +#define PACKAGE_TARNAME "alsa-lib"
> +
> +/* Define to the home page for this package. */
> +#define PACKAGE_URL ""
> +
> +/* Max number of cards */
> +#define SND_MAX_CARDS 32
> +
> +/* Define to 1 if you have the ANSI C header files. */
> +#define STDC_HEADERS 1
> +
> +/* Support /dev/aload* access for auto-loading */
> +/* #undef SUPPORT_ALOAD */
> +
> +/* Support resmgr with alsa-lib */
> +/* #undef SUPPORT_RESMGR */
> +
> +/* Disable thread-safe API functions */
> +#define THREAD_SAFE_API "1"
> +
> +/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
> +#define TIME_WITH_SYS_TIME 1
> +
> +/* directory to put tmp socket files */
> +#define TMPDIR "/tmp"
> +
> +/* Enable extensions on AIX 3, Interix.  */
> +#ifndef _ALL_SOURCE
> +# define _ALL_SOURCE 1
> +#endif
> +/* Enable GNU extensions on systems that have them.  */
> +#ifndef _GNU_SOURCE
> +# define _GNU_SOURCE 1
> +#endif
> +/* Enable threading extensions on Solaris.  */
> +#ifndef _POSIX_PTHREAD_SEMANTICS
> +# define _POSIX_PTHREAD_SEMANTICS 1
> +#endif
> +/* Enable extensions on HP NonStop.  */
> +#ifndef _TANDEM_SOURCE
> +# define _TANDEM_SOURCE 1
> +#endif
> +/* Enable general extensions on Solaris.  */
> +#ifndef __EXTENSIONS__
> +# define __EXTENSIONS__ 1
> +#endif
> +
> +
> +/* compiled with versioned symbols */
> +/* #undef VERSIONED_SYMBOLS */
> +
> +/* Define to 1 if on MINIX. */
> +/* #undef _MINIX */
> +
> +/* Define to 2 if the system does not provide POSIX.1 features except with
> +   this defined. */
> +/* #undef _POSIX_1_SOURCE */
> +
> +/* Define to 1 if you need to in order for `stat' and other things to work. */
> +/* #undef _POSIX_SOURCE */
> +
> +/* Toolchain Symbol Prefix */
> +#define __SYMBOL_PREFIX ""
> +
> +/* Define to empty if `const' does not conform to ANSI C. */
> +/* #undef const */
> +
> +/* Define to `__inline__' or `__inline' if that's what the C compiler
> +   calls it, or to nothing if 'inline' is not supported under any name.  */
> +#ifndef __cplusplus
> +/* #undef inline */
> +#endif

I am afraid, but those changes do not belong to the universal source
package. You may create an androidcompile script (something like
gitcompile) with some reasonable defaults for configure / autoconf /
automake.

If something is missing in the autoconf/automake files - just add it there.

					Jaroslav

-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Android porting of alsa-lib
  2019-03-15  9:17 Android porting of alsa-lib Chih-Wei Huang
                   ` (4 preceding siblings ...)
  2019-03-15  9:17 ` [PATCH 5/5] Android: add makefile and config.h Chih-Wei Huang
@ 2019-03-15 12:22 ` Jaroslav Kysela
  5 siblings, 0 replies; 12+ messages in thread
From: Jaroslav Kysela @ 2019-03-15 12:22 UTC (permalink / raw)
  To: Chih-Wei Huang; +Cc: alsa-devel

Dne 15. 03. 19 v 10:17 Chih-Wei Huang napsal(a):
> Tested OK on Android-x86 pie-x86 branch.

Write a cover letter (man git-send-email) next time, please.

I applied the first three obvious patches and commented the last two.

			Thanks,
				Jaroslav

-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 5/5] Android: add makefile and config.h
  2019-03-15 12:20   ` Jaroslav Kysela
@ 2019-03-15 15:55     ` Chih-Wei Huang
  2019-03-16  9:39     ` Takashi Iwai
  1 sibling, 0 replies; 12+ messages in thread
From: Chih-Wei Huang @ 2019-03-15 15:55 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: alsa-devel, Chih-Wei Huang

Jaroslav Kysela <perex@perex.cz> 於 2019年3月15日 週五 下午8:20寫道:
>
> Dne 15. 03. 19 v 10:17 Chih-Wei Huang napsal(a):
> > This is the initial porting of alsa-lib 1.1.8 to Android.
> >
> > Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
> > ---
> >  android/Android.mk |  55 ++++++++++++
> >  android/config.h   | 217 +++++++++++++++++++++++++++++++++++++++++++++
> >  2 files changed, 272 insertions(+)
> >  create mode 100644 android/Android.mk
> >  create mode 100644 android/config.h
> >
> > diff --git a/android/Android.mk b/android/Android.mk
> > new file mode 100644
> > index 00000000..e12fd3a6
> > --- /dev/null
> > +++ b/android/Android.mk
> > @@ -0,0 +1,55 @@
> > +#
> > +# Copyright (C) 2019 The Android-x86 Open Source Project
> > +#
> > +# Licensed under the GNU Lesser General Public License Version 2.1.
> > +# You may not use this file except in compliance with the License.
> > +# You may obtain a copy of the License at
> > +#
> > +#      http://www.gnu.org/licenses/lgpl.html
> > +#
> > +
> > +LOCAL_PATH := $(dir $(call my-dir))
> > +include $(CLEAR_VARS)
> > +
> > +LOCAL_MODULE := libasound
> > +LOCAL_MODULE_TAGS := optional
> > +LOCAL_MODULE_CLASS := SHARED_LIBRARIES
> > +
> > +intermediates := $(call local-generated-sources-dir)
> > +
> > +LOCAL_C_INCLUDES := $(LOCAL_PATH)include $(LOCAL_PATH)android
> > +LOCAL_EXPORT_C_INCLUDE_DIRS := $(intermediates)
> > +
> > +LOCAL_CFLAGS := -DPIC \
> > +     -Wno-absolute-value -Wno-address-of-packed-member -Wno-missing-braces \
> > +     -Wno-pointer-arith -Wno-sign-compare -Wno-unused-function \
> > +     -Wno-unused-const-variable -Wno-unused-parameter -Wno-unused-variable \
> > +     -finline-limit=300 -finline-functions -fno-inline-functions-called-once
> > +
> > +# list of files to be excluded
> > +EXCLUDE_SRC_FILES := \
> > +     src/alisp/alisp_snd.c \
> > +     src/compat/hsearch_r.c \
> > +     src/control/control_shm.c \
> > +     src/pcm/pcm_d%.c \
> > +     src/pcm/pcm_ladspa.c \
> > +     src/pcm/pcm_shm.c \
> > +     src/pcm/scopes/level.c \
> > +
> > +LOCAL_SRC_FILES := $(filter-out $(EXCLUDE_SRC_FILES),$(call all-c-files-under,src))
> > +
> > +GEN := $(intermediates)/alsa/asoundlib.h
> > +$(GEN): $(LOCAL_PATH)configure.ac $(wildcard $(LOCAL_PATH)include/*.h)
> > +     rm -rf $(@D); mkdir -p $(@D); cd $(@D); \
> > +     ln -s ../../../../../../../../$(<D)/include/*.h .
> > +     cat $(@D)/asoundlib-head.h > $@; \
> > +     sed -n "/.*\(#include <[ae].*.h>\).*/s//\1/p" $< >> $@; \
> > +     cat $(@D)/asoundlib-tail.h >> $@
> > +     sed -n "/^AC_INIT.* \([0-9.]*\))/s//\#define SND_LIB_VERSION_STR \"\1\"/p" $< > $(@D)/version.h; \
> > +     ln -sf alsa/version.h $(@D)/..
> > +
> > +LOCAL_GENERATED_SOURCES := $(GEN)
> > +
> > +LOCAL_SHARED_LIBRARIES := libdl
> > +
> > +include $(BUILD_SHARED_LIBRARY)
> > diff --git a/android/config.h b/android/config.h
> > new file mode 100644
> > index 00000000..53d50396
> > --- /dev/null
> > +++ b/android/config.h
> > @@ -0,0 +1,217 @@
> > +/* include/config.h.  Generated from config.h.in by configure.  */
> > +/* include/config.h.in.  Generated from configure.ac by autoheader.  */
> > +
> > +/* Directory with aload* device files */
> > +#define ALOAD_DEVICE_DIRECTORY "/dev/"
> > +
> > +/* directory containing ALSA configuration database */
> > +#define ALSA_CONFIG_DIR "/system/usr/share/alsa"
> > +
> > +/* Enable assert at error message handler */
> > +/* #undef ALSA_DEBUG_ASSERT */
> > +
> > +/* Directory with ALSA device files */
> > +#define ALSA_DEVICE_DIRECTORY "/dev/snd/"
> > +
> > +/* directory containing ALSA add-on modules */
> > +#define ALSA_PLUGIN_DIR "/system/usr/lib/alsa-lib"
> > +
> > +/* Build hwdep component */
> > +#define BUILD_HWDEP "1"
> > +
> > +/* Build mixer component */
> > +#define BUILD_MIXER "1"
> > +
> > +/* Build PCM component */
> > +#define BUILD_PCM "1"
> > +
> > +/* Build PCM adpcm plugin */
> > +#define BUILD_PCM_PLUGIN_ADPCM "1"
> > +
> > +/* Build PCM alaw plugin */
> > +#define BUILD_PCM_PLUGIN_ALAW "1"
> > +
> > +/* Build PCM lfloat plugin */
> > +#define BUILD_PCM_PLUGIN_LFLOAT "1"
> > +
> > +/* Build PCM mmap-emul plugin */
> > +#define BUILD_PCM_PLUGIN_MMAP_EMUL "1"
> > +
> > +/* Build PCM mulaw plugin */
> > +#define BUILD_PCM_PLUGIN_MULAW "1"
> > +
> > +/* Build PCM rate plugin */
> > +#define BUILD_PCM_PLUGIN_RATE "1"
> > +
> > +/* Build PCM route plugin */
> > +#define BUILD_PCM_PLUGIN_ROUTE "1"
> > +
> > +/* Build raw MIDI component */
> > +/* #undef BUILD_RAWMIDI */
> > +
> > +/* Build sequencer component */
> > +/* #undef BUILD_SEQ */
> > +
> > +/* Build DSP Topology component */
> > +#define BUILD_TOPOLOGY "1"
> > +
> > +/* Build UCM component */
> > +#define BUILD_UCM "1"
> > +
> > +/* Have clock gettime */
> > +#define HAVE_CLOCK_GETTIME 1
> > +
> > +/* Define to 1 if you have the <dlfcn.h> header file. */
> > +#define HAVE_DLFCN_H 1
> > +
> > +/* Define to 1 if you have the <endian.h> header file. */
> > +#define HAVE_ENDIAN_H 1
> > +
> > +/* Define to 1 if you have the <inttypes.h> header file. */
> > +#define HAVE_INTTYPES_H 1
> > +
> > +/* Have libdl */
> > +#define HAVE_LIBDL 1
> > +
> > +/* Have libpthread */
> > +#define HAVE_LIBPTHREAD 1
> > +
> > +/* Define to 1 if you have the `resmgr' library (-lresmgr). */
> > +/* #undef HAVE_LIBRESMGR */
> > +
> > +/* Have librt */
> > +/* #undef HAVE_LIBRT */
> > +
> > +/* Define to 1 if you have the <memory.h> header file. */
> > +#define HAVE_MEMORY_H 1
> > +
> > +/* Define if your pthreads implementation have PTHREAD_MUTEX_RECURSIVE */
> > +#define HAVE_PTHREAD_MUTEX_RECURSIVE /**/
> > +
> > +/* Avoid calculation in float */
> > +/* #undef HAVE_SOFT_FLOAT */
> > +
> > +/* Define to 1 if you have the <stdint.h> header file. */
> > +#define HAVE_STDINT_H 1
> > +
> > +/* Define to 1 if you have the <stdlib.h> header file. */
> > +#define HAVE_STDLIB_H 1
> > +
> > +/* Define to 1 if you have the <strings.h> header file. */
> > +#define HAVE_STRINGS_H 1
> > +
> > +/* Define to 1 if you have the <string.h> header file. */
> > +#define HAVE_STRING_H 1
> > +
> > +/* Define to 1 if you have the <sys/endian.h> header file. */
> > +/* #undef HAVE_SYS_ENDIAN_H */
> > +
> > +/* Define to 1 if you have the <sys/shm.h> header file. */
> > +#define HAVE_SYS_SHM_H 1
> > +
> > +/* Define to 1 if you have the <sys/stat.h> header file. */
> > +#define HAVE_SYS_STAT_H 1
> > +
> > +/* Define to 1 if you have the <sys/types.h> header file. */
> > +#define HAVE_SYS_TYPES_H 1
> > +
> > +/* Define to 1 if you have the <unistd.h> header file. */
> > +#define HAVE_UNISTD_H 1
> > +
> > +/* Define to 1 if you have the `uselocale' function. */
> > +#define HAVE_USELOCALE 1
> > +
> > +/* Enable use of wordexp */
> > +/* #undef HAVE_WORDEXP */
> > +
> > +/* Define to 1 if compiler supports __thread */
> > +#define HAVE___THREAD 1
> > +
> > +/* Define to the sub-directory where libtool stores uninstalled libraries. */
> > +#define LT_OBJDIR ".libs/"
> > +
> > +/* No assert debug */
> > +/* #undef NDEBUG */
> > +
> > +/* Name of package */
> > +#define PACKAGE "alsa-lib"
> > +
> > +/* Define to the address where bug reports for this package should be sent. */
> > +#define PACKAGE_BUGREPORT ""
> > +
> > +/* Define to the full name of this package. */
> > +#define PACKAGE_NAME "alsa-lib"
> > +
> > +/* Define to the one symbol short name of this package. */
> > +#define PACKAGE_TARNAME "alsa-lib"
> > +
> > +/* Define to the home page for this package. */
> > +#define PACKAGE_URL ""
> > +
> > +/* Max number of cards */
> > +#define SND_MAX_CARDS 32
> > +
> > +/* Define to 1 if you have the ANSI C header files. */
> > +#define STDC_HEADERS 1
> > +
> > +/* Support /dev/aload* access for auto-loading */
> > +/* #undef SUPPORT_ALOAD */
> > +
> > +/* Support resmgr with alsa-lib */
> > +/* #undef SUPPORT_RESMGR */
> > +
> > +/* Disable thread-safe API functions */
> > +#define THREAD_SAFE_API "1"
> > +
> > +/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
> > +#define TIME_WITH_SYS_TIME 1
> > +
> > +/* directory to put tmp socket files */
> > +#define TMPDIR "/tmp"
> > +
> > +/* Enable extensions on AIX 3, Interix.  */
> > +#ifndef _ALL_SOURCE
> > +# define _ALL_SOURCE 1
> > +#endif
> > +/* Enable GNU extensions on systems that have them.  */
> > +#ifndef _GNU_SOURCE
> > +# define _GNU_SOURCE 1
> > +#endif
> > +/* Enable threading extensions on Solaris.  */
> > +#ifndef _POSIX_PTHREAD_SEMANTICS
> > +# define _POSIX_PTHREAD_SEMANTICS 1
> > +#endif
> > +/* Enable extensions on HP NonStop.  */
> > +#ifndef _TANDEM_SOURCE
> > +# define _TANDEM_SOURCE 1
> > +#endif
> > +/* Enable general extensions on Solaris.  */
> > +#ifndef __EXTENSIONS__
> > +# define __EXTENSIONS__ 1
> > +#endif
> > +
> > +
> > +/* compiled with versioned symbols */
> > +/* #undef VERSIONED_SYMBOLS */
> > +
> > +/* Define to 1 if on MINIX. */
> > +/* #undef _MINIX */
> > +
> > +/* Define to 2 if the system does not provide POSIX.1 features except with
> > +   this defined. */
> > +/* #undef _POSIX_1_SOURCE */
> > +
> > +/* Define to 1 if you need to in order for `stat' and other things to work. */
> > +/* #undef _POSIX_SOURCE */
> > +
> > +/* Toolchain Symbol Prefix */
> > +#define __SYMBOL_PREFIX ""
> > +
> > +/* Define to empty if `const' does not conform to ANSI C. */
> > +/* #undef const */
> > +
> > +/* Define to `__inline__' or `__inline' if that's what the C compiler
> > +   calls it, or to nothing if 'inline' is not supported under any name.  */
> > +#ifndef __cplusplus
> > +/* #undef inline */
> > +#endif
>
> I am afraid, but those changes do not belong to the universal source
> package. You may create an androidcompile script (something like
> gitcompile) with some reasonable defaults for configure / autoconf /
> automake.
>
> If something is missing in the autoconf/automake files - just add it there.

Thank you for review the patches.

Android doesn't use autoconf/automake.
Android uses non-recursive build system.
The main makefile will include all Android.mk
found in the source tree and make all necessary targets
to build the final image.

This patch just adds two files to the android/ subfolder
which intends to work with Android build system.
We just pull the alsa-lib (and alsa-utils, will send later) code
to Android source tree and build them.
It won't affect others. I hope to upstream them
so other people don't need to re-invent the wheel.

Several upstream projects we use have accepted such patches.
For examples:

efivar:
  https://github.com/rhboot/efivar/pull/125
libva:
  https://github.com/intel/libva/pull/37
vaapi:
  https://github.com/intel/intel-vaapi-driver/pull/446
exfat:
  https://github.com/relan/exfat/pull/53
libdrm:
  https://cgit.freedesktop.org/mesa/drm/tree/Android.mk
mesa:
  https://cgit.freedesktop.org/mesa/mesa/tree/Android.mk

In particular, libdrm / mesa have added Android makefiles
and maintained them for years.
I hope you can consider to accept it.

Best Regards,




--
Chih-Wei
Android-x86 project
http://www.android-x86.org
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 4/5] Android: avoid link_warning
  2019-03-15 12:18   ` Jaroslav Kysela
@ 2019-03-15 16:19     ` Chih-Wei Huang
  0 siblings, 0 replies; 12+ messages in thread
From: Chih-Wei Huang @ 2019-03-15 16:19 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: alsa-devel

Jaroslav Kysela <perex@perex.cz> 於 2019年3月15日 週五 下午8:18寫道:
>
> Dne 15. 03. 19 v 10:17 Chih-Wei Huang napsal(a):
> > It will be treated as an error.
> >
> > Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
> > ---
> >  src/pcm/pcm.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
> > index 11aec805..4bb5fe5f 100644
> > --- a/src/pcm/pcm.c
> > +++ b/src/pcm/pcm.c
> > @@ -1053,7 +1053,7 @@ int snd_pcm_hwsync(snd_pcm_t *pcm)
> >       snd_pcm_unlock(pcm);
> >       return err;
> >  }
> > -#ifndef DOC_HIDDEN
> > +#if !defined(DOC_HIDDEN) && !defined(ANDROID)
> >  link_warning(snd_pcm_hwsync, "Warning: snd_pcm_hwsync() is deprecated, consider to use snd_pcm_avail()");
> >  #endif
>
> Create a new option in the configure script (--disable-hwsync-warning or
> so). I don't think that this should be Android only specific case.

I'm sorry but Android doesn't use the configure script.
The Android build system include the Android.mk in
the subfolders and build the targets defined in it directly.

I've tried to add cflag -DDOC_HIDDEN to Android.mk but
it generates more errors.

If change it to

#if !defined(DOC_HIDDEN) && !defined(NO_HWSYNC_WARNING)

and then define NO_HWSYNC_WARNING in Android.mk,
is it acceptable?

-- 
Chih-Wei
Android-x86 project
http://www.android-x86.org
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 5/5] Android: add makefile and config.h
  2019-03-15 12:20   ` Jaroslav Kysela
  2019-03-15 15:55     ` Chih-Wei Huang
@ 2019-03-16  9:39     ` Takashi Iwai
  1 sibling, 0 replies; 12+ messages in thread
From: Takashi Iwai @ 2019-03-16  9:39 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: Chih-Wei Huang, Chih-Wei Huang, alsa-devel

On Fri, 15 Mar 2019 13:20:50 +0100,
Jaroslav Kysela wrote:
> 
> Dne 15. 03. 19 v 10:17 Chih-Wei Huang napsal(a):
> > This is the initial porting of alsa-lib 1.1.8 to Android.
> > 
> > Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
> > ---
> >  android/Android.mk |  55 ++++++++++++
> >  android/config.h   | 217 +++++++++++++++++++++++++++++++++++++++++++++
> >  2 files changed, 272 insertions(+)
> >  create mode 100644 android/Android.mk
> >  create mode 100644 android/config.h
> > 
> > diff --git a/android/Android.mk b/android/Android.mk
> > new file mode 100644
> > index 00000000..e12fd3a6
> > --- /dev/null
> > +++ b/android/Android.mk
> > @@ -0,0 +1,55 @@
> > +#
> > +# Copyright (C) 2019 The Android-x86 Open Source Project
> > +#
> > +# Licensed under the GNU Lesser General Public License Version 2.1.
> > +# You may not use this file except in compliance with the License.
> > +# You may obtain a copy of the License at
> > +#
> > +#      http://www.gnu.org/licenses/lgpl.html
> > +#
> > +
> > +LOCAL_PATH := $(dir $(call my-dir))
> > +include $(CLEAR_VARS)
> > +
> > +LOCAL_MODULE := libasound
> > +LOCAL_MODULE_TAGS := optional
> > +LOCAL_MODULE_CLASS := SHARED_LIBRARIES
> > +
> > +intermediates := $(call local-generated-sources-dir)
> > +
> > +LOCAL_C_INCLUDES := $(LOCAL_PATH)include $(LOCAL_PATH)android
> > +LOCAL_EXPORT_C_INCLUDE_DIRS := $(intermediates)
> > +
> > +LOCAL_CFLAGS := -DPIC \
> > +	-Wno-absolute-value -Wno-address-of-packed-member -Wno-missing-braces \
> > +	-Wno-pointer-arith -Wno-sign-compare -Wno-unused-function \
> > +	-Wno-unused-const-variable -Wno-unused-parameter -Wno-unused-variable \
> > +	-finline-limit=300 -finline-functions -fno-inline-functions-called-once
> > +
> > +# list of files to be excluded
> > +EXCLUDE_SRC_FILES := \
> > +	src/alisp/alisp_snd.c \
> > +	src/compat/hsearch_r.c \
> > +	src/control/control_shm.c \
> > +	src/pcm/pcm_d%.c \
> > +	src/pcm/pcm_ladspa.c \
> > +	src/pcm/pcm_shm.c \
> > +	src/pcm/scopes/level.c \
> > +
> > +LOCAL_SRC_FILES := $(filter-out $(EXCLUDE_SRC_FILES),$(call all-c-files-under,src))
> > +
> > +GEN := $(intermediates)/alsa/asoundlib.h
> > +$(GEN): $(LOCAL_PATH)configure.ac $(wildcard $(LOCAL_PATH)include/*.h)
> > +	rm -rf $(@D); mkdir -p $(@D); cd $(@D); \
> > +	ln -s ../../../../../../../../$(<D)/include/*.h .
> > +	cat $(@D)/asoundlib-head.h > $@; \
> > +	sed -n "/.*\(#include <[ae].*.h>\).*/s//\1/p" $< >> $@; \
> > +	cat $(@D)/asoundlib-tail.h >> $@
> > +	sed -n "/^AC_INIT.* \([0-9.]*\))/s//\#define SND_LIB_VERSION_STR \"\1\"/p" $< > $(@D)/version.h; \
> > +	ln -sf alsa/version.h $(@D)/..
> > +
> > +LOCAL_GENERATED_SOURCES := $(GEN)
> > +
> > +LOCAL_SHARED_LIBRARIES := libdl
> > +
> > +include $(BUILD_SHARED_LIBRARY)
> > diff --git a/android/config.h b/android/config.h
> > new file mode 100644
> > index 00000000..53d50396
> > --- /dev/null
> > +++ b/android/config.h
> > @@ -0,0 +1,217 @@
> > +/* include/config.h.  Generated from config.h.in by configure.  */
> > +/* include/config.h.in.  Generated from configure.ac by autoheader.  */
> > +
> > +/* Directory with aload* device files */
> > +#define ALOAD_DEVICE_DIRECTORY "/dev/"
> > +
> > +/* directory containing ALSA configuration database */
> > +#define ALSA_CONFIG_DIR "/system/usr/share/alsa"
> > +
> > +/* Enable assert at error message handler */
> > +/* #undef ALSA_DEBUG_ASSERT */
> > +
> > +/* Directory with ALSA device files */
> > +#define ALSA_DEVICE_DIRECTORY "/dev/snd/"
> > +
> > +/* directory containing ALSA add-on modules */
> > +#define ALSA_PLUGIN_DIR "/system/usr/lib/alsa-lib"
> > +
> > +/* Build hwdep component */
> > +#define BUILD_HWDEP "1"
> > +
> > +/* Build mixer component */
> > +#define BUILD_MIXER "1"
> > +
> > +/* Build PCM component */
> > +#define BUILD_PCM "1"
> > +
> > +/* Build PCM adpcm plugin */
> > +#define BUILD_PCM_PLUGIN_ADPCM "1"
> > +
> > +/* Build PCM alaw plugin */
> > +#define BUILD_PCM_PLUGIN_ALAW "1"
> > +
> > +/* Build PCM lfloat plugin */
> > +#define BUILD_PCM_PLUGIN_LFLOAT "1"
> > +
> > +/* Build PCM mmap-emul plugin */
> > +#define BUILD_PCM_PLUGIN_MMAP_EMUL "1"
> > +
> > +/* Build PCM mulaw plugin */
> > +#define BUILD_PCM_PLUGIN_MULAW "1"
> > +
> > +/* Build PCM rate plugin */
> > +#define BUILD_PCM_PLUGIN_RATE "1"
> > +
> > +/* Build PCM route plugin */
> > +#define BUILD_PCM_PLUGIN_ROUTE "1"
> > +
> > +/* Build raw MIDI component */
> > +/* #undef BUILD_RAWMIDI */
> > +
> > +/* Build sequencer component */
> > +/* #undef BUILD_SEQ */
> > +
> > +/* Build DSP Topology component */
> > +#define BUILD_TOPOLOGY "1"
> > +
> > +/* Build UCM component */
> > +#define BUILD_UCM "1"
> > +
> > +/* Have clock gettime */
> > +#define HAVE_CLOCK_GETTIME 1
> > +
> > +/* Define to 1 if you have the <dlfcn.h> header file. */
> > +#define HAVE_DLFCN_H 1
> > +
> > +/* Define to 1 if you have the <endian.h> header file. */
> > +#define HAVE_ENDIAN_H 1
> > +
> > +/* Define to 1 if you have the <inttypes.h> header file. */
> > +#define HAVE_INTTYPES_H 1
> > +
> > +/* Have libdl */
> > +#define HAVE_LIBDL 1
> > +
> > +/* Have libpthread */
> > +#define HAVE_LIBPTHREAD 1
> > +
> > +/* Define to 1 if you have the `resmgr' library (-lresmgr). */
> > +/* #undef HAVE_LIBRESMGR */
> > +
> > +/* Have librt */
> > +/* #undef HAVE_LIBRT */
> > +
> > +/* Define to 1 if you have the <memory.h> header file. */
> > +#define HAVE_MEMORY_H 1
> > +
> > +/* Define if your pthreads implementation have PTHREAD_MUTEX_RECURSIVE */
> > +#define HAVE_PTHREAD_MUTEX_RECURSIVE /**/
> > +
> > +/* Avoid calculation in float */
> > +/* #undef HAVE_SOFT_FLOAT */
> > +
> > +/* Define to 1 if you have the <stdint.h> header file. */
> > +#define HAVE_STDINT_H 1
> > +
> > +/* Define to 1 if you have the <stdlib.h> header file. */
> > +#define HAVE_STDLIB_H 1
> > +
> > +/* Define to 1 if you have the <strings.h> header file. */
> > +#define HAVE_STRINGS_H 1
> > +
> > +/* Define to 1 if you have the <string.h> header file. */
> > +#define HAVE_STRING_H 1
> > +
> > +/* Define to 1 if you have the <sys/endian.h> header file. */
> > +/* #undef HAVE_SYS_ENDIAN_H */
> > +
> > +/* Define to 1 if you have the <sys/shm.h> header file. */
> > +#define HAVE_SYS_SHM_H 1
> > +
> > +/* Define to 1 if you have the <sys/stat.h> header file. */
> > +#define HAVE_SYS_STAT_H 1
> > +
> > +/* Define to 1 if you have the <sys/types.h> header file. */
> > +#define HAVE_SYS_TYPES_H 1
> > +
> > +/* Define to 1 if you have the <unistd.h> header file. */
> > +#define HAVE_UNISTD_H 1
> > +
> > +/* Define to 1 if you have the `uselocale' function. */
> > +#define HAVE_USELOCALE 1
> > +
> > +/* Enable use of wordexp */
> > +/* #undef HAVE_WORDEXP */
> > +
> > +/* Define to 1 if compiler supports __thread */
> > +#define HAVE___THREAD 1
> > +
> > +/* Define to the sub-directory where libtool stores uninstalled libraries. */
> > +#define LT_OBJDIR ".libs/"
> > +
> > +/* No assert debug */
> > +/* #undef NDEBUG */
> > +
> > +/* Name of package */
> > +#define PACKAGE "alsa-lib"
> > +
> > +/* Define to the address where bug reports for this package should be sent. */
> > +#define PACKAGE_BUGREPORT ""
> > +
> > +/* Define to the full name of this package. */
> > +#define PACKAGE_NAME "alsa-lib"
> > +
> > +/* Define to the one symbol short name of this package. */
> > +#define PACKAGE_TARNAME "alsa-lib"
> > +
> > +/* Define to the home page for this package. */
> > +#define PACKAGE_URL ""
> > +
> > +/* Max number of cards */
> > +#define SND_MAX_CARDS 32
> > +
> > +/* Define to 1 if you have the ANSI C header files. */
> > +#define STDC_HEADERS 1
> > +
> > +/* Support /dev/aload* access for auto-loading */
> > +/* #undef SUPPORT_ALOAD */
> > +
> > +/* Support resmgr with alsa-lib */
> > +/* #undef SUPPORT_RESMGR */
> > +
> > +/* Disable thread-safe API functions */
> > +#define THREAD_SAFE_API "1"
> > +
> > +/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
> > +#define TIME_WITH_SYS_TIME 1
> > +
> > +/* directory to put tmp socket files */
> > +#define TMPDIR "/tmp"
> > +
> > +/* Enable extensions on AIX 3, Interix.  */
> > +#ifndef _ALL_SOURCE
> > +# define _ALL_SOURCE 1
> > +#endif
> > +/* Enable GNU extensions on systems that have them.  */
> > +#ifndef _GNU_SOURCE
> > +# define _GNU_SOURCE 1
> > +#endif
> > +/* Enable threading extensions on Solaris.  */
> > +#ifndef _POSIX_PTHREAD_SEMANTICS
> > +# define _POSIX_PTHREAD_SEMANTICS 1
> > +#endif
> > +/* Enable extensions on HP NonStop.  */
> > +#ifndef _TANDEM_SOURCE
> > +# define _TANDEM_SOURCE 1
> > +#endif
> > +/* Enable general extensions on Solaris.  */
> > +#ifndef __EXTENSIONS__
> > +# define __EXTENSIONS__ 1
> > +#endif
> > +
> > +
> > +/* compiled with versioned symbols */
> > +/* #undef VERSIONED_SYMBOLS */
> > +
> > +/* Define to 1 if on MINIX. */
> > +/* #undef _MINIX */
> > +
> > +/* Define to 2 if the system does not provide POSIX.1 features except with
> > +   this defined. */
> > +/* #undef _POSIX_1_SOURCE */
> > +
> > +/* Define to 1 if you need to in order for `stat' and other things to work. */
> > +/* #undef _POSIX_SOURCE */
> > +
> > +/* Toolchain Symbol Prefix */
> > +#define __SYMBOL_PREFIX ""
> > +
> > +/* Define to empty if `const' does not conform to ANSI C. */
> > +/* #undef const */
> > +
> > +/* Define to `__inline__' or `__inline' if that's what the C compiler
> > +   calls it, or to nothing if 'inline' is not supported under any name.  */
> > +#ifndef __cplusplus
> > +/* #undef inline */
> > +#endif
> 
> I am afraid, but those changes do not belong to the universal source
> package. You may create an androidcompile script (something like
> gitcompile) with some reasonable defaults for configure / autoconf /
> automake.
> 
> If something is missing in the autoconf/automake files - just add it there.

Yes, otherwise we'd have to modify two places once when something
needs to be changed, and that's error-prone.

Or moving to a modern build infrastructure instead of stone aged
auto-tools would help for cross-platform builds?


thanks,

Takashi

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-03-16  9:39 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-15  9:17 Android porting of alsa-lib Chih-Wei Huang
2019-03-15  9:17 ` [PATCH 1/5] Android: avoid using versionsort Chih-Wei Huang
2019-03-15  9:17 ` [PATCH 2/5] pcm: add the missing <strings.h> include Chih-Wei Huang
2019-03-15  9:17 ` [PATCH 3/5] alisp: add the missing include Chih-Wei Huang
2019-03-15  9:17 ` [PATCH 4/5] Android: avoid link_warning Chih-Wei Huang
2019-03-15 12:18   ` Jaroslav Kysela
2019-03-15 16:19     ` Chih-Wei Huang
2019-03-15  9:17 ` [PATCH 5/5] Android: add makefile and config.h Chih-Wei Huang
2019-03-15 12:20   ` Jaroslav Kysela
2019-03-15 15:55     ` Chih-Wei Huang
2019-03-16  9:39     ` Takashi Iwai
2019-03-15 12:22 ` Android porting of alsa-lib Jaroslav Kysela

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.