[Android] Move generation of iomx and anw in the Android.mk

Jean-Baptiste Kempf git at videolan.org
Thu Feb 5 15:51:13 CET 2015


vlc-ports/android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Thu Feb  5 15:50:07 2015 +0100| [fe1ffba9dd34d51920704fec59d2988307f47233] | committer: Jean-Baptiste Kempf

Move generation of iomx and anw in the Android.mk

And call it from compile-libvlc.sh

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=fe1ffba9dd34d51920704fec59d2988307f47233
---

 Makefile              |   24 ------------------------
 compile-libvlc.sh     |   11 ++++++++---
 libvlc/jni/Android.mk |   45 +++++++++++++++++++++++++++++++++++++++------
 3 files changed, 47 insertions(+), 33 deletions(-)

diff --git a/Makefile b/Makefile
index 6742d1e..56765c2 100644
--- a/Makefile
+++ b/Makefile
@@ -12,23 +12,6 @@ JAVA_SOURCES+=$(shell find $(APP_SRC)/res -name "*.xml" -o -name "*.png")
 JNI_SOURCES=$(SRC)/jni/*.c $(SRC)/jni/*.h
 LIBVLC_LIBS = libvlcjni
 
-ifneq ($(HAVE_64),1)
-# Can't link with 32bits symbols.
-# Not a problem since MediaCodec should work on 64bits devices (android-21)
-LIBVLC_LIBS += libiomx.14 libiomx.13 libiomx.10
-endif
-
-# The following iomx libs are used for DEBUG only.
-# (after android Jelly Bean, we prefer to use MediaCodec instead of iomx)
-#LIBVLC_LIBS += libiomx.19 libiomx.18
-
-LIBVLC_LIBS += libanw.10 libanw.13 libanw.14 libanw.18 libanw.21
-
-LIBVLCJNI= $(addprefix $(SRC)/obj/local/$(ARCH)/,$(addsuffix .so,$(LIBVLC_LIBS)))
-
-PRIVATE_LIBDIR=android-libs
-PRIVATE_LIBS=$(PRIVATE_LIBDIR)/libstagefright.so $(PRIVATE_LIBDIR)/libmedia.so $(PRIVATE_LIBDIR)/libutils.so $(PRIVATE_LIBDIR)/libcutils.so $(PRIVATE_LIBDIR)/libbinder.so $(PRIVATE_LIBDIR)/libui.so $(PRIVATE_LIBDIR)/libhardware.so
-
 ANT_OPTS += -v
 VERBOSE =
 GEN =
@@ -57,13 +40,6 @@ endef
 $(VLC_APK): $(LIBVLCJNI) $(JAVA_SOURCES)
 	$(call build_apk)
 
-$(PRIVATE_LIBDIR)/%.so: $(PRIVATE_LIBDIR)/%.c
-	$(GEN)$(TARGET_TUPLE)-gcc $< -shared -o $@ --sysroot=$(SYSROOT)
-
-$(PRIVATE_LIBDIR)/%.c: $(PRIVATE_LIBDIR)/%.symbols
-	$(VERBOSE)rm -f $@
-	$(GEN)for s in `cat $<`; do echo "void $$s() {}" >> $@; done
-
 apk:
 	$(call build_apk)
 
diff --git a/compile-libvlc.sh b/compile-libvlc.sh
index 45e1182..f059fd6 100755
--- a/compile-libvlc.sh
+++ b/compile-libvlc.sh
@@ -428,12 +428,15 @@ cd ../..
 
 
 ######################################################################################
+# libvlcJNI
+######################################################################################
 
+##################
+# libVLC modules #
+##################
 echo "Generating static module list"
 VLC_MODULES=`./find_modules.sh vlc/$VLC_BUILD_DIR`
 
-echo $VLC_MODULES
-
 DEFINITION="";
 BUILTINS="const void *vlc_static_modules[] = {\n";
 for file in $VLC_MODULES; do
@@ -444,6 +447,9 @@ done; \
 BUILTINS="$BUILTINS NULL\n};\n"; \
 printf "/* Autogenerated from the list of modules */\n $DEFINITION\n $BUILTINS\n" > libvlc/jni/libvlcjni.h
 
+###############################
+# NDK-Build for libvlcjni.so  #
+###############################
 
 echo $VLC_BUILD_DIR
 LIBVLC_LIBS="libvlcjni"
@@ -464,4 +470,3 @@ $ANDROID_NDK/ndk-build -C libvlc \
     APP_PLATFORM=${ANDROID_API} \
     APP_ABI=${ANDROID_ABI} \
     NDK_PROJECT_PATH=jni
-
diff --git a/libvlc/jni/Android.mk b/libvlc/jni/Android.mk
index 24ac0e7..1d9b8bc 100644
--- a/libvlc/jni/Android.mk
+++ b/libvlc/jni/Android.mk
@@ -1,5 +1,6 @@
 LOCAL_PATH := $(call my-dir)
 include $(CLEAR_VARS)
+ANDROID_PRIVATE_LIBDIR := $(LOCAL_PATH)/../../android-libs
 
 LOCAL_MODULE    := libvlcjni
 
@@ -87,9 +88,25 @@ LOCAL_LDLIBS := -L$(VLC_CONTRIB)/lib \
 	-lzvbi \
 	$(CPP_STATIC)
 
+################
+# PRIVATE LIBS #
+################
+
+ANDROID_PRIVATE_LIBS=$(ANDROID_PRIVATE_LIBDIR)/libstagefright.so $(ANDROID_PRIVATE_LIBDIR)/libmedia.so $(ANDROID_PRIVATE_LIBDIR)/libutils.so $(ANDROID_PRIVATE_LIBDIR)/libcutils.so $(ANDROID_PRIVATE_LIBDIR)/libbinder.so $(ANDROID_PRIVATE_LIBDIR)/libui.so $(ANDROID_PRIVATE_LIBDIR)/libhardware.so
+
+$(ANDROID_PRIVATE_LIBDIR)/%.so: $(ANDROID_PRIVATE_LIBDIR)/%.c
+	$(GEN)$(TARGET_TUPLE)-gcc $< -shared -o $@ --sysroot=$(SYSROOT)
+
+$(ANDROID_PRIVATE_LIBDIR)/%.c: $(ANDROID_PRIVATE_LIBDIR)/%.symbols
+	$(VERBOSE)rm -f $@
+	$(GEN)for s in `cat $<`; do echo "void $$s() {}" >> $@; done
+
+$(TARGET_OUT)/$(1).so: $(ANDROID_PRIVATE_LIBS)
 include $(BUILD_SHARED_LIBRARY)
 
-# libiomx-* build
+###########
+# libiOMX #
+###########
 
 LIBIOMX_INCLUDES_COMMON := $(VLC_SRC_DIR)/modules/codec/omxil
 
@@ -129,20 +146,33 @@ LIBIOMX_INCLUDES_21 := $(LIBIOMX_INCLUDES_COMMON) \
 	$(ANDROID_SYS_HEADERS)/21/system/core/include \
 	$(ANDROID_SYS_HEADERS)/21/hardware/libhardware/include
 
+ifneq ($(HAVE_64),1)
+# Can't link with 32bits symbols.
+# Not a problem since MediaCodec should work on 64bits devices (android-21)
+LIBIOMX_LIBS += libiomx.14 libiomx.13 libiomx.10
+endif
+# (after android Jelly Bean, we prefer to use MediaCodec instead of iomx)
+#LIBIOMX_LIBS += libiomx.19 libiomx.18
+
 define build_iomx
 include $(CLEAR_VARS)
 LOCAL_MODULE := $(1)
 LOCAL_SRC_FILES  := ../$(VLC_SRC_DIR)/modules/codec/omxil/iomx.cpp
 LOCAL_C_INCLUDES := $(LIBIOMX_INCLUDES_$(2))
-LOCAL_LDLIBS     := -L$(ANDROID_LIBS) -lgcc -lstagefright -lmedia -lutils -lbinder -llog -lcutils -lui
+LOCAL_LDLIBS     := -L$(ANDROID_PRIVATE_LIBDIR) -lgcc -lstagefright -lmedia -lutils -lbinder -llog -lcutils -lui
 LOCAL_CFLAGS     := -Wno-psabi -DANDROID_API=$(2)
+$(TARGET_OUT)/$(1).so: $(ANDROID_PRIVATE_LIBS)
 include $(BUILD_SHARED_LIBRARY)
 endef
 
-# call build_iomx for each libiomx-* in LIBVLC_LIBS
-$(foreach IOMX_MODULE,$(filter libiomx.%,$(LIBVLC_LIBS)), \
+# call build_iomx for each libiomx-* in LIBIOMX_LIBS
+$(foreach IOMX_MODULE, $(LIBIOMX_LIBS), \
 	$(eval $(call build_iomx,$(IOMX_MODULE),$(subst libiomx.,,$(IOMX_MODULE)))))
 
+
+#######
+# ANW #
+#######
 LIBANW_SRC_FILES_COMMON += ../$(VLC_SRC_DIR)/modules/video_output/android/nativewindowpriv.c
 # Once we always build this with a version of vlc that contains nativewindowpriv.c,
 # we can remove this condition
@@ -153,11 +183,14 @@ include $(CLEAR_VARS)
 LOCAL_MODULE := $(1)
 LOCAL_SRC_FILES  := $(LIBANW_SRC_FILES_COMMON)
 LOCAL_C_INCLUDES := $(LIBIOMX_INCLUDES_$(2))
-LOCAL_LDLIBS     := -L$(ANDROID_LIBS) -llog -lhardware
+LOCAL_LDLIBS     := -L$(ANDROID_PRIVATE_LIBDIR) -llog -lhardware
 LOCAL_CFLAGS     := $(LIBIOMX_CFLAGS_COMMON) -DANDROID_API=$(2)
+$(TARGET_OUT)/$(1).so: $(ANDROID_PRIVATE_LIBS)
 include $(BUILD_SHARED_LIBRARY)
 endef
 
-$(foreach ANW_MODULE,$(filter libanw.%,$(LIBVLC_LIBS)), \
+LIBANW_LIBS += libanw.10 libanw.13 libanw.14 libanw.18 libanw.21
+
+$(foreach ANW_MODULE,$(LIBANW_LIBS), \
     $(eval $(call build_anw,$(ANW_MODULE),$(subst libanw.,,$(ANW_MODULE)))))
 endif



More information about the Android mailing list