Commit 75e1d9c7 authored by Rafaël Carré's avatar Rafaël Carré

android/configure.sh: sanitize flags

No need for -Wl,-shared or -rpath-link
No need for -lc -lgcc -ld, especially when using -nostdlib
Use --sysroot to point compiler to android headers/libs
Rename some shell variables
Move enabled modules at the top of the options
No need to set PATH, we give the absolute path for compiler
parent 69b3ac6b
......@@ -7,51 +7,57 @@ fi
ANDROID_API=android-9
ANDROID_BIN=$ANDROID_NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/*-x86/bin/
ANDROID_INCLUDE=$ANDROID_NDK/platforms/$ANDROID_API/arch-arm/usr/include
ANDROID_LIB=$ANDROID_NDK/platforms/$ANDROID_API/arch-arm/usr/lib
GCC_PREFIX=${ANDROID_BIN}/arm-linux-androideabi-
VLC_SOURCEDIR="`dirname $0`/../../.."
# needed for old ndk: change all the arm-linux-androideabi to arm-eabi
# the --host is kept on purpose because otherwise libtool complains..
EXTRA_CFLAGS="-mlong-calls -fstrict-aliasing -fprefetch-loop-arrays -ffast-math"
EXTRA_LDFLAGS=""
EXTRA_PARAMS=""
CFLAGS="-O2 -mlong-calls -fstrict-aliasing -fprefetch-loop-arrays -ffast-math"
LDFLAGS="-Wl,-Bdynamic,-dynamic-linker=/system/bin/linker -Wl,--no-undefined"
if [ -z "$NO_NEON" ]; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -mfpu=neon -mtune=cortex-a8 -ftree-vectorize -mvectorize-with-neon-quad"
EXTRA_LDFLAGS="-Wl,--fix-cortex-a8"
CXX_TARGET="armeabi-v7a"
CFLAGS="$CFLAGS -mfpu=neon -mtune=cortex-a8 -ftree-vectorize -mvectorize-with-neon-quad"
LDFLAGS="$LDFLAGS -Wl,--fix-cortex-a8"
EXTRA_PARAMS=""
else
EXTRA_CFLAGS="$EXTRA_CFLAGS -march=armv6j -mtune=arm1136j-s -msoft-float"
EXTRA_PARAMS=" --disable-neon"
CXX_TARGET="armeabi"
CFLAGS="$CFLAGS -march=armv6j -mtune=arm1136j-s -msoft-float"
EXTRA_PARAMS=" --disable-neon"
fi
PATH="$ANDROID_BIN:$PATH" \
CC="${GCC_PREFIX}gcc" \
CXX="${GCC_PREFIX}g++" \
NM="${GCC_PREFIX}nm" \
STRIP="${GCC_PREFIX}strip" \
RANLIB="${GCC_PREFIX}ranlib" \
AR="${GCC_PREFIX}ar" \
CPPFLAGS="-I$ANDROID_INCLUDE -I$VLC_SOURCEDIR/extras/contrib/hosts/arm-eabi/include \
-I${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/include \
-I${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include/" \
LDFLAGS="-Wl,-rpath-link=$ANDROID_LIB,-Bdynamic,-dynamic-linker=/system/bin/linker -Wl,--no-undefined -Wl,-shared -L$ANDROID_LIB $EXTRA_LDFLAGS" \
CFLAGS="-nostdlib $EXTRA_CFLAGS -O2" \
CXXFLAGS="-nostdlib $EXTRA_CFLAGS -O2 -D__STDC_VERSION__=199901L -D__STDC_CONSTANT_MACROS" \
LIBS="-lc -ldl -lgcc" \
CPPFLAGS="-I${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/include -I${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/libs/${CXX_TARGET}/include"
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" \
CXXFLAGS="$CFLAGS" \
LDFLAGS="$LDFLAGS" \
CC="${CROSS_COMPILE}gcc --sysroot=${SYSROOT}" \
CXX="${CROSS_COMPILE}g++ --sysroot=${SYSROOT}" \
NM="${CROSS_COMPILE}nm" \
STRIP="${CROSS_COMPILE}strip" \
RANLIB="${CROSS_COMPILE}ranlib" \
AR="${CROSS_COMPILE}ar" \
PKG_CONFIG_LIBDIR="$VLC_SOURCEDIR/extras/contrib/hosts/arm-eabi/lib/pkgconfig" \
sh $VLC_SOURCEDIR/configure --host=arm-eabi-linux --build=x86_64-unknown-linux $EXTRA_PARAMS \
--enable-static-modules \
--disable-vlc \
--enable-live555 --enable-realrtsp \
--enable-avformat \
--enable-swscale \
--enable-avcodec \
--enable-opensles \
--enable-android-surface \
--enable-debug \
--disable-mkv \
--disable-vlc \
--disable-vlm --disable-sout \
--disable-dbus \
--disable-lua \
--disable-libgcrypt \
--enable-live555 --enable-realrtsp \
--disable-vcd \
--disable-v4l2 \
--disable-gnomevfs \
......@@ -60,11 +66,7 @@ sh $VLC_SOURCEDIR/configure --host=arm-eabi-linux --build=x86_64-unknown-linux $
--disable-bluray \
--disable-linsys \
--disable-decklink \
--enable-avformat \
--enable-swscale \
--enable-avcodec \
--disable-libva \
--disable-mkv \
--disable-dv \
--disable-mod \
--disable-sid \
......@@ -75,7 +77,6 @@ sh $VLC_SOURCEDIR/configure --host=arm-eabi-linux --build=x86_64-unknown-linux $
--disable-sdl-image \
--disable-zvbi \
--disable-fluidsynth \
--enable-opensles \
--disable-jack \
--disable-pulse \
--disable-alsa \
......@@ -94,7 +95,6 @@ sh $VLC_SOURCEDIR/configure --host=arm-eabi-linux --build=x86_64-unknown-linux $
--disable-sqlite \
--disable-udev \
--disable-libxml2 \
--enable-android-surface \
--disable-caca \
--disable-glx \
--disable-egl \
......
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