389abd7de7
modding/mods/ holds message edits as plain JSON (type, index, language, plus only the changed fields - a long body can live in a sibling .txt to avoid escaping in JSON), so mod authoring is reviewable in git instead of living only in hacked's GUI. mdlp (modding/src/mdlp/, its own Docker image mdlp-image/) turns them into the same mod folder/zip hacked's own Save produces, reusing hacked's ss1/edit, ss1/world and ss1/content/text packages via a go.mod replace - no GUI/GLFW/GTK needed. `make mods` builds every mod into dist/mods/<name>/, scoped per-mod so it never touches hacked's own build output; `make` (no target) now builds both. Fixes a bug this surfaced: hacked's FileLocation.AbsolutePathFrom silently writes into the current directory instead of the given output folder when passed a relative path (the GUI never hits this since its folder picker is always absolute) - mdlp now resolves its own paths up front. res/run-mods.sh/.bat are new companion launchers to run.sh/.bat: they pass every dist/mods/*/mod folder to the engine as a separate absolute argument, since ProcessModDirectory() only scans one directory level deep. Wired into `make dist`/`dist-win` only, not the release archives. modding/hacked/, its patches, sqweek-dialog/, its patches, and the new mdlp/ move under modding/src/, separating source from the surrounding Docker/script scaffolding; all path references updated to match. NOTICE.txt gains a section for hacked's distributed build, listing hacked (New BSD), sqweek/dialog (ISC - corrected from a wrong "New BSD" note), and hacked's other direct Go dependencies.
65 lines
3.2 KiB
Docker
65 lines
3.2 KiB
Docker
# Build environment for modding/src/hacked/ (vendored from
|
|
# https://github.com/inkyblackness/hacked, see ../README.md). Fetches the Go
|
|
# toolchain and this module's dependencies once, here, at image-build time, so
|
|
# ../hacked-build-run-image.sh can compile fully offline afterward. Rebuild
|
|
# with ../hacked-build-image.sh whenever a version below changes, or whenever
|
|
# ../src/hacked/go.mod or go.sum changes (its dependencies are baked into the
|
|
# image's module cache).
|
|
FROM ubuntu:22.04
|
|
|
|
# go.mod's own "go" directive is a minimum toolchain version, not a version to
|
|
# fetch - pin a stable release that already satisfies it so `go build` never
|
|
# needs to fetch a newer toolchain over the network at build time.
|
|
ARG GO_VERSION=1.27.1
|
|
|
|
# build-essential/pkg-config/curl/ca-certificates/git/gosu: base toolchain.
|
|
# mingw-w64: the Windows cross-build. libgl1-mesa-dev/xorg-dev: go-gl/glfw's
|
|
# cgo bindings (Linux build only - the Windows cross-build talks to the Win32
|
|
# API directly, via mingw-w64's own headers). libgtk-3-dev:
|
|
# github.com/sqweek/dialog's Linux backend uses GTK3 via cgo (`pkg-config
|
|
# gtk+-3.0`) for native file/message dialogs. zip: packages the Windows build
|
|
# (see build-hacked.sh) - tar, for the Linux .tgz, is already part of the
|
|
# base image.
|
|
RUN apt-get update \
|
|
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
|
build-essential pkg-config curl ca-certificates git gosu \
|
|
mingw-w64 \
|
|
libgl1-mesa-dev xorg-dev \
|
|
libgtk-3-dev \
|
|
zip \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN curl -sSLO "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" \
|
|
&& tar -C /usr/local -xzf "go${GO_VERSION}.linux-amd64.tar.gz" \
|
|
&& rm "go${GO_VERSION}.linux-amd64.tar.gz"
|
|
ENV PATH=/usr/local/go/bin:${PATH}
|
|
ENV GOTOOLCHAIN=local
|
|
ENV GOPATH=/opt/go
|
|
|
|
# Populates /opt/go/pkg/mod with every dependency hacked/go.mod pins, so the
|
|
# container never needs network access to build it. Only go.mod/go.sum are
|
|
# copied in for this - not the rest of the source - so editing hacked's own
|
|
# .go files doesn't invalidate this layer's cache.
|
|
COPY src/hacked/go.mod src/hacked/go.sum /tmp/hacked-deps/
|
|
RUN cd /tmp/hacked-deps && go mod download && rm -rf /tmp/hacked-deps
|
|
|
|
COPY hacked-build-image/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
|
COPY hacked-build-image/build-hacked.sh /usr/local/bin/build-hacked.sh
|
|
# 755, not +x: the entrypoint drops to a `builder` user matching the *host's*
|
|
# UID/GID (see docker-entrypoint.sh), which is never in these root-owned
|
|
# files' group, so it needs the image's own explicit world-read+execute here -
|
|
# `chmod +x` alone only adds execute bits on top of whatever "other"
|
|
# permissions the source file happened to have (host umask-dependent).
|
|
RUN chmod 755 /usr/local/bin/docker-entrypoint.sh /usr/local/bin/build-hacked.sh
|
|
|
|
WORKDIR /workspace
|
|
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
|
CMD ["/usr/local/bin/build-hacked.sh"]
|
|
|
|
# Marks a shell as already running inside this image, same convention as the
|
|
# main project's own build-image (see ../../build-image/Dockerfile) - lets
|
|
# ../Makefile compile directly instead of trying to docker-run this image
|
|
# again from inside itself (e.g. a CI job already using this image as its
|
|
# container).
|
|
ENV HACKED_BUILD_IMAGE=1
|