forked from starknet-io/starknet-devnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompile_binary.sh
More file actions
executable file
·42 lines (32 loc) · 957 Bytes
/
Copy pathcompile_binary.sh
File metadata and controls
executable file
·42 lines (32 loc) · 957 Bytes
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
#!/bin/bash
set -euo pipefail
if [ "$#" -ne 1 ]; then
echo >&2 "Error: $0 <TARGET>"
exit 1
fi
TARGET="$1"
CARGO_CONFIG=~/.cargo/config.toml
case "$TARGET" in
x86_64-unknown-linux-gnu | x86_64-apple-darwin | aarch64-apple-darwin)
echo "Target requires no extra actions: $TARGET"
;;
x86_64-unknown-linux-musl)
sudo apt-get update
sudo apt-get install musl-tools
musl-gcc --version && echo "Musl successfully installed"
;;
aarch64-unknown-linux-gnu)
sudo apt-get update
sudo apt-get install gcc-aarch64-linux-gnu
aarch64-linux-gnu-gcc --version
echo "Cross compiler successfully installed"
echo '[target.aarch64-unknown-linux-gnu]' >>"$CARGO_CONFIG"
echo 'linker = "aarch64-linux-gnu-gcc"' >>"$CARGO_CONFIG"
;;
*)
echo >&2 "Error: Unsupported compilation target: $TARGET"
exit 2
;;
esac
rustup target add "$TARGET"
cargo build --release --target="$TARGET" --bin starknet-devnet