[Android] Move CFLAGS computation to compile-libvlc.sh

Jean-Baptiste Kempf git at videolan.org
Wed Feb 4 18:56:18 CET 2015


vlc-ports/android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Wed Feb  4 18:56:01 2015 +0100| [e277ab934e64a06370445cc1fdff45353ec915d7] | committer: Jean-Baptiste Kempf

Move CFLAGS computation to compile-libvlc.sh

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

 compile-libvlc.sh |   44 +++++++++++++++++++++++++++++++++++++++++++-
 compile.sh        |   38 --------------------------------------
 2 files changed, 43 insertions(+), 39 deletions(-)

diff --git a/compile-libvlc.sh b/compile-libvlc.sh
index bcbf48f..3ba2a7e 100755
--- a/compile-libvlc.sh
+++ b/compile-libvlc.sh
@@ -91,6 +91,45 @@ if [ -n "$HAVE_ARM" -a ! -n "$HAVE_64" ]; then
     CFLAGS="${CFLAGS} -mlong-calls"
 fi
 
+# Setup CFLAGS
+if [ ${ANDROID_ABI} = "armeabi-v7a" ] ; then
+    EXTRA_CFLAGS="-mfpu=vfpv3-d16 -mcpu=cortex-a8"
+    EXTRA_CFLAGS="${EXTRA_CFLAGS} -mthumb -mfloat-abi=softfp"
+elif [ ${ANDROID_ABI} = "armeabi" ] ; then
+    if [ -n "${NO_ARMV6}" ]; then
+        EXTRA_CFLAGS="-march=armv5te -mtune=arm9tdmi -msoft-float"
+    else
+        if [ -n "${NO_FPU}" ]; then
+            EXTRA_CFLAGS="-march=armv6j -mtune=arm1136j-s -msoft-float"
+        else
+            EXTRA_CFLAGS="-mfpu=vfp -mcpu=arm1136jf-s -mfloat-abi=softfp"
+        fi
+    fi
+elif [ ${ANDROID_ABI} = "arm64-v8a" ] ; then
+    EXTRA_CFLAGS=""
+elif [ ${ANDROID_ABI} = "x86" ] ; then
+    EXTRA_CFLAGS="-march=pentium -m32"
+elif [ ${ANDROID_ABI} = "x86_64" ] ; then
+    EXTRA_CFLAGS=""
+elif [ ${ANDROID_ABI} = "mips" ] ; then
+    EXTRA_CFLAGS="-march=mips32 -mtune=mips32r2 -mhard-float"
+    # All MIPS Linux kernels since 2.4.4 will trap any unimplemented FPU
+    # instruction and emulate it, so we select -mhard-float.
+    # See http://www.linux-mips.org/wiki/Floating_point#The_Linux_kernel_and_floating_point
+else
+    echo "Unknown ABI. Die, die, die!"
+    exit 2
+fi
+
+EXTRA_CFLAGS="${EXTRA_CFLAGS} -O2"
+
+EXTRA_CFLAGS="${EXTRA_CFLAGS} -I${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++${CXXSTL}/include"
+EXTRA_CFLAGS="${EXTRA_CFLAGS} -I${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++${CXXSTL}/libs/${ANDROID_ABI}/include"
+
+# Setup LDFLAGS
+EXTRA_LDFLAGS="-L${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++${CXXSTL}/libs/${ANDROID_ABI} -lgnustl_static"
+
+
 LDFLAGS="-Wl,-Bdynamic,-dynamic-linker=/system/bin/linker -Wl,--no-undefined"
 
 if [ -n "$HAVE_ARM" ]; then
@@ -110,11 +149,14 @@ CROSS_COMPILE=${ANDROID_BIN}/${TARGET_TUPLE}-
 # Release or not?
 if [ "$RELEASE" = 1 ]; then
     OPTS=""
-    EXTRA_CFLAGS=" -DNDEBUG "
+    EXTRA_CFLAGS="${EXTRA_CFLAGS} -DNDEBUG "
 else
     OPTS="--enable-debug"
 fi
 
+
+echo "CFLAGS ${EXTRA_CFLAGS}"
+
 ###########################
 # Build buildsystem tools #
 ###########################
diff --git a/compile.sh b/compile.sh
index 9502388..a47a1f4 100755
--- a/compile.sh
+++ b/compile.sh
@@ -178,44 +178,6 @@ then
     exit 0
 fi
 
-# Setup CFLAGS
-if [ ${ANDROID_ABI} = "armeabi-v7a" ] ; then
-    EXTRA_CFLAGS="-mfpu=vfpv3-d16 -mcpu=cortex-a8"
-    EXTRA_CFLAGS="${EXTRA_CFLAGS} -mthumb -mfloat-abi=softfp"
-elif [ ${ANDROID_ABI} = "armeabi" ] ; then
-    if [ -n "${NO_ARMV6}" ]; then
-        EXTRA_CFLAGS="-march=armv5te -mtune=arm9tdmi -msoft-float"
-    else
-        if [ -n "${NO_FPU}" ]; then
-            EXTRA_CFLAGS="-march=armv6j -mtune=arm1136j-s -msoft-float"
-        else
-            EXTRA_CFLAGS="-mfpu=vfp -mcpu=arm1136jf-s -mfloat-abi=softfp"
-        fi
-    fi
-elif [ ${ANDROID_ABI} = "arm64-v8a" ] ; then
-    EXTRA_CFLAGS=""
-elif [ ${ANDROID_ABI} = "x86" ] ; then
-    EXTRA_CFLAGS="-march=pentium -m32"
-elif [ ${ANDROID_ABI} = "x86_64" ] ; then
-    EXTRA_CFLAGS=""
-elif [ ${ANDROID_ABI} = "mips" ] ; then
-    EXTRA_CFLAGS="-march=mips32 -mtune=mips32r2 -mhard-float"
-    # All MIPS Linux kernels since 2.4.4 will trap any unimplemented FPU
-    # instruction and emulate it, so we select -mhard-float.
-    # See http://www.linux-mips.org/wiki/Floating_point#The_Linux_kernel_and_floating_point
-else
-    echo "Unknown ABI. Die, die, die!"
-    exit 2
-fi
-
-EXTRA_CFLAGS="${EXTRA_CFLAGS} -O2"
-
-EXTRA_CFLAGS="${EXTRA_CFLAGS} -I${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++${CXXSTL}/include"
-EXTRA_CFLAGS="${EXTRA_CFLAGS} -I${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++${CXXSTL}/libs/${ANDROID_ABI}/include"
-
-# Setup LDFLAGS
-EXTRA_LDFLAGS="-L${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++${CXXSTL}/libs/${ANDROID_ABI} -lgnustl_static"
-
 # Make in //
 if [ -z "$MAKEFLAGS" ]; then
     UNAMES=$(uname -s)



More information about the Android mailing list