Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit ba0546c

Browse files
authored
Roll clang to 15. (#69)
* Roll clang to 15. This change fixes some compiling issues with the latest VS2022. It also update script to generate certificate with ECDSA as RSA is not supported by browser. * Run hooks after applying patch. It updates clang binary after applying the patch for clang. * Update perfetto after sync. Because build.py updates DEPS after running gclient sync, changes in DEPS doesn't take effect.
1 parent 78dd584 commit ba0546c

7 files changed

+357
-8
lines changed

test/scripts/build.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,29 @@
2626
TEST_TARGETS = ['owt_web_transport_tests']
2727
TEST_TARGETS_WIN = ['owt_web_transport_dll_tests']
2828
PATCH_LIST = [
29-
('0001-Add-owt_web_transport-to-BUILD.gn.patch', SRC_PATH)
29+
('0001-Add-owt_web_transport-to-BUILD.gn.patch', SRC_PATH),
30+
('0002-build-Relanding-Rudimentary-support-for-Visual-Studi.patch', SRC_PATH),
31+
('0003-Update-generate-certs.sh-to-use-ECDSA.patch', SRC_PATH),
32+
('0004-Roll-clang-llvmorg-14-init-8564-g34b903d8-2-llvmorg-.patch', SRC_PATH),
33+
('0005-Fix-compiling-issues-after-upgrading-clang-to-15.patch', SRC_PATH)
3034
]
3135
GIT_BIN = 'git.bat' if sys.platform == 'win32' else 'git'
36+
GCLIENT_BIN = 'gclient.bat' if sys.platform == 'win32' else 'gclient'
3237

3338
def sync():
34-
gclient_bin = 'gclient.bat' if sys.platform == 'win32' else 'gclient'
35-
if subprocess.call([gclient_bin, 'sync', '--reset'], cwd=SRC_PATH, shell=False):
39+
if subprocess.call([GCLIENT_BIN, 'sync', '--reset', '--nohooks'], cwd=SRC_PATH, shell=False):
40+
return False
41+
return True
42+
43+
def run_hooks():
44+
if subprocess.call([GCLIENT_BIN, 'runhooks'], cwd=SRC_PATH, shell=False):
45+
return False
46+
return True
47+
48+
49+
def update_perfetto():
50+
# Manually update perfetto because this script patches DEPS after sync.
51+
if subprocess.call([GIT_BIN, 'fetch', 'https://android.googlesource.com/platform/external/perfetto.git', 'd8081faeb0e9264d0343208d9a2325525bb90832'], cwd=SRC_PATH/'third_party'/'perfetto', shell=False) or subprocess.call([GIT_BIN, 'checkout', 'FETCH_HEAD'], cwd=SRC_PATH/'third_party'/'perfetto', shell=False):
3652
return False
3753
return True
3854

@@ -142,6 +158,10 @@ def main():
142158
if not sync():
143159
return 1
144160
patch()
161+
if not update_perfetto():
162+
return 1
163+
if not run_hooks():
164+
return 1
145165
create_gclient_args()
146166
setup_environment_variables()
147167
if not build():

web_transport/docs/build_instructions.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ You will see a `src` directory after sync completes. Switch to the `src` directo
3535

3636
Some manually changes to Chromium code are needed before building SDK.
3737

38-
1. Add `"//owt/web_transport:owt_web_transport",` to `BUILD.gn`, after line 104. You need to revert this change before rolling Chromium revision, and redo this change after rolling.
38+
1. Apply patches in `owt/web_transport/patches` to `src` directory.
39+
40+
1. Run `git fetch https://android.googlesource.com/platform/external/perfetto.git d8081faeb0e9264d0343208d9a2325525bb90832 && git checkout FETCH_HEAD` in `src/third_party/perfetto` directory.
3941

4042
1. Create a file `gclient_args.gni` in `build/config` with following code.
4143

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
From 1d409ac32a4381e43d0b67d08bedfabac91da371 Mon Sep 17 00:00:00 2001
1+
From f2a513d78caf635e5786be41aeaaf688f23f50dc Mon Sep 17 00:00:00 2001
22
From: Jianjun Zhu <[email protected]>
33
Date: Sat, 30 Oct 2021 00:20:39 +0800
4-
Subject: [PATCH] Add owt_web_transport to BUILD.gn.
4+
Subject: [PATCH 1/5] Add owt_web_transport to BUILD.gn.
55

66
---
77
BUILD.gn | 1 +
88
1 file changed, 1 insertion(+)
99

1010
diff --git a/BUILD.gn b/BUILD.gn
11-
index fe0ed6dd1b584..963d0df64a453 100644
11+
index 8b6f4bf90557a..5ed8919d17662 100644
1212
--- a/BUILD.gn
1313
+++ b/BUILD.gn
1414
@@ -101,6 +101,7 @@ group("gn_all") {
@@ -20,5 +20,5 @@ index fe0ed6dd1b584..963d0df64a453 100644
2020

2121
if (!is_component_build) {
2222
--
23-
2.33.1
23+
2.33.0.windows.2
2424

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
From 55c25a8ec55837c1ccfdbca10c06a15c6f2a2665 Mon Sep 17 00:00:00 2001
2+
From: Bruce Dawson <[email protected]>
3+
Date: Tue, 21 Dec 2021 16:19:32 +0000
4+
Subject: [PATCH 2/5] build: Relanding Rudimentary support for Visual Studio
5+
2022.
6+
7+
This CL patches vs_toolchain.py to handle an installed version of
8+
Visual Studio 2022. This is a necessary first step towards supporting
9+
VS2022, but it's not sufficient. There are no guarantees that the
10+
MSVC143 toolchain produces acceptable results.
11+
12+
Visual Studio 2022 is the first 64-bit edition, so it is installed in
13+
C:\Program Files\, not C:\Program Files (x86)\. Handling both VS2022 and
14+
older versions introduces a bit of extra complexity in the path
15+
detection code. We'll be able to remove this complexity when we remove
16+
support for VS2019 and below.
17+
18+
This was originally landed as crrev.com/c/3316095 but that change broke
19+
arm64 builds because this change inadvertently changed the toolset
20+
version for prepackaged toolchains which arm64 use to find the UCRT.
21+
22+
Tested: Full build with Visual Studio 2022 Professional retail, gn gen
23+
of x64 and arm64 with packaged toolchain.
24+
25+
Bug: 1277518
26+
Change-Id: Ic942ba82a71799bbe14dc64e4e640d9d36e62b22
27+
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3351095
28+
Reviewed-by: Victor Costan <[email protected]>
29+
Reviewed-by: Peter Wen <[email protected]>
30+
Commit-Queue: Bruce Dawson <[email protected]>
31+
Cr-Commit-Position: refs/heads/main@{#953228}
32+
---
33+
build/vs_toolchain.py | 58 ++++++++++++++++++------------
34+
docs/windows_build_instructions.md | 8 +++--
35+
2 files changed, 40 insertions(+), 26 deletions(-)
36+
37+
diff --git a/build/vs_toolchain.py b/build/vs_toolchain.py
38+
index ecf0971ab1349..e759bd6ca2afe 100755
39+
--- a/build/vs_toolchain.py
40+
+++ b/build/vs_toolchain.py
41+
@@ -39,15 +39,20 @@ script_dir = os.path.dirname(os.path.realpath(__file__))
42+
json_data_file = os.path.join(script_dir, 'win_toolchain.json')
43+
44+
# VS versions are listed in descending order of priority (highest first).
45+
+# The first version is assumed by this script to be the one that is packaged,
46+
+# which makes a difference for the arm64 runtime.
47+
MSVS_VERSIONS = collections.OrderedDict([
48+
- ('2019', '16.0'),
49+
- ('2017', '15.0'),
50+
+ ('2019', '16.0'), # Default and packaged version of Visual Studio.
51+
+ ('2022', '17.0'),
52+
+ ('2017', '15.0'),
53+
])
54+
55+
# List of preferred VC toolset version based on MSVS
56+
+# Order is not relevant for this dictionary.
57+
MSVC_TOOLSET_VERSION = {
58+
- '2019' : 'VC142',
59+
- '2017' : 'VC141',
60+
+ '2022': 'VC143',
61+
+ '2019': 'VC142',
62+
+ '2017': 'VC141',
63+
}
64+
65+
def _HostIsWindows():
66+
@@ -167,13 +172,17 @@ def GetVisualStudioVersion():
67+
# Checking vs%s_install environment variables.
68+
# For example, vs2019_install could have the value
69+
# "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community".
70+
- # Only vs2017_install and vs2019_install are supported.
71+
+ # Only vs2017_install, vs2019_install and vs2022_install are supported.
72+
path = os.environ.get('vs%s_install' % version)
73+
if path and os.path.exists(path):
74+
available_versions.append(version)
75+
break
76+
# Detecting VS under possible paths.
77+
- path = os.path.expandvars('%ProgramFiles(x86)%' +
78+
+ if version >= '2022':
79+
+ program_files_path_variable = '%ProgramFiles%'
80+
+ else:
81+
+ program_files_path_variable = '%ProgramFiles(x86)%'
82+
+ path = os.path.expandvars(program_files_path_variable +
83+
'/Microsoft Visual Studio/%s' % version)
84+
if path and any(
85+
os.path.exists(os.path.join(path, edition))
86+
@@ -200,23 +209,26 @@ def DetectVisualStudioPath():
87+
# the registry. For details see:
88+
# https://blogs.msdn.microsoft.com/heaths/2016/09/15/changes-to-visual-studio-15-setup/
89+
# For now we use a hardcoded default with an environment variable override.
90+
- for path in (
91+
- os.environ.get('vs%s_install' % version_as_year),
92+
- os.path.expandvars('%ProgramFiles(x86)%' +
93+
- '/Microsoft Visual Studio/%s/Enterprise' %
94+
- version_as_year),
95+
- os.path.expandvars('%ProgramFiles(x86)%' +
96+
- '/Microsoft Visual Studio/%s/Professional' %
97+
- version_as_year),
98+
- os.path.expandvars('%ProgramFiles(x86)%' +
99+
- '/Microsoft Visual Studio/%s/Community' %
100+
- version_as_year),
101+
- os.path.expandvars('%ProgramFiles(x86)%' +
102+
- '/Microsoft Visual Studio/%s/Preview' %
103+
- version_as_year),
104+
- os.path.expandvars('%ProgramFiles(x86)%' +
105+
- '/Microsoft Visual Studio/%s/BuildTools' %
106+
- version_as_year)):
107+
+ if version_as_year >= '2022':
108+
+ program_files_path_variable = '%ProgramFiles%'
109+
+ else:
110+
+ program_files_path_variable = '%ProgramFiles(x86)%'
111+
+ for path in (os.environ.get('vs%s_install' % version_as_year),
112+
+ os.path.expandvars(program_files_path_variable +
113+
+ '/Microsoft Visual Studio/%s/Enterprise' %
114+
+ version_as_year),
115+
+ os.path.expandvars(program_files_path_variable +
116+
+ '/Microsoft Visual Studio/%s/Professional' %
117+
+ version_as_year),
118+
+ os.path.expandvars(program_files_path_variable +
119+
+ '/Microsoft Visual Studio/%s/Community' %
120+
+ version_as_year),
121+
+ os.path.expandvars(program_files_path_variable +
122+
+ '/Microsoft Visual Studio/%s/Preview' %
123+
+ version_as_year),
124+
+ os.path.expandvars(program_files_path_variable +
125+
+ '/Microsoft Visual Studio/%s/BuildTools' %
126+
+ version_as_year)):
127+
if path and os.path.exists(path):
128+
return path
129+
130+
diff --git a/docs/windows_build_instructions.md b/docs/windows_build_instructions.md
131+
index 2cfd0f7cebb81..83de36d71a69e 100644
132+
--- a/docs/windows_build_instructions.md
133+
+++ b/docs/windows_build_instructions.md
134+
@@ -90,10 +90,12 @@ Also, add a DEPOT_TOOLS_WIN_TOOLCHAIN system variable in the same way, and set
135+
it to 0. This tells depot_tools to use your locally installed version of Visual
136+
Studio (by default, depot_tools will try to use a google-internal version).
137+
138+
-You may also have to set variable `vs2017_install` or `vs2019_install` to your
139+
-installation path of Visual Studio 2017 or 19, like
140+
+You may also have to set variable `vs2017_install` or `vs2019_install` or
141+
+`vs2022_install` to your installation path of Visual Studio 2017 or 19 or 22, like
142+
`set vs2019_install=C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional`
143+
-for Visual Studio 2019.
144+
+for Visual Studio 2019, or
145+
+`set vs2022_install=C:\Program Files\Microsoft Visual Studio\2022\Professional`
146+
+for Visual Studio 2022.
147+
148+
From a cmd.exe shell, run:
149+
150+
--
151+
2.33.0.windows.2
152+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
From 143d1d128d0a8e1884cf1874a3f222d3c0dcafe7 Mon Sep 17 00:00:00 2001
2+
From: Jianjun Zhu <[email protected]>
3+
Date: Thu, 7 Apr 2022 10:43:23 +0800
4+
Subject: [PATCH 3/5] Update generate-certs.sh to use ECDSA.
5+
6+
RSA is not supported when using serverCertificateHashes.
7+
See
8+
https://www.w3.org/TR/webtransport/#dom-webtransportoptions-servercertificatehashes.
9+
---
10+
net/tools/quic/certs/generate-certs.sh | 4 +++-
11+
1 file changed, 3 insertions(+), 1 deletion(-)
12+
13+
diff --git a/net/tools/quic/certs/generate-certs.sh b/net/tools/quic/certs/generate-certs.sh
14+
index 11dde0703a60d..a296323134a33 100755
15+
--- a/net/tools/quic/certs/generate-certs.sh
16+
+++ b/net/tools/quic/certs/generate-certs.sh
17+
@@ -18,7 +18,7 @@ try /bin/sh -c "echo 01 > out/2048-sha256-root-serial"
18+
touch out/2048-sha256-root-index.txt
19+
20+
# Generate the key.
21+
-try openssl genrsa -out out/2048-sha256-root.key 2048
22+
+try openssl ecparam -genkey -name prime256v1 -out out/2048-sha256-root.key
23+
24+
# Generate the root certificate.
25+
try openssl req \
26+
@@ -38,6 +38,8 @@ try openssl x509 \
27+
# Generate the leaf certificate request.
28+
try openssl req \
29+
-new \
30+
+ -newkey ec\
31+
+ -pkeyopt ec_paramgen_curve:prime256v1\
32+
-keyout out/leaf_cert.key \
33+
-out out/leaf_cert.req \
34+
-config leaf.cnf
35+
--
36+
2.33.0.windows.2
37+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
From ff2ff6d9d87858fe4b0ac4800b098f7f14c2dd31 Mon Sep 17 00:00:00 2001
2+
From: Jianjun Zhu <[email protected]>
3+
Date: Mon, 27 Jun 2022 19:31:34 +0800
4+
Subject: [PATCH 4/5] Roll clang llvmorg-14-init-8564-g34b903d8-2 :
5+
llvmorg-15-init-13850-ge2913362-1
6+
7+
---
8+
tools/clang/scripts/update.py | 4 ++--
9+
1 file changed, 2 insertions(+), 2 deletions(-)
10+
11+
diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py
12+
index 9a8bae564d9a7..4198f07dbbb4f 100755
13+
--- a/tools/clang/scripts/update.py
14+
+++ b/tools/clang/scripts/update.py
15+
@@ -34,8 +34,8 @@ import zipfile
16+
# https://chromium.googlesource.com/chromium/src/+/main/docs/updating_clang.md
17+
# Reverting problematic clang rolls is safe, though.
18+
# This is the output of `git describe` and is usable as a commit-ish.
19+
-CLANG_REVISION = 'llvmorg-14-init-8564-g34b903d8'
20+
-CLANG_SUB_REVISION = 2
21+
+CLANG_REVISION = 'llvmorg-15-init-13850-ge2913362'
22+
+CLANG_SUB_REVISION = 1
23+
24+
PACKAGE_VERSION = '%s-%s' % (CLANG_REVISION, CLANG_SUB_REVISION)
25+
RELEASE_VERSION = '14.0.0'
26+
--
27+
2.33.0.windows.2
28+

0 commit comments

Comments
 (0)