#!/bin/bash set -e set +x trap "cd $(pwd -P)" EXIT cd "$(dirname "$0")" USAGE=$(cat< ./out/Default/args.gn echo "dcheck_always_on = false" >> ./out/Default/args.gn if [[ $2 == "--symbols" || $3 == "--symbols" ]]; then echo "symbol_level = 1" >> ./out/Default/args.gn else echo "symbol_level = 0" >> ./out/Default/args.gn fi if [[ $1 == "--compile-mac-arm64" ]]; then echo 'target_cpu = "arm64"' >> ./out/Default/args.gn elif [[ $1 == "--compile-linux-arm64" ]]; then echo 'target_cpu = "arm64"' >> ./out/Default/args.gn fi if [[ ! -z "$USE_GOMA" ]]; then PLAYWRIGHT_GOMA_PATH="${SCRIPT_FOLDER}/electron-build-tools/third_party/goma" if [[ $1 == "--compile-win"* ]]; then PLAYWRIGHT_GOMA_PATH=$(cygpath -w "${PLAYWRIGHT_GOMA_PATH}") fi echo 'use_goma = true' >> ./out/Default/args.gn echo "goma_dir = \"${PLAYWRIGHT_GOMA_PATH}\"" >> ./out/Default/args.gn fi echo "===== args.gn =====" cat ./out/Default/args.gn echo "===== ======= =====" if [[ $2 == "--full" || $3 == "--full" ]]; then if [[ $(uname) == "--compile-linux" ]]; then ./build/install-build-deps.sh elif [[ $1 == "--compile-linux-arm64" ]]; then ./build/install-build-deps.sh # Install sysroot image, see https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/linux/chromium_arm.md ./build/linux/sysroot_scripts/install-sysroot.py --arch=arm64 fi fi if [[ $1 == "--compile-win"* ]]; then if [[ -z "$USE_GOMA" ]]; then /c/Windows/System32/cmd.exe "/c $(cygpath -w "${SCRIPT_FOLDER}"/buildwin.bat)" else /c/Windows/System32/cmd.exe "/c $(cygpath -w "${SCRIPT_FOLDER}"/buildwingoma.bat)" fi else gn gen out/Default if [[ $1 == "--compile-linux"* ]]; then TARGETS="chrome chrome_sandbox clear_key_cdm" else TARGETS="chrome" fi if [[ -z "$USE_GOMA" ]]; then autoninja -C out/Default $TARGETS else ninja -j 200 -C out/Default $TARGETS fi fi } main "$1" "$2" "$3"