[vlc-devel] [PATCH] android: utils: build utils as a lib
Zhao Zhili
quinkblack at foxmail.com
Sat Jan 30 18:07:03 UTC 2021
Make other targets depend on libandroid_utils instead of duplicate
the source code.
---
It should have no functional change since modules are linked statically.
I'm trying to build VLC on android natively. Without the patch, there
are link errors since android/utils should link to opengles and egl, and
some modules missing to specify android/utils as depencency.
With the patch, VLC build and run successfully.
modules/audio_output/Makefile.am | 4 ++--
modules/codec/Makefile.am | 5 ++---
modules/keystore/Makefile.am | 1 +
modules/video_output/Makefile.am | 16 ++++++++++------
4 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/modules/audio_output/Makefile.am b/modules/audio_output/Makefile.am
index b64659e6c9..194c421e54 100644
--- a/modules/audio_output/Makefile.am
+++ b/modules/audio_output/Makefile.am
@@ -4,9 +4,9 @@ aout_LTLIBRARIES =
libopensles_android_plugin_la_SOURCES = audio_output/opensles_android.c
libopensles_android_plugin_la_LIBADD = $(LIBDL) $(LIBM)
-libandroid_audiotrack_plugin_la_SOURCES = audio_output/audiotrack.c \
- video_output/android/utils.c video_output/android/utils.h
+libandroid_audiotrack_plugin_la_SOURCES = audio_output/audiotrack.c
libandroid_audiotrack_plugin_la_CFLAGS = $(AM_CFLAGS)
+libandroid_audiotrack_plugin_la_LIBADD = libandroid_utils.la
if HAVE_ANDROID
aout_LTLIBRARIES += libandroid_audiotrack_plugin.la libopensles_android_plugin.la
diff --git a/modules/codec/Makefile.am b/modules/codec/Makefile.am
index 9de65afa5e..987c1d9da1 100644
--- a/modules/codec/Makefile.am
+++ b/modules/codec/Makefile.am
@@ -460,9 +460,8 @@ libomxil_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(codecdir)'
libmediacodec_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/codec/omxil
libmediacodec_plugin_la_SOURCES = codec/omxil/mediacodec.c codec/omxil/mediacodec.h \
codec/omxil/mediacodec_jni.c codec/omxil/mediacodec_ndk.c codec/omxil/utils.c \
- codec/omxil/omxil_utils.h codec/omxil/qcom.c codec/omxil/qcom.h \
- video_output/android/utils.c video_output/android/utils.h
-libmediacodec_plugin_la_LIBADD = libchroma_copy.la libvlc_hxxxhelper.la
+ codec/omxil/omxil_utils.h codec/omxil/qcom.c codec/omxil/qcom.h
+libmediacodec_plugin_la_LIBADD = libchroma_copy.la libvlc_hxxxhelper.la libandroid_utils.la $(LIBDL)
codec_LTLIBRARIES += $(LTLIBomxil)
EXTRA_LTLIBRARIES += libomxil_plugin.la
if HAVE_ANDROID
diff --git a/modules/keystore/Makefile.am b/modules/keystore/Makefile.am
index 318132881f..bdf9bdb7e0 100644
--- a/modules/keystore/Makefile.am
+++ b/modules/keystore/Makefile.am
@@ -9,6 +9,7 @@ libfile_keystore_plugin_la_SOURCES = keystore/file.c \
keystore/list_util.c keystore/list_util.h
if HAVE_ANDROID
libfile_keystore_plugin_la_SOURCES += keystore/file_crypt_android.c
+libfile_keystore_plugin_la_LIBADD = libandroid_utils.la
endif
if HAVE_WIN32
libfile_keystore_plugin_la_SOURCES += keystore/file_crypt_win32.c
diff --git a/modules/video_output/Makefile.am b/modules/video_output/Makefile.am
index 1bed305daa..684bf11d73 100644
--- a/modules/video_output/Makefile.am
+++ b/modules/video_output/Makefile.am
@@ -230,20 +230,24 @@ endif
### Android ###
+libandroid_utils_la_SOURCES = video_output/android/utils.c video_output/android/utils.h
+libandroid_utils_la_CFLAGS = $(AM_CFLAGS) $(GLES2_CFLAGS) $(EGL_CFLAGS)
+libandroid_utils_la_LIBADD = $(GLES2_LIBS) $(EGL_LIBS)
+if HAVE_ANDROID
+noinst_LTLIBRARIES += libandroid_utils.la
+endif
libegl_android_plugin_la_SOURCES = video_output/opengl/egl.c
libegl_android_plugin_la_CFLAGS = $(AM_CFLAGS) $(EGL_CFLAGS) -DUSE_PLATFORM_ANDROID=1
libegl_android_plugin_la_LIBADD = $(EGL_LIBS)
-libandroid_window_plugin_la_SOURCES = video_output/android/window.c \
- video_output/android/utils.c video_output/android/utils.h
+libandroid_window_plugin_la_SOURCES = video_output/android/window.c
libandroid_window_plugin_la_CFLAGS = $(AM_CFLAGS)
-libandroid_window_plugin_la_LIBADD = $(LIBDL)
+libandroid_window_plugin_la_LIBADD = libandroid_utils.la $(LIBDL)
-libandroid_display_plugin_la_SOURCES = video_output/android/display.c \
- video_output/android/utils.c video_output/android/utils.h
+libandroid_display_plugin_la_SOURCES = video_output/android/display.c
libandroid_display_plugin_la_CFLAGS = $(AM_CFLAGS)
-libandroid_display_plugin_la_LIBADD = $(LIBDL)
+libandroid_display_plugin_la_LIBADD = libandroid_utils.la $(LIBDL)
libglinterop_android_plugin_la_SOURCES = video_output/opengl/interop_android.c \
video_output/opengl/interop.h
--
2.28.0
More information about the vlc-devel
mailing list