2011-08-31 01:42:56 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
if [ "$NDK" = "" ]; then
|
2011-09-09 20:44:36 +03:00
|
|
|
echo NDK variable not set, assuming ${HOME}/android-ndk
|
|
|
|
export NDK=${HOME}/android-ndk
|
2011-08-31 01:42:56 +03:00
|
|
|
fi
|
|
|
|
|
2011-10-09 12:06:12 +03:00
|
|
|
echo "Fetching Android system headers"
|
2014-03-13 01:07:00 +03:00
|
|
|
git clone --depth=1 --branch gingerbread-release https://github.com/CyanogenMod/android_frameworks_base.git ../android-source/frameworks/base
|
|
|
|
git clone --depth=1 --branch gingerbread-release https://github.com/CyanogenMod/android_system_core.git ../android-source/system/core
|
2011-10-09 12:06:12 +03:00
|
|
|
|
|
|
|
echo "Fetching Android libraries for linking"
|
|
|
|
# Libraries from any froyo/gingerbread device/emulator should work
|
|
|
|
# fine, since the symbols used should be available on most of them.
|
2012-01-07 18:05:51 +03:00
|
|
|
if [ ! -d "../android-libs" ]; then
|
|
|
|
if [ ! -f "../update-cm-7.0.3-N1-signed.zip" ]; then
|
|
|
|
wget http://download.cyanogenmod.com/get/update-cm-7.0.3-N1-signed.zip -P../
|
|
|
|
fi
|
|
|
|
unzip ../update-cm-7.0.3-N1-signed.zip system/lib/* -d../
|
2011-10-09 12:06:12 +03:00
|
|
|
mv ../system/lib ../android-libs
|
|
|
|
rmdir ../system
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2011-08-31 01:42:56 +03:00
|
|
|
SYSROOT=$NDK/platforms/android-9/arch-arm
|
|
|
|
# Expand the prebuilt/* path into the correct one
|
|
|
|
TOOLCHAIN=`echo $NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/*-x86`
|
|
|
|
export PATH=$TOOLCHAIN/bin:$PATH
|
2011-10-09 12:06:12 +03:00
|
|
|
ANDROID_SOURCE=../android-source
|
|
|
|
ANDROID_LIBS=../android-libs
|
2012-04-18 21:32:53 +03:00
|
|
|
ABI="armeabi-v7a"
|
2011-08-31 01:42:56 +03:00
|
|
|
|
2011-09-14 03:33:50 +03:00
|
|
|
rm -rf ../build/stagefright
|
|
|
|
mkdir -p ../build/stagefright
|
2011-08-31 01:42:56 +03:00
|
|
|
|
2011-09-14 03:33:50 +03:00
|
|
|
DEST=../build/stagefright
|
2011-08-31 01:42:56 +03:00
|
|
|
FLAGS="--target-os=linux --cross-prefix=arm-linux-androideabi- --arch=arm --cpu=armv7-a"
|
|
|
|
FLAGS="$FLAGS --sysroot=$SYSROOT"
|
2011-09-08 18:47:17 +03:00
|
|
|
FLAGS="$FLAGS --disable-avdevice --disable-decoder=h264 --disable-decoder=h264_vdpau --enable-libstagefright-h264"
|
2011-08-31 01:42:56 +03:00
|
|
|
|
|
|
|
EXTRA_CFLAGS="-I$ANDROID_SOURCE/frameworks/base/include -I$ANDROID_SOURCE/system/core/include"
|
|
|
|
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$ANDROID_SOURCE/frameworks/base/media/libstagefright"
|
|
|
|
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$ANDROID_SOURCE/frameworks/base/include/media/stagefright/openmax"
|
2012-04-18 21:32:53 +03:00
|
|
|
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$NDK/sources/cxx-stl/gnu-libstdc++/include -I$NDK/sources/cxx-stl/gnu-libstdc++/libs/$ABI/include"
|
2011-08-31 01:42:56 +03:00
|
|
|
|
|
|
|
EXTRA_CFLAGS="$EXTRA_CFLAGS -march=armv7-a -mfloat-abi=softfp -mfpu=neon"
|
2012-04-18 21:32:53 +03:00
|
|
|
EXTRA_LDFLAGS="-Wl,--fix-cortex-a8 -L$ANDROID_LIBS -Wl,-rpath-link,$ANDROID_LIBS -L$NDK/sources/cxx-stl/gnu-libstdc++/libs/$ABI"
|
2011-08-31 01:42:56 +03:00
|
|
|
EXTRA_CXXFLAGS="-Wno-multichar -fno-exceptions -fno-rtti"
|
|
|
|
DEST="$DEST/$ABI"
|
|
|
|
FLAGS="$FLAGS --prefix=$DEST"
|
|
|
|
|
|
|
|
mkdir -p $DEST
|
|
|
|
|
|
|
|
echo $FLAGS --extra-cflags="$EXTRA_CFLAGS" --extra-ldflags="$EXTRA_LDFLAGS" --extra-cxxflags="$EXTRA_CXXFLAGS" > $DEST/info.txt
|
|
|
|
./configure $FLAGS --extra-cflags="$EXTRA_CFLAGS" --extra-ldflags="$EXTRA_LDFLAGS" --extra-cxxflags="$EXTRA_CXXFLAGS" | tee $DEST/configuration.txt
|
|
|
|
[ $PIPESTATUS == 0 ] || exit 1
|
|
|
|
make clean
|
|
|
|
make -j4 || exit 1
|