Bug 1516568 - Add jobs to cross-compile wrench and use the resulting binaries. r=glandium

One job (which runs on a Linux docker worker) cross compiles wrench in
two configurations (regular and headless) and publishes artifacts with
the binaries. The other job (which runs on macOS) downloads the
artifacts and uses them to run the WebRender macOS CI release-mode
scripts, which basically consists of running the WebRender reftest
suite.

Differential Revision: https://phabricator.services.mozilla.com/D19369

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kartikaya Gupta 2019-02-15 01:32:16 +00:00
Родитель 7fdac6c6fe
Коммит dc62fcc29a
3 изменённых файлов: 189 добавлений и 0 удалений

Просмотреть файл

@ -91,6 +91,68 @@ jobs:
files-changed:
- 'gfx/wr/**'
wrench-macos-build:
description: Cross compilation of wrench for macOS on Linux
worker-type: aws-provisioner-v1/gecko-{level}-b-linux
worker:
docker-image: {in-tree: webrender}
env:
TOOLTOOL_MANIFEST: "/builds/worker/checkouts/gecko/browser/config/tooltool-manifests/macosx64/cross-releng.manifest"
chain-of-trust: true
artifacts:
- type: file
name: public/build/wrench-macos.tar.bz2
path: /builds/worker/artifacts/wrench-macos.tar.bz2
- type: file
name: public/build/wrench-macos-headless.tar.bz2
path: /builds/worker/artifacts/wrench-macos-headless.tar.bz2
toolchains:
- linux64-rust-macos
- linux64-cctools-port
- linux64-clang
- linux64-llvm-dsymutil
- wrench-deps
run:
using: run-task
tooltool-downloads: internal
command: '$HOME/checkouts/gecko/taskcluster/scripts/misc/wrench-macos-build.sh'
treeherder:
platform: macosx64-qr/opt
symbol: WR(B)
when:
files-changed:
- 'gfx/wr/**'
- 'taskcluster/scripts/misc/tooltool-download.sh'
- 'taskcluster/scripts/misc/wr-macos-cross-build-setup.sh'
- 'taskcluster/scripts/misc/wrench-macos-build.sh'
macos-release:
description: Runs release-mode WebRender CI tests on a macOS worker
worker-type: releng-hardware/gecko-t-osx-1010
worker:
max-run-time: 3600
env:
MOZ_FETCHES_DIR: 'checkouts/gecko/gfx/wr'
dependencies:
webrender-wrench-macos-build: webrender-wrench-macos-build
fetches:
webrender-wrench-macos-build:
- 'wrench-macos.tar.bz2'
- 'wrench-macos-headless.tar.bz2'
run:
using: run-task
command: >-
cd $GECKO_PATH/gfx/wr &&
export WRENCH_HEADLESS_TARGET=$PWD/wrench-macos-headless/ &&
export WRENCH_BINARY=$PWD/wrench-macos/bin/wrench &&
ci-scripts/macos-release-tests.sh
treeherder:
platform: macosx64-qr/opt
symbol: WR(wrench)
when:
files-changed:
- 'gfx/wr/**'
windows:
description: Runs WebRender CI tests on a Windows worker
worker-type: aws-provisioner-v1/gecko-t-win10-64

Просмотреть файл

@ -0,0 +1,81 @@
#!/bin/bash
set -x -e -v
export WORKSPACE="/builds/worker/workspace"
export TOOLS_DIR="${WORKSPACE}/build/src"
export TARGET_TRIPLE="x86_64-apple-darwin"
mkdir -p "${TOOLS_DIR}"
# The tooltool-download script assumes that the gecko checkout is in
# ${WORKSPACE}/build/src and that it can run `./mach` there. This is not
# true when using run-task (which is what this script runs with) so we
# symlink mach to satisfy tooltool-download's assumptions.
ln -s "${GECKO_PATH}/mach" "${TOOLS_DIR}"
source "${GECKO_PATH}/taskcluster/scripts/misc/tooltool-download.sh"
MACOS_SYSROOT="${TOOLS_DIR}/MacOSX10.11.sdk"
CLANGDIR="${TOOLS_DIR}/clang"
# Deploy the wrench dependencies
mv ${TOOLS_DIR}/wrench-deps/{vendor,.cargo} "${GECKO_PATH}/gfx/wr/"
# Building wrench with the `headless` feature also builds the osmesa-src crate,
# which includes building C++ code. We have to do a bunch of shenanigans
# to make this cross-compile properly.
pushd "${TOOLS_DIR}/cctools/bin"
# Link all the tools from x86_64-darwin11-* to x86_64-apple-darwin-* because
# x86_64-apple-darwin is the Official Rust Triple (TM) and so that's the prefix
# we run configure with, and the toolchain configure/make will look for.
# We can't just rename the files because e.g. the ar tool invokes the ranlib
# tool with the old prefix hard-coded. So we symlink instead.
for TOOL in x86_64-darwin11-*; do
ln -s "${TOOL}" "${TOOL/x86_64-darwin11/${TARGET_TRIPLE}}"
done
# Add a pkg-config cross-compile wrapper. Without this, the configure script
# will use pkg-config from the host, which will find host libraries that are
# not what we want. This script stolen from
# https://autotools.io/pkgconfig/cross-compiling.html
cat > ${TARGET_TRIPLE}-pkg-config <<END_PKGCONFIG_WRAPPER
#!/bin/sh
export PKG_CONFIG_DIR=
export PKG_CONFIG_LIBDIR=${MACOS_SYSROOT}/usr/lib/pkgconfig:${MACOS_SYSROOT}/usr/share/pkgconfig
export PKG_CONFIG_SYSROOT_DIR=${MACOS_SYSROOT}
exec pkg-config "$@"
END_PKGCONFIG_WRAPPER
chmod +x "${TARGET_TRIPLE}-pkg-config"
popd
# The PATH intentionally excludes clang/bin because osmesa will try to
# build llvmpipe if it finds a llvm-config. And that will fail because
# we don't have a target libLLVM library to link with. We don't need
# llvmpipe anyway since we only use the softpipe driver. If for whatever
# reason we need to add clang/bin to the path here, we should be able to
# instead set LLVM_CONFIG=no to disable llvmpipe, but that might impact
# other parts of the build.
export PATH="${TOOLS_DIR}/rustc/bin:${TOOLS_DIR}/cctools/bin:${TOOLS_DIR}/llvm-dsymutil/bin:${PATH}"
# The x86_64-darwin11-ld linker from cctools requires libraries provided
# by clang, so we need to set LD_LIBRARY_PATH for that to work.
export LD_LIBRARY_PATH="${CLANGDIR}/lib:${LD_LIBRARY_PATH}"
# Tell the configure script where to find zlib, because otherwise it tries
# to use pkg-config to find it, which fails (no .pc file in the macos SDK).
export ZLIB_CFLAGS="-I${MACOS_SYSROOT}/usr/include"
export ZLIB_LIBS="-L${MACOS_SYSROOT}/usr/lib -lz"
# Set up compiler and flags for cross-compile
LDPATH="${TOOLS_DIR}/cctools/bin/${TARGET_TRIPLE}-ld"
export CC="${CLANGDIR}/bin/clang"
export CFLAGS="-fuse-ld=${LDPATH} -target ${TARGET_TRIPLE} -mmacosx-version-min=10.7 --rtlib=compiler-rt --sysroot ${MACOS_SYSROOT}"
export CXX="${CLANGDIR}/bin/clang++"
export CXXFLAGS="-fuse-ld=${LDPATH} -target ${TARGET_TRIPLE} -mmacosx-version-min=10.7 --rtlib=compiler-rt --sysroot ${MACOS_SYSROOT} -stdlib=libc++"
# See documentation in cargo-linker for why we need this. TL;DR is that passing
# the right arguments to the linker when invoked by cargo is nigh impossible
# without this.
export MOZ_CARGO_WRAP_LD="${CC}"
export MOZ_CARGO_WRAP_LDFLAGS="${CFLAGS}"
export CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER="${GECKO_PATH}/build/cargo-linker"

Просмотреть файл

@ -0,0 +1,46 @@
#!/bin/bash
set -x -e -v
source ${GECKO_PATH}/taskcluster/scripts/misc/wr-macos-cross-build-setup.sh
# The osmesa-src build which we do as part of the headless build below
# doesn't seem to always use CFLAGS/CXXFLAGS where expected. Instead we
# just squash those flags into CC/CXX and everything works out.
export CC="${CC} ${CFLAGS}"
export CFLAGS=
export CXX="${CXX} ${CXXFLAGS}"
export CXXFLAGS=
export UPLOAD_DIR="${HOME}/artifacts"
mkdir -p "${UPLOAD_DIR}"
# Do a cross-build without the `headless` feature
pushd "${GECKO_PATH}/gfx/wr/wrench"
cargo build --release -vv --frozen --target=${TARGET_TRIPLE}
# Package up the resulting wrench binary
cd "../target/${TARGET_TRIPLE}"
mkdir -p wrench-macos/bin
mv release/wrench wrench-macos/bin/
tar cjf wrench-macos.tar.bz2 wrench-macos
mv wrench-macos.tar.bz2 "${UPLOAD_DIR}"
# Clean the build
cd "${GECKO_PATH}/gfx/wr"
rm -rf target
popd
# Do a cross-build with the `headless` feature
pushd "${GECKO_PATH}/gfx/wr/wrench"
cargo build --release -vv --frozen --target=${TARGET_TRIPLE} --features headless
# Package up the wrench binary and some libraries that we will need
cd "../target/${TARGET_TRIPLE}"
mkdir wrench-macos-headless
mv release wrench-macos-headless/
tar cjf wrench-macos-headless.tar.bz2 \
wrench-macos-headless/release/wrench \
wrench-macos-headless/release/build/osmesa-src*/out/src/gallium/targets/osmesa/.libs \
wrench-macos-headless/release/build/osmesa-src*/out/src/mapi/shared-glapi/.libs
mv wrench-macos-headless.tar.bz2 "${UPLOAD_DIR}"
# Clean the build
cd "${GECKO_PATH}/gfx/wr"
rm -rf target
popd