Chromium/WebRTC构建指南(持续更新中)

必备工具——梯子

由于隔着墙,得先准备一把好使的梯子,梯子自己想办法造。

  • 在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

在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

获取代码

  • 配置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开发

GN快速入门指南

GN参考

The Ninja build system

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值