# syntax=docker/dockerfile:1 # Windows on ARM64 cross-build environment (aarch64-w64-mingw32), isolated from # the x86_64 Windows image and the Linux images. # # Toolchain: the same multi-target llvm-mingw as Dockerfile.win (clang + libc++ + # the libc++ `std` module, MSVCRT runtime), targeting aarch64. The official SDL # release ships no MinGW ARM64 dev package, so SDL3 comes from MSYS2's clangarm64 # repository, staged into the `/{include,lib,bin}` layout the toolchain # expects. 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 \ python3 \ xz-utils \ zstd \ && 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 # SDL3 for aarch64-w64-mingw32 from MSYS2's clangarm64 repo (name includes the # MSYS2 package release, hence the `-1`). ARG MSYS2_SDL3_PKG=mingw-w64-clang-aarch64-sdl3-3.4.16-1-any.pkg.tar.zst RUN mkdir -p /opt/llvm-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 RUN mkdir -p /opt/sdl3-aarch64/aarch64-w64-mingw32/include /opt/sdl3-aarch64/aarch64-w64-mingw32/lib /opt/sdl3-aarch64/aarch64-w64-mingw32/bin \ && curl -fL "https://repo.msys2.org/mingw/clangarm64/${MSYS2_SDL3_PKG}" -o /tmp/sdl3.pkg.tar.zst \ && mkdir -p /tmp/sdl3 && tar --zstd -xf /tmp/sdl3.pkg.tar.zst -C /tmp/sdl3 \ && cp -r /tmp/sdl3/clangarm64/include/SDL3 /opt/sdl3-aarch64/aarch64-w64-mingw32/include/ \ && cp /tmp/sdl3/clangarm64/lib/libSDL3.dll.a /opt/sdl3-aarch64/aarch64-w64-mingw32/lib/ \ && cp /tmp/sdl3/clangarm64/bin/SDL3.dll /opt/sdl3-aarch64/aarch64-w64-mingw32/bin/ \ && rm -rf /tmp/sdl3 /tmp/sdl3.pkg.tar.zst ENV OPENRA3_LLVM_MINGW_ROOT=/opt/llvm-mingw ENV OPENRA3_SDL3_ROOT=/opt/sdl3-aarch64 WORKDIR /work COPY . . RUN cmake -S . -B build/windows-arm64 -G Ninja \ -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/llvm-mingw-aarch64.cmake \ -DCMAKE_BUILD_TYPE=Release \ && cmake --build build/windows-arm64 -j \ && (cd build/windows-arm64 && cpack -G ZIP) # package target: the .exe plus the SDL3 runtime DLL. FROM ubuntu:26.04 AS package WORKDIR /app COPY --from=dev /work/build/windows-arm64/bin/openra3.exe /app/ COPY --from=dev /work/build/windows-arm64/bin/SDL3.dll /app/