summaryrefslogtreecommitdiff
path: root/script/setup-rust
blob: 489cc50044075b09987050aaaf7f753ac91bf56a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env bash

# Installs the Rust toolchain via rustup.
# Run this before any platform-specific setup script.

set -euo pipefail

CARGO_BIN="$HOME/.cargo/bin/rustup"

if command -v rustup &> /dev/null || [ -f "$CARGO_BIN" ]; then
  echo "rustup already installed"
  exit 0
fi

echo "Installing rustup..."
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source "$HOME/.cargo/env"

echo "Installing wasm-pack..."
cargo install wasm-pack
echo "Done. Rust toolchain ready."