#!/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 30 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 VERSION="$1" if [[ -z $VERSION ]]; then # Query the API for the most recent Linux release: VERSION=$(curl -s "https://versionhistory.googleapis.com/v1/chrome/platforms/linux/channels/stable/versions" | jq -r '.versions[0].version') echo "-- [$(date +%Y%m%d_%H%M)] will use latest Chromium release $VERSION" 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" EXPORT_TARBALL_PY="https://chromium.googlesource.com/chromium/tools/build/+/refs/heads/main/recipes/recipe_modules/chromium/resources/export_tarball.py" # The actual work (takes a while to checkout 30 GB of data 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 # Get the export_tarball.py script: curl -s "${EXPORT_TARBALL_PY}/?format=TEXT" |base64 -d > export_tarball.py python3 -m py_compile export_tarball.py || { echo "Bad export_tarball.py download"; exit 1; } # Use gclient to fetch the source and all the other required stuff: gclient config --name src ${CHROMIUM_REPO}.git@${VERSION} cat <> .gclient target_os = [ 'linux' ] target_cpu = [ 'x64' ] EOF # Run the Chromium-specific hooks, which will download additional binaries # and other stuff we need: gclient sync --no-history --nohooks gclient runhooks # Chromium last change fetching utility: python3 src/build/util/lastchange.py -o src/build/util/LASTCHANGE python3 src/build/util/lastchange.py -m GPU_LISTS_VERSION \ --revision-id-only --header src/gpu/config/gpu_lists_version.h python3 src/build/util/lastchange.py -m SKIA_COMMIT_HASH \ -s src/third_party/skia --header src/skia/ext/skia_commit_hash.h python3 src/build/util/lastchange.py \ -s src/third_party/dawn --revision src/gpu/webgpu/DAWN_VERSION # Don't ask me why: touch src/chrome/test/data/webui/i18n_process_css_test.html # PGO profiles: python3 src/tools/update_pgo_profiles.py --target=linux update \ --gs-url-base=chromium-optimization-profiles/pgo_profiles python3 src/v8/tools/builtins-pgo/download_profiles.py \ --force --check-v8-revision --depot-tools depot_tools download # Force CIPD to fetch platform-specific packages: python3 src/third_party/devtools-frontend/src/scripts/deps/sync_rollup_libs.py # 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" mkdir output python3 export_tarball.py --version --xz \ --remove-nonessential-files \ output/chromium-${VERSION} --progress --src-dir src/ # That's it, folks! echo "-- [$(date +%Y%m%d_%H%M)] Tarball for chromium-$VERSION created in $(pwd)/output/"