forked from lithdew/solana-zig
-
Notifications
You must be signed in to change notification settings - Fork 3
/
install-solana-zig.sh
executable file
·51 lines (46 loc) · 1.09 KB
/
install-solana-zig.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
if [[ -n $SOLANA_ZIG_VERSION ]]; then
solana_zig_version="$SOLANA_ZIG_VERSION"
else
solana_zig_version="v1.43.0"
fi
solana_zig_release_url="https://github.com/joncinque/solana-zig-bootstrap/releases/download/solana-$solana_zig_version"
output_dir="$1"
if [[ -z $output_dir ]]; then
output_dir="solana-zig"
fi
output_dir="$(mkdir -p "$output_dir"; cd "$output_dir"; pwd)"
cd $output_dir
arch=$(uname -m)
if [[ "$arch" == "arm64" ]]; then
arch="aarch64"
fi
case $(uname -s | cut -c1-7) in
"Linux")
os="linux"
abi="musl"
;;
"Darwin")
os="macos"
abi="none"
;;
"Windows" | "MINGW64")
os="windows"
abi="gnu"
;;
*)
echo "install-solana-zig.sh: Unknown OS $(uname -s)" >&2
exit 1
;;
esac
solana_zig_tar=zig-$arch-$os-$abi.tar.bz2
url="$solana_zig_release_url/$solana_zig_tar"
echo "Downloading $url"
curl --proto '=https' --tlsv1.2 -SfOL "$url"
echo "Unpacking $solana_zig_tar"
tar -xjf $solana_zig_tar
rm $solana_zig_tar
solana_zig_dir="zig-$arch-$os-$abi-baseline"
mv "$solana_zig_dir"/* .
rmdir $solana_zig_dir
echo "solana-zig compiler available at $output_dir"