为 electron 编译构建 chromium 浏览器

Compile and build chromium browser for electron

所以我正在开发一个电子应用程序。我知道 electron 运行 的核心是一个 chromium 浏览器。

我目前正在处理的一个用例涉及更改 Chromium 的源代码。我克隆了 Chromium 项目并进行了更改。现在可以使用我的 Chromium 版本来构建我的电子应用程序了吗?

如果是,我该怎么做?如果否,有哪些替代方案?

所以我不得不基本上重建整个电子代码。

here

获取 libchromium 源

要修改 electron 内容模块中的代码,我们必须在 libchromium/patches 中编写一个补丁。 然后构建 libchromiumcontent :

./scripts/bootstrap
./scripts/update

使用以下命令编译打包libchromiumcontent:

./script/build
./script/create-dist

构建完成后,记下包含您的补丁的 libchromiumcontent 提交的哈希值,并执行以下命令,根据需要替换您的操作系统和体系结构:

# Use either win|linux|osx to reference the platform
mkdir -p osx/x64/<commit>
mv libchromiumcontent* osx/x64/<commit>

然后使用我们自定义的 libchromiumcontent 构建 Electron:

克隆电子,如果你还没有这样做

git clone https://github.com/atom/electron && cd electron

Bootstrap Electron 与我们自定义的 libchromium 内容:

./script/bootstrap.py -v --url file:///path/to/libchromiumcontent

最后构建 Electron:

./script/build.py -c D