chore(config): add automated Godot download to make setup
Adds tooling/install-godot script that downloads the Godot binary from GitHub releases to ~/bin/godot4. Skips download when the correct version is already installed. Supports Linux x86_64/arm64 and macOS. GODOT_VERSION defaults to 4.6 and is overridable. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
.PHONY: help setup build client server test lint ci ci-client ci-server clean \
|
||||
decisions-sync decisions-coverage decisions-active decisions-orphan
|
||||
|
||||
# --- Configuration ---
|
||||
|
||||
GODOT_VERSION ?= 4.6
|
||||
|
||||
# Default
|
||||
help:
|
||||
@echo "The Settled Reach — Development Commands"
|
||||
@@ -20,6 +24,8 @@ help:
|
||||
@echo " make decisions-coverage Decision-to-ticket coverage by domain"
|
||||
@echo " make decisions-active List active decisions"
|
||||
@echo " make decisions-orphan Decisions without implementing tickets"
|
||||
@echo ""
|
||||
@echo " GODOT_VERSION=4.6 make setup Override Godot version"
|
||||
|
||||
# --- Setup ---
|
||||
|
||||
@@ -32,12 +38,13 @@ setup-rust:
|
||||
@rustup component add clippy rustfmt
|
||||
|
||||
setup-godot:
|
||||
@echo "Checking Godot..."
|
||||
@command -v godot4 >/dev/null 2>&1 || command -v godot >/dev/null 2>&1 || { echo "Install Godot 4: https://godotengine.org"; exit 1; }
|
||||
@GODOT_VERSION=$(GODOT_VERSION) tooling/install-godot
|
||||
|
||||
setup-tooling:
|
||||
@echo "Checking tooling dependencies..."
|
||||
@command -v python3 >/dev/null 2>&1 || { echo "Install Python 3"; exit 1; }
|
||||
@command -v curl >/dev/null 2>&1 || { echo "Install curl (required for Godot download)"; exit 1; }
|
||||
@command -v unzip >/dev/null 2>&1 || { echo "Install unzip (required for Godot download)"; exit 1; }
|
||||
|
||||
# --- Build ---
|
||||
|
||||
|
||||
+6
-3
@@ -23,9 +23,11 @@ Unit tests live inside their respective projects (`server/` uses `#[cfg(test)]`
|
||||
| Tool | Version | Purpose |
|
||||
|------|---------|---------|
|
||||
| Rust (via rustup) | stable | Server compilation, clippy, rustfmt |
|
||||
| Godot | 4.x | Client editor and runtime |
|
||||
| Godot | 4.x | Client editor and runtime (auto-installed to `~/bin/` by `make setup`) |
|
||||
| Python | 3.x | Tooling scripts, db connectors |
|
||||
| Make | any | Task runner (see below) |
|
||||
| curl | any | Downloading Godot |
|
||||
| unzip | any | Extracting Godot |
|
||||
|
||||
## Makefile Targets
|
||||
|
||||
@@ -34,10 +36,11 @@ All development operations go through the top-level `Makefile`. Run `make` with
|
||||
### Setup
|
||||
|
||||
```bash
|
||||
make setup # Install/verify all dev dependencies
|
||||
make setup # Install/verify all dev dependencies
|
||||
GODOT_VERSION=4.4 make setup # Pin a specific Godot version
|
||||
```
|
||||
|
||||
Checks for Rust toolchain (installs clippy + rustfmt components), Godot binary, and Python. Run this on a fresh clone or new workstation.
|
||||
Downloads and installs Godot to `~/bin/godot4`, installs Rust clippy + rustfmt, and verifies Python/curl/unzip. Skips the download if the correct version is already installed. The `GODOT_VERSION` variable defaults to `4.6` and can be overridden.
|
||||
|
||||
### Build
|
||||
|
||||
|
||||
Executable
+108
@@ -0,0 +1,108 @@
|
||||
#!/usr/bin/env bash
|
||||
# tooling/install-godot — Download and install Godot to ~/bin/
|
||||
#
|
||||
# Usage:
|
||||
# GODOT_VERSION=4.6 ./tooling/install-godot
|
||||
# ./tooling/install-godot # uses default version
|
||||
#
|
||||
# Installs the Godot binary to ~/bin/godot4.
|
||||
# Skips download if correct version is already installed.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
GODOT_VERSION="${GODOT_VERSION:-4.6}"
|
||||
INSTALL_DIR="$HOME/bin"
|
||||
BINARY="$INSTALL_DIR/godot4"
|
||||
|
||||
# Check if already installed at the right version
|
||||
if [[ -x "$BINARY" ]]; then
|
||||
INSTALLED="$("$BINARY" --version 2>/dev/null | head -1 | cut -d. -f1-2)" || true
|
||||
if [[ "$INSTALLED" == "$GODOT_VERSION" ]]; then
|
||||
echo "Godot $GODOT_VERSION already installed at $BINARY"
|
||||
exit 0
|
||||
fi
|
||||
echo "Godot found but version is $INSTALLED, want $GODOT_VERSION"
|
||||
fi
|
||||
|
||||
# Detect platform and architecture
|
||||
OS="$(uname -s)"
|
||||
ARCH="$(uname -m)"
|
||||
|
||||
case "$OS" in
|
||||
Linux)
|
||||
case "$ARCH" in
|
||||
x86_64) PLATFORM="linux.x86_64" ;;
|
||||
aarch64) PLATFORM="linux.arm64" ;;
|
||||
*) echo "Error: unsupported architecture: $ARCH"; exit 1 ;;
|
||||
esac
|
||||
;;
|
||||
Darwin)
|
||||
PLATFORM="macos.universal"
|
||||
;;
|
||||
*)
|
||||
echo "Error: unsupported OS: $OS"
|
||||
echo "Install Godot manually: https://godotengine.org/download"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
FILENAME="Godot_v${GODOT_VERSION}-stable_${PLATFORM}.zip"
|
||||
URL="https://github.com/godotengine/godot/releases/download/${GODOT_VERSION}-stable/${FILENAME}"
|
||||
|
||||
echo "Downloading Godot $GODOT_VERSION for $PLATFORM..."
|
||||
echo " $URL"
|
||||
|
||||
mkdir -p "$INSTALL_DIR"
|
||||
|
||||
# Download to temp directory
|
||||
TMPDIR="$(mktemp -d)"
|
||||
trap 'rm -rf "$TMPDIR"' EXIT
|
||||
|
||||
if ! curl -fSL --progress-bar -o "$TMPDIR/$FILENAME" "$URL"; then
|
||||
echo "Error: download failed. Check GODOT_VERSION=$GODOT_VERSION is a valid release."
|
||||
echo "Available releases: https://github.com/godotengine/godot/releases"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Extract
|
||||
echo "Extracting..."
|
||||
if ! command -v unzip >/dev/null 2>&1; then
|
||||
echo "Error: unzip is required but not found. Install it and retry."
|
||||
exit 1
|
||||
fi
|
||||
unzip -q -o "$TMPDIR/$FILENAME" -d "$TMPDIR/extract"
|
||||
|
||||
# Install binary
|
||||
case "$OS" in
|
||||
Linux)
|
||||
SRC="$TMPDIR/extract/Godot_v${GODOT_VERSION}-stable_${PLATFORM}"
|
||||
if [[ -f "$SRC" ]]; then
|
||||
chmod +x "$SRC"
|
||||
mv "$SRC" "$BINARY"
|
||||
else
|
||||
echo "Error: expected binary not found after extraction"
|
||||
ls -la "$TMPDIR/extract/"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
Darwin)
|
||||
SRC="$TMPDIR/extract/Godot.app/Contents/MacOS/Godot"
|
||||
if [[ -f "$SRC" ]]; then
|
||||
mv "$SRC" "$BINARY"
|
||||
chmod +x "$BINARY"
|
||||
else
|
||||
echo "Error: expected Godot.app binary not found after extraction"
|
||||
ls -la "$TMPDIR/extract/"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# Verify
|
||||
if "$BINARY" --version >/dev/null 2>&1; then
|
||||
echo "Godot $GODOT_VERSION installed to $BINARY"
|
||||
"$BINARY" --version
|
||||
else
|
||||
echo "Warning: installed to $BINARY but --version check failed."
|
||||
echo "This may be a display server issue (expected in headless environments)."
|
||||
fi
|
||||
Reference in New Issue
Block a user