Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile and build chromium browser for electron

So I am developing an electron application. I know electron is running a chromium browser in its core.

One of the use cases I am currently working on involves changing the source code of Chromium. I have cloned the Chromium project and made the changes. Now is it possible to use my version of Chromium to build my electron application?

If yes, how can I do it? If no, what are the alternatives?

like image 278
Anand Srinivasan Avatar asked Apr 04 '17 08:04

Anand Srinivasan


1 Answers

So I had to basically rebuild the entire electron code.

Get the libchromium source from here

To modify the code in content module of electron we have to write a patch in libchromium/patches. And then build libchromiumcontent :

./scripts/bootstrap
./scripts/update

Compile and package libchromiumcontent with the following commands:

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

After the build is done, take note of the hash from the libchromiumcontent commit that includes your patch and perform the following commands, replacing your operating system and architecture as appropriate:

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

And then build Electron with our custom libchromiumcontent :

Clone electron if you have not done already

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

Bootstrap Electron with our custom libchromiumcontent:

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

And finally build Electron:

./script/build.py -c D 
like image 103
Anand Srinivasan Avatar answered Sep 30 '22 09:09

Anand Srinivasan