Files
radiantwave-legacy/scripts/setup-debian.sh
T
2026-07-29 14:46:11 -05:00

72 lines
2.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
echo "=== Debian dev environment setup ==="
# Update package index
sudo apt-get update
# --- Core dev & build tools ---
sudo apt-get install -y \
curl \
g++ \
gcc \
git \
make \
cmake \
ninja-build \
pkg-config
# --- SDL2 and all official extension libraries ---
sudo apt-get install -y \
libsdl2-dev \
libsdl2-mixer-dev \
libsdl2-net-dev \
libsdl2-ttf-dev \
libsdl2-image-dev \
libsdl2-gfx-dev
# --- SDL3 (available in Debian testing/sid, but not bookworm) ---
# If this fails, SDL3 isn't in your Debian release yet.
# See https://github.com/libsdl-org/SDL for building from source.
sudo apt-get install -y libsdl3-dev || echo "SDL3 not found in apt (expected on older Debian releases)"
# --- Go ---
if ! command -v go &>/dev/null; then
echo "Installing Go..."
GO_VERSION=$(curl -sL https://go.dev/VERSION?m=text | head -1)
GO_TAR="${GO_VERSION}.linux-amd64.tar.gz"
curl -sLO "https://go.dev/dl/${GO_TAR}"
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf "${GO_TAR}"
rm "${GO_TAR}"
export PATH=$PATH:/usr/local/go/bin
if ! grep -q '/usr/local/go/bin' "$HOME/.profile" 2>/dev/null; then
echo 'export PATH=$PATH:/usr/local/go/bin' >> "$HOME/.profile"
fi
else
echo "Go already installed: $(go version)"
fi
# --- Nix (multi-user install) ---
if ! command -v nix &>/dev/null; then
echo "Installing Nix..."
sh <(curl -sL https://nixos.org/nix/install) --daemon
echo "Nix installed. You may need to log out and back in, or run:"
echo " . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh"
else
echo "Nix already installed: $(nix --version)"
fi
echo ""
echo "=== Setup complete ==="
echo "Installed: gcc, g++, make, cmake, ninja, pkg-config"
echo "Installed: SDL2 + mixer/net/ttf/image/gfx"
echo "Installed: Go $(go version 2>/dev/null || echo '(check PATH)')"
echo "Installed: Nix $(nix --version 2>/dev/null || echo '(restart shell)')"
if dpkg -l libsdl3-dev &>/dev/null; then
echo "Installed: SDL3"
else
echo "SDL3: not in apt for this release (install from https://github.com/libsdl-org/SDL)"
fi