Skip to content

Instantly share code, notes, and snippets.

@diorahman
Created February 20, 2016 02:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diorahman/6a40c69d0c8cb3268ac6 to your computer and use it in GitHub Desktop.
Save diorahman/6a40c69d0c8cb3268ac6 to your computer and use it in GitHub Desktop.
#!/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 checkout atom; # As the build is performed from the 'atom' branch, not master
git remote add atom https://github.com/atom/libchromiumcontent.git
git fetch atom
cd ../
git clone https://github.com/$GITHUB_USER/brightray.git
cd brightray
git remote add atom https://github.com/atom/brightray.git
git fetch atom
cd ../
git clone https://github.com/$GITHUB_USER/electron.git
cd electron
git remote add atom https://github.com/atom/electron.git
git fetch atom
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, I've only solved this
# with a fresh checkout (but have yet to try deleting vendor/chroumium/src which may
# work).
# 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
ELECTRONS_REFERENCE_TO_LIBCHROMIUMCONTENT_COMMIT='599c8941e1884e155218ec1013cba9fc5c7c7072'
#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
# Locate the widevinecdmadapter.plugin, probably best to go looking inside the latest Chrome.app then
# copy it to vendor/brightray/vendor/download/libchromiumcontent/shared_library/widevinecdmadapter.plugin
WIDEVINE_CDM_ADAPTER_PLUGIN="/Applications/Google Chrome.app/Contents/Versions/47.0.2526.80/Google Chrome Framework.framework/Internet Plug-Ins/widevinecdmadapter.plugin"
# Depending on the distribution target above - ie shared or static_library - copy the widevine plugin to it, ie
cp "$WIDEVINE_CDM_ADAPTER_PLUGIN" vendor/brightray/vendor/download/libchromiumcontent/shared_library/
cp "$WIDEVINE_CDM_ADAPTER_PLUGIN" vendor/brightray/vendor/download/libchromiumcontent/static_library/
# Start the build
./script/build.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment