# Cross-compiles the LGPL ffmpeg.exe + ffprobe.exe for Windows x64 (MinGW-w64).
# The arm64 MSIX ships the same x64 binaries: Windows on Arm runs them under
# emulation, and the encoding is done by the GPU/Media Foundation anyway.
# Built by build-windows.sh; the tarball is passed in (already checksummed).
FROM ubuntu:24.04
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
      ca-certificates git make gcc libc6-dev nasm pkg-config xz-utils mingw-w64 \
 && rm -rf /var/lib/apt/lists/*
# Header-only SDKs (MIT): NVENC (ffnvcodec) and AMD AMF.
ARG NVCODEC_TAG=n13.0.19.0
ARG AMF_TAG=v1.5.3
RUN git clone --depth 1 --branch "$NVCODEC_TAG" https://github.com/FFmpeg/nv-codec-headers /tmp/nv \
 && make -C /tmp/nv PREFIX=/usr/x86_64-w64-mingw32 install \
 && git clone --depth 1 --branch "$AMF_TAG" --filter=blob:none --sparse https://github.com/GPUOpen-LibrariesAndSDKs/AMF /tmp/amf \
 && git -C /tmp/amf sparse-checkout set amf/public/include \
 && mkdir -p /usr/x86_64-w64-mingw32/include/AMF \
 && cp -r /tmp/amf/amf/public/include/* /usr/x86_64-w64-mingw32/include/AMF/ \
 && rm -rf /tmp/nv /tmp/amf
WORKDIR /build
