Dockerfile 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. ARG GH_REPO=ghcr.io/yt-dlp/ffmpeg-builds
  2. FROM $GH_REPO/base:latest
  3. RUN \
  4. git clone --filter=blob:none https://github.com/mstorsjo/llvm-mingw /llvm-mingw && cd /llvm-mingw && \
  5. ./build-all.sh --disable-lldb --disable-lldb-mi /opt/llvm-mingw && \
  6. cd / && \
  7. rm -rf llvm-mingw
  8. # LLVM/Clang workarounds
  9. RUN \
  10. ln -s windows.h /opt/llvm-mingw/generic-w64-mingw32/include/Windows.h
  11. # Prepare "cross" environment to heavily favour static builds
  12. RUN \
  13. find /opt/llvm-mingw \
  14. -name "*.dll" \
  15. -or -name "*.dll.a" \
  16. -delete && \
  17. mkdir /opt/ffbuild
  18. ENV FFBUILD_TOOLCHAIN=aarch64-w64-mingw32 \
  19. FFBUILD_RUST_TARGET=aarch64-pc-windows-gnullvm
  20. RUN \
  21. rustup target add "$FFBUILD_RUST_TARGET" && \
  22. echo "[target.$FFBUILD_RUST_TARGET]\nlinker = \"${FFBUILD_TOOLCHAIN}-clang\"\nar = \"${FFBUILD_TOOLCHAIN}-llvm-ar\"\n" >> "$CARGO_HOME"/config.toml
  23. ADD toolchain.cmake /toolchain.cmake
  24. ADD cross.meson /cross.meson
  25. ENV PATH="/opt/llvm-mingw/bin:${PATH}" \
  26. FFBUILD_TARGET_FLAGS="--pkg-config=pkg-config --cross-prefix=${FFBUILD_TOOLCHAIN}- --arch=aarch64 --target-os=mingw32" \
  27. FFBUILD_CROSS_PREFIX=${FFBUILD_TOOLCHAIN}- \
  28. FFBUILD_PREFIX=/opt/ffbuild \
  29. FFBUILD_CMAKE_TOOLCHAIN=/toolchain.cmake \
  30. PKG_CONFIG=pkg-config \
  31. PKG_CONFIG_LIBDIR=/opt/ffbuild/lib/pkgconfig:/opt/ffbuild/share/pkgconfig \
  32. COMPILER_SYSROOT=/opt/llvm-mingw/aarch64-w64-mingw32 \
  33. CC="${FFBUILD_TOOLCHAIN}-clang" \
  34. CXX="${FFBUILD_TOOLCHAIN}-clang++" \
  35. LD="${FFBUILD_TOOLCHAIN}-ld" \
  36. AR="${FFBUILD_TOOLCHAIN}-llvm-ar" \
  37. RANLIB="${FFBUILD_TOOLCHAIN}-llvm-ranlib" \
  38. NM="${FFBUILD_TOOLCHAIN}-nm" \
  39. DLLTOOL="${FFBUILD_TOOLCHAIN}-dlltool" \
  40. CFLAGS="-I/opt/ffbuild/include -O2 -pipe -D_FORTIFY_SOURCE=2 -fstack-protector-strong" \
  41. CXXFLAGS="-I/opt/ffbuild/include -O2 -pipe -D_FORTIFY_SOURCE=2 -fstack-protector-strong" \
  42. LDFLAGS="-L/opt/ffbuild/lib -O2 -pipe -fstack-protector-strong" \
  43. STAGE_CFLAGS="" \
  44. STAGE_CXXFLAGS=""