1、必要的代理软件,HTTP/HTTPS配置为127.0.0.1:1080
2、下载depot_tools,https://storage.googleapis.com/chrome-infra/depot_tools.zip,解压放到D:depot_tools
3、环境变量
PATH 第一条设置为D:depot_tools
然后设置以下环境变量
DEPOT_TOOLS_WIN_TOOLCHAIN=0
GYP_GENERATORS=ninja,msvs-ninja
HTTPS_PROXY=127.0.0.1:1080
如需用VS查看项目,请安装VS2017并设置以下环境变量
GYP_MSVS_OVERRIDE_PATH=C:Program Files (x86)Microsoft Visual Studio2017Community
GYP_MSVS_VERSION=2017
4、目录结构(用CMD,不要cygwin, PowerShell,下同)
mkdir chromium && cd chromium
5、拉代码
fetch chromium
6、设置编译目录
cd src && gn gen out/Default
7、生成项目(GN要在src目录执行,下同)
不用VS
gn gen outDefault
要用VS查看
gn gen --ide=vs outDefault && devenv outDefaultall.sln
8、编译传参
使用DLL方式编译RELEASE版本
gn gen out/Default --args="is_component_build = true is_debug = true"
打印全部参数到文本
gn args out/Default --list >> ../gn_arg_list_default_output.txt
9、获取最新代码
gclient sync
使用代理的情况可以创建批处理文件,gclient_sync.bat 放在D:chromium下
cd src && git config https.proxy 127.0.0.1:1080 && cd ..
set NO_AUTH_BOTO_CONFIG=D:chromiumsrc.boto
set HTTPS_PROXY=127.0.0.1:1080
gclient sync && pause
.boto文件内容
[Boto]
proxy = 127.0.0.1
proxy_port = 1080
10、已知问题
问题1
LookupError: unknown encoding: cp65001
解决方案
设置环境变量PYTHONIOENCODING=utf-8
问题2
ImportError: No module named win32file
解决方案
python -m pip install pywin32