由源码构建 V8
为了能在 64 位 Windows/Linux/macOS 系统上从源码编译 V8,请遵循以下步骤。
获取 V8 源码 #
依照我们的指南的步骤获取 V8 源码。
安装构建依赖 #
在 macOS 上: 安装 Xcode 并接受它的许可协议。(如果你已经单独安装了命令行工具,先卸载它.)
确保你在 V8 源码目录下。如果你按照前文的步骤操作了,你现在应该已经在正确的位置了。
下载所有构建需要的依赖:
For Googlers - If you see Failed to fetch file or Login required errors when running the hooks, try authenticating with Google Storage first by running:
gsutil.py config
Login with your @google.com account, and enter
0
when asked for a project ID.gclient sync
这一步只有 Linux 需要。下载额外的构建依赖:
./build/install-build-deps.sh
构建 V8 #
确保你现在在 V8 的源码目录下且位于
main
分支。cd /path/to/v8
拉取最新代码并安装任何新的构建依赖:
git pull && gclient sync
编译:
tools/dev/gm.py x64.release
或者编译并立即执行测试:
tools/dev/gm.py x64.release.check
关于
gm.py
帮助类脚本的更多信息和它触发的命令,参见使用 GN 构建.