-
Notifications
You must be signed in to change notification settings - Fork 2
/
entrypoint.sh
executable file
·122 lines (96 loc) · 4.98 KB
/
entrypoint.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/usr/bin/env bash
function fatal_error() {
echo "$1"
exit 1
}
BASE=/webrtc
apt update && apt install -y git curl wget lsb-release python3 sudo
echo "----------------------------------------------------------------------------------"
echo "Configuring GIT..."
echo "----------------------------------------------------------------------------------"
git config --global user.name "John Doe"
git config --global user.email "[email protected]"
git config --global core.autocrlf false
git config --global core.filemode false
mkdir -p $BASE
cd $BASE || fatal_error "Cannot change directory"
echo "----------------------------------------------------------------------------------"
echo "Downloading depot_tools..."
echo "----------------------------------------------------------------------------------"
if [ -d "depot_tools" ]
then
echo "Depot tools already downloaded"
else
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
fi
export PATH=$BASE/depot_tools:$PATH
./depot_tools/update_depot_tools
echo "----------------------------------------------------------------------------------"
echo "Downloading WebRTC Android..."
echo "----------------------------------------------------------------------------------"
fetch --nohooks --no-history webrtc_android
gclient sync
echo "----------------------------------------------------------------------------------"
echo "Downloading dependencies..."
echo "----------------------------------------------------------------------------------"
cd src && ./build/install-build-deps.sh
echo "----------------------------------------------------------------------------------"
echo "Checkout M119 version..."
echo "----------------------------------------------------------------------------------"
git fetch --all && git fetch https://webrtc.googlesource.com/src.git refs/branch-heads/6045 && git checkout -b m119 FETCH_HEAD
echo "----------------------------------------------------------------------------------"
echo "Preparing compilation environment..."
echo "----------------------------------------------------------------------------------"
function generateNinjaBuild() {
gn gen out/Release_"$1" --args='target_os="android" target_cpu="'"$1"'" target_environment="device" proprietary_codecs=true rtc_use_h264=true rtc_use_h265=false is_debug=false symbol_level=1 dcheck_always_on=false is_official_build=true is_unsafe_developer_build=false rtc_build_examples=false rtc_include_tests=false'
}
generateNinjaBuild "arm"
generateNinjaBuild "arm64"
generateNinjaBuild "x86"
generateNinjaBuild "x64"
echo "----------------------------------------------------------------------------------"
echo "Compiling ARM..."
echo "----------------------------------------------------------------------------------"
function compileNinja() {
ninja -C out/Release_"$1" -j 1
}
compileNinja "arm"
echo "----------------------------------------------------------------------------------"
echo "Compiling ARM64..."
echo "----------------------------------------------------------------------------------"
compileNinja "arm64"
echo "----------------------------------------------------------------------------------"
echo "Compiling x86..."
echo "----------------------------------------------------------------------------------"
compileNinja "x86"
echo "----------------------------------------------------------------------------------"
echo "Compiling x64..."
echo "----------------------------------------------------------------------------------"
compileNinja "x64"
echo "----------------------------------------------------------------------------------"
echo "Moving out java classes..."
echo "----------------------------------------------------------------------------------"
JAVA_FOLDER=$BASE/output/java/org/webrtc
mkdir -p $JAVA_FOLDER
cp -rv $BASE/src/sdk/android/src/java/org/webrtc/* $JAVA_FOLDER/
cp -rv $BASE/src/sdk/android/api/org/webrtc/* $JAVA_FOLDER/
cp -rv $BASE/src/rtc_base/java/src/org/webrtc/* $JAVA_FOLDER/
#cp -rv $BASE/src/modules/audio_device/android/java/src/org/webrtc/* $JAVA_FOLDER/
cp -rv $BASE/src/out/Release_arm/gen/sdk/android/video_api_java/generated_java/input_srcjars/org/webrtc/* $JAVA_FOLDER/
cp -rv $BASE/src/out/Release_arm/gen/sdk/android/peerconnection_java/generated_java/input_srcjars/org/webrtc/* $JAVA_FOLDER/
echo "----------------------------------------------------------------------------------"
echo "Moving out libs..."
echo "----------------------------------------------------------------------------------"
LIB_FOLDER=$BASE/output/libs
function moveLibs() {
mkdir -p $LIB_FOLDER/"$1"
cp -rv $BASE/src/out/Release_"$1"/libjingle_peerconnection_so.so $LIB_FOLDER/"$1"
}
moveLibs "arm"
moveLibs "arm64"
moveLibs "x86"
moveLibs "x64"
echo "----------------------------------------------------------------------------------"
echo "That's all :-)"
echo "You can find .so libs file under '$LIB_FOLDER' and .java files under '$JAVA_FOLDER'"
echo "----------------------------------------------------------------------------------"