Skip to content

Commit 8442f2f

Browse files
authored
Use custom bpf-tools (#319)
* Use custom bpf-tools * Source rustup * Typos * Fix CI
1 parent 262e6c9 commit 8442f2f

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ COPY --chown=pyth:pyth . pyth-client/
6060
# Build off-chain binaries.
6161
RUN cd pyth-client && ./scripts/build.sh
6262

63-
63+
RUN ./pyth-client/scripts/get-bpf-tools.sh
6464
# Copy solana sdk and apply patch.
6565
RUN mkdir solana
6666
RUN cp -a /usr/bin/sdk solana

scripts/get-bpf-tools.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
#
3+
# The goal of this script is downloading our own version of bpf/sbf tools. When cargo-build-bpf/sbf gets called
4+
# https://github.com/solana-labs/sbf-tools/releases/download/v1.29/solana-bpf-tools-linux.tar.bz2 gets downloaded, extracted and linked as a toolchain.
5+
# This script is meant to override that behavior and use another version of bpf/sbf-tools.
6+
# Using a custom version of bpf/sbf-tools allows our use of -Z build-std=std,panic_abort flags that make the binary smaller. These flags compile the std library from scratch.
7+
# If solana fixes bpf/sbf-tools, we can revert back to the default behavior (once this PR https://github.com/solana-labs/cargo/pull/1 gets merged and released)
8+
set -eux
9+
10+
curl https://github.com/guibescos/sbf-tools/releases/download/v1.29.1/solana-bpf-tools-linux.tar.bz2 --output solana-bpf-tools-linux.tar.bz2 -L
11+
mkdir -p ~/.cache/solana/v1.29/bpf-tools/
12+
tar -xf solana-bpf-tools-linux.tar.bz2 -C ~/.cache/solana/v1.29/bpf-tools/
13+
rm solana-bpf-tools-linux.tar.bz2
14+
15+
# Source cargo
16+
if ! which cargo 2> /dev/null
17+
then
18+
# shellcheck disable=SC1090
19+
source "${CARGO_HOME:-$HOME/.cargo}/env"
20+
fi
21+
22+
# Link the toolchain for future use
23+
rustup toolchain link bpf ~/.cache/solana/v1.29/bpf-tools/rust

0 commit comments

Comments
 (0)