chrome源代码下载

来源:互联网 发布:异星工厂0.15 mac版 编辑:程序博客网 时间:2024/06/05 15:14


1、请确保可以翻墙,建议使用稳定一点的VPN。


2、安装vs2013和windows 8.1 sdk。


3、下载depot,解压并将解压路径设置为PATH环境变量:
http://src.chromium.org/svn/trunk/tools/depot_tools.zip 


4、进入本地下载目录(随便指定,例如d:\chrome\),下载源码:
下载主干代码
fetch --nohooks --no-history chromium --nosvn=true
或下载某个版本(未测试),如44.0.2403.155
cd src
git fetch --tags >>tags.txt 2>&1  //标签号44.0.2403.155会保存在tags.txt文件中
git checkout -b chrome_44.0.2403.155_local_branch 44.0.2403.155
gclient sync --with_branch_heads --jobs 16


ps:这个过程会持续很长时间,而且网络不能中断,一旦中断,必须重新下载,因为git不支持断点续传。


5、如何解决编译过程中unicode的编码的warning问题:
在src\build\common.gypi文件中查找到字符串"4611",回车增加字符串"4819,4067,"
用记事本打开src\components\autofill\core\browser\autofill_regex_constants.cc并另存为ANSI编码


6、设置编译环境配置:
set GYP_GENERATORS=msvs-ninja,ninja
set DEPOT_TOOLS_WIN_TOOLCHAIN=0
set GYP_MSVS_VERSION=2013
set GYP_DEFINES=component=shared_library 


7、在"src"源码目录(例如d:\chrome\src\)生成配置文件,如工程文件等:
gclient runhooks


ps:这个过程也很长
这个命令会下载一些必须的工具,命令行后结果:
D:\chrome2015>gclient runhooks
Installing python 2.7.6...
Fetching from https://src.chromium.org/svn/trunk/tools/third_party/python276_bin
.zip
Installing git 1.9.5.chromium.6 (avg 1-2 min download) ...
Fetching from https://commondatastorage.googleapis.com/chrome-infra/git-1.9.5.ch
romium.6_bin.zip
Installing subversion ...
Fetching from https://src.chromium.org/svn/trunk/tools/third_party/svn_bin.zip


8、编译:
cd src
ninja -C out\Debug chrome

vs2013打开src\chrome\chrome.sln进行编译(此方法非常慢,建议vs2013只用于调试代码)


9、更新(未测试):
git rebase-update
gclient sync --force –nohooks


10、参考链接:
https://www.chromium.org/developers/how-tos/get-the-code
http://blog.gclxry.com/?p=364
http://www.suninf.net/2015/08/chromium-44-build-and-debug.html
http://my.oschina.net/ghost045/blog/395973