Files
OpenRA3/Dockerfile.win-arm64
EnderTheCoder d0ae4c76ba v0.5.0: Windows/ARM64 and Linux/ARM64 cross targets, .deb/.msi packaging
- Cross toolchains: llvm-mingw-aarch64 (Windows ARM64; SDL3 staged from MSYS2's
  clangarm64 repo since SDL ships no MinGW ARM64 dev package) and
  clang-aarch64-linux-gnu (Linux ARM64; arm64 libc++/SDL3 via dpkg multiarch).
- Distro images: Dockerfile.linux-arm64, Dockerfile.win-arm64, Dockerfile.debian
  and Dockerfile.debian-arm64 (Debian 13 with upstream CMake, whose 3.31 gate
  cannot enable import std).
- Packaging via CPack: .deb for Ubuntu 26.04 and Debian 13 on amd64 and arm64
  (dependencies derived by dpkg-shlibdeps), portable .zip/.tar.gz, and a
  Windows .msi built with wixl (msitools) straight from the Linux cross image.
  wixl 0.106 lacks arm64, so Windows/ARM64 ships the portable zip only.
- CMake: parameterize the SDL3 MinGW triple, add install() + CPack config.
- CI: build/package jobs for both arm64 targets and both Debian packages;
  existing Linux/Windows jobs now also emit the .deb / .zip + .msi.
- scripts/: build-linux-arm64, build-windows-arm64, build-debian,
  build-debian-arm64.
2026-09-28 20:38:40 +08:00

78 lines
3.3 KiB
Docker

# 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 `<triple>/{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/