Dockerfile 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ARG GH_REPO=ghcr.io/yt-dlp/ffmpeg-builds
  2. FROM $GH_REPO/base:latest
  3. RUN --mount=src=ct-ng-config,dst=/.config \
  4. git clone --filter=blob:none https://github.com/crosstool-ng/crosstool-ng.git /ct-ng && cd /ct-ng && \
  5. ./bootstrap && \
  6. ./configure --enable-local && \
  7. make -j$(nproc) && \
  8. cp /.config .config && \
  9. ./ct-ng build && \
  10. cd / && \
  11. rm -rf ct-ng
  12. # Prepare "cross" environment to heavily favour static builds
  13. RUN \
  14. find /opt/ct-ng \
  15. -name "*.dll" \
  16. -or -name "*.dll.a" \
  17. -delete && \
  18. mkdir /opt/ffbuild
  19. ENV FFBUILD_TOOLCHAIN=x86_64-w64-mingw32 \
  20. FFBUILD_RUST_TARGET=x86_64-pc-windows-gnu
  21. RUN \
  22. rustup target add "$FFBUILD_RUST_TARGET" && \
  23. echo "[target.$FFBUILD_RUST_TARGET]\nlinker = \"${FFBUILD_TOOLCHAIN}-gcc\"\nar = \"${FFBUILD_TOOLCHAIN}-gcc-ar\"\n" > "$CARGO_HOME"/config.toml
  24. ADD toolchain.cmake /toolchain.cmake
  25. ADD cross.meson /cross.meson
  26. ENV PATH="/opt/ct-ng/bin:${PATH}" \
  27. FFBUILD_TARGET_FLAGS="--pkg-config=pkg-config --cross-prefix=${FFBUILD_TOOLCHAIN}- --arch=x86_64 --target-os=mingw32" \
  28. FFBUILD_CROSS_PREFIX=${FFBUILD_TOOLCHAIN}- \
  29. FFBUILD_PREFIX=/opt/ffbuild \
  30. FFBUILD_CMAKE_TOOLCHAIN=/toolchain.cmake \
  31. PKG_CONFIG=pkg-config \
  32. PKG_CONFIG_LIBDIR=/opt/ffbuild/lib/pkgconfig:/opt/ffbuild/share/pkgconfig \
  33. CC="${FFBUILD_TOOLCHAIN}-gcc" \
  34. CXX="${FFBUILD_TOOLCHAIN}-g++" \
  35. LD="${FFBUILD_TOOLCHAIN}-ld" \
  36. AR="${FFBUILD_TOOLCHAIN}-gcc-ar" \
  37. RANLIB="${FFBUILD_TOOLCHAIN}-gcc-ranlib" \
  38. NM="${FFBUILD_TOOLCHAIN}-gcc-nm" \
  39. DLLTOOL="${FFBUILD_TOOLCHAIN}-dlltool" \
  40. CFLAGS="-static-libgcc -static-libstdc++ -I/opt/ffbuild/include -O2 -pipe -D_FORTIFY_SOURCE=2 -fstack-protector-strong" \
  41. CXXFLAGS="-static-libgcc -static-libstdc++ -I/opt/ffbuild/include -O2 -pipe -D_FORTIFY_SOURCE=2 -fstack-protector-strong" \
  42. LDFLAGS="-static-libgcc -static-libstdc++ -L/opt/ffbuild/lib -O2 -pipe -fstack-protector-strong" \
  43. STAGE_CFLAGS="-fno-semantic-interposition" \
  44. STAGE_CXXFLAGS="-fno-semantic-interposition"