【问题标题】:Compile and build chromium browser for electron为电子编译和构建铬浏览器
【发布时间】:2017-08-29 09:03:53
【问题描述】:

所以我正在开发一个电子应用程序。我知道电子在其核心中运行铬浏览器。

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

如果是,我该怎么做?如果不是,有什么替代方案?

【问题讨论】:

  • 您基本上必须重建 Electron 才能使用您的代码。这可以通过将源代码复制到 Electron 源代码中的 chromium_src 文件夹中来实现,然后重新编译整个 Electron 源代码。
  • @AlexanderLeithner :是的,我知道这一点。但是我进行更改的源的目录结构(here)和 chromium_src 是不同的。知道如何复制吗?
  • @AlexanderLeithner :我想对 Chromium 的内容模块进行一些更改并重建电子。问题是,电子的 chromium_src 中没有内容模块。
  • 这只是一个有根据的猜测,我没有研究目录树,我不知道 GitHub 的人们如何为 Electron 构建 Chromium。例如,也许创建模块并且在makefile中有一个标志?

标签: electron chromium


【解决方案1】:

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

here获取libchromium源

要修改电子内容模块中的代码,我们必须在 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

使用我们的自定义 libchromiumcontent 引导电子:

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

最后构建 Electron:

./script/build.py -c D 

【讨论】:

    猜你喜欢
    • 2019-06-14
    • 2018-04-23
    • 2022-11-29
    • 2018-06-27
    • 1970-01-01
    • 2015-03-16
    • 1970-01-01
    • 2018-05-20
    • 1970-01-01
    相关资源
    最近更新 更多