Last active
December 22, 2020 16:45
-
-
Save maruel/ee97364b1ff7985407e1c989e947fbc6 to your computer and use it in GitHub Desktop.
Checking out chromium release branch from scratch on Ubuntu 20.04
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Ref: | |
# https://chromium.googlesource.com/chromium/src/+/master/docs/#checking-out-and-building | |
# | |
# Note: the instructions say to use "fetch --nohooks chromium" but we'll do it | |
# manual here since we want to fetch the minimal amount of data and fetch a | |
# release branch instead of the tip of tree. | |
set -eux | |
# Where to checkout: | |
BASEDIR=$HOME/checkout_root | |
# Release to build: | |
REVISION=89.0.4364.1 | |
# Set it to skip sync and install. | |
SKIP_SYNC_AND_INSTALL=1 | |
# If this fails, sudo apt install python2: | |
python2 -c pass | |
# If this fails, sudo apt install python: | |
python -c pass | |
# Make sure you have git installed. | |
git help > /dev/null | |
cd $HOME | |
mkdir -p $BASEDIR | |
if [ ! -d $BASEDIR/depot_tools ]; then | |
cd $BASEDIR | |
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git | |
fi | |
PATH=$BASEDIR/depot_tools:$PATH | |
mkdir -p $BASEDIR/chromium | |
cd $BASEDIR/chromium | |
if [ ! -d $BASEDIR/chromium/src ]; then | |
# If starting from scratch, do not skip anything. | |
SKIP_SYNC_AND_INSTALL= | |
# For faster performance, use an authenticated URL: | |
# https://chromium.googlesource.com/a/chromium/src | |
# It is determined with the /a/ prefix. To get the git cookies to | |
# authenticate, visit this URL in a web browser, and it will provide a command | |
# you can run to set it up in git. It's required if you want to contribute a | |
# change. | |
# | |
# The following is using unauthenticated flow, which has less quota and will | |
# be much slower. | |
gclient config https://chromium.googlesource.com/chromium/src | |
# A github clone: | |
#gclient config --unmanaged https://github.com/maruel/chromium --name src | |
fi | |
if [ "$SKIP_SYNC_AND_INSTALL" = "" ]; then | |
# Do a minimal checkout with no history. This will significantly reduce the | |
# checkout size. | |
# In practice with a combination of very fast internet and even with a very fast | |
# 35Gbps SSD, writing files to disk will take more time than downloading the | |
# repos... This fetches 126 git repositories. $BASEDIR/chromiumTook over 70 minutes here. | |
time gclient sync --no-history --revision $REVISION | |
fi | |
# This should output over 45G. | |
du -h -s $BASEDIR/chromium | |
cd $BASEDIR/chromium/src | |
if [ "$SKIP_SYNC_AND_INSTALL" = "" ]; then | |
# Install build dependencies. Skip when re-running so you don't have to sudo | |
# every time. | |
# Warning: installs a bunch of packages. | |
./build/install-build-deps.sh | |
fi | |
gn gen out/default | |
# Optimize our build: | |
cat > out/default/args.gn << EOF | |
# Do not build Native Client. | |
enable_nacl=false | |
# Build in Release but without LTO (very slow). | |
is_debug=false | |
# I don't plan to debug, so skip debug symbols. | |
symbol_level=0 | |
EOF | |
# Expect something around 1680 minutes of user time and 65 minutes of kernel | |
# time. Divide by the number of logical cores. | |
time autoninja -C out/default chrome |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment