a5ec8db5f7
build / build (push) Failing after 5s
dependency (SDL2, SDL2_mixer, fluidsynth-lite, a MIDI soundfont) prebuilt, so compiling the engine needs no network access - just the image and the engine source. Add res/assets/extract_assets.sh to pull the game's data files out of a purchased GOG installer, and a Makefile that assembles a runnable dist/ from the two. Also add `make package`, which builds a redistributable tarball that omits the proprietary game assets (shipping res/GET_ASSETS.txt instead) plus license information for both the MIT tooling and the GPLv3 engine, and a Gitea Actions workflow that builds and publishes it to dl.ladkau.de on every push.
56 lines
1.7 KiB
Bash
Executable File
56 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Runs the build-image against the repo to compile engine/ (the vendored
|
|
# Shockolate snapshot), entirely offline - every dependency it needs
|
|
# (SDL2, SDL2_mixer, fluidsynth-lite, a MIDI soundfont) was already built
|
|
# into the image by ./build-image.sh.
|
|
#
|
|
# Output lands in engine/.build-output/ - run `make dist` afterwards to
|
|
# assemble it (together with the game assets from res/assets/ss_ee/) into
|
|
# dist/.
|
|
#
|
|
# Usage: ./run-image.sh [command...]
|
|
# With no arguments, runs the engine build. Pass a command (e.g. `bash`)
|
|
# to get a shell in the build environment instead, useful for debugging
|
|
# a failed build.
|
|
set -euo pipefail
|
|
|
|
cd "$(dirname "${BASH_SOURCE[0]}")"
|
|
ROOT="$(pwd)"
|
|
|
|
fail() { echo "PREFLIGHT FAIL: $*" >&2; exit 1; }
|
|
|
|
command -v docker >/dev/null 2>&1 \
|
|
|| fail "docker not found in PATH"
|
|
|
|
IMAGE="${REGISTRY_IMAGE:-questshock/builder}"
|
|
if [ -f "$ROOT/registry.env" ]; then
|
|
# shellcheck disable=SC1091
|
|
source "$ROOT/registry.env"
|
|
IMAGE="${REGISTRY_IMAGE:-$IMAGE}"
|
|
fi
|
|
|
|
IMAGE_TAG="$(<"$ROOT/build-image/VERSION")"
|
|
[ -n "$IMAGE_TAG" ] || fail "build-image/VERSION is empty"
|
|
IMAGE="$IMAGE:$IMAGE_TAG"
|
|
|
|
docker image inspect "$IMAGE" >/dev/null 2>&1 \
|
|
|| fail "$IMAGE not found locally - run ./build-image.sh first"
|
|
|
|
TTY_FLAGS="-i"
|
|
[ -t 1 ] && TTY_FLAGS="-it"
|
|
|
|
# shellcheck disable=SC2086
|
|
docker run --rm $TTY_FLAGS \
|
|
-v "$ROOT:/workspace" \
|
|
-e HOST_UID="$(id -u)" \
|
|
-e HOST_GID="$(id -g)" \
|
|
"$IMAGE" \
|
|
"$@"
|
|
|
|
if [ "$#" -eq 0 ]; then
|
|
echo
|
|
echo "This only compiled the engine (engine/.build-output/) - it does not"
|
|
echo "create dist/ by itself. Run 'make dist' next to assemble a runnable"
|
|
echo "copy (or 'make package' for a redistributable tarball)."
|
|
fi
|