7
7
8
8
export COMMAND_DIR=$( cd $( dirname $0 ) ; pwd)
9
9
export PATH=" $( pwd) /depot_tools:$PATH "
10
- export WEBRTC_VERSION=4515
10
+ export WEBRTC_VERSION=5304
11
11
export OUTPUT_DIR=" $( pwd) /out"
12
12
export ARTIFACTS_DIR=" $( pwd) /artifacts"
13
+ export PYTHON3_BIN=" $( pwd) /depot_tools/python-bin/python3"
13
14
14
15
if [ ! -e " $( pwd) /src" ]
15
16
then
19
20
sudo git config --system core.longpaths true
20
21
git checkout " refs/remotes/branch-heads/$WEBRTC_VERSION "
21
22
cd ..
22
- gclient sync -f
23
+ gclient sync -D --force --reset
23
24
fi
24
25
25
- # add jsoncpp
26
+ # Add jsoncpp
26
27
patch -N " src/BUILD.gn" < " $COMMAND_DIR /patches/add_jsoncpp.patch"
27
28
29
+ # Add visibility libunwind
30
+ patch -N " src/buildtools/third_party/libunwind/BUILD.gn" < " $COMMAND_DIR /patches/add_visibility_libunwind.patch"
31
+
32
+ # Add deps libunwind
33
+ patch -N " src/build/config/BUILD.gn" < " $COMMAND_DIR /patches/add_deps_libunwind.patch"
34
+
35
+ # downgrade JDK11 to JDK8 because Unity supports OpenJDK version 1.8.
36
+ # https://docs.unity3d.com/Manual/android-sdksetup.html
37
+ pushd " src/build"
38
+ git apply " $COMMAND_DIR /patches/downgrade_JDK.patch"
39
+ popd
40
+
41
+
28
42
mkdir -p " $ARTIFACTS_DIR /lib"
29
43
30
44
for target_cpu in " arm64"
34
48
for is_debug in " true" " false"
35
49
do
36
50
# generate ninja files
51
+ # use `treat_warnings_as_errors` option to avoid deprecation warnings
37
52
gn gen " $OUTPUT_DIR " --root=" src" \
38
53
--args=" is_debug=${is_debug} \
54
+ is_java_debug=${is_debug} \
39
55
target_os=\" android\" \
40
56
target_cpu=\" ${target_cpu} \" \
41
57
rtc_use_h264=false \
42
58
rtc_include_tests=false \
43
59
rtc_build_examples=false \
44
60
is_component_build=false \
45
61
use_rtti=true \
46
- use_custom_libcxx=false"
62
+ use_custom_libcxx=false \
63
+ treat_warnings_as_errors=false"
47
64
48
65
# build static library
49
66
ninja -C " $OUTPUT_DIR " webrtc
@@ -62,17 +79,20 @@ pushd src
62
79
63
80
for is_debug in " true" " false"
64
81
do
65
- python tools_webrtc/android/build_aar.py \
82
+ # use `treat_warnings_as_errors` option to avoid deprecation warnings
83
+ " $PYTHON3_BIN " tools_webrtc/android/build_aar.py \
66
84
--build-dir $OUTPUT_DIR \
67
85
--output $OUTPUT_DIR /libwebrtc.aar \
68
86
--arch arm64-v8a \
69
87
--extra-gn-args " is_debug=${is_debug} \
88
+ is_java_debug=${is_debug} \
70
89
rtc_use_h264=false \
71
90
rtc_include_tests=false \
72
91
rtc_build_examples=false \
73
92
is_component_build=false \
74
93
use_rtti=true \
75
- use_custom_libcxx=false"
94
+ use_custom_libcxx=false \
95
+ treat_warnings_as_errors=false"
76
96
77
97
filename=" libwebrtc.aar"
78
98
if [ $is_debug = " true" ]; then
84
104
85
105
popd
86
106
87
- # fix error when generate license
88
- patch -N " ./src/tools_webrtc/libs/generate_licenses.py" < \
89
- " $COMMAND_DIR /patches/generate_licenses.patch"
90
-
91
- python " ./src/tools_webrtc/libs/generate_licenses.py" \
92
- --target //:default " $OUTPUT_DIR " " $OUTPUT_DIR "
107
+ " $PYTHON3_BIN " " ./src/tools_webrtc/libs/generate_licenses.py" \
108
+ --target :webrtc " $OUTPUT_DIR " " $OUTPUT_DIR "
93
109
94
110
cd src
95
111
find . -name " *.h" -print | cpio -pd " $ARTIFACTS_DIR /include"
@@ -98,4 +114,4 @@ cp "$OUTPUT_DIR/LICENSE.md" "$ARTIFACTS_DIR"
98
114
99
115
# create zip
100
116
cd " $ARTIFACTS_DIR "
101
- zip -r webrtc-android.zip lib include LICENSE.md
117
+ zip -r webrtc-android.zip lib include LICENSE.md
0 commit comments