Bump bpf-tools to v1.2 and get rid of xargo

This commit is contained in:
Dmitri Makarov
2021-03-16 16:32:42 +01:00
committed by Dmitri Makarov
parent 3d8c4f8389
commit 14e45155e4
43 changed files with 187 additions and 193 deletions

View File

@ -27,13 +27,3 @@ export RUSTFLAGS="
-C link-arg=--threads=1 \
-C link-arg=--entry=entrypoint \
-C linker=$bpf_sdk/dependencies/bpf-tools/llvm/bin/ld.lld"
# CARGO may be set if run from within cargo, causing
# incompatibilities between cargo and xargo versions
unset CARGO
export XARGO="$bpf_sdk"/dependencies/bin/xargo
export XARGO_TARGET=bpfel-unknown-unknown
export XARGO_HOME="$bpf_sdk/dependencies/xargo"
export XARGO_RUST_SRC="$bpf_sdk/dependencies/rust-bpf-sysroot/src"
export RUST_COMPILER_RT_ROOT="$bpf_sdk/dependencies/rust-bpf-sysroot/src/compiler-rt"

View File

@ -1,29 +0,0 @@
#!/usr/bin/env bash
bpf_sdk=$(cd "$(dirname "$0")/.." && pwd)
# shellcheck source=sdk/bpf/env.sh
source "$bpf_sdk"/env.sh
set -e
(
while true; do
if [[ -r Xargo.toml ]]; then
break;
fi
if [[ $PWD = / ]]; then
cat <<EOF
Error: Failed to find Xargo.toml
Please create a Xargo.toml file in the same directory as your Cargo.toml with
the following contents:
[target.bpfel-unknown-unknown.dependencies.std]
features = []
EOF
exit 1
fi
cd ..
done
)
exec "$XARGO" build --target "$XARGO_TARGET" --release "$@"

View File

@ -40,24 +40,6 @@ download() {
return 1
}
clone() {
declare url=$1
declare version=$2
rm -rf temp
if (
set -x
git clone --recursive --depth 1 --single-branch --branch "$version" "$url" temp
); then
(
shopt -s dotglob nullglob
mv temp/* .
)
return 0
fi
return 1
}
get() {
declare version=$1
declare dirname=$2
@ -85,26 +67,6 @@ get() {
return 1
}
# Install xargo
version=0.3.22
if [[ ! -e xargo-$version.md ]] || [[ ! -x bin/xargo ]]; then
(
args=()
# shellcheck disable=SC2154
if [[ -n $rust_stable ]]; then
args+=(+"$rust_stable")
fi
args+=(install xargo --version "$version" --root .)
set -ex
cargo "${args[@]}"
)
exitcode=$?
if [[ $exitcode -ne 0 ]]; then
exit 1
fi
./bin/xargo --version >xargo-$version.md 2>&1
fi
# Install Criterion
if [[ $machine == "linux" ]]; then
version=v2.3.3
@ -130,7 +92,7 @@ if [[ ! -e criterion-$version.md || ! -e criterion ]]; then
fi
# Install Rust-BPF
version=v1.1
version=v1.2
if [[ ! -e bpf-tools-$version.md || ! -e bpf-tools ]]; then
(
set -e
@ -148,31 +110,12 @@ if [[ ! -e bpf-tools-$version.md || ! -e bpf-tools ]]; then
exit 1
fi
touch bpf-tools-$version.md
fi
set -ex
./bpf-tools/rust/bin/rustc --print sysroot
set +e
rustup toolchain uninstall bpf
set -e
rustup toolchain link bpf bpf-tools/rust
# Install Rust-BPF Sysroot sources
version=v1.1
if [[ ! -e rust-bpf-sysroot-$version.md || ! -e rust-bpf-sysroot ]]; then
(
set -e
rm -rf rust-bpf-sysroot*
rm -rf xargo
job="clone \
https://github.com/solana-labs/rust-bpf-sysroot.git \
$version"
get $version rust-bpf-sysroot "$job"
)
exitcode=$?
if [[ $exitcode -ne 0 ]]; then
exit 1
fi
touch rust-bpf-sysroot-$version.md
set -ex
./bpf-tools/rust/bin/rustc --print sysroot
set +e
rustup toolchain uninstall bpf
set -e
rustup toolchain link bpf bpf-tools/rust
fi
exit 0