-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·98 lines (87 loc) · 2.87 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·98 lines (87 loc) · 2.87 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/usr/bin/env bash
# Set exit code to non-zero if any command / any command in a pipeline fails
set -euo pipefail
OS="$(uname -s)"
# Install package manager
# Homebrew if MacOS, or apt-get if on Linux (e.g. Gorgonzola/Havarti)
if [[ "$OS" == "Darwin" ]]; then
if ! command -v brew &>/dev/null; then
echo "Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
if [[ -f /opt/homebrew/bin/brew ]]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
else
echo "Homebrew already installed: $(brew --version | head -1)"
fi
elif [[ "$OS" == "Linux" ]]; then
if ! command -v apt-get &>/dev/null; then
echo "ERROR: apt-get not found" >&2
exit 1
fi
echo "Updating apt package lists..."
sudo apt-get update -q
else
echo "ERROR: Unsupported OS $OS" >&2
exit 1
fi
# Install Rust via Rustup
if ! command -v cargo &>/dev/null; then
echo "Installing Rust via rustup..."
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# shellcheck source=/dev/null
source "$HOME/.cargo/env"
else
echo "Cargo already installed: $(cargo --version)"
fi
# Check that Rust version matches current version requirement in cargo.toml (1.95)
REQUIRED_RUST="1.95"
CURRENT_RUST=$(rustc --version | awk '{print $2}')
if [[ "$(printf '%s\n' "$REQUIRED_RUST" "$CURRENT_RUST" | sort -V | head -1)" != "$REQUIRED_RUST" ]]; then
echo "Rust $CURRENT_RUST is older than required version $REQUIRED_RUST, updating..."
rustup update stable
fi
# Install uv (for Python dependencies / virtual environments)
if ! command -v uv &>/dev/null; then
echo "Installing uv..."
if [[ "$OS" == "Darwin" ]]; then
brew install uv
else
curl -LsSf https://astral.sh/uv/install.sh | sh
export PATH="$HOME/.local/bin:$PATH"
fi
else
echo "uv already installed: $(uv --version)"
fi
# Install just (for running Justfiles)
if ! command -v just &>/dev/null; then
echo "Installing just..."
if [[ "$OS" == "Darwin" ]]; then
brew install just
else
cargo install just
fi
else
echo "just already installed: $(just --version)"
fi
# Install Yosys (for interpreter)
if ! command -v yosys &>/dev/null; then
echo "Installing yosys..."
if [[ "$OS" == "Darwin" ]]; then
brew install yosys
else
sudo apt-get install -y yosys
fi
else
echo "yosys already installed: $(yosys --version 2>&1 | head -1)"
fi
# Install Nikil's fork of Runt
if ! command -v runt &>/dev/null; then
echo "Installing our fork of runt..."
cargo install --git https://github.com/Nikil-Shyamsunder/runt.git
else
echo "runt already installed: $(runt --version 2>&1 | head -1)"
fi
echo "Syncing Python dependencies..."
uv sync
echo -e "\nAll dependencies installed. Run 'just test' to check tests pass."