v0.2.0: clang + import std; isolated Windows cross-build (llvm-mingw + SDL3)
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
# Windows cross-build environment (x86_64), fully isolated from the Linux image
|
||||
# in Dockerfile so the two toolchains and standard libraries never interfere.
|
||||
#
|
||||
# Toolchain: llvm-mingw (clang + libc++ + the libc++ `std` module, MSVCRT
|
||||
# runtime) with the official SDL3 MinGW development package.
|
||||
|
||||
FROM ubuntu:26.04 AS dev
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
ARG APT_MIRROR=""
|
||||
RUN if [ -n "$APT_MIRROR" ]; then \
|
||||
sed -i -e "s|http://archive.ubuntu.com/ubuntu|${APT_MIRROR}|g" \
|
||||
-e "s|http://security.ubuntu.com/ubuntu|${APT_MIRROR}|g" \
|
||||
-e "s|http://ports.ubuntu.com/ubuntu-ports|${APT_MIRROR}|g" \
|
||||
/etc/apt/sources.list /etc/apt/sources.list.d/*.sources 2>/dev/null || true; \
|
||||
fi
|
||||
|
||||
RUN --mount=type=cache,target=/var/lib/apt,sharing=locked \
|
||||
--mount=type=cache,target=/var/cache/apt,sharing=locked \
|
||||
for attempt in 1 2 3 4 5; do \
|
||||
apt-get -o Acquire::Retries=5 update && break; \
|
||||
echo "apt-get update failed (attempt $attempt), retrying"; \
|
||||
sleep 5; \
|
||||
done \
|
||||
&& apt-get -o Acquire::Retries=5 install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
curl \
|
||||
ninja-build \
|
||||
xz-utils \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Pinned toolchain + SDL3 versions (override with --build-arg to bump).
|
||||
ARG LLVM_MINGW_VERSION=20260908
|
||||
ARG LLVM_MINGW_FLAVOR=msvcrt
|
||||
ARG SDL3_VERSION=3.4.16
|
||||
|
||||
RUN mkdir -p /opt/llvm-mingw /opt/sdl3-mingw \
|
||||
&& curl -fL "https://github.com/mstorsjo/llvm-mingw/releases/download/${LLVM_MINGW_VERSION}/llvm-mingw-${LLVM_MINGW_VERSION}-${LLVM_MINGW_FLAVOR}-ubuntu-22.04-x86_64.tar.xz" \
|
||||
| tar -xJ -C /opt/llvm-mingw --strip-components=1 \
|
||||
&& curl -fL "https://github.com/libsdl-org/SDL/releases/download/release-${SDL3_VERSION}/SDL3-devel-${SDL3_VERSION}-mingw.tar.gz" \
|
||||
| tar -xz -C /opt/sdl3-mingw --strip-components=1
|
||||
|
||||
ENV OPENRA3_LLVM_MINGW_ROOT=/opt/llvm-mingw
|
||||
ENV OPENRA3_SDL3_ROOT=/opt/sdl3-mingw
|
||||
|
||||
WORKDIR /work
|
||||
COPY . .
|
||||
|
||||
RUN cmake -S . -B build/windows -G Ninja \
|
||||
-DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/llvm-mingw-x86_64.cmake \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
&& cmake --build build/windows -j
|
||||
|
||||
# package target: the .exe plus the SDL3 runtime DLL.
|
||||
FROM ubuntu:26.04 AS package
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=dev /work/build/windows/bin/openra3.exe /app/
|
||||
COPY --from=dev /work/build/windows/bin/SDL3.dll /app/
|
||||
Reference in New Issue
Block a user