Move & Rename buildscript, remove tabs
[ffmpeg.git] / tools / build_libstagefright
1 #!/bin/bash
2
3 if [ "$NDK" = "" ]; then
4     echo NDK variable not set, assuming ${HOME}/android-ndk
5     export NDK=${HOME}/android-ndk
6 fi
7
8 SYSROOT=$NDK/platforms/android-9/arch-arm
9 # Expand the prebuilt/* path into the correct one
10 TOOLCHAIN=`echo $NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/*-x86`
11 export PATH=$TOOLCHAIN/bin:$PATH
12 ANDROID_SOURCE=$HOME/android
13 ANDROID_LIBS=$HOME/glib
14
15 rm -rf ../build/libav
16 mkdir -p ../build/libav
17
18 DEST=../build/libav
19 FLAGS="--target-os=linux --cross-prefix=arm-linux-androideabi- --arch=arm --cpu=armv7-a"
20 FLAGS="$FLAGS --sysroot=$SYSROOT"
21 FLAGS="$FLAGS --disable-avdevice --disable-decoder=h264 --disable-decoder=h264_vdpau --enable-libstagefright-h264"
22
23 EXTRA_CFLAGS="-I$ANDROID_SOURCE/frameworks/base/include -I$ANDROID_SOURCE/system/core/include"
24 EXTRA_CFLAGS="$EXTRA_CFLAGS -I$ANDROID_SOURCE/frameworks/base/media/libstagefright"
25 EXTRA_CFLAGS="$EXTRA_CFLAGS -I$ANDROID_SOURCE/frameworks/base/include/media/stagefright/openmax"
26 EXTRA_CFLAGS="$EXTRA_CFLAGS -I$NDK/sources/cxx-stl/system/include"
27
28 EXTRA_CFLAGS="$EXTRA_CFLAGS -march=armv7-a -mfloat-abi=softfp -mfpu=neon"
29 EXTRA_LDFLAGS="-Wl,--fix-cortex-a8 -L$ANDROID_LIBS -Wl,-rpath-link,$ANDROID_LIBS"
30 EXTRA_CXXFLAGS="-Wno-multichar -fno-exceptions -fno-rtti"
31 ABI="armeabi-v7a"
32 DEST="$DEST/$ABI"
33 FLAGS="$FLAGS --prefix=$DEST"
34
35 mkdir -p $DEST
36
37 echo $FLAGS --extra-cflags="$EXTRA_CFLAGS" --extra-ldflags="$EXTRA_LDFLAGS" --extra-cxxflags="$EXTRA_CXXFLAGS" > $DEST/info.txt
38 ./configure $FLAGS --extra-cflags="$EXTRA_CFLAGS" --extra-ldflags="$EXTRA_LDFLAGS" --extra-cxxflags="$EXTRA_CXXFLAGS" | tee $DEST/configuration.txt
39 [ $PIPESTATUS == 0 ] || exit 1
40 make clean
41 make -j4 || exit 1