[Android] Move libvlcjni.so compilation to compile-libvlc.sh

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 12:02:21 2015 +0100| [e6c7d0584cd6e9303a117aee5a256a0256ab27e7] | committer: Jean-Baptiste Kempf

Move libvlcjni.so compilation to compile-libvlc.sh

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

 Makefile          |   49 +------------------------------------------------
 compile-libvlc.sh |   31 +++++++++++++++++++++++++++++++
 compile.sh        |    1 -
 3 files changed, 32 insertions(+), 49 deletions(-)

diff --git a/Makefile b/Makefile
index c6aa191..6742d1e 100644
--- a/Makefile
+++ b/Makefile
@@ -26,19 +26,12 @@ LIBVLC_LIBS += libanw.10 libanw.13 libanw.14 libanw.18 libanw.21
 
 LIBVLCJNI= $(addprefix $(SRC)/obj/local/$(ARCH)/,$(addsuffix .so,$(LIBVLC_LIBS)))
 
-LIBVLCJNI_H=$(SRC)/jni/libvlcjni.h
-
 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
 
-ifneq ($(V),)
 ANT_OPTS += -v
 VERBOSE =
 GEN =
-else
-VERBOSE = @
-GEN = @echo "Generating" $@;
-endif
 
 ifeq ($(RELEASE),1)
 ANT_TARGET = release
@@ -64,22 +57,6 @@ endef
 $(VLC_APK): $(LIBVLCJNI) $(JAVA_SOURCES)
 	$(call build_apk)
 
-VLC_MODULES=`./find_modules.sh $(VLC_BUILD_DIR)`
-
-$(LIBVLCJNI_H):
-	$(VERBOSE)if [ -z "$(VLC_BUILD_DIR)" ]; then echo "VLC_BUILD_DIR not defined" ; exit 1; fi
-	$(GEN)modules="$(VLC_MODULES)" ; \
-	if [ -z "$$modules" ]; then echo "No VLC modules found in $(VLC_BUILD_DIR)/modules"; exit 1; fi; \
-	DEFINITION=""; \
-	BUILTINS="const void *vlc_static_modules[] = {\n"; \
-	for file in $$modules; do \
-		name=`echo $$file | sed 's/.*\.libs\/lib//' | sed 's/_plugin\.a//'`; \
-		DEFINITION=$$DEFINITION"int vlc_entry__$$name (int (*)(void *, void *, int, ...), void *);\n"; \
-		BUILTINS="$$BUILTINS vlc_entry__$$name,\n"; \
-	done; \
-	BUILTINS="$$BUILTINS NULL\n};\n"; \
-	printf "/* Autogenerated from the list of modules */\n $$DEFINITION\n $$BUILTINS\n" > $@
-
 $(PRIVATE_LIBDIR)/%.so: $(PRIVATE_LIBDIR)/%.c
 	$(GEN)$(TARGET_TUPLE)-gcc $< -shared -o $@ --sysroot=$(SYSROOT)
 
@@ -87,30 +64,6 @@ $(PRIVATE_LIBDIR)/%.c: $(PRIVATE_LIBDIR)/%.symbols
 	$(VERBOSE)rm -f $@
 	$(GEN)for s in `cat $<`; do echo "void $$s() {}" >> $@; done
 
-$(LIBVLCJNI): $(JNI_SOURCES) $(LIBVLCJNI_H) $(PRIVATE_LIBS)
-	@if [ -z "$(VLC_BUILD_DIR)" ]; then echo "VLC_BUILD_DIR not defined" ; exit 1; fi
-	@if [ -z "$(ANDROID_NDK)" ]; then echo "ANDROID_NDK not defined" ; exit 1; fi
-	@echo
-	@echo "=== Building libvlcjni ==="
-	@echo
-	$(VERBOSE)if [ -z "$(VLC_SRC_DIR)" ] ; then VLC_SRC_DIR=./vlc; fi ; \
-	if [ -z "$(VLC_CONTRIB)" ] ; then VLC_CONTRIB="$$VLC_SRC_DIR/contrib/$(TARGET_TUPLE)"; fi ; \
-	vlc_modules="$(VLC_MODULES)" ; \
-	if [ `echo "$(VLC_BUILD_DIR)" | head -c 1` != "/" ] ; then \
-		vlc_modules="`echo $$vlc_modules|sed \"s|$(VLC_BUILD_DIR)|../$(VLC_BUILD_DIR)|g\"`" ; \
-        VLC_BUILD_DIR="../$(VLC_BUILD_DIR)"; \
-	fi ; \
-	[ `echo "$$VLC_CONTRIB" | head -c 1` != "/" ] && VLC_CONTRIB="../$$VLC_CONTRIB"; \
-	[ `echo "$$VLC_SRC_DIR" | head -c 1` != "/" ] && VLC_SRC_DIR="../$$VLC_SRC_DIR"; \
-	$(ANDROID_NDK)/ndk-build -C $(SRC) \
-		VLC_SRC_DIR="$$VLC_SRC_DIR" \
-		VLC_CONTRIB="$$VLC_CONTRIB" \
-		VLC_BUILD_DIR="$$VLC_BUILD_DIR" \
-		VLC_MODULES="$$vlc_modules" \
-		NDK_DEBUG=$(NDK_DEBUG) \
-		TARGET_CFLAGS="$$VLC_EXTRA_CFLAGS" \
-		LIBVLC_LIBS="$(LIBVLC_LIBS)"
-
 apk:
 	$(call build_apk)
 
@@ -126,7 +79,7 @@ clean: lightclean
 	rm -rf $(APP_SRC)/gen java-libs/*/gen java-libs/*/bin .sdk vlc-sdk/ vlc-sdk.7z
 
 jniclean: lightclean
-	rm -rf $(LIBVLCJNI) $(LIBVLCJNI_H) $(APP_SRC)/libs/
+	rm -rf $(LIBVLCJNI) $(APP_SRC)/libs/
 
 distclean: clean jniclean
 
diff --git a/compile-libvlc.sh b/compile-libvlc.sh
index 32ef288..03c0816 100755
--- a/compile-libvlc.sh
+++ b/compile-libvlc.sh
@@ -429,3 +429,34 @@ cd ../..
 
 ######################################################################################
 
+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
+	name=`echo $file | sed 's/.*\.libs\/lib//' | sed 's/_plugin\.a//'`; \
+	DEFINITION=$DEFINITION"int vlc_entry__$name (int (*)(void *, void *, int, ...), void *);\n"; \
+	BUILTINS="$BUILTINS vlc_entry__$name,\n"; \
+done; \
+BUILTINS="$BUILTINS NULL\n};\n"; \
+printf "/* Autogenerated from the list of modules */\n $DEFINITION\n $BUILTINS\n" > libvlc/jni/libvlcjni.h
+
+
+echo "Generating static modules object files"
+
+echo $VLC_BUILD_DIR
+LIBVLC_LIBS="libvlcjni"
+VLC_MODULES=`echo $VLC_MODULES|sed "s|vlc/$VLC_BUILD_DIR|../vlc/$VLC_BUILD_DIR|g"`
+VLC_SRC_DIR="../vlc"
+VLC_CONTRIB="$VLC_SRC_DIR/contrib/$TARGET_TUPLE"
+$ANDROID_NDK/ndk-build -C libvlc \
+	VLC_SRC_DIR="$VLC_SRC_DIR" \
+	VLC_BUILD_DIR="$VLC_SRC_DIR/$VLC_BUILD_DIR" \
+	VLC_CONTRIB="$VLC_CONTRIB" \
+	VLC_MODULES="$VLC_MODULES" \
+	TARGET_CFLAGS="$VLC_EXTRA_CFLAGS" \
+	LIBVLC_LIBS="$LIBVLC_LIBS" V=1
+
diff --git a/compile.sh b/compile.sh
index a00d02c..04b667a 100755
--- a/compile.sh
+++ b/compile.sh
@@ -170,7 +170,6 @@ export ANDROID_SYS_HEADERS=${PWD}/android-headers           # Android.mk
 export ANDROID_LIBS=${PWD}/android-libs                     # Android.mk
 export VLC_BUILD_DIR=vlc/build-android-${TARGET_TUPLE}      # Android.mk
 
-make $CLEAN
 make -j1 TARGET_TUPLE=$TARGET_TUPLE SYSROOT=$SYSROOT GCCVER=$GCCVER RELEASE=$RELEASE $TARGET
 
 #



More information about the Android mailing list