-
Notifications
You must be signed in to change notification settings - Fork 4
/
build_android.sh
90 lines (75 loc) · 2.22 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
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
78
79
80
81
82
83
84
85
86
87
88
89
90
#! /bin/bash
#out directories
ARMV7_OUT_DIR="out_android_armv7"
ARM64_OUT_DIR="out_android_arm64"
X86_OUT_DIR="out_android_x86"
X64_OUT_DIR="out_android_x64"
ARCH_ARM64=0
ARCH_ARMV7=0
ARCH_X86=0
ARCH_X64=0
#help
me=$(basename $0)
HELP_INFO="$me [arch/--allarch]\n Existing arches: armv7 arm64 i386 x86_64"
WEBRTC_TARGET="AppRTCDemo"
#WEBRTC_TARGET="libjingle_peerconnection_so"
if [ $* ]; then
for input in $@
do
if [[ $input = "-h" || $input = "--help" ]]; then echo $HELP_INFO; exit 0; fi
if [ $input = "armv7" ]; then ARCH_ARMV7=1;
elif [ $input = "arm64" ]; then ARCH_ARM64=1;
elif [ $input = "i386" ]; then ARCH_X86=1;
elif [ $input = "x86_64" ]; then ARCH_X64=1;
elif [ $input = "--allarch" ]; then
ARCH_ARMV7=1
ARCH_ARM64=1
ARCH_X86=1
ARCH_X64=1
else
ARCH_ARMV7=1
fi
done
else
ARCH_ARMV7=1
fi
ROOT_DIR=`pwd`
export GYP_CROSSCOMPILE=1
cd ./src
source ./build/android/envsetup.sh
if [ $ARCH_ARMV7 = 1 ]; then
echo "build android armv7 library"
export GYP_GENERATOR_FLAGS="output_dir=${ARMV7_OUT_DIR}"
export GYP_DEFINES="OS=android host_os=linux"
export GYP_GENERATORS="ninja"
gclient runhooks
#ninja -C $ARMV7_OUT_DIR/Release/ -t clean
ninja -C $ARMV7_OUT_DIR/Release/ $WEBRTC_TARGET
fi
if [ $ARCH_ARM64 = 1 ]; then
echo "build android arm64 library"
export GYP_GENERATOR_FLAGS="output_dir=${ARM64_OUT_DIR}"
export GYP_GENERATORS="ninja"
export GYP_DEFINES="OS=android host_os=linux target_arch=arm64 target_subarch=arm64"
gclient runhooks
#ninja -C $ARM64_OUT_DIR/Release/ -t clean
ninja -C $ARM64_OUT_DIR/Release/ $WEBRTC_TARGET
fi
if [ $ARCH_X86 = 1 ]; then
echo "build android x86 library"
export GYP_GENERATOR_FLAGS="output_dir=${X86_OUT_DIR}"
export GYP_GENERATORS="ninja"
export GYP_DEFINES="OS=android host_os=linux target_arch=ia32"
gclient runhooks
ninja -C $X84_OUT_DIR/Release/ $WEBRTC_TARGET
fi
if [ $ARCH_X64 = 1 ]; then
echo "build android x64 library"
export GYP_GENERATOR_FLAGS="output_dir=${X64_OUT_DIR}"
export GYP_GENERATOR="ninja"
export GYP_DEFINES="OS=android host_os=linux target_arch=x64"
gclient runhooks
ninja -C $X64_OUT_DIR/Release/ $WEBRTC_TARGET
fi
echo "WebRTC build Done"
cd $ROOT_DIR