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 ...@@ -22,9 +22,10 @@ export NO_NDK_V7=0
If you plan to use a release build, run 'compile.sh release' If you plan to use a release build, run 'compile.sh release'
EOF EOF
if [ -z "$ANDROID_NDK" -o -z "$ANDROID_SDK" ]; then if [ -z "$ANDROID_NDK" -o -z "$ANDROID_SDK" -o -z "$ANDROID_ABI" ]; then
echo "You must define ANDROID_NDK and ANDROID_SDK before starting." echo "You must define ANDROID_NDK, ANDROID_SDK and ANDROID_ABI before starting."
echo "They must point to your NDK and SDK directories." echo "They must point to your NDK and SDK directories.\n"
echo "ANDROID_ABI should match your ABI: armeabi-v7a, armeabi or ..."
exit 1 exit 1
fi fi
...@@ -41,7 +42,7 @@ fi ...@@ -41,7 +42,7 @@ fi
export PATH=${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin:${PATH} export PATH=${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin:${PATH}
# 1/ libvlc, libvlccore and its plugins # 1/ libvlc, libvlccore and its plugins
TESTED_HASH=defdb5a9e1 TESTED_HASH=3e140bd0
if [ ! -d "vlc" ]; then if [ ! -d "vlc" ]; then
echo "VLC source not found, cloning" echo "VLC source not found, cloning"
git clone git://git.videolan.org/vlc.git vlc git clone git://git.videolan.org/vlc.git vlc
...@@ -92,25 +93,41 @@ cd contrib/android ...@@ -92,25 +93,41 @@ cd contrib/android
--disable-sidplay2 \ --disable-sidplay2 \
--disable-samplerate \ --disable-samplerate \
--enable-iconv --enable-iconv
echo EXTRA_CFLAGS=-g >> config.mak
# TODO: mpeg2, theora # TODO: mpeg2, theora
if test -z "${NO_NEON}" -o -n "${TEGRA2}"; then if [ ${ANDROID_ABI} = "armeabi-v7a" ] ; then
# assumes armv7-a if test -z "${NO_NEON}" ; then
echo "EXTRA_CFLAGS += -mthumb" >> config.mak 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 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 fi
# Release or not? # Release or not?
if [ $# -ne 0 ] && [ "$1" == "release" ]; then if [ $# -ne 0 ] && [ "$1" == "release" ]; then
OPTS="" OPTS=""
echo "EXTRA_CFLAGS += -DNDEBUG" >> config.mak EXTRA_CFLAGS="${EXTRA_CFLAGS} -DNDEBUG "
MAKEFLAGS="RELEASE=1" RELEASEFLAG="RELEASE=1"
else else
OPTS="--enable-debug" OPTS="--enable-debug"
fi fi
echo "EXTRA_CFLAGS= -g ${EXTRA_CFLAGS}" >> config.mak
export VLC_EXTRA_CFLAGS=${EXTRA_CFLAGS}
make fetch make fetch
make make
...@@ -141,4 +158,4 @@ export ANDROID_LIBS=${PWD}/android-libs ...@@ -141,4 +158,4 @@ export ANDROID_LIBS=${PWD}/android-libs
export VLC_BUILD_DIR=vlc/android export VLC_BUILD_DIR=vlc/android
make distclean make distclean
make $MAKEFLAGS make $RELEASEFLAG
#!/bin/sh #!/bin/sh
if [ -z "$ANDROID_NDK" ]; then if [ -z "$ANDROID_NDK" -o -z "$ANDROID_ABI" ]; then
echo "Please set the ANDROID_NDK environment variable with its path." 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 exit 1
fi fi
...@@ -11,34 +12,25 @@ ANDROID_API=android-9 ...@@ -11,34 +12,25 @@ ANDROID_API=android-9
VLC_SOURCEDIR=.. 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" LDFLAGS="-Wl,-Bdynamic,-dynamic-linker=/system/bin/linker -Wl,--no-undefined"
if [ -z "$NO_NEON" ]; then 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" EXTRA_PARAMS=" --enable-neon"
elif [ -n "$TEGRA2" ]; then LDFLAGS="$LDFLAGS -Wl,--fix-cortex-a8"
CXX_TARGET="armeabi-v7a"
CFLAGS="$CFLAGS -mfpu=vfpv3-d16 -mcpu=cortex-a9 -mthumb"
EXTRA_PARAMS=" --disable-neon"
else else
CXX_TARGET="armeabi"
CFLAGS="$CFLAGS -march=armv6j -mtune=arm1136j-s -msoft-float"
EXTRA_PARAMS=" --disable-neon" EXTRA_PARAMS=" --disable-neon"
fi fi
CPPFLAGS="-I${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/include -I${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/libs/${ANDROID_ABI}/include"
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/${ANDROID_ABI}"
LDFLAGS="$LDFLAGS -L${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/libs/${CXX_TARGET}"
SYSROOT=$ANDROID_NDK/platforms/$ANDROID_API/arch-arm SYSROOT=$ANDROID_NDK/platforms/$ANDROID_API/arch-arm
ANDROID_BIN=$ANDROID_NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/*-x86/bin/ ANDROID_BIN=$ANDROID_NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/*-x86/bin/
CROSS_COMPILE=${ANDROID_BIN}/arm-linux-androideabi- CROSS_COMPILE=${ANDROID_BIN}/arm-linux-androideabi-
CPPFLAGS="$CPPFLAGS" \ CPPFLAGS="$CPPFLAGS" \
CFLAGS="$CFLAGS" \ CFLAGS="$CFLAGS ${VLC_EXTRA_CFLAGS}" \
CXXFLAGS="$CFLAGS" \ CXXFLAGS="$CFLAGS" \
LDFLAGS="$LDFLAGS" \ LDFLAGS="$LDFLAGS" \
CC="${CROSS_COMPILE}gcc --sysroot=${SYSROOT}" \ 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