[vlc-devel] [PATCH] Automatically detect NDK v7 presence

Edward Wang edward.c.wang at compdigitec.com
Sat Jan 28 20:35:31 CET 2012


Alleviates the need to modify files
---
 compile.sh                 |   14 +++++++++++++-
 vlc-android/jni/Android.mk |    8 +++-----
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/compile.sh b/compile.sh
index 561b563..dd7889f 100755
--- a/compile.sh
+++ b/compile.sh
@@ -10,7 +10,11 @@
 # export NO_NEON=1
 # make sure it is set for both the contribs bootstrap next and the configure.sh later.
 
-# Also, if you do not have NDK v7 or later, then set HAS_NDK_V7 to 0 in vlc-android/jni/Android.mk:10
+# The script will attempt to automatically detect if you have NDK v7, but you can override this
+# If you do not have NDK v7 or later:
+# export NO_NDK_V7=1
+# or if you are sure you have NDK v7:
+# export NO_NDK_V7=0
 # to prevent this error message in your compile:
 # arm-linux-androideabi-g++: /opt/android-ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/libgnustl_static.a: No such file or directory
 
@@ -20,6 +24,14 @@ if [ -z "$ANDROID_NDK" -o -z "$ANDROID_SDK" ]; then
    exit 1
 fi
 
+if [ -z "$NO_NDK_V7" ]; then
+    # try to detect NDK version
+    REL=$(grep -iw "r7" $ANDROID_NDK/RELEASE.TXT)
+    if [ -z $REL ]; then
+	export NO_NDK_V7=1
+    fi
+fi
+
 # Add the NDK toolchain to the PATH, needed both for contribs and for building
 # stub libraries
 export PATH=${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin:${PATH}
diff --git a/vlc-android/jni/Android.mk b/vlc-android/jni/Android.mk
index b1183b4..9c378a8 100644
--- a/vlc-android/jni/Android.mk
+++ b/vlc-android/jni/Android.mk
@@ -7,18 +7,16 @@ LOCAL_SRC_FILES := libvlcjni.c aout.c thumbnailer.c
 
 LOCAL_C_INCLUDES := $(VLC_SRC_DIR)/include
 
-HAS_NDK_V7 = 1
-
 ifeq ($(NO_NEON),)
 ARCH=armeabi-v7a
 else
 ARCH=armeabi
 endif
 
-ifeq ($(HAS_NDK_V7),1)
-CPP_STATIC=$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/libs/$(ARCH)/libgnustl_static.a
-else
+ifeq ($(NO_NDK_V7),1)
 CPP_STATIC=$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/libs/$(ARCH)/libstdc++.a
+else
+CPP_STATIC=$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/libs/$(ARCH)/libgnustl_static.a
 endif
 
 LOCAL_LDLIBS := -L$(VLC_CONTRIB)/lib \
-- 
1.7.5.4




More information about the vlc-devel mailing list