Kelsidavis-WoWee/container/run-linux.sh

59 lines
1.8 KiB
Bash
Raw Normal View History

feat: add multi-platform Docker build system for Linux, macOS, and Windows Replace the single Ubuntu-based container build with a dedicated Dockerfile, build script, and launcher for each target platform. Infrastructure: - Add .dockerignore to minimize Docker build context - Add container/builder-linux.Dockerfile (Ubuntu 24.04, GCC, native build) - Add container/builder-macos.Dockerfile (multi-stage: SDK fetcher + osxcross/Clang 18) - Add container/builder-windows.Dockerfile (LLVM-MinGW 20240619, vcpkg) - Add container/macos/sdk-fetcher.py (auto-fetch macOS SDK from Apple catalog) - Add container/macos/osxcross-toolchain.cmake (auto-detecting CMake toolchain) - Add container/macos/triplets/arm64-osx-cross.cmake - Add container/macos/triplets/x64-osx-cross.cmake - Remove container/builder-ubuntu.Dockerfile (replaced by per-platform Dockerfiles) - Remove container/build-in-container.sh and container/build-wowee.sh (replaced) Build scripts (run inside containers): - Add container/build-linux.sh (tar copy, FidelityFX clone, cmake/ninja) - Add container/build-macos.sh (arch detection, vcpkg triplet, cross-compile) - Add container/build-windows.sh (Vulkan import lib via dlltool, cross-compile) Launcher scripts (run on host): - Add container/run-linux.sh, run-macos.sh, run-windows.sh (bash) - Add container/run-linux.ps1, run-macos.ps1, run-windows.ps1 (PowerShell) Documentation: - Add container/README.md (quick start, options, file structure, troubleshooting) - Add container/FLOW.md (comprehensive build flow for each platform) CMake changes: - Add macOS cross-compile support (VulkanHeaders, -undefined dynamic_lookup) - Add LLVM-MinGW/Windows cross-compile support - Detect osxcross toolchain and vcpkg triplets Other: - Update vcpkg.json with ffmpeg feature flags - Update resources/wowee.rc version string
2026-03-30 20:17:41 +03:00
#!/usr/bin/env bash
# run-linux.sh — Build WoWee for Linux (amd64) inside a Docker container.
#
# Usage (run from project root):
# ./container/run-linux.sh [--rebuild-image]
#
# Environment variables:
# WOWEE_FFX_SDK_REPO — FidelityFX SDK git repo URL (passed through to container)
# WOWEE_FFX_SDK_REF — FidelityFX SDK git ref / tag (passed through to container)
# REBUILD_IMAGE — Set to 1 to force a fresh docker build (same as --rebuild-image)
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
IMAGE_NAME="wowee-builder-linux"
BUILD_OUTPUT="${PROJECT_ROOT}/build/linux"
# Parse arguments
REBUILD_IMAGE="${REBUILD_IMAGE:-0}"
for arg in "$@"; do
case "$arg" in
--rebuild-image) REBUILD_IMAGE=1 ;;
*) echo "Unknown argument: $arg" >&2; exit 1 ;;
esac
done
# Verify Docker is available
if ! command -v docker &>/dev/null; then
echo "Error: docker is not installed or not in PATH." >&2
exit 1
fi
# Build the image (skip if already present and --rebuild-image not given)
if [[ "$REBUILD_IMAGE" == "1" ]] || ! docker image inspect "$IMAGE_NAME" &>/dev/null; then
echo "==> Building Docker image: ${IMAGE_NAME}"
docker build \
-f "${SCRIPT_DIR}/builder-linux.Dockerfile" \
-t "$IMAGE_NAME" \
"${SCRIPT_DIR}"
else
echo "==> Using existing Docker image: ${IMAGE_NAME}"
fi
# Create output directory on the host
mkdir -p "$BUILD_OUTPUT"
echo "==> Starting Linux build (output: ${BUILD_OUTPUT})"
docker run --rm \
--mount "type=bind,src=${PROJECT_ROOT},dst=/src,readonly" \
--mount "type=bind,src=${BUILD_OUTPUT},dst=/out" \
${WOWEE_FFX_SDK_REPO:+--env "WOWEE_FFX_SDK_REPO=${WOWEE_FFX_SDK_REPO}"} \
${WOWEE_FFX_SDK_REF:+--env "WOWEE_FFX_SDK_REF=${WOWEE_FFX_SDK_REF}"} \
"$IMAGE_NAME"
echo "==> Linux build complete. Artifacts in: ${BUILD_OUTPUT}"