Skip to content

Commit 1427496

Browse files
karasusanNishant Naveen
and
Nishant Naveen
authored
ci: Update build script for upgrading libwebrtc version m107 (#842)
* upgrade libwebrtc M96 * fix * replace python to python3 * use clang provided by chromium * apply patch to enable bitcode * Revert "use clang provided by chromium" This reverts commit ba4ce00. * Fix build errors due to interface changes in M96. NOTE: The webrtc.zip for the M96 version also needs to be updated to include these missing files. (For testing, I used the files locally from the M92 version) api/video_track_source_proxy.h api/proxy.h media/base/h264_profile_level_id.h * Fix typo * update libwebrtc m107 * fix build error when generating license file * fix * fix * fix build error on android * fix * fix * fix * fix * use_custom_libcxx=false * test * fix error * use_custom_libcxx=false * test * fix * revert * update image * fix * revert * wip * change image for linux build * fix build error * add patch file * disable use_custom_libcxx for android * remove is_java_debug * revert * downgrade JDK version * add is_java_debug * revert * revert * revert * revert Co-authored-by: Nishant Naveen <[email protected]>
1 parent 4ea6188 commit 1427496

14 files changed

+528
-83
lines changed

.yamato/package.metafile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ upm:
22
registry_url: https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
33
package_version: stable
44
webrtc_version:
5-
name: M92
5+
name: M107
66

77
editors:
88
- version: 2019.4

.yamato/upm-ci-libwebrtc.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
platforms:
44
- name: win
55
type: Unity::VM
6-
image: renderstreaming/win10:v0.3.13-1084239
6+
image: renderstreaming/win10:v0.4.0-1250406
77
flavor: b1.xlarge
88
build_command: BuildScripts~/build_libwebrtc_win.cmd
99
- name: macos
1010
type: Unity::VM::osx
11-
image: package-ci/mac:v1.20.0-1079282
11+
image: package-ci/macos-12:v4.3.0-1248181
1212
flavor: m1.mac
1313
build_command: BuildScripts~/build_libwebrtc_macos.sh
1414
- name: linux
1515
type: Unity::VM
16-
image: cds-ops/ubuntu-18.04-base:v1.6.0-546186
16+
image: package-ci/ubuntu-20.04:v1.4.0-1235639
1717
flavor: b1.xlarge
1818
build_command: BuildScripts~/build_libwebrtc_linux.sh
1919
- name: android
@@ -23,7 +23,7 @@ platforms:
2323
build_command: BuildScripts~/build_libwebrtc_android.sh
2424
- name: ios
2525
type: Unity::VM::osx
26-
image: package-ci/mac:v1.20.0-1079282
26+
image: package-ci/macos-12:v4.3.0-1248181
2727
flavor: m1.mac
2828
build_command: BuildScripts~/build_libwebrtc_ios.sh
2929
projects:

BuildScripts~/build_libwebrtc_android.sh

+29-13
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ fi
77

88
export COMMAND_DIR=$(cd $(dirname $0); pwd)
99
export PATH="$(pwd)/depot_tools:$PATH"
10-
export WEBRTC_VERSION=4515
10+
export WEBRTC_VERSION=5304
1111
export OUTPUT_DIR="$(pwd)/out"
1212
export ARTIFACTS_DIR="$(pwd)/artifacts"
13+
export PYTHON3_BIN="$(pwd)/depot_tools/python-bin/python3"
1314

1415
if [ ! -e "$(pwd)/src" ]
1516
then
@@ -19,12 +20,25 @@ then
1920
sudo git config --system core.longpaths true
2021
git checkout "refs/remotes/branch-heads/$WEBRTC_VERSION"
2122
cd ..
22-
gclient sync -f
23+
gclient sync -D --force --reset
2324
fi
2425

25-
# add jsoncpp
26+
# Add jsoncpp
2627
patch -N "src/BUILD.gn" < "$COMMAND_DIR/patches/add_jsoncpp.patch"
2728

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+
2842
mkdir -p "$ARTIFACTS_DIR/lib"
2943

3044
for target_cpu in "arm64"
@@ -34,16 +48,19 @@ do
3448
for is_debug in "true" "false"
3549
do
3650
# generate ninja files
51+
# use `treat_warnings_as_errors` option to avoid deprecation warnings
3752
gn gen "$OUTPUT_DIR" --root="src" \
3853
--args="is_debug=${is_debug} \
54+
is_java_debug=${is_debug} \
3955
target_os=\"android\" \
4056
target_cpu=\"${target_cpu}\" \
4157
rtc_use_h264=false \
4258
rtc_include_tests=false \
4359
rtc_build_examples=false \
4460
is_component_build=false \
4561
use_rtti=true \
46-
use_custom_libcxx=false"
62+
use_custom_libcxx=false \
63+
treat_warnings_as_errors=false"
4764

4865
# build static library
4966
ninja -C "$OUTPUT_DIR" webrtc
@@ -62,17 +79,20 @@ pushd src
6279

6380
for is_debug in "true" "false"
6481
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 \
6684
--build-dir $OUTPUT_DIR \
6785
--output $OUTPUT_DIR/libwebrtc.aar \
6886
--arch arm64-v8a \
6987
--extra-gn-args "is_debug=${is_debug} \
88+
is_java_debug=${is_debug} \
7089
rtc_use_h264=false \
7190
rtc_include_tests=false \
7291
rtc_build_examples=false \
7392
is_component_build=false \
7493
use_rtti=true \
75-
use_custom_libcxx=false"
94+
use_custom_libcxx=false \
95+
treat_warnings_as_errors=false"
7696

7797
filename="libwebrtc.aar"
7898
if [ $is_debug = "true" ]; then
@@ -84,12 +104,8 @@ done
84104

85105
popd
86106

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"
93109

94110
cd src
95111
find . -name "*.h" -print | cpio -pd "$ARTIFACTS_DIR/include"
@@ -98,4 +114,4 @@ cp "$OUTPUT_DIR/LICENSE.md" "$ARTIFACTS_DIR"
98114

99115
# create zip
100116
cd "$ARTIFACTS_DIR"
101-
zip -r webrtc-android.zip lib include LICENSE.md
117+
zip -r webrtc-android.zip lib include LICENSE.md

BuildScripts~/build_libwebrtc_ios.sh

+13-19
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ fi
77

88
export COMMAND_DIR=$(cd $(dirname $0); pwd)
99
export PATH="$(pwd)/depot_tools:$PATH"
10-
export WEBRTC_VERSION=4515
10+
export WEBRTC_VERSION=5304
1111
export OUTPUT_DIR="$(pwd)/out"
1212
export ARTIFACTS_DIR="$(pwd)/artifacts"
13+
export PYTHON3_BIN="$(pwd)/depot_tools/python-bin/python3"
1314

1415
if [ ! -e "$(pwd)/src" ]
1516
then
@@ -19,7 +20,7 @@ then
1920
sudo git config --system core.longpaths true
2021
git checkout "refs/remotes/branch-heads/$WEBRTC_VERSION"
2122
cd ..
22-
gclient sync -f
23+
gclient sync -D --force --reset
2324
fi
2425

2526
# add jsoncpp
@@ -44,18 +45,15 @@ do
4445
# See below for details.
4546
# https://bugs.chromium.org/p/webrtc/issues/detail?id=11729
4647
#
47-
# note: `use_xcode_clang=true` is for using bitcode.
48-
#
4948
gn gen "$OUTPUT_DIR" --root="src" \
50-
--args="is_debug=${is_debug} \
51-
target_os=\"ios\" \
52-
target_cpu=\"${target_cpu}\" \
53-
rtc_use_h264=false \
54-
treat_warnings_as_errors=false \
55-
use_xcode_clang=true \
56-
enable_ios_bitcode=true \
57-
ios_enable_code_signing=false \
58-
rtc_include_tests=false \
49+
--args="is_debug=${is_debug} \
50+
target_os=\"ios\" \
51+
target_cpu=\"${target_cpu}\" \
52+
rtc_use_h264=false \
53+
use_custom_libcxx=false \
54+
treat_warnings_as_errors=false \
55+
ios_enable_code_signing=false \
56+
rtc_include_tests=false \
5957
rtc_build_examples=false"
6058

6159
# build static library
@@ -81,12 +79,8 @@ do
8179
rm -r "$ARTIFACTS_DIR/lib/x64"
8280
done
8381

84-
# fix error when generate license
85-
patch -N "./src/tools_webrtc/libs/generate_licenses.py" < \
86-
"$COMMAND_DIR/patches/generate_licenses.patch"
87-
88-
vpython "./src/tools_webrtc/libs/generate_licenses.py" \
89-
--target //:default "$OUTPUT_DIR" "$OUTPUT_DIR"
82+
"$PYTHON3_BIN" "./src/tools_webrtc/libs/generate_licenses.py" \
83+
--target :webrtc "$OUTPUT_DIR" "$OUTPUT_DIR"
9084

9185
cd src
9286
find . -name "*.h" -print | cpio -pd "$ARTIFACTS_DIR/include"

BuildScripts~/build_libwebrtc_linux.sh

+18-9
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ fi
77

88
export COMMAND_DIR=$(cd $(dirname $0); pwd)
99
export PATH="$(pwd)/depot_tools:$PATH"
10-
export WEBRTC_VERSION=4515
10+
export WEBRTC_VERSION=5304
1111
export OUTPUT_DIR="$(pwd)/out"
1212
export ARTIFACTS_DIR="$(pwd)/artifacts"
13+
export PYTHON3_BIN="$(pwd)/depot_tools/python-bin/python3"
1314

1415
if [ ! -e "$(pwd)/src" ]
1516
then
@@ -19,7 +20,7 @@ then
1920
sudo git config --system core.longpaths true
2021
git checkout "refs/remotes/branch-heads/$WEBRTC_VERSION"
2122
cd ..
22-
gclient sync -f
23+
gclient sync -D --force --reset
2324
fi
2425

2526
# add jsoncpp
@@ -32,7 +33,19 @@ do
3233
mkdir -p "$ARTIFACTS_DIR/lib/${target_cpu}"
3334
for is_debug in "true" "false"
3435
do
35-
args="is_debug=${is_debug} target_os=\"linux\" target_cpu=\"${target_cpu}\" rtc_include_tests=false rtc_build_examples=false rtc_use_h264=false symbol_level=0 enable_iterator_debugging=false is_component_build=false use_rtti=true rtc_use_x11=false libcxx_abi_unstable=false";
36+
args="is_debug=${is_debug} \
37+
target_os=\"linux\" \
38+
target_cpu=\"${target_cpu}\" \
39+
use_custom_libcxx=false \
40+
rtc_include_tests=false \
41+
rtc_build_examples=false \
42+
rtc_use_h264=false \
43+
symbol_level=0 \
44+
enable_iterator_debugging=false \
45+
is_component_build=false \
46+
use_rtti=true \
47+
rtc_use_x11=false"
48+
3649
if [ $is_debug = "true" ]; then
3750
args="${args} is_asan=true is_lsan=true";
3851
fi
@@ -53,12 +66,8 @@ do
5366
done
5467
done
5568

56-
# fix error when generate license
57-
patch -N "./src/tools_webrtc/libs/generate_licenses.py" < \
58-
"$COMMAND_DIR/patches/generate_licenses.patch"
59-
60-
vpython "./src/tools_webrtc/libs/generate_licenses.py" \
61-
--target //:default "$OUTPUT_DIR" "$OUTPUT_DIR"
69+
"$PYTHON3_BIN" "./src/tools_webrtc/libs/generate_licenses.py" \
70+
--target :webrtc "$OUTPUT_DIR" "$OUTPUT_DIR"
6271

6372
cd src
6473
find . -name "*.h" -print | cpio -pd "$ARTIFACTS_DIR/include"

BuildScripts~/build_libwebrtc_macos.sh

+7-10
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ fi
77

88
export COMMAND_DIR=$(cd $(dirname $0); pwd)
99
export PATH="$(pwd)/depot_tools:$PATH"
10-
export WEBRTC_VERSION=4515
10+
export WEBRTC_VERSION=5304
1111
export OUTPUT_DIR="$(pwd)/out"
1212
export ARTIFACTS_DIR="$(pwd)/artifacts"
13+
export PYTHON3_BIN="$(pwd)/depot_tools/python-bin/python3"
1314

1415
if [ ! -e "$(pwd)/src" ]
1516
then
@@ -19,7 +20,7 @@ then
1920
sudo git config --system core.longpaths true
2021
git checkout "refs/remotes/branch-heads/$WEBRTC_VERSION"
2122
cd ..
22-
gclient sync -f
23+
gclient sync -D --force --reset
2324
fi
2425

2526
# add jsoncpp
@@ -44,15 +45,15 @@ do
4445
--args="is_debug=${is_debug} \
4546
target_os=\"mac\" \
4647
target_cpu=\"${target_cpu}\" \
48+
use_custom_libcxx=false \
4749
rtc_include_tests=false \
4850
rtc_build_examples=false \
4951
rtc_use_h264=false \
5052
symbol_level=0 \
5153
enable_iterator_debugging=false \
5254
is_component_build=false \
5355
use_rtti=true \
54-
rtc_use_x11=false \
55-
libcxx_abi_unstable=false"
56+
rtc_use_x11=false"
5657

5758
# build static library
5859
ninja -C "$OUTPUT_DIR" webrtc
@@ -77,12 +78,8 @@ do
7778
rm -r "$ARTIFACTS_DIR/lib/x64"
7879
done
7980

80-
# fix error when generate license
81-
patch -N "./src/tools_webrtc/libs/generate_licenses.py" < \
82-
"$COMMAND_DIR/patches/generate_licenses.patch"
83-
84-
vpython "./src/tools_webrtc/libs/generate_licenses.py" \
85-
--target //:default "$OUTPUT_DIR" "$OUTPUT_DIR"
81+
"$PYTHON3_BIN" "./src/tools_webrtc/libs/generate_licenses.py" \
82+
--target :webrtc "$OUTPUT_DIR" "$OUTPUT_DIR"
8683

8784
cd src
8885
find . -name "*.h" -print | cpio -pd "$ARTIFACTS_DIR/include"

BuildScripts~/build_libwebrtc_win.cmd

+11-10
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ if not exist depot_tools (
66

77
set COMMAND_DIR=%~dp0
88
set PATH=%cd%\depot_tools;%PATH%
9-
set WEBRTC_VERSION=4515
9+
set WEBRTC_VERSION=5304
1010
set DEPOT_TOOLS_WIN_TOOLCHAIN=0
11-
set CPPFLAGS=/WX-
1211
set GYP_GENERATORS=ninja,msvs-ninja
1312
set GYP_MSVS_VERSION=2019
1413
set OUTPUT_DIR=out
@@ -24,12 +23,18 @@ if not exist src (
2423
call git.bat config --system core.longpaths true
2524
call git.bat checkout refs/remotes/branch-heads/%WEBRTC_VERSION%
2625
cd ..
27-
call gclient.bat sync -f
26+
call gclient.bat sync -D --force --reset
2827
)
2928

3029
rem add jsoncpp
3130
patch -N "src\BUILD.gn" < "%COMMAND_DIR%\patches\add_jsoncpp.patch"
3231

32+
rem fix towupper
33+
patch -N "src\modules\desktop_capture\win\full_screen_win_application_handler.cc" < "%COMMAND_DIR%\patches\fix_towupper.patch"
34+
35+
rem fix abseil
36+
patch -N "src\third_party\abseil-cpp/absl/base/config.h" < "%COMMAND_DIR%\patches\fix_abseil.patch"
37+
3338
rem install pywin32
3439
call "%cd%\depot_tools\bootstrap-3_8_0_chromium_8_bin\python\bin\python.exe" ^
3540
-m pip install pywin32 --index-url "%PYPI_URL%" --upgrade
@@ -44,10 +49,10 @@ for %%i in (x64) do (
4449

4550
rem generate ninja for release
4651
call gn.bat gen %OUTPUT_DIR% --root="src" ^
47-
--args="is_debug=%%j is_clang=false target_cpu=\"%%i\" rtc_include_tests=false rtc_build_examples=false rtc_use_h264=false symbol_level=0 enable_iterator_debugging=false"
52+
--args="is_debug=%%j is_clang=true target_cpu=\"%%i\" use_custom_libcxx=false rtc_include_tests=false rtc_build_examples=false rtc_use_h264=false symbol_level=0 enable_iterator_debugging=false"
4853

4954
rem build
50-
ninja.exe -C %OUTPUT_DIR%
55+
ninja.exe -C %OUTPUT_DIR% webrtc
5156

5257
set filename=
5358
if true==%%j (
@@ -63,13 +68,9 @@ for %%i in (x64) do (
6368

6469
endlocal
6570

66-
rem fix error when generate license
67-
patch -N "%cd%\src\tools_webrtc\libs\generate_licenses.py" < ^
68-
"%COMMAND_DIR%\patches\generate_licenses.patch"
69-
7071
rem generate license
7172
call python.bat "%cd%\src\tools_webrtc\libs\generate_licenses.py" ^
72-
--target //:default %OUTPUT_DIR% %OUTPUT_DIR%
73+
--target :webrtc %OUTPUT_DIR% %OUTPUT_DIR%
7374

7475
rem unescape license
7576
powershell -File "%COMMAND_DIR%\Unescape.ps1" "%OUTPUT_DIR%\LICENSE.md"

0 commit comments

Comments
 (0)