Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

devops: infra to automate chromium builds #5347

Merged
merged 1 commit into from
Feb 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions browser_patches/checkout_build_archive_upload.sh
Expand Up @@ -66,6 +66,16 @@ elif [[ "$BUILD_FLAVOR" == "ffmpeg-cross-compile-win64" ]]; then
EXPECTED_HOST_OS="Ubuntu"
EXPECTED_HOST_OS_VERSION="20.04"
BUILD_BLOB_NAME="ffmpeg-win64.zip"
elif [[ "$BUILD_FLAVOR" == "chromium-win32" ]]; then
BROWSER_NAME="chromium"
EXTRA_BUILD_ARGS="--compile-win32"
EXPECTED_HOST_OS="MINGW"
BUILD_BLOB_NAME="chromium-win32.zip"
elif [[ "$BUILD_FLAVOR" == "chromium-win64" ]]; then
BROWSER_NAME="chromium"
EXTRA_BUILD_ARGS="--compile-win64"
EXPECTED_HOST_OS="MINGW"
BUILD_BLOB_NAME="chromium-win64.zip"
elif [[ "$BUILD_FLAVOR" == "chromium-mac" ]]; then
BROWSER_NAME="chromium"
EXTRA_BUILD_ARGS="--compile-mac"
Expand Down
52 changes: 46 additions & 6 deletions browser_patches/chromium/build.sh
Expand Up @@ -35,10 +35,15 @@ compile_chromium() {
exit 1
fi

if [[ ! -d "${SCRIPT_PATH}/depot_tools" ]]; then
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git "${SCRIPT_PATH}/depot_tools"
# install depot_tools if they are not in system
# NOTE: as of Feb 8, 2021, windows requires manual and separate
# installation of depot_tools.
if ! command -v autoninja >/dev/null; then
if [[ ! -d "${SCRIPT_PATH}/depot_tools" ]]; then
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git "${SCRIPT_PATH}/depot_tools"
fi
export PATH="${SCRIPT_PATH}/depot_tools:$PATH"
fi
export PATH="${SCRIPT_PATH}/depot_tools:$PATH"

CHROMIUM_FOLDER_NAME=""
CHROMIUM_FILES_TO_ARCHIVE=()
Expand Down Expand Up @@ -90,6 +95,32 @@ compile_chromium() {
"xdg-mime"
"xdg-settings"
)
elif [[ $1 == "--compile-win"* ]]; then
CHROMIUM_FOLDER_NAME="chrome-win"
CHROMIUM_FILES_TO_ARCHIVE=(
"chrome.dll"
"chrome.exe"
"chrome_100_percent.pak"
"chrome_200_percent.pak"
"chrome_elf.dll"
"chrome_proxy.exe"
"chrome_pwa_launcher.exe"
"D3DCompiler_47.dll"
"elevation_service.exe"
"eventlog_provider.dll"
"First Run"
"icudtl.dat"
"libEGL.dll"
"libGLESv2.dll"
"locales"
"MEIPreload"
"mojo_core.dll"
"nacl_irt_x86_64.nexe"
"notification_helper.exe"
"resources.pak"
"swiftshader"
"v8_context_snapshot.bin"
)
fi

# Get chromium SHA from the build revision.
Expand Down Expand Up @@ -128,11 +159,16 @@ EOF

if [[ $1 == "--compile-mac-arm64" ]]; then
echo 'target_cpu = "arm64"' >> ./out/Default/args.gn
elif [[ $1 == "--compile-win32" ]]; then
echo 'target_cpu = "x86"' >> ./out/Default/args.gn
fi

# Compile Chromium with correct Xcode version.
gn gen out/Default
autoninja -C out/Default chrome
if [[ $1 == "--compile-win"* ]]; then
/c/Windows/System32/cmd.exe "/c $(cygpath -w ${SCRIPT_PATH}/buildwin.bat)"
else
gn gen out/Default
autoninja -C out/Default chrome
fi

if [[ $1 == "--compile-linux" ]]; then
autoninja -C out/Default chrome_sandbox clear_key_cdm
Expand All @@ -151,6 +187,10 @@ EOF
for file in ${CHROMIUM_FILES_TO_ARCHIVE[@]}; do
$COPY_COMMAND "${CR_CHECKOUT_PATH}/src/out/Default/${file}" "output/${CHROMIUM_FOLDER_NAME}/${file}"
done
if [[ $1 == "--compile-win"* ]]; then
$COPY_COMMAND "${CR_CHECKOUT_PATH}/src/out/Default/"*.manifest "output/${CHROMIUM_FOLDER_NAME}/"
fi

cd output
zip --symlinks -r build.zip "${CHROMIUM_FOLDER_NAME}"
}
Expand Down
2 changes: 2 additions & 0 deletions browser_patches/chromium/buildwin.bat
@@ -0,0 +1,2 @@
CALL gn gen out/Default
CALL autoninja -C out/Default chrome