-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_libstagefright
executable file
·77 lines (62 loc) · 4.12 KB
/
build_libstagefright
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
if [ "$NDK" = "" ];
then echo NDK variable not set, assuming ${HOME}/android-ndk #export NDK=${HOME}/android-ndk
export NDK=/Users/willman/android-tools/android-ndk-r10e
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
#git clone --depth=1 --branch cm-10.1 https://github.com/CyanogenMod/android_frameworks_base.git ../android-source/frameworks/base
#git clone --depth=1 --branch cm-10.1 https://github.com/CyanogenMod/android_system_core.git ../android-source/system/core
#git clone --depth=1 --branch cm-10.1 https://github.com/CyanogenMod/android_frameworks_av.git ../android-source/frameworks/av
#git clone --depth=1 --branch cm-10.1 https://github.com/CyanogenMod/android_frameworks_native.git ../android-source/frameworks/native
#git clone --depth=1 --branch cm-10.1 https://github.com/CyanogenMod/android_hardware_libhardware.git ../android-source/frameworks/hardware
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
echo "aaa"
#wget http://download.cyanogenmod.com/get/update-cm-7.0.3-N1-signed.zip -P../
#wget http://sourceforge.net/projects/nexusoneandroid/files/update-cm-7.0.3-N1-signed.zip/stats/timeline -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
echo "sysroot:"$SYSROO21T
# Expand the prebuilt/* path into the correct one
#TOOLCHAIN=`echo $NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/*-x86`
TOOLCHAIN=`echo $NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64`
export PATH=$TOOLCHAIN/bin:$PATH
ANDROID_SOURCE=/Users/willman/android-tools/android-source
ANDROID_LIBS=/Users/willman/android-tools/android-libs
ABI="armeabi-v7a"
rm -rf ./build/stagefright
mkdir -p ./build/stagefright
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"
echo "ANDROID SOURCE:"$ANDROID_SOURCE
echo "ABI:"$ABI
EXTRA_CFLAGS="-I$ANDROID_SOURCE/frameworks/native/include -I$ANDROID_SOURCE/frameworks/native/include/media/openmax/ -I$ANDROID_SOURCE/system/core/include"
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$ANDROID_SOURCE/frameworks/av/include"
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$ANDROID_SOURCE/frameworks/av/media/libstagefright"
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$ANDROID_SOURCE/frameworks/base/include"
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$ANDROID_SOURCE/frameworks/hardware/include"
#EXTRA_CFLAGS="$EXTRA_CFLAGS -I$NDK/sources/cxx-stl/stlport/stlport/ -I$NDK/sources/cxx-stl/stlport/libs/$ABI/"
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$NDK/sources/cxx-stl/gnu-libstdc++/4.8/include -I$NDK/sources/cxx-stl/gnu-libstdc++/4.8/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 -L$NDK/sources/cxx-stl/gnu-libstdc++/libs/$ABI"
EXTRA_LDFLAGS="-Wl,--fix-cortex-a8 -L$ANDROID_LIBS -Wl,-rpath-link,$ANDROID_LIBS -lstagefright -L$NDK/sources/cxx-stl/gnu-libstdc++/4.8/libs/$ABI -lstdc++ -lutils -lbinder -lgnustl_static -lgnustl_shared -lm"
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 --enable-memalign-hack --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