#!/bin/bash # Checking out the sources of an official chromium release, # by Eric Hameleers : # In a working directory, the script creates three directories: # - depot_tools: this contains all the tools needed for creating the tarball # - src: here almost 7 GB of sourcecode will be checked out # - output: here the chromium-${VERSION}.tar.xz source tarball will be created. # -------------------------------------------------------------------------- # Another example: # https://gitlab.archlinux.org/archlinux/packaging/packages/chromium/-/blob/main/fetch-chromium-release?ref_type=heads # -------------------------------------------------------------------------- set -e readonly VERSION=$1 if [[ -z $VERSION ]]; then echo >&2 'No version given as an argument' exit 1 fi # Some variables: TMP=${TMP:-"/tmp"} WORKING_DIR="$TMP/chromium_src" DEPOT_TOOLS_REPO="https://chromium.googlesource.com/chromium/tools/depot_tools.git" CHROMIUM_REPO="https://chromium.googlesource.com/chromium/src" RELEASES_URL="https://src.chromium.org/chrome/releases" # The actual work (takes a while to checkout 7 GB of source and pack it up: rm -rf ${WORKING_DIR} mkdir -p ${WORKING_DIR} cd ${WORKING_DIR} echo "-- [$(date +%Y%m%d_%H%M)] starting the work" # Clone the tools: git clone --depth=1 ${DEPOT_TOOLS_REPO} export PATH="$PWD/depot_tools:$PATH" DEPOT_TOOLS_UPDATE=0 # Use gclient to fetch the source and all the other required stuff: gclient config --name src ${CHROMIUM_REPO}.git@${VERSION} echo "target_os = [ 'linux' ]" >> .gclient # Run the Chromium-specific hooks, which will download additional binaries # and other stuff we need: gclient sync --no-history --nohooks gclient runhooks # Also needed: src/third_party/node/update_npm_deps find src/third_party/jdk/current -type f -delete # Create the tarball: echo "-- [$(date +%Y%m%d_%H%M)] PATIENCE! Creating tarball for chromium-$VERSION" mv src chromium-$VERSION mkdir output tar -Jcf output/chromium-$VERSION.tar.xz chromium-$VERSION echo "-- [$(date +%Y%m%d_%H%M)] Tarball for chromium-$VERSION created in $(pwd)/output/"