Commit a3a59fd0 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Rework the Android compilation flags

This will support more ABIs, but requires a change in your compile flags
parent 6cc5b333
......@@ -22,9 +22,10 @@ export NO_NDK_V7=0
If you plan to use a release build, run 'compile.sh release'
EOF
if [ -z "$ANDROID_NDK" -o -z "$ANDROID_SDK" ]; then
echo "You must define ANDROID_NDK and ANDROID_SDK before starting."
echo "They must point to your NDK and SDK directories."
if [ -z "$ANDROID_NDK" -o -z "$ANDROID_SDK" -o -z "$ANDROID_ABI" ]; then
echo "You must define ANDROID_NDK, ANDROID_SDK and ANDROID_ABI before starting."
echo "They must point to your NDK and SDK directories.\n"
echo "ANDROID_ABI should match your ABI: armeabi-v7a, armeabi or ..."
exit 1
fi
......@@ -41,7 +42,7 @@ fi
export PATH=${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin:${PATH}
# 1/ libvlc, libvlccore and its plugins
TESTED_HASH=defdb5a9e1
TESTED_HASH=3e140bd0
if [ ! -d "vlc" ]; then
echo "VLC source not found, cloning"
git clone git://git.videolan.org/vlc.git vlc
......@@ -92,25 +93,41 @@ cd contrib/android
--disable-sidplay2 \
--disable-samplerate \
--enable-iconv
echo EXTRA_CFLAGS=-g >> config.mak
# TODO: mpeg2, theora
if test -z "${NO_NEON}" -o -n "${TEGRA2}"; then
# assumes armv7-a
echo "EXTRA_CFLAGS += -mthumb" >> config.mak
if [ ${ANDROID_ABI} = "armeabi-v7a" ] ; then
if test -z "${NO_NEON}" ; then
EXTRA_CFLAGS="-mfpu=neon -mcpu=cortex-a8"
else
EXTRA_CFLAGS="-mfpu=vfpv3-d16 -mcpu=cortex-a9"
fi
EXTRA_CFLAGS="${EXTRA_CFLAGS} -mthumb -mfloat-abi=softfp"
echo "NOTHUMB := -marm" >> config.mak
elif [ ${ANDROID_ABI} = "armeabi" ] ; then
export NO_NEON=1
if test -z "${NO_FPU}" ; then
EXTRA_CFLAGS="-mfpu=vfp -mcpu=arm1136jf-s -mfloat-abi=softfp"
else
EXTRA_CFLAGS="-march=armv6j -mtune=arm1136j-s -msoft-float"
fi
else
echo "Unknown ABI. Die, die, die!"
exit 2
fi
# Release or not?
if [ $# -ne 0 ] && [ "$1" == "release" ]; then
OPTS=""
echo "EXTRA_CFLAGS += -DNDEBUG" >> config.mak
MAKEFLAGS="RELEASE=1"
EXTRA_CFLAGS="${EXTRA_CFLAGS} -DNDEBUG "
RELEASEFLAG="RELEASE=1"
else
OPTS="--enable-debug"
fi
echo "EXTRA_CFLAGS= -g ${EXTRA_CFLAGS}" >> config.mak
export VLC_EXTRA_CFLAGS=${EXTRA_CFLAGS}
make fetch
make
......@@ -141,4 +158,4 @@ export ANDROID_LIBS=${PWD}/android-libs
export VLC_BUILD_DIR=vlc/android
make distclean
make $MAKEFLAGS
make $RELEASEFLAG
#!/bin/sh
if [ -z "$ANDROID_NDK" ]; then
echo "Please set the ANDROID_NDK environment variable with its path."
if [ -z "$ANDROID_NDK" -o -z "$ANDROID_ABI" ]; then
echo "Please set the ANDROID_NDK environment variable with its path.\n"
echo "ANDROID_ABI should match your ABI: armeabi-v7a, armeabi or ..."
exit 1
fi
......@@ -11,34 +12,25 @@ ANDROID_API=android-9
VLC_SOURCEDIR=..
CFLAGS="-g -O2 -mlong-calls -fstrict-aliasing -mfloat-abi=softfp -funsafe-math-optimizations"
CFLAGS="-g -O2 -mlong-calls -fstrict-aliasing -funsafe-math-optimizations"
LDFLAGS="-Wl,-Bdynamic,-dynamic-linker=/system/bin/linker -Wl,--no-undefined"
if [ -z "$NO_NEON" ]; then
CXX_TARGET="armeabi-v7a"
CFLAGS="$CFLAGS -mfpu=neon -mcpu=cortex-a8 -mthumb"
LDFLAGS="$LDFLAGS -Wl,--fix-cortex-a8"
EXTRA_PARAMS=" --enable-neon"
elif [ -n "$TEGRA2" ]; then
CXX_TARGET="armeabi-v7a"
CFLAGS="$CFLAGS -mfpu=vfpv3-d16 -mcpu=cortex-a9 -mthumb"
EXTRA_PARAMS=" --disable-neon"
LDFLAGS="$LDFLAGS -Wl,--fix-cortex-a8"
else
CXX_TARGET="armeabi"
CFLAGS="$CFLAGS -march=armv6j -mtune=arm1136j-s -msoft-float"
EXTRA_PARAMS=" --disable-neon"
fi
CPPFLAGS="-I${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/include -I${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/libs/${CXX_TARGET}/include"
LDFLAGS="$LDFLAGS -L${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/libs/${CXX_TARGET}"
CPPFLAGS="-I${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/include -I${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/libs/${ANDROID_ABI}/include"
LDFLAGS="$LDFLAGS -L${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/libs/${ANDROID_ABI}"
SYSROOT=$ANDROID_NDK/platforms/$ANDROID_API/arch-arm
ANDROID_BIN=$ANDROID_NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/*-x86/bin/
CROSS_COMPILE=${ANDROID_BIN}/arm-linux-androideabi-
CPPFLAGS="$CPPFLAGS" \
CFLAGS="$CFLAGS" \
CFLAGS="$CFLAGS ${VLC_EXTRA_CFLAGS}" \
CXXFLAGS="$CFLAGS" \
LDFLAGS="$LDFLAGS" \
CC="${CROSS_COMPILE}gcc --sysroot=${SYSROOT}" \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment