Add linux prebuild stuff

This commit is contained in:
Colin Sames
2026-04-03 17:59:19 +02:00
parent 09b97782e0
commit 3a281cb676
163 changed files with 154507 additions and 161084 deletions

View File

@@ -1,12 +1,35 @@
#!/usr/bin/env bash
# One-time bootstrap: builds SDL3 from source and installs it into prebuilt/linux/.
# Run this once on the Linux remote after cloning. Re-run only when upgrading SDL.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
SDL_SOURCE="$PROJECT_ROOT/external/SDL"
BUILD_DIR="$PROJECT_ROOT/out/build/_sdl_build/linux"
SDL_VERSION="${1:-3.2.10}"
BUILD_TYPE="${2:-Release}"
BUILD_DIR="$PROJECT_ROOT/out/build/_sdl_bootstrap/linux"
PREBUILT_DIR="$PROJECT_ROOT/prebuilt/linux"
BUILD_TYPE="${1:-Release}"
SDL_SOURCE="$BUILD_DIR/SDL-src"
# Install build dependencies (Debian 12 bookworm)
echo "Checking build dependencies..."
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends \
ninja-build cmake build-essential \
gcc-12 g++-12 \
libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev \
libwayland-dev libpulse-dev libasound2-dev \
libgl1-mesa-dev
# Download SDL source if not already present
if [ ! -d "$SDL_SOURCE" ]; then
echo ""
echo "=== Downloading SDL3 $SDL_VERSION ==="
mkdir -p "$BUILD_DIR"
curl -L "https://github.com/libsdl-org/SDL/archive/refs/tags/release-${SDL_VERSION}.tar.gz" \
| tar -xz -C "$BUILD_DIR"
mv "$BUILD_DIR/SDL-release-${SDL_VERSION}" "$SDL_SOURCE"
fi
build_sdl() {
local LINK_TYPE="$1"
@@ -65,20 +88,6 @@ create_dynamic_symlinks() {
echo "=== Done ==="
}
# Install build dependencies if needed (Debian 12 bookworm)
echo "Checking build dependencies..."
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends \
ninja-build cmake build-essential \
gcc-12 g++-12 \
libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev \
libwayland-dev libpulse-dev libasound2-dev \
libgl1-mesa-dev
build_sdl "dynamic"
build_sdl "static"
# Always recreate symlinks regardless of whether the build was a no-op.
# cmake --install does not preserve symlinks and Ninja may skip the build
# entirely if sources are unchanged, leaving the lib directory without them.
create_dynamic_symlinks