forked from yixia/libupnp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_android.sh
executable file
·45 lines (37 loc) · 1.12 KB
/
build_android.sh
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
#!/bin/bash
if [ -z "$ANDROID_NDK" ]; then
echo "You must define ANDROID_NDK before starting."
echo "They must point to your NDK directories.\n"
exit 1
fi
# Detect OS
OS=`uname`
HOST_ARCH=`uname -m`
export CCACHE=; type ccache >/dev/null 2>&1 && export CCACHE=ccache
if [ $OS == 'Linux' ]; then
export HOST_SYSTEM=linux-$HOST_ARCH
elif [ $OS == 'Darwin' ]; then
export HOST_SYSTEM=darwin-$HOST_ARCH
fi
SOURCE=`pwd`
PREFIX=$SOURCE/build/android
SYSROOT=$ANDROID_NDK/platforms/android-18/arch-arm
CROSS_PREFIX=$ANDROID_NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/$HOST_SYSTEM/bin/arm-linux-androideabi-
./configure --prefix=$PREFIX \
--host=arm-linux \
--with-sysroot=${SYSROOT} \
--enable-shared \
--disable-static \
--with-pic=no \
CC="${CROSS_PREFIX}gcc --sysroot=${SYSROOT}" \
CXX="${CROSS_PREFIX}g++ --sysroot=${SYSROOT}" \
RANLIB="${CROSS_PREFIX}ranlib" \
AR="${CROSS_PREFIX}ar" \
AR_FLAGS=rcu \
STRIP="${CROSS_PREFIX}strip" \
NM="${CROSS_PREFIX}nm" \
CFLAGS="-O3 --sysroot=${SYSROOT} -D__DragonFly__" \
CXXFLAGS="-O3 --sysroot=${SYSROOT}" \
|| exit 1
make clean
make -j4 install || exit 1