# LLVM-MinGW clang for Windows x86_64 (UCRT), plus CMake, Ninja and Wine.
#
# The upstream mstorsjo/llvm-mingw image is Ubuntu 24.04 with a complete
# LLVM-MinGW toolchain in /opt/llvm-mingw (clang, lld, compiler-rt, libc++ and
# the mingw-w64 runtime, DEFAULT_CRT=ucrt). Arch's GCC image covers the GCC
# side; this one is the clang side.
FROM mstorsjo/llvm-mingw:latest

LABEL org.opencontainers.image.title="Void CI Windows Clang" \
      org.opencontainers.image.description="LLVM-MinGW clang cross toolchain, CMake, Ninja and Wine" \
      org.opencontainers.image.source="https://git.faumaray.com/Void/CI-Images"

ENV DEBIAN_FRONTEND=noninteractive \
    CMAKE_GENERATOR=Ninja \
    WINEPREFIX=/root/.wine \
    WINEARCH=win64 \
    WINEDEBUG=-all \
    WINEDLLOVERRIDES=mscoree,mshtml= \
    WINEPATH=Z:/opt/llvm-mingw/x86_64-w64-mingw32/bin

RUN apt-get update \
    && apt-get install -y --no-install-recommends \
        cmake ninja-build pkg-config git ca-certificates \
        libvulkan-dev vulkan-tools mesa-vulkan-drivers \
        wine xvfb \
        zip unzip jq curl \
    && rm -rf /var/lib/apt/lists/*

# The Vulkan headers are OS-independent; make them visible to LLVM-MinGW.
RUN mkdir -p /opt/llvm-mingw/x86_64-w64-mingw32/include \
    && cp -a /usr/include/vulkan /opt/llvm-mingw/x86_64-w64-mingw32/include/ \
    && git config --system --add safe.directory '*'

# Initialise the Wine prefix once, at build time, not in every job.
RUN wineboot --init >/dev/null 2>&1 || true; wineserver -w || true

CMD ["/bin/bash"]
