3 if [ "$NDK" = "" ]; then
4 echo NDK variable not
set, assuming
${HOME}/android-ndk
5 export NDK
=${HOME}/android-ndk
8 echo "Fetching Android system headers"
9 git clone
--depth=1 --branch gingerbread-release https
://github.com
/CyanogenMod
/android_frameworks_base.git ..
/android-source
/frameworks
/base
10 git clone
--depth=1 --branch gingerbread-release https
://github.com
/CyanogenMod
/android_system_core.git ..
/android-source
/system
/core
12 echo "Fetching Android libraries for linking"
13 # Libraries from any froyo/gingerbread device/emulator should work
14 # fine, since the symbols used should be available on most of them.
15 if [ ! -d "../android-libs" ]; then
16 if [ ! -f "../update-cm-7.0.3-N1-signed.zip" ]; then
17 wget http
://download.cyanogenmod.com
/get
/update-cm-7.0
.3-N1-signed.
zip -P..
/
19 unzip ..
/update-cm-7.0
.3-N1-signed.
zip system
/lib
/* -d..
/
20 mv ..
/system
/lib ..
/android-libs
25 SYSROOT
=$NDK/platforms
/android-
9/arch-arm
26 # Expand the prebuilt/* path into the correct one
27 TOOLCHAIN
=`echo $NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/*-x86`
28 export PATH
=$TOOLCHAIN/bin
:$PATH
29 ANDROID_SOURCE
=..
/android-source
30 ANDROID_LIBS
=..
/android-libs
33 rm -rf ..
/build
/stagefright
34 mkdir
-p ..
/build
/stagefright
36 DEST
=..
/build
/stagefright
37 FLAGS
="--target-os=linux --cross-prefix=arm-linux-androideabi- --arch=arm --cpu=armv7-a"
38 FLAGS
="$FLAGS --sysroot=$SYSROOT"
39 FLAGS
="$FLAGS --disable-avdevice --disable-decoder=h264 --disable-decoder=h264_vdpau --enable-libstagefright-h264"
41 EXTRA_CFLAGS
="-I$ANDROID_SOURCE/frameworks/base/include -I$ANDROID_SOURCE/system/core/include"
42 EXTRA_CFLAGS
="$EXTRA_CFLAGS -I$ANDROID_SOURCE/frameworks/base/media/libstagefright"
43 EXTRA_CFLAGS
="$EXTRA_CFLAGS -I$ANDROID_SOURCE/frameworks/base/include/media/stagefright/openmax"
44 EXTRA_CFLAGS
="$EXTRA_CFLAGS -I$NDK/sources/cxx-stl/gnu-libstdc++/include -I$NDK/sources/cxx-stl/gnu-libstdc++/libs/$ABI/include"
46 EXTRA_CFLAGS
="$EXTRA_CFLAGS -march=armv7-a -mfloat-abi=softfp -mfpu=neon"
47 EXTRA_LDFLAGS
="-Wl,--fix-cortex-a8 -L$ANDROID_LIBS -Wl,-rpath-link,$ANDROID_LIBS -L$NDK/sources/cxx-stl/gnu-libstdc++/libs/$ABI"
48 EXTRA_CXXFLAGS
="-Wno-multichar -fno-exceptions -fno-rtti"
50 FLAGS
="$FLAGS --prefix=$DEST"
54 echo $FLAGS --extra-cflags="$EXTRA_CFLAGS" --extra-ldflags="$EXTRA_LDFLAGS" --extra-cxxflags="$EXTRA_CXXFLAGS" > $DEST/info.txt
55 .
/configure
$FLAGS --extra-cflags="$EXTRA_CFLAGS" --extra-ldflags="$EXTRA_LDFLAGS" --extra-cxxflags="$EXTRA_CXXFLAGS" |
tee $DEST/configuration.txt
56 [ $PIPESTATUS == 0 ] ||
exit 1