Skip to content

Commit

Permalink
Install the C SDK correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
joncinque committed Sep 6, 2024
1 parent b04f2a1 commit 80ed0bd
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,8 @@ jobs:
./install-solana.sh
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
- name: Install C compiler
run: ./install-solana-c.sh

- name: Build and test program
run: ./test-c.sh ${{ matrix.program }}
2 changes: 1 addition & 1 deletion helloworld/c/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LOCAL_PATH := /home/$(USER)/.local/share/solana/install/active_release/bin/sdk/sbf/c/
LOCAL_PATH := ../../solana-c-sdk/c/

.PHONY: all clean

Expand Down
28 changes: 28 additions & 0 deletions install-solana-c.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

if [[ -n $SOLANA_VERSION ]]; then
solana_version="$SOLANA_VERSION"
else
solana_version="v2.0.8"
fi

output_dir="$1"
if [[ -z $output_dir ]]; then
output_dir="solana-c-sdk"
fi
output_dir="$(mkdir -p "$output_dir"; cd "$output_dir"; pwd)"
cd $output_dir

sdk_tar="sbf-sdk.tar.bz2"
sdk_release_url="https://github.com/anza-xyz/agave/releases/download/$solana_version/$sdk_tar"
echo "Downloading $sdk_release_url"
curl --proto '=https' --tlsv1.2 -SfOL "$sdk_release_url"
echo "Unpacking $sdk_tar"
tar -xjf $sdk_tar
rm $sdk_tar

# Install platform-tools
mv sbf-sdk/* .
rmdir sbf-sdk
./scripts/install.sh
echo "solana-c compiler available at $output_dir"

0 comments on commit 80ed0bd

Please sign in to comment.