mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-11 08:13:35 +00:00
Bug 1848419 - Add a toolchain for building CaR for Android arm64. r=perftest-reviewers,sparky
This patch adds the ability to build custom chromium-as-release (CaR) for the android platform (arm64). A linux host is used for the android builds so a new dockerfile is added to maintain as either platform (e.g. Linux and Android) may have differing dependencies and potentially diverge further in the future. We can look into consolidating them into one dockerfile later if needed. Differential Revision: https://phabricator.services.mozilla.com/D189604
This commit is contained in:
parent
1793a9615b
commit
9be0f8d503
@ -122,6 +122,10 @@ jobs:
|
||||
custom-car-linux:
|
||||
symbol: I(custom-car-linux)
|
||||
parent: debian12-base
|
||||
# Chromium-as-Release Android
|
||||
custom-car-android:
|
||||
symbol: I(custom-car-android)
|
||||
parent: debian12-base
|
||||
valgrind-build:
|
||||
symbol: I(vb)
|
||||
parent: debian12-amd64-build
|
||||
|
@ -229,6 +229,36 @@ macosx64-custom-car:
|
||||
- MacOSX14.0.sdk
|
||||
- macosx64-python-3.8
|
||||
|
||||
android-custom-car:
|
||||
description: "Custom chromium-as-release build for Android"
|
||||
treeherder:
|
||||
symbol: TL(custom-car-android)
|
||||
worker:
|
||||
docker-image: {in-tree: custom-car-android}
|
||||
max-run-time: 20000
|
||||
run:
|
||||
script: build-custom-car.sh
|
||||
arguments: [
|
||||
car_android.tar.zst,
|
||||
blink_symbol_level=0,
|
||||
chrome_pgo_phase=2,
|
||||
dcheck_always_on=false,
|
||||
enable_nacl=false,
|
||||
enable_resource_allowlist_generation=false,
|
||||
is_chrome_branded=false,
|
||||
is_clang=true,
|
||||
is_component_build=false,
|
||||
is_debug=false,
|
||||
is_official_build=true,
|
||||
symbol_level=0,
|
||||
target_cpu="arm64",
|
||||
target_os="android",
|
||||
is_android=true,
|
||||
is_high_end_android=true,
|
||||
v8_symbol_level=0
|
||||
]
|
||||
toolchain-artifact: public/build/car_android.tar.zst
|
||||
|
||||
linux64-custom-car:
|
||||
description: "Custom chromium-as-release build for Linux"
|
||||
treeherder:
|
||||
|
25
taskcluster/docker/custom-car-android/Dockerfile
Normal file
25
taskcluster/docker/custom-car-android/Dockerfile
Normal file
@ -0,0 +1,25 @@
|
||||
FROM $DOCKER_IMAGE_PARENT
|
||||
MAINTAINER kshampur <kshampur@mozilla.com>
|
||||
|
||||
VOLUME /builds/worker/checkouts
|
||||
VOLUME /builds/worker/workspace
|
||||
VOLUME /builds/worker/tooltool-cache
|
||||
|
||||
ENV XZ_OPT=-T0
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install \
|
||||
bzip2 \
|
||||
curl \
|
||||
libbz2-dev \
|
||||
libglib2.0-dev \
|
||||
libtinfo5 \
|
||||
pkg-config \
|
||||
tar \
|
||||
unzip \
|
||||
wget \
|
||||
zip \
|
||||
lsb-release \
|
||||
gperf \
|
||||
procps \
|
||||
gcc
|
@ -10,6 +10,11 @@ shift
|
||||
# Use the rest of the arguments as the build config for gn
|
||||
CONFIG=$(echo $* | tr -d "'")
|
||||
|
||||
# Android build flag
|
||||
if [[ "$ARTIFACT_NAME" == *"android"* ]]; then
|
||||
IS_ANDROID=true
|
||||
fi
|
||||
|
||||
mkdir custom_car
|
||||
cd custom_car
|
||||
CUSTOM_CAR_DIR=$PWD
|
||||
@ -19,30 +24,45 @@ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||
export PATH="$PATH:$CUSTOM_CAR_DIR/depot_tools"
|
||||
|
||||
# Set up some env variables depending on the target OS
|
||||
# Linux is the default case
|
||||
# Linux is the default case, with minor adjustments for
|
||||
# android since it is built with a linux host
|
||||
|
||||
# Final folder structure before compressing is
|
||||
# the same for linux and windows
|
||||
FINAL_BIN_PATH="src/out/Default"
|
||||
|
||||
# unique substring for PGO data for Linux
|
||||
# Final binary name for autoninja build sequence
|
||||
FINAL_BIN=chrome
|
||||
|
||||
# Unique substring for PGO data for Linux
|
||||
PGO_SUBSTR="chrome-linux-main"
|
||||
|
||||
# Default (non android) fetch name for upstream src
|
||||
FETCH_NAME=chromium
|
||||
|
||||
# Android specific vars
|
||||
if [ "$IS_ANDROID" = true ]; then
|
||||
FETCH_NAME=android
|
||||
PGO_SUBSTR="android64"
|
||||
FINAL_BIN_PATH="src/out/Default/apks"
|
||||
FINAL_BIN=chrome_public_apk
|
||||
fi
|
||||
|
||||
# Logic for macosx64
|
||||
if [[ $(uname -s) == "Darwin" ]]; then
|
||||
# modify the config with fetched sdk path
|
||||
# Modify the config with fetched sdk path
|
||||
export MACOS_SYSROOT="$MOZ_FETCHES_DIR/MacOSX14.0.sdk"
|
||||
|
||||
# Use the fetched toolchain python instead as it is a higher version
|
||||
# than the system python
|
||||
export PATH="$MOZ_FETCHES_DIR/python/bin/:$PATH"
|
||||
|
||||
# set the SDK path for build, which is technically a higher version
|
||||
# than what is associated with the current OS version (10.15)
|
||||
# this should work as long as MACOSX_DEPLOYMENT_TARGET is set correctly
|
||||
# Set the SDK path for build, which is technically a higher version
|
||||
# than what is associated with the current OS version (10.15).
|
||||
# This should work as long as MACOSX_DEPLOYMENT_TARGET is set correctly
|
||||
CONFIG=$(echo $CONFIG mac_sdk_path='"'$MACOS_SYSROOT'"')
|
||||
|
||||
# ensure we don't use ARM64 profdata with this unique sub string
|
||||
# Ensure we don't use ARM64 profdata with this unique sub string
|
||||
PGO_SUBSTR="chrome-mac-main"
|
||||
|
||||
# macOS final build folder is different than linux/win
|
||||
@ -51,10 +71,10 @@ fi
|
||||
|
||||
# Logic for win64 using the mingw environment
|
||||
if [[ $(uname -o) == "Msys" ]]; then
|
||||
# setup VS 2022
|
||||
# Setup VS 2022
|
||||
. $GECKO_PATH/taskcluster/scripts/misc/vs-setup.sh
|
||||
|
||||
# setup some environment variables for chromium build scripts
|
||||
# Setup some environment variables for chromium build scripts
|
||||
export DEPOT_TOOLS_WIN_TOOLCHAIN=0
|
||||
export GYP_MSVS_OVERRIDE_PATH="$MOZ_FETCHES_DIR/VS"
|
||||
export GYP_MSVS_VERSION=2022
|
||||
@ -65,7 +85,7 @@ if [[ $(uname -o) == "Msys" ]]; then
|
||||
# Fool GYP
|
||||
touch "$MOZ_FETCHES_DIR/VS/VC/vcvarsall.bat"
|
||||
|
||||
# construct some of our own dirs and move VS dlls + other files
|
||||
# Construct some of our own dirs and move VS dlls + other files
|
||||
# to a path that chromium build files & scripts are expecting
|
||||
mkdir chrome_dll
|
||||
cd chrome_dll
|
||||
@ -78,25 +98,31 @@ if [[ $(uname -o) == "Msys" ]]; then
|
||||
mv "$WINDOWSSDKDIR/App Certification Kit/"* "$WINDOWSSDKDIR"/Debuggers/x64/
|
||||
export WINDIR="$PWD/chrome_dll"
|
||||
|
||||
# run glcient once first to get some windows deps
|
||||
# Run glcient once first to get some windows deps
|
||||
gclient
|
||||
|
||||
# ensure we don't use WIN32 profdata with this unique sub string
|
||||
# Ensure we don't use WIN32 profdata with this unique sub string
|
||||
PGO_SUBSTR="chrome-win64-main"
|
||||
fi
|
||||
|
||||
# Get chromium source code and dependencies
|
||||
mkdir chromium
|
||||
cd chromium
|
||||
fetch --no-history --nohooks chromium
|
||||
|
||||
# setup the .gclient file to ensure pgo profiles are downloaded
|
||||
# for some reason we need to set --name flag even though it already exists.
|
||||
# currently the gclient.py file does NOT recognize --custom-var as it's own argument
|
||||
fetch --no-history --nohooks $FETCH_NAME
|
||||
|
||||
# Setup the .gclient file to ensure pgo profiles are downloaded.
|
||||
# For some reason we need to set --name flag even though it already exists.
|
||||
# Currently the gclient.py file does NOT recognize --custom-var as it's own argument
|
||||
gclient config --name src "https://chromium.googlesource.com/chromium/src.git" --custom-var="checkout_pgo_profiles=True" --unmanaged
|
||||
|
||||
cd src
|
||||
|
||||
# Amend gclient file
|
||||
if [ "$IS_ANDROID" = true ]; then
|
||||
echo "target_os = [ 'android' ]" >> ../.gclient
|
||||
fi
|
||||
|
||||
if [[ $(uname -o) == "Msys" ]]; then
|
||||
# For fast fetches it seems we will be missing some dummy files in windows.
|
||||
# We can create a dummy this way to satisfy the rest of the build sequence.
|
||||
@ -114,7 +140,12 @@ if [[ $(uname -s) == "Linux" ]] || [[ $(uname -s) == "Darwin" ]]; then
|
||||
cipd_bin_setup
|
||||
fi
|
||||
|
||||
# now we can run hooks and fetch PGO + everything else
|
||||
# Sync again for android, after cipd bin setup
|
||||
if [ "$IS_ANDROID" = true ]; then
|
||||
gclient sync
|
||||
fi
|
||||
|
||||
# Now we can run hooks and fetch PGO + everything else
|
||||
gclient runhooks
|
||||
|
||||
# PGO data should be in src/chrome/build/pgo_profiles/
|
||||
@ -133,16 +164,17 @@ done
|
||||
|
||||
PGO_FILE=$PGO_DATA_PATH
|
||||
if [[ $(uname -o) == "Msys" ]]; then
|
||||
# compute a relative path that the build scripts looks for.
|
||||
# this odd pathing seems to only happen on windows
|
||||
# Compute a relative path that the build scripts looks for.
|
||||
# This odd pathing seems to only happen on windows
|
||||
PGO_FILE=${PGO_DATA_PATH#*/*/*/*/*/*/*/*/*/}
|
||||
mv $PGO_DATA_PATH build/config/compiler/pgo/
|
||||
fi
|
||||
|
||||
CONFIG=$(echo $CONFIG pgo_data_path='"'$PGO_FILE'"')
|
||||
|
||||
# set up then build chrome
|
||||
# Set up then build chrome
|
||||
gn gen out/Default --args="$CONFIG"
|
||||
autoninja -C out/Default chrome # skips test binaries
|
||||
autoninja -C out/Default $FINAL_BIN
|
||||
|
||||
# Gather binary and related files into a zip, and upload it
|
||||
cd ..
|
||||
|
Loading…
Reference in New Issue
Block a user