File size: 4,657 Bytes
2512c40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# syntax=docker/dockerfile:1
# Minimal audio-only ffmpeg for rAIdio.bot — win64 static, LGPL-2.1 (no GPL).
# Cross-compiled with mingw-w64. See README.md for rationale + smoke matrix.

FROM ubuntu:24.04 AS build
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
      build-essential gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 binutils-mingw-w64-x86-64 \
      yasm nasm make pkg-config git curl xz-utils ca-certificates \
      autoconf automake libtool \
 && rm -rf /var/lib/apt/lists/*

ENV HOST=x86_64-w64-mingw32
ENV PREFIX=/opt/win64
ENV PKG_CONFIG_LIBDIR=/opt/win64/lib/pkgconfig
WORKDIR /build

# ---- libogg (BSD) ----
ARG OGG_VER=1.3.5
RUN curl -fL https://downloads.xiph.org/releases/ogg/libogg-${OGG_VER}.tar.gz | tar xz \
 && cd libogg-${OGG_VER} \
 && ./configure --host=$HOST --prefix=$PREFIX --disable-shared --enable-static \
 && make -j"$(nproc)" && make install

# ---- libvorbis (BSD) ----
ARG VORBIS_VER=1.3.7
RUN curl -fL https://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VER}.tar.gz | tar xz \
 && cd libvorbis-${VORBIS_VER} \
 && ./configure --host=$HOST --prefix=$PREFIX --disable-shared --enable-static --with-ogg=$PREFIX \
 && make -j"$(nproc)" && make install

# ---- opus (BSD) ----
ARG OPUS_VER=1.5.2
RUN curl -fL https://downloads.xiph.org/releases/opus/opus-${OPUS_VER}.tar.gz | tar xz \
 && cd opus-${OPUS_VER} \
 && ./configure --host=$HOST --prefix=$PREFIX --disable-shared --enable-static --disable-doc --disable-extra-programs \
 && make -j"$(nproc)" && make install

# ---- LAME (LGPL-2.1) ----
ARG LAME_VER=3.100
RUN curl -fL https://downloads.sourceforge.net/project/lame/lame/${LAME_VER}/lame-${LAME_VER}.tar.gz | tar xz \
 && cd lame-${LAME_VER} \
 && ./configure --host=$HOST --prefix=$PREFIX --disable-shared --enable-static --disable-frontend \
 && make -j"$(nproc)" && make install

# ---- zlib (Zlib) — mingw cross via its win32 makefile ----
ARG ZLIB_VER=1.3.1
RUN curl -fL https://zlib.net/fossils/zlib-${ZLIB_VER}.tar.gz | tar xz \
 && cd zlib-${ZLIB_VER} \
 && make -f win32/Makefile.gcc PREFIX=$HOST- \
      BINARY_PATH=$PREFIX/bin INCLUDE_PATH=$PREFIX/include LIBRARY_PATH=$PREFIX/lib \
      SHARED_MODE=0 install

# ---- ffmpeg (LGPL-2.1-or-later; no --enable-gpl) ----
ARG FFMPEG_VER=7.1.1
RUN curl -fL https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VER}.tar.xz | tar xJ \
 && cd ffmpeg-${FFMPEG_VER} \
 && PKG_CONFIG_LIBDIR=$PREFIX/lib/pkgconfig ./configure \
      --prefix=/out \
      --arch=x86_64 --target-os=mingw32 --cross-prefix=$HOST- \
      --pkg-config=pkg-config --pkg-config-flags=--static \
      --enable-static --disable-shared \
      --extra-cflags="-I$PREFIX/include" \
      --extra-ldflags="-L$PREFIX/lib -static -static-libgcc" \
      --disable-debug --disable-doc --disable-network --disable-devices --disable-autodetect \
      --disable-programs --enable-ffmpeg --enable-ffprobe \
      --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-zlib \
      --enable-protocol=file,pipe \
      --disable-encoders \
      --enable-encoder=pcm_s16le,pcm_s16be,pcm_s24le,pcm_s32le,pcm_f32le,pcm_u8,pcm_s8,flac,libmp3lame,libvorbis,libopus,wavpack,alac \
      --disable-muxers \
      --enable-muxer=wav,w64,flac,mp3,ogg,opus,null,pcm_s16le,pcm_s24le,pcm_f32le,pcm_s16be,data,ipod,mp4 \
      --disable-decoder=h264,hevc,vvc,vc1,vc1image,mpeg1video,mpeg2video,mpeg4,msmpeg4v1,msmpeg4v2,msmpeg4v3,wmv1,wmv2,wmv3,vp6,vp6a,vp6f \
      --enable-filter=aresample,aformat,anull,atrim,asetnsamples,asetpts,aselect,volume,channelmap,channelsplit,join,amerge,amix,pan,silenceremove,silencedetect,loudnorm,dynaudnorm,highpass,lowpass,equalizer,atempo,aecho,acompressor,anlmdn,afftdn,abuffer,abuffersink,anullsrc \
 && make -j"$(nproc)" && make install \
 && $HOST-strip /out/bin/ffmpeg.exe /out/bin/ffprobe.exe || true

# Capture the exact configure + component manifest for the SBOM / audit trail.
RUN cd ffmpeg-${FFMPEG_VER} 2>/dev/null || cd $(ls -d ffmpeg-*) ; \
    { echo "=== build host ==="; $HOST-gcc --version | head -1; \
      echo; echo "=== ffmpeg -buildconf (from config.h) ==="; \
      sed -n 's/.*FFMPEG_CONFIGURATION "\(.*\)"/\1/p' config.h; \
      echo; echo "=== lib versions ==="; \
      echo "ffmpeg ${FFMPEG_VER}; lame ${LAME_VER}; libvorbis ${VORBIS_VER}; libogg ${OGG_VER}; opus ${OPUS_VER}; zlib ${ZLIB_VER}"; \
    } > /out/MANIFEST.txt && cat /out/MANIFEST.txt

# ---- export stage: only the artifacts ----
FROM scratch AS export
COPY --from=build /out/bin/ffmpeg.exe /ffmpeg.exe
COPY --from=build /out/bin/ffprobe.exe /ffprobe.exe
COPY --from=build /out/MANIFEST.txt /MANIFEST.txt