[Android] [PATCH 6/6] build: add multiple ABI build

Thomas Guillem tom at gllm.fr
Tue Oct 21 11:48:43 CEST 2014


ANDROID_ABI can now contains more than one ABI.

For example:
ANDROID_ABI="armeabi-v7a x86" ./compile.sh
will build an apk containing armeabi-v7a and x86 libs.
---
 Makefile   | 11 +++++++++--
 compile.sh | 20 ++++++++++++++++++++
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index dc92c38..91bdc9f 100644
--- a/Makefile
+++ b/Makefile
@@ -46,15 +46,19 @@ VLC_APK=$(SRC)/bin/VLC-debug.apk
 NDK_DEBUG=1
 endif
 
-$(VLC_APK): $(LIBVLCJNI) $(JAVA_SOURCES)
+define build_apk
 	@echo
-	@echo "=== Building $@ for $(ARCH) ==="
+	@echo "=== Building $(VLC_APK) for $(ARCH) ==="
 	@echo
 	date +"%Y-%m-%d" > $(SRC)/assets/builddate.txt
 	echo `id -u -n`@`hostname` > $(SRC)/assets/builder.txt
 	git rev-parse --short HEAD > $(SRC)/assets/revision.txt
 	./gen-env.sh $(SRC)
 	$(VERBOSE)cd $(SRC) && ant $(ANT_OPTS) $(ANT_TARGET)
+endef
+
+$(VLC_APK): $(LIBVLCJNI) $(JAVA_SOURCES)
+	$(call build_apk)
 
 VLC_MODULES=`./find_modules.sh $(VLC_BUILD_DIR)`
 
@@ -103,6 +107,9 @@ $(LIBVLCJNI): $(JNI_SOURCES) $(LIBVLCJNI_H) $(PRIVATE_LIBS)
 		TARGET_CFLAGS="$$VLC_EXTRA_CFLAGS" \
 		LIBVLC_LIBS="$(LIBVLC_LIBS)"
 
+apk:
+	$(call build_apk)
+
 apkclean:
 	rm -f $(VLC_APK)
 
diff --git a/compile.sh b/compile.sh
index 6d42be9..268737f 100755
--- a/compile.sh
+++ b/compile.sh
@@ -25,6 +25,26 @@ if [ -z "$NO_ARMV6" ];then
     NO_ARMV6=0
 fi
 
+if [ `set -- ${ANDROID_ABI}; echo $#` -gt 1 ]; then
+    ANDROID_ABI_LIST="${ANDROID_ABI}"
+    echo "More than one ABI specified: ${ANDROID_ABI_LIST}"
+    for i in ${ANDROID_ABI_LIST}; do
+        echo "$i starts building"
+        ANDROID_NDK=$ANDROID_NDK ANDROID_SDK=$ANDROID_SDK \
+            NO_FPU=$NO_FPU NO_ARMV6=$NO_ARMV6 ANDROID_ABI=$i \
+            ./compile.sh $* --jni || { echo "$i build KO"; exit 1; }
+        mkdir -p obj/
+        cp -r vlc-android/libs/$i obj
+        echo "$i build OK"
+    done
+    for i in ${ANDROID_ABI_LIST}; do
+        cp -r obj/$i vlc-android/libs/
+        rm -rf obj/$i
+    done
+    make -b -j1 apk || exit 1
+    exit 0
+fi
+
 BUILD=0
 FETCH=0
 RELEASE=0
-- 
2.1.0



More information about the Android mailing list