Bug 1772035 - Add cargo-vet toolchains. r=firefox-build-system-reviewers,andi

We won't need all of them immediately, but while we're here, we might as
well produce them all.

Differential Revision: https://phabricator.services.mozilla.com/D147820
This commit is contained in:
Mike Hommey 2022-06-02 06:54:25 +00:00
Родитель 0e3dacb973
Коммит 09e265a73b
4 изменённых файлов: 127 добавлений и 0 удалений

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

@ -658,3 +658,10 @@ aflplusplus-4.0:
type: git
repo: https://github.com/AFLplusplus/AFLplusplus
revision: ba3c7bfe40f9b17a691958e3525828385127ad25
cargo-vet:
description: cargo-vet source
fetch:
type: git
repo: https://github.com/bholley/cargo-vet
revision: 1d5cd771cd1df8921a57b346a0626e8b8f8694f6

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

@ -0,0 +1,64 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
---
job-defaults:
description: "cargo-vet toolchain build"
attributes:
local-toolchain: true
worker-type: b-linux
worker:
max-run-time: 1800
run:
script: build-cargo-vet.sh
toolchain-artifact: public/build/cargo-vet.tar.zst
fetches:
fetch:
- cargo-vet
linux64-cargo-vet:
treeherder:
symbol: TL(cargo-vet)
run:
arguments: ['x86_64-unknown-linux-gnu']
fetches:
toolchain:
- linux64-clang-toolchain
- linux64-rust-1.60
- sysroot-x86_64-linux-gnu
macosx64-cargo-vet:
treeherder:
symbol: TM(cargo-vet)
run:
arguments: ['x86_64-apple-darwin']
toolchain-alias: macosx64-aarch64-cargo-vet
fetches:
toolchain:
- linux64-cctools-port
- linux64-clang-toolchain
- linux64-rust-macos-1.60
- macosx64-sdk-11.0
macosx64-aarch64-cargo-vet:
treeherder:
symbol: TM(cargo-vet-arm64)
run:
arguments: ['aarch64-apple-darwin']
fetches:
toolchain:
- linux64-cctools-port
- linux64-clang-toolchain
- linux64-rust-macos-1.60
- macosx64-sdk-11.0
win64-cargo-vet:
treeherder:
symbol: TW64(cargo-vet)
run:
arguments: ['x86_64-pc-windows-msvc']
fetches:
toolchain:
- linux64-clang-toolchain
- linux64-rust-windows-1.60
- win64-vs2017

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

@ -25,6 +25,7 @@ job-defaults:
jobs-from:
- android.yml
- cargo-vet.yml
- cbindgen.yml
- clang-tidy.yml
- clang.yml

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

@ -0,0 +1,55 @@
#!/bin/bash
set -x -e -v
PROJECT=cargo-vet
# Needed by osx-cross-linker.
export TARGET=$1
case "$TARGET" in
x86_64-unknown-linux-gnu)
# Native Linux Build
EXE=
FEATURES="--features reqwest/native-tls-vendored"
export RUSTFLAGS="-Clinker=$MOZ_FETCHES_DIR/clang/bin/clang++ -C link-arg=--sysroot=$MOZ_FETCHES_DIR/sysroot-x86_64-linux-gnu -C link-arg=-fuse-ld=lld"
export CC=$MOZ_FETCHES_DIR/clang/bin/clang
export CFLAGS="--sysroot=$MOZ_FETCHES_DIR/sysroot-x86_64-linux-gnu"
;;
*-apple-darwin)
# Cross-compiling for Mac on Linux.
EXE=
FEATURES=
export PATH="$MOZ_FETCHES_DIR/clang/bin:$PATH"
export PATH="$MOZ_FETCHES_DIR/cctools/bin:$PATH"
export RUSTFLAGS="-C linker=$GECKO_PATH/taskcluster/scripts/misc/osx-cross-linker"
if test "$TARGET" = "aarch64-apple-darwin"; then
export MACOSX_DEPLOYMENT_TARGET=11.0
else
export MACOSX_DEPLOYMENT_TARGET=10.12
fi
export CC="$MOZ_FETCHES_DIR/clang/bin/clang"
export TARGET_CC="$CC -isysroot $MOZ_FETCHES_DIR/MacOSX11.0.sdk"
;;
x86_64-pc-windows-msvc)
# Cross-compiling for Windows on Linux.
EXE=.exe
FEATURES=
export CC=$MOZ_FETCHES_DIR/clang/bin/clang-cl
export TARGET_AR=$MOZ_FETCHES_DIR/clang/bin/llvm-lib
. $GECKO_PATH/taskcluster/scripts/misc/vs-setup.sh
export CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_LINKER=$MOZ_FETCHES_DIR/clang/bin/lld-link
;;
esac
PATH="$MOZ_FETCHES_DIR/rustc/bin:$PATH"
cd $MOZ_FETCHES_DIR/$PROJECT
cargo build --verbose --release --target "$TARGET" --bin $PROJECT $FEATURES
mkdir ${PROJECT}
cp target/$TARGET/release/${PROJECT}${EXE} ${PROJECT}/${PROJECT}${EXE}
tar -acf ${PROJECT}.tar.zst ${PROJECT}
mkdir -p $UPLOAD_DIR
cp ${PROJECT}.tar.zst $UPLOAD_DIR