avdevice/lavfi: add io.h, should fix msvc build
[ffmpeg.git] / tools / build_libstagefright
old mode 100755 (executable)
new mode 100644 (file)
index 583c801..22bb712
@@ -5,17 +5,35 @@ if [ "$NDK" = "" ]; then
     export NDK=${HOME}/android-ndk
 fi
 
+echo "Fetching Android system headers"
+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
+
+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.
+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../
+    mv ../system/lib ../android-libs
+    rmdir ../system
+fi
+
+
 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
-ANDROID_SOURCE=$HOME/android
-ANDROID_LIBS=$HOME/glib
+ANDROID_SOURCE=../android-source
+ANDROID_LIBS=../android-libs
+ABI="armeabi-v7a"
 
-rm -rf ../build/libav
-mkdir -p ../build/libav
+rm -rf ../build/stagefright
+mkdir -p ../build/stagefright
 
-DEST=../build/libav
+DEST=../build/stagefright
 FLAGS="--target-os=linux --cross-prefix=arm-linux-androideabi- --arch=arm --cpu=armv7-a"
 FLAGS="$FLAGS --sysroot=$SYSROOT"
 FLAGS="$FLAGS --disable-avdevice --disable-decoder=h264 --disable-decoder=h264_vdpau --enable-libstagefright-h264"
@@ -23,12 +41,11 @@ FLAGS="$FLAGS --disable-avdevice --disable-decoder=h264 --disable-decoder=h264_v
 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"
-EXTRA_CFLAGS="$EXTRA_CFLAGS -I$NDK/sources/cxx-stl/system/include"
+EXTRA_CFLAGS="$EXTRA_CFLAGS -I$NDK/sources/cxx-stl/gnu-libstdc++/include -I$NDK/sources/cxx-stl/gnu-libstdc++/libs/$ABI/include"
 
 EXTRA_CFLAGS="$EXTRA_CFLAGS -march=armv7-a -mfloat-abi=softfp -mfpu=neon"
-EXTRA_LDFLAGS="-Wl,--fix-cortex-a8 -L$ANDROID_LIBS -Wl,-rpath-link,$ANDROID_LIBS"
+EXTRA_LDFLAGS="-Wl,--fix-cortex-a8 -L$ANDROID_LIBS -Wl,-rpath-link,$ANDROID_LIBS -L$NDK/sources/cxx-stl/gnu-libstdc++/libs/$ABI"
 EXTRA_CXXFLAGS="-Wno-multichar -fno-exceptions -fno-rtti"
-ABI="armeabi-v7a"
 DEST="$DEST/$ABI"
 FLAGS="$FLAGS --prefix=$DEST"