Files
spacedrive/.github/scripts/ffmpeg-macos/Dockerfile
Vítor Vasconcellos 44efac959d [ENG-630] Windows ffmpeg + libheif custom build (#871)
* Initial Windows ffmpeg + libheif custom build

* Add build steps for most of ffmpeg deps

* FFmpeg deps and libheif

* Fix libheif build

* Fix libvpx and dlfcn + attempt to fix rav1e

* Rework the whole ffmpeg-windows build system
 - New system based on https://github.com/BtbN/FFmpeg-Builds
 - Add new ffmpeg-windows workflow
 - Rename macos ffmpeg workflow
 - Adapt macos setupt script due to above name change

* Forgot to update update the workflow name

* Strip all libs from debug symbols

* Add docs

* Add libde265 deps, required by libheif
 - Make x265, svtav1 and dav1d as shared deps (used by both ffmpeg and libheif)

* Add missing libheif to Linux setup script

* Fix libx265 build script

* Forgot to point x265 ninja install to the correct directory

* Remove libaom and libsvt-av1
 - dav1d and rav1d are our default AV1 decoders/encoders
 - Quote subshell executions
 - Make libweb shared

* Forgot to remove libaom and libsvt-av1 build steps

* Fix typo

* Try force webp to link against static libs

* Revert libwebp to a static build

* Dumb typo

* Modify windows script to download our ffmpeg build (WIP)

* Fix dlls output folder structure

* Fix dumb mistake

* Remove unused ffbuild_enabled

* Enable core's heif feature on Windows
 - Fix windows ffmpeg build not including the headers
 - Fix windows setupt script incorrect download loagic
 - Implement build_arg to pass which repo ref to use when cloning

* Fix windows setup script

* Fix workflow artifact path
 - Make ffmpeg-windows dockerfile respect the FFMPEG_VERSION env

* Fix Windows setup script incorrect logic for downloading ffmpeg builds

* Error out when workflow_runs is empty

* Fix dumb mistake

* Manually define ffmpeg version for windows script

* Fix ffmpeg windows build extract logic

* Fix prop access in windows setup script

* Revert back to a web request because nightly.link does a redirect before serving the artifact content

* Fix windows setup script

* Do not use nightly.link in Github CI

* Fix windows setup script

* Should finally fix window setup script
 - Update ffmpeg-windows deps
 - Should fix ffmpeg-windows failing to build due to mingw changes in new base image

* Fix libxz failing to build due to doxygen

* Fix windows setup-script not executing till the end

* Fix LASTEXITCODE not defined

* Remove libjxl, deps are not being compiled

* Fix dll and lib copy logic

* Move final copy dll logic to external script

* Use main for libjxl

* Change brotli from stable to main
 - Attempt to fix libjxl

* Attempt fix lib copy again

* Split copy_dll logic to avoid cache burst in docker

* Missing file

* Change how to export build files from shared deps

* Replace rsync with cp

* Fix copy

* Fix dir not existing

* Fix pkgconfig

* Remove superflous files from exported ffmpeg for windows
 - Adjust dav1d to not build tools and examples
 - Adjust windows setup-script to point linker to the libs directory

* Fix dav1d meson config args

* Fix dumb mistake

* WORK PLZ

* Fix .lib file location
 - Strip all dlls

* Formatter
2023-06-10 15:23:37 +00:00

66 lines
2.1 KiB
Docker

ARG FAKE_DEPS="python311 perl5.34 gdk-pixbuf2 xorg-libsm xorg-libX11" \
FFMPEG_DEPS="aom bzip2 fontconfig freetype fribidi lame libgsm libheif libogg libopus libpng \
libtheora libvorbis libvpx-devel openjpeg rav1e soxr svt-av1 twolame webp x264 x265 XviD xz zimg \
zlib" \
FFMPEG_VERSION=6.0
FROM vvasconcellos/osxcross:12.3-50e86eb-1 as base
# Download ffmpeg
ARG FFMPEG_VERSION
ADD "https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.xz" ./
RUN tar -xf ffmpeg-${FFMPEG_VERSION}.tar.xz && rm ffmpeg-${FFMPEG_VERSION}.tar.xz
WORKDIR /srv/ffmpeg-${FFMPEG_VERSION}
COPY --chmod=755 ./ffmpeg-build-macos.sh ./
# ---
FROM base as x86_64
# Fake Install macOS dependencies not required to build ffmpeg
ARG FAKE_DEPS
# hadolint ignore=SC2086
RUN osxcross-macports fake-install $FAKE_DEPS
# Install macOS dependencies required to build ffmpeg
ARG FFMPEG_DEPS
# hadolint ignore=SC2086
RUN --mount=type=cache,id=macports-x86_64,target=/opt/osxcross/macports/cache \
osxcross-macports install $FFMPEG_DEPS
# Build ffmpeg
RUN ./ffmpeg-build-macos.sh x86_64 "$MACOSX_SDK"
# ---
FROM base as aarch64
# https://ffmpeg.org/pipermail/ffmpeg-user/2016-January/030202.html
ADD https://raw.githubusercontent.com/yuvi/gas-preprocessor/master/gas-preprocessor.pl /usr/local/bin/
RUN chmod +x /usr/local/bin/gas-preprocessor.pl
# Update min macOS version for arm64
# libbrotli macports precompiled binaries are only available for macOS 11.2+
ENV OSX_VERSION_MIN="11.2" \
MACOSX_DEPLOYMENT_TARGET="11.2"
# Fake Install macOS dependencies not required to build ffmpeg
ARG FAKE_DEPS
# hadolint ignore=SC2086
RUN osxcross-macports fake-install --arm64 $FAKE_DEPS
# Install macOS dependencies required to build ffmpeg
ARG FFMPEG_DEPS
# hadolint ignore=SC2086
RUN --mount=type=cache,id=macports-arm64,target=/opt/osxcross/macports/cache \
osxcross-macports install --arm64 $FFMPEG_DEPS
# Build ffmpeg
RUN ./ffmpeg-build-macos.sh aarch64 "$MACOSX_SDK"
# ---
FROM scratch
COPY --from=x86_64 /FFMpeg.framework /ffmpeg/x86_64/FFMpeg.framework
COPY --from=aarch64 /FFMpeg.framework /ffmpeg/aarch64/FFMpeg.framework