[Android] build: add 64bits and android-L support

Thomas Guillem git at videolan.org
Thu Oct 9 14:32:56 CEST 2014


vlc-ports/android | branch: tv | Thomas Guillem <tom at gllm.fr> | Wed Oct  8 18:25:37 2014 +0200| [12c1a7f01eba07eb6a48124f4657c62efc12cb11] | committer: Geoffrey Métais

build: add 64bits and android-L support

Don't hardcode android api to android-9 anymore, use ANDROID_API export.

In case of 64bits build: set ANDROID_API to android-L and GCCVER to 4.9.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 Makefile                       |    2 +-
 compile.sh                     |   50 +++++++++++++++++++++++++++-------------
 configure.sh                   |    8 ++++---
 vlc-android/jni/Application.mk |    4 ++--
 4 files changed, 42 insertions(+), 22 deletions(-)

diff --git a/Makefile b/Makefile
index 2fbe6f8..3832f86 100644
--- a/Makefile
+++ b/Makefile
@@ -78,7 +78,7 @@ $(LIBVLCJNI_H):
 	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=$(ANDROID_NDK)/platforms/android-9/arch-$(PLATFORM_SHORT_ARCH)
+	$(GEN)$(TARGET_TUPLE)-gcc $< -shared -o $@ --sysroot=$(ANDROID_NDK)/platforms/$(ANDROID_API)/arch-$(PLATFORM_SHORT_ARCH)
 
 $(PRIVATE_LIBDIR)/%.c: $(PRIVATE_LIBDIR)/%.symbols
 	$(VERBOSE)rm -f $@
diff --git a/compile.sh b/compile.sh
index 885ec25..b0e80c4 100755
--- a/compile.sh
+++ b/compile.sh
@@ -34,22 +34,6 @@ if [ -z "$ANDROID_ABI" ]; then
    exit 1
 fi
 
-# try to detect NDK version
-REL=$(grep -o '^r[0-9]*.*' $ANDROID_NDK/RELEASE.TXT 2>/dev/null|cut -b2-)
-case "$REL" in
-    9*|10*)
-        GCCVER=4.8
-        CXXSTL="/"${GCCVER}
-    ;;
-    7|8|*)
-        echo "You need the NDKv9 or later"
-        exit 1
-    ;;
-esac
-
-export GCCVER
-export CXXSTL
-
 # Set up ABI variables
 if [ ${ANDROID_ABI} = "x86" ] ; then
     TARGET_TUPLE="i686-linux-android"
@@ -68,6 +52,38 @@ else
     PLATFORM_SHORT_ARCH="arm"
 fi
 
+# try to detect NDK version
+REL=$(grep -o '^r[0-9]*.*' $ANDROID_NDK/RELEASE.TXT 2>/dev/null|cut -b2-)
+case "$REL" in
+    10*)
+        if [ "${HAVE_64}" = 1 ];then
+            GCCVER=4.9
+            ANDROID_API=android-L
+        else
+            GCCVER=4.8
+            ANDROID_API=android-9
+        fi
+        CXXSTL="/"${GCCVER}
+    ;;
+    9*)
+        if [ "${HAVE_64}" = 1 ];then
+            echo "You need the NDKv10 or later for 64 bits build"
+            exit 1
+        fi
+        GCCVER=4.8
+        ANDROID_API=android-9
+        CXXSTL="/"${GCCVER}
+    ;;
+    7|8|*)
+        echo "You need the NDKv9 or later"
+        exit 1
+    ;;
+esac
+
+export GCCVER
+export CXXSTL
+export ANDROID_API
+
 # XXX : important!
 [ "$HAVE_ARM" = 1 ] && cat << EOF
 For an ARMv6 device without FPU:
@@ -83,6 +99,7 @@ export PATH_HOST
 export HAVE_ARM
 export HAVE_X86
 export HAVE_MIPS
+export HAVE_64
 export PLATFORM_SHORT_ARCH
 
 # Add the NDK toolchain to the PATH, needed both for contribs and for building
@@ -329,6 +346,7 @@ echo "# Re-run 'sh compile.sh' to update this file." >> env.sh
 
 # The essentials
 cat <<EssentialsA >> env.sh
+export ANDROID_API=$ANDROID_API
 export ANDROID_ABI=$ANDROID_ABI
 export ANDROID_SDK=$ANDROID_SDK
 export ANDROID_NDK=$ANDROID_NDK
diff --git a/configure.sh b/configure.sh
index 5832bc0..3da859c 100755
--- a/configure.sh
+++ b/configure.sh
@@ -10,9 +10,11 @@ if [ -z "$ANDROID_ABI" ]; then
     exit 1
 fi
 
-# Must use android-9 here. Any replacement functions needed are in the vlc-android/jni
-# folder.
-ANDROID_API=android-9
+# ANDROID_API must be previously set by compile.sh or env.sh
+if [ -z "$ANDROID_API" ];then
+    echo "ANDROID_API not set, call ./compile.sh first"
+    exit 1
+fi
 
 VLC_SOURCEDIR=..
 
diff --git a/vlc-android/jni/Application.mk b/vlc-android/jni/Application.mk
index 0bd8e8a..9e30f15 100644
--- a/vlc-android/jni/Application.mk
+++ b/vlc-android/jni/Application.mk
@@ -1,3 +1,3 @@
-APP_PLATFORM := android-9
+APP_PLATFORM := $(ANDROID_API)
 APP_ABI := $(ANDROID_ABI)
-NDK_TOOLCHAIN_VERSION=4.6
+NDK_TOOLCHAIN_VERSION=$(GCCVER)



More information about the Android mailing list