1.安装git
2.按照官网说明,安装depot_tools
3.check out source code:
$ fetch –nohooks chromium # Optionally, –no-history
$ fetch –nohooks blink # Optionally, –no-history
The checkout will be from 6GB to 22GB, depending on your choices.
You can fetch one of two targets: chromium or blink. Either choice will clone both the Chromium and Blink repos, but there’s a small difference.
- fetch chromium will use the Blink version that’s rolled into Chromium via DEPS (usually a few hours old). This choice is easier if working only on Chromium.
- fetch blink will always retrieve the latest Blink (ToT) version, and is useful if working on Blink.
Either choice, the fetch will consume ~22GB of disk space. However, if you choose to clone without git history, the checkout will total ~6.5GB.
Use –no-history with fetch to create shallow clones. Use if you don’t need repo history or want a faster clone. Later, git fetch –unshallow will deepen these shallow clones.
我们选择chromeium就可以了。
fetch –nohooks chromium –nosvn=True 或者 fetch –nohooks –no-history chromium
4.如果第3步未能成功完成,则执行 gclient sync –force 继续更新.
5.安装依赖软件:
Linux:
$ ./build/install-build-deps.sh
Mac:
需要暗转xcode5 (或以上。参考:https://code.google.com/p/chromium/wiki/MacBuildInstructions)
Windows:
需要VS2013: 参考:http://dev.chromium.org/developers/how-tos/build-instructions-windows
6.Run post-sync hooks
$ gclient runhooks
7.Update, checkout
$ git rebase-update
$ gclient sync
8.Build
Chrome使用的是GYP (Generate-Your-Project)作为build工具:使用以下命令生成build file:
export GYP_GENERATORS=ninja,xcode-ninja
./build/gyp_chromium
也可以加参数,例如:
$ ./build/gyp_chromium -Goutput_dir=out_cros
详见:http://dev.chromium.org/developers/gyp-environment-variables
最后Building Chrome
ninja -C out/Release/ chrome
9.有可能在第5步中的最后ninja -C out/Debug/ chrome命令中报下面的错误:
ninja: error: ‘../../native_client/toolchain/mac_x86/nacl_x86_newlib/nacl_x86_newlib.json’, needed by ‘gen/tc_irt/lib64/libppapi_proxy_nacl.a’, missing and no known rule to make it
,此时需要执行gclient runhooks(The hooks are required to download some prebuilts / sdks (like nacl, for which you’re getting an error).)来下载部分相应的依赖库. 如果步骤6执行过则应该没有问题。
以上总结参考Chrome 官方给出的 Get the Code: Checkout, Build, Run & Submit: http://dev.chromium.org/developers/how-tos/get-the-code