Skip to content

Instantly share code, notes, and snippets.

@simongregory
Last active April 13, 2016 17:09
Show Gist options
  • Save simongregory/0ece919708962c8432ac to your computer and use it in GitHub Desktop.
Save simongregory/0ece919708962c8432ac to your computer and use it in GitHub Desktop.
Building Electron and it's upstream projects with widevine support
#!/usr/bin/env bash
echo 'WARNING: This script for documentation. Follow the steps it details as some are manual.'
exit 0;
# Before you start fork libchromiumcontent, brightray and electron. Brightray isn't strictly
# necessary as we patch it manually, but at some point it will need to be addressed.
GITHUB_USER=simongregory
# Create a container for all the repos
mkdir electron-repos
cd electron-repos
git clone https://github.com/$GITHUB_USER/libchromiumcontent.git
cd libchromiumcontent
git remote add electron https://github.com/electron/libchromiumcontent.git
git fetch electron
cd ../
git clone https://github.com/$GITHUB_USER/brightray.git
cd brightray
git remote add electron https://github.com/electron/brightray.git
git fetch electron
cd ../
git clone https://github.com/$GITHUB_USER/electron.git
cd electron
git remote add electron https://github.com/electron/electron.git
git fetch electron
cd ../
# Read the README
cd libchromiumcontent
less README.md
# Follow the README, no need to specifiy a custom VERSION of Chrome, defaults to the x64 target
./script/bootstrap
./script/update
./script/build
# Bootstrapping should only be needed once. Assuming you're working on a branch and
# pulling/merging changes from atom/atom go back to the `script/update` step. If this
# fails, it's most likely because patches fail to apply. This appears to be because
# upstream chromium sources aren't re-fetched automatically. To trigger a re-fetch by
# deleting vendor/chroumium/src and running update again. Otherwise use a fresh checkout.
# Build took 105 minutes, outputs two targets
#
# vendor/chromium/src/out/Release
# vendor/chromium/src/out_component/Release
# Create the debug distribution (libchromiumcontent-static.zip and libchromiumcontent.zip)
./script/create-dist -c shared_library
# OR/AND create the release distribution
./script/create-dist -c static_library
# Identify the commit libchromium content Electron is expecting, see ../electron/script/lib/config.py:11
sed -n 11p ../electron/script/lib/config.py
ELECTRONS_REFERENCE_TO_LIBCHROMIUMCONTENT_COMMIT='b06d4c307b861cdb091f4ba26b1a185333889033'
#LIBCHROMIUMCONTENT_COMMIT=`git rev-parse HEAD`
# Use either win|linux|osx to reference the platform (originally I tried 'darwin' and Electrons bootstrapping failed)
mkdir -p osx/x64/$ELECTRONS_REFERENCE_TO_LIBCHROMIUMCONTENT_COMMIT
mv libchromiumcontent* osx/x64/$ELECTRONS_REFERENCE_TO_LIBCHROMIUMCONTENT_COMMIT
# Store our PWD for reference from the Electron directory
LIBCHROMIUMCONTENT_PATH=$PWD
cd ../electron
# Bootstrap passing in the reference to our custom libchromium content
./script/bootstrap.py -v -u file://$LIBCHROMIUMCONTENT_PATH
# Manually add dependencies
# TODO: Branch brightray and add them there.
# Assuming you have a default editor, ie mate, subl assigned to EDITOR
"$EDITOR" vendor/brightray/brightray.gyp
# Add the following at line 122
# # Following libraries are always linked statically.
# '<(libchromiumcontent_dir)/libcdm_renderer.a',
# '<(libchromiumcontent_dir)/libcomponent_updater.a',
# Re-generate ninja dependencies
./script/update.py
# Start the build
./script/build.py -c D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment