Install xargo once (#4753)

This commit is contained in:
Jack May 2019-06-20 16:49:33 -07:00 committed by GitHub
parent ace98bba08
commit 4069ef2e02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 9 deletions

View File

@ -10,23 +10,17 @@ if [ ! -f "$1/Cargo.toml" ]; then
fi
echo "Building $1"
pushd "$(dirname "$0")"
bpf_sdk="$PWD/.."
popd
cd "$1"
cargo install xargo
set -e
cd "$(dirname "$0")" && bpf_sdk="$PWD/.."
# Ensure the sdk is installed
"$bpf_sdk"/scripts/install.sh
# Use the SDK's version of llvm to build the compiler-builtins for BPF
export CC="$bpf_sdk/dependencies/llvm-native/bin/clang"
export AR="$bpf_sdk/dependencies/llvm-native/bin/llvm-ar"
# Use the SDK's version of Rust to build for BPF
export RUSTUP_TOOLCHAIN=bpf
export RUSTFLAGS="
@ -38,8 +32,12 @@ export RUSTFLAGS="
-C link-arg=-shared \
-C link-arg=--entry=entrypoint \
-C linker=$bpf_sdk/dependencies/llvm-native/bin/ld.lld"
# Setup xargo
export XARGO_HOME="$bpf_sdk/dependencies/xargo"
export XARGO_RUST_SRC="$bpf_sdk/dependencies/rust-bpf-sysroot/src"
cd "$1"
xargo build --target bpfel-unknown-unknown --release
{ { set +x; } 2>/dev/null; echo Success; }

View File

@ -22,6 +22,12 @@ download() {
wget "${args[@]}"
}
# Install xargo
if [[ ! -r xargo.md ]]; then
cargo install xargo
xargo --version > xargo.md 2>&1
fi
# Install Criterion
version=v2.3.2
if [[ ! -r criterion-$machine-$version.md ]]; then