必备工具——梯子
由于隔着墙,得先准备一把好使的梯子,梯子自己想办法造。
- 在Linux 终端中使用梯子
export http_proxy=http://127.0.0.1:1080 export https_proxy=http://127.0.0.1:1080
- 在Windows cmd 中使用梯子
set http_proxy=127.0.0.1:1080 set https_proxy=127.0.0.1:1080
必备软件——depot_tools
-
官方文档 WebRTC development - Prerequisite software(需使用梯子)
-
官方文档 depot_tools_tutorial(7) Manual Page (需使用梯子)
在Linux / Mac上安装depot_tools
克隆depot_tools(需使用梯子)
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
添加depot_tools路径到PATH环境变量中,注意把/path/to/depot_tools放在前面。
export PATH=/path/to/depot_tools:$PATH
在Windows上安装depot_tools
- Visual Studio
要求 Visual Studio 2017 (>=15.7.2)或VS2019 (>=16.0.0) ,必须安装“使用C ++进行桌面开发”组件和“ MFC / ATL支持”子组件。
可以使用以下命令来安装这些组件。
%PATH_TO_INSTALLER.EXE% --add Microsoft.VisualStudio.Workload.NativeDesktop --add Microsoft.VisualStudio.Component.VC.ATLMFC --includeRecommended
-
Windows 10 SDK
您必须安装版本10.0.18362或更高版本的Windows 10 SDK。可以单独安装它,也可以在Visual Studio安装程序中选中相应的框。 -
Windows调试工具
还必须安装SDK调试工具。如果Windows 10 SDK是通过Visual Studio安装程序安装的,则可以通过以下方式安装它们:控制面板→程序→程序和功能→选择“ Windows软件开发工具包”→更改→更改→选中“ Windows调试工具” ”→更改。或者,您可以下载独立的SDK安装程序并使用它来安装调试工具。 -
安装depot_tools
下载depot_tools.zip,解压到某个目录下。(需使用梯子)
添加depot_tools路径到PATH环境变量中,注意把/path/to/depot_tools放在前面。
set PATH=\path\to\depot_tools;$PATH
添加环境变量DEPOT_TOOLS_WIN_TOOLCHAIN=0
,告诉depot_tools使用本地安装的Visual Studio版本(默认情况下,depot_tools将尝试使用google-内部版本。这个必须设置为0,谷歌内部版本只有谷歌员工才能使用。)
set DEPOT_TOOLS_WIN_TOOLCHAIN=0
在cmd中(不能使用powershell)执行gclient,不带任何参数,安装所有window上依赖的工具链。(需使用梯子)
gclient
在cmd中执行where命令确保depot_tools\python.bat,depot_tools\git.bat排在第一位。
where python
where git
构建Chromium/WebRTC
- 官方文档 Checking out and Building Chromium for Windows (需使用梯子)
- 官方文档 Checking out and building Chromium on Linux (需使用梯子)
获取代码
- 配置git
git config --global user.name "My Name" git config --global user.email "my-name@chromium.org" git config --global core.autocrlf false git config --global core.filemode false git config --global branch.autosetuprebase always
- 获取chromium代码(需使用梯子)
mkdir chromium && cd chromium fetch --no-history --nohooks chromium gclient sync
- 获取webrtc代码(需使用梯子)
mkdir webrtc && cd webrtc fetch --no-history --nohooks webrtc gclient sync
fetch
命令只在第一获取代码时使用,fetch完成后必须执行gclient sync
更新同步一次代码。
更新代码(需使用梯子)
git rebase-update
gclient sync
在Windows上构建Chromium/WebRTC
- 构建Chromium
cd chromium\src gn gen out/Default ninja -C out\Default
- 构建WebRTC
cd webrtc\src gn gen out/Default ninja -C out\Default
在Linux上构建Chromium/WebRTC
- 构建WebRTC
第一次构建前必须执行install-build-deps.sh
安装构建所依赖的工具链。
构建cd webrtc\src ./build/install-build-deps.sh gclient runhooks
cd webrtc\src gn gen out/Default ninja -C out\Default
进阶参考
WebRTC开发
- 官方文档 WebRTC development(需使用梯子)
GN快速入门指南
- 官方文档 GN Quick Start guide(需使用梯子)
GN参考
- 官方文档 GN Reference(需使用梯子)