[ENG-867] Remove unnecessary encoders from our FFmpeg bundle (#1061)

* Greatly improve our ffmpeg build

* Remove not needed deps

* Remove libpng from windows ffmpeg build
This commit is contained in:
Vítor Vasconcellos 2023-06-30 01:35:52 -03:00 committed by GitHub
parent 942bf50638
commit f433995de6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 347 additions and 714 deletions

View file

@ -1,19 +1,41 @@
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
ARG FAKE_DEPS="gettext-runtime libiconv ncurses" \
FFMPEG_DEPS="brotli bzip2 dav1d libde265 libjxl libopus libpng libvorbis libvpx-devel openjpeg \
soxr xz zimg" \
LIBWEBP_VERSION=1.3.1 \
FFMPEG_VERSION=6.0 \
LIBHEIF_VERSION=1.16.2
FROM vvasconcellos/osxcross:12.3-50e86eb-1 as base
FROM vvasconcellos/osxcross:12.3-564e2b9-8 as base
SHELL ["/bin/bash", "-eux", "-o", "pipefail", "-c"]
WORKDIR /srv
ARG LIBWEBP_VERSION
ADD "https://github.com/webmproject/libwebp/archive/refs/tags/v${LIBWEBP_VERSION}.tar.gz" ./
RUN tar -xf "v${LIBWEBP_VERSION}.tar.gz" && rm "v${LIBWEBP_VERSION}.tar.gz" \
&& \
mv "/srv/libwebp-${LIBWEBP_VERSION}" /srv/libwebp
ARG LIBHEIF_VERSION
ADD "https://github.com/strukturag/libheif/releases/download/v${LIBHEIF_VERSION}/libheif-${LIBHEIF_VERSION}.tar.gz" ./
RUN tar -xf "libheif-${LIBHEIF_VERSION}.tar.gz" && rm "libheif-${LIBHEIF_VERSION}.tar.gz" \
&& \
mv "/srv/libheif-${LIBHEIF_VERSION}" /srv/libheif
# 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 ./
RUN tar -xf "ffmpeg-${FFMPEG_VERSION}.tar.xz" && rm "ffmpeg-${FFMPEG_VERSION}.tar.xz" \
&& \
mv "/srv/ffmpeg-${FFMPEG_VERSION}" /srv/ffmpeg \
&& \
cd /srv/ffmpeg \
&& \
for patch in \
'https://github.com/macports/macports-ports/raw/0e62a6d66fbaa7faf7b4eb9029647d3d5651fb2e/multimedia/ffmpeg6/files/patch-libavcodec-audiotoolboxenc.c.diff' \
'https://github.com/macports/macports-ports/raw/0e62a6d66fbaa7faf7b4eb9029647d3d5651fb2e/multimedia/ffmpeg6/files/patch-avutil-builtin-available.diff' \
'https://github.com/macports/macports-ports/raw/0e62a6d66fbaa7faf7b4eb9029647d3d5651fb2e/multimedia/ffmpeg6/files/patch-libavcodec-profvidworkflow.diff' \
; do curl -LSs "$patch" | patch -p0; done
# ---
FROM base as x86_64
@ -30,7 +52,7 @@ 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"
RUN --mount=src=build.sh,dst=/srv/build.sh /srv/build.sh x86_64 "$MACOSX_SDK"
# ---
FROM base as aarch64
@ -56,7 +78,7 @@ 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"
RUN --mount=src=build.sh,dst=/srv/build.sh /srv/build.sh aarch64 "$MACOSX_SDK"
# ---
FROM scratch

View file

@ -45,14 +45,14 @@ DARWIN_VERSION="$(basename "$(realpath "$(command -v "oa64-clang")")" | awk -F-
TRIPLE="${ARCH}-apple-${DARWIN_VERSION}"
# Check macOS clang exists
if ! CC="$(command -v "${TRIPLE}-clang" 2>/dev/null)"; then
echo "${TRIPLE}-clang not found" >&2
CC="${TRIPLE}-clang"
if ! command -v "$CC" 2>/dev/null; then
echo "$CC not found" >&2
exit 1
fi
export CC
# Get osxcross root directory
_osxcross_root="$(dirname "$(dirname "$CC")")"
_osxcross_root="$(dirname "$(dirname "$(command -v "$CC")")")"
# Check macports root exists
_macports_root="${_osxcross_root}/macports/pkgs/opt/local"
@ -60,6 +60,7 @@ if ! [ -d "$_macports_root" ]; then
echo "macports root not found: $_macports_root" >&2
exit 1
fi
ln -s "$_macports_root" /opt/local
# Check SDK exists
_sdk="${_osxcross_root}/SDK/MacOSX${MACOS_VERSION}.sdk"
@ -78,16 +79,83 @@ _skd_libs="$(
| sort -u
)"
# Change cwd to the script directory (which should be ffmpeg source root)
CDPATH='' cd -- "$(dirname -- "$0")"
setup_cross_env() {
export CC
export LD="${TRIPLE}-ld"
export AR="${TRIPLE}-ar"
export CXX="${TRIPLE}-clang++"
export STRIP="${TRIPLE}-strip"
export CMAKE="${TRIPLE}-cmake"
export RANLIB="${TRIPLE}-ranlib"
export PKG_CONFIG="${TRIPLE}-pkg-config"
}
# Change cwd to libwebp source root
CDPATH='' cd -- /srv/libwebp
# Configure libwebp
(
setup_cross_env
./autogen.sh
./configure \
--host="$TRIPLE" \
--prefix="/opt/local" \
--disable-shared \
--enable-static \
--with-sysroot="${_sdk}" \
--with-pic \
--enable-everything \
--disable-sdl \
--disable-png \
--disable-jpeg \
--disable-tiff \
--disable-gif
# Build libwebp
make -j"$(nproc)" install
)
# Create a tmp TARGET_DIR
TARGET_DIR="$(mktemp -d -t target-XXXXXXXXXX)"
# Change cwd to libheif source root
mkdir -p /srv/libheif/build
CDPATH='' cd -- /srv/libheif/build
# Configure libheif
"${TRIPLE}-cmake" \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="${TARGET_DIR}" \
-DCMAKE_INSTALL_BINDIR="${TARGET_DIR}/bin" \
-DCMAKE_INSTALL_LIBDIR="${TARGET_DIR}/lib" \
-DCMAKE_TOOLCHAIN_FILE="${_osxcross_root}/toolchain.cmake" \
-DLIBSHARPYUV_INCLUDE_DIR="${_macports_root}/include/webp" \
-DBUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=ON \
-DWITH_DAV1D=ON \
-DWITH_DAV1D_PLUGIN=OFF \
-DWITH_LIBDE265=ON \
-DWITH_LIBDE265_PLUGIN=OFF \
-DWITH_LIBSHARPYUV=ON \
-DWITH_FUZZERS=OFF \
-DWITH_EXAMPLES=OFF \
-DWITH_UNCOMPRESSED_CODEC=ON \
-DWITH_REDUCED_VISIBILITY=ON \
-DWITH_DEFLATE_HEADER_COMPRESSION=ON \
-DENABLE_PLUGIN_LOADING=OFF \
-DENABLE_MULTITHREADING_SUPPORT=ON \
..
# Build libheif
ninja -j"$(nproc)" install
# Change cwd to ffmpeg source root
CDPATH='' cd -- /srv/ffmpeg
# Save FFmpeg version
FFMPEG_VERSION="$(xargs printf '%s' <VERSION)"
# Create a tmp TARGET_DIR
TARGET_DIR="$(mktemp -d -t ffmpeg-macos-XXXXXXXXXX)"
trap 'rm -rf "$TARGET_DIR"' EXIT
# Configure FFMpeg.
# NOTICE: This isn't autotools
# TODO: Metal suport is disabled because no open source toolchain is available for it
@ -116,44 +184,38 @@ trap 'rm -rf "$TARGET_DIR"' EXIT
--extra-ldexeflags="-Bstatic" \
--extra-cflags=-DLIBTWOLAME_STATIC \
--extra-cxxflags="-xc++-header" \
--disable-alsa \
--disable-cuda \
--disable-cuvid \
--disable-static \
--disable-debug \
--disable-doc \
--disable-htmlpages \
--disable-indevs \
--disable-libjack \
--disable-libopencore-amrnb \
--disable-libopencore-amrwb \
--disable-libpulse \
--disable-libxcb \
--disable-libxcb-shape \
--disable-libxcb-shm \
--disable-libxcb-xfixes \
--disable-txtpages \
--disable-manpages \
--disable-metal \
--disable-neon-clobber-test \
--disable-network \
--disable-nvdec \
--disable-nvenc \
--disable-openssl \
--disable-outdevs \
--disable-podpages \
--disable-indevs \
--disable-outdevs \
--disable-parser=avs2 \
--disable-parser=avs3 \
--disable-postproc \
--disable-programs \
--disable-schannel \
--disable-libwebp \
--disable-sdl2 \
--disable-metal \
--disable-network \
--disable-openssl \
--disable-schannel \
--disable-securetransport \
--disable-sndio \
--disable-static \
--disable-txtpages \
--disable-v4l2-m2m \
--disable-vaapi \
--disable-vdpau \
--disable-vulkan \
--disable-xlib \
--disable-libxcb \
--disable-libxcb-shm \
--disable-libxcb-xfixes \
--disable-libxcb-shape \
--disable-libv4l2 \
--disable-v4l2-m2m \
--disable-vulkan \
--disable-cuda-llvm \
--disable-w32threads \
--disable-xmm-clobber-test \
--disable-neon-clobber-test \
--enable-appkit \
--enable-audiotoolbox \
--enable-avcodec \
@ -163,29 +225,17 @@ trap 'rm -rf "$TARGET_DIR"' EXIT
--enable-bzlib \
--enable-coreimage \
--enable-cross-compile \
--enable-fontconfig \
--enable-gpl \
--enable-gray \
--enable-iconv \
--enable-inline-asm \
--enable-libaom \
--enable-libfreetype \
--enable-libfribidi \
--enable-libgsm \
--enable-libmp3lame \
--enable-libdav1d \
--enable-libjxl \
--enable-libopenjpeg \
--enable-libopus \
--enable-librav1e \
--enable-libsoxr \
--enable-libsvtav1 \
--enable-libtheora \
--enable-libtwolame \
--enable-libvorbis \
--enable-libvpx \
--enable-libwebp \
--enable-libx264 \
--enable-libx265 \
--enable-libxvid \
--enable-libzimg \
--enable-lto \
--enable-lzma \
@ -203,6 +253,7 @@ trap 'rm -rf "$TARGET_DIR"' EXIT
--enable-zlib \
"$@"
# Build FFMpeg
make -j"$(nproc)" install
# Create FFMpeg.framework
@ -222,15 +273,11 @@ cp -avt "$_framework_docs" COPYING* LICENSE*
(cd "${_macports_root}/share/doc" \
&& cp -avt "$_framework_docs" --parents \
zimg/COPYING \
webp/COPYING \
libpng/LICENSE \
libvorbis/COPYING \
freetype/LICENSE.TXT \
fontconfig/COPYING)
libvorbis/COPYING)
(cd /srv && cp -avt "$_framework_docs" --parents libwebp/COPYING)
# libvorbis, libogg and libtheora share the same license
# libvorbis, libogg share the same license
ln -s libvorbis "${_framework_docs}/libogg"
ln -s libvorbis "${_framework_docs}/libtheora"
# Create required framework symlinks
ln -s A "/${_framework}/Versions/Current"
@ -268,46 +315,34 @@ cat <<EOF >"/${_framework}/Versions/Current/Resources/Info.plist"
</plist>
EOF
# Process FFMpeg libraries to be compatible with the Framework structure
# Process built libraries to be compatible with the Framework structure
cd "$TARGET_DIR/lib"
# Move all symlinks of ffmpeg libraries to Framework
# Move all symlinks of built libraries to Framework
while IFS= read -r -d '' _lib; do
# Copy symlinks to the output directory
cp -Ppv "$_lib" "/${_framework}/Libraries/${_lib#./}"
rm "$_lib"
done < <(find . -type l -print0)
# Populate queue with ffmpeg libraries
# Populate queue with built libraries
set -- # Clear command line arguments
while IFS= read -r -d '' _lib; do
set -- "$@" "${_lib#./}"
done < <(find . -name '*.dylib' -print0)
# Copy all symlinks of libheif libraries to Framework
while IFS= read -r -d '' _lib; do
# Copy symlinks to the output directory
cp -Ppv "$_lib" "/${_framework}/Libraries/${_lib#"${_macports_root}/lib/"}"
done < <(find "${_macports_root}/lib" -type l \( -name 'libheif.*' -a -name '*.dylib' \) -print0)
# Copy libheif to cwd and add it to queue
while IFS= read -r -d '' _lib; do
_lib_rel="${_lib#"${_macports_root}/lib/"}"
cp -Lpv "$_lib" "./${_lib_rel}"
set -- "$@" "${_lib_rel}"
done < <(find "${_macports_root}/lib" -type f \( -name 'libheif.*' -a -name '*.dylib' \) -print0)
while [ $# -gt 0 ]; do
# Loop through each of the library's dependencies
for _dep in $("${TRIPLE}-otool" -L "$1" | tail -n+2 | awk '{print $1}'); do
for _dep in $("${TRIPLE}-otool" -L "$1" | tail -n+3 | awk '{print $1}'); do
case "$_dep" in
# FFMpeg inter dependency
# Built libs inter dependency
"${TARGET_DIR}/lib/"*)
_linker_path="@loader_path/${_dep#"${TARGET_DIR}/lib/"}"
;;
# Macports dependency (/opt/local/lib means it was installed by Macports)
/opt/local/lib/*)
_dep_rel="${_dep#/opt/local/lib/}"
"@rpath/"* | /opt/local/lib/*)
_dep_rel="${_dep#'@rpath/'}"
_dep_rel="${_dep_rel#/opt/local/lib/}"
# Check if the macports dependency is already included in the macOS SDK
if [ -n "$(comm -12 <(printf "%s" "$_dep_rel") <(printf "%s" "$_skd_libs"))" ]; then
# Relink libs already included in macOS SDK
@ -344,10 +379,7 @@ while [ $# -gt 0 ]; do
shift
done
# Copy all libheif headers to framework
cp -av "${_macports_root}/include/libheif" "/${_framework}/Headers/"
# Copy all FFMPEG headers to framework
# Copy all built headers to framework
cp -av "${TARGET_DIR}/include/"* "/${_framework}/Headers/"
# Strip all libraries

View file

@ -20,20 +20,32 @@ COPY --from=layer-10-mingw /opt/mingw/. /opt/mingw
COPY --from=layer-10-mingw-std-threads $FFBUILD_PREFIX/. $FFBUILD_PREFIX
FROM layer-10 AS layer-20-zlib
FROM layer-10 AS layer-20-brotli
RUN --mount=src=scripts.d/20-zlib.sh,dst=/stage.sh run_stage /stage.sh
RUN --mount=src=scripts.d/20-brotli.sh,dst=/stage.sh run_stage /stage.sh
FROM layer-10 AS layer-20-bzip2
RUN --mount=src=scripts.d/20-bzip2.sh,dst=/stage.sh --mount=src=patches/bzip2,dst=/patches run_stage /stage.sh
FROM layer-10 AS layer-20-iconv
RUN --mount=src=scripts.d/20-iconv.sh,dst=/stage.sh run_stage /stage.sh
FROM layer-10 AS layer-20-zlib
RUN --mount=src=scripts.d/20-zlib.sh,dst=/stage.sh run_stage /stage.sh
FROM layer-10 AS layer-20
COPY --from=layer-20-zlib $FFBUILD_PREFIX/. $FFBUILD_PREFIX
COPY --from=layer-20-brotli $FFBUILD_PREFIX/. $FFBUILD_PREFIX
COPY --from=layer-20-bzip2 $FFBUILD_PREFIX/. $FFBUILD_PREFIX
COPY --from=layer-20-iconv $FFBUILD_PREFIX/. $FFBUILD_PREFIX
COPY --from=layer-20-zlib $FFBUILD_PREFIX/. $FFBUILD_PREFIX
FROM layer-20 AS layer-25-libogg
RUN --mount=src=scripts.d/25-libogg.sh,dst=/stage.sh run_stage /stage.sh
@ -48,10 +60,6 @@ COPY --from=layer-25-libogg $FFBUILD_PREFIX/. $FFBUILD_PREFIX
COPY --from=layer-25-xz $FFBUILD_PREFIX/. $FFBUILD_PREFIX
FROM layer-25 AS layer-45-brotli
RUN --mount=src=scripts.d/45-brotli.sh,dst=/stage.sh run_stage /stage.sh
FROM layer-25 AS layer-45-libvorbis
RUN --mount=src=scripts.d/45-libvorbis.sh,dst=/stage.sh run_stage /stage.sh
@ -60,20 +68,12 @@ FROM layer-25 AS layer-45-opencl
RUN --mount=src=scripts.d/45-opencl.sh,dst=/stage.sh run_stage /stage.sh
FROM layer-25 AS layer-45-vmaf
RUN --mount=src=scripts.d/45-vmaf.sh,dst=/stage.sh run_stage /stage.sh
FROM layer-25 AS layer-45
COPY --from=layer-45-brotli $FFBUILD_PREFIX/. $FFBUILD_PREFIX
COPY --from=layer-45-libvorbis $FFBUILD_PREFIX/. $FFBUILD_PREFIX
COPY --from=layer-45-opencl $FFBUILD_PREFIX/. $FFBUILD_PREFIX
COPY --from=layer-45-vmaf $FFBUILD_PREFIX/. $FFBUILD_PREFIX
FROM layer-45 AS layer-50-amf
RUN --mount=src=scripts.d/50-amf.sh,dst=/stage.sh run_stage /stage.sh
@ -86,10 +86,6 @@ FROM layer-45 AS layer-50-ffnvcodec
RUN --mount=src=scripts.d/50-ffnvcodec.sh,dst=/stage.sh run_stage /stage.sh
FROM layer-45 AS layer-50-kvazaar
RUN --mount=src=scripts.d/50-kvazaar.sh,dst=/stage.sh run_stage /stage.sh
FROM layer-45 AS layer-50-libde265
RUN --mount=src=scripts.d/50-libde265.sh,dst=/stage.sh run_stage /stage.sh
@ -98,18 +94,10 @@ FROM layer-45 AS layer-50-libjxl
RUN --mount=src=scripts.d/50-libjxl.sh,dst=/stage.sh run_stage /stage.sh
FROM layer-45 AS layer-50-libmp3lame
RUN --mount=src=scripts.d/50-libmp3lame.sh,dst=/stage.sh run_stage /stage.sh
FROM layer-45 AS layer-50-libopus
RUN --mount=src=scripts.d/50-libopus.sh,dst=/stage.sh run_stage /stage.sh
FROM layer-45 AS layer-50-libtheora
RUN --mount=src=scripts.d/50-libtheora.sh,dst=/stage.sh run_stage /stage.sh
FROM layer-45 AS layer-50-libvpx
RUN --mount=src=scripts.d/50-libvpx.sh,dst=/stage.sh run_stage /stage.sh
@ -130,18 +118,10 @@ FROM layer-45 AS layer-50-openjpeg
RUN --mount=src=scripts.d/50-openjpeg.sh,dst=/stage.sh run_stage /stage.sh
FROM layer-45 AS layer-50-rav1e
RUN --mount=src=scripts.d/50-rav1e.sh,dst=/stage.sh run_stage /stage.sh
FROM layer-45 AS layer-50-soxr
RUN --mount=src=scripts.d/50-soxr.sh,dst=/stage.sh run_stage /stage.sh
FROM layer-45 AS layer-50-twolame
RUN --mount=src=scripts.d/50-twolame.sh,dst=/stage.sh run_stage /stage.sh
FROM layer-45 AS layer-50-vulkan
RUN --mount=src=scripts.d/50-vulkan/45-vulkan.sh,dst=/stage.sh run_stage /stage.sh
@ -150,18 +130,6 @@ RUN --mount=src=scripts.d/50-vulkan/50-shaderc.sh,dst=/stage.sh run_stage /stage
RUN --mount=src=scripts.d/50-vulkan/55-spirv-cross.sh,dst=/stage.sh run_stage /stage.sh
FROM layer-45 AS layer-50-x264
RUN --mount=src=scripts.d/50-x264.sh,dst=/stage.sh run_stage /stage.sh
FROM layer-45 AS layer-50-x265
RUN --mount=src=scripts.d/50-x265.sh,dst=/stage.sh run_stage /stage.sh
FROM layer-45 AS layer-50-xvid
RUN --mount=src=scripts.d/50-xvid.sh,dst=/stage.sh run_stage /stage.sh
FROM layer-45 AS layer-50-zimg
RUN --mount=src=scripts.d/50-zimg.sh,dst=/stage.sh run_stage /stage.sh
@ -175,18 +143,12 @@ COPY --from=layer-50-dav1d /opt/dlls /opt/dlls
COPY --from=layer-50-ffnvcodec $FFBUILD_PREFIX/. $FFBUILD_PREFIX
COPY --from=layer-50-kvazaar $FFBUILD_PREFIX/. $FFBUILD_PREFIX
COPY --from=layer-50-libde265 $FFBUILD_PREFIX/. $FFBUILD_PREFIX
COPY --from=layer-50-libjxl $FFBUILD_PREFIX/. $FFBUILD_PREFIX
COPY --from=layer-50-libmp3lame $FFBUILD_PREFIX/. $FFBUILD_PREFIX
COPY --from=layer-50-libopus $FFBUILD_PREFIX/. $FFBUILD_PREFIX
COPY --from=layer-50-libtheora $FFBUILD_PREFIX/. $FFBUILD_PREFIX
COPY --from=layer-50-libvpx $FFBUILD_PREFIX/. $FFBUILD_PREFIX
COPY --from=layer-50-libwebp $FFBUILD_PREFIX/. $FFBUILD_PREFIX
@ -197,22 +159,10 @@ COPY --from=layer-50-openal $FFBUILD_PREFIX/. $FFBUILD_PREFIX
COPY --from=layer-50-openjpeg $FFBUILD_PREFIX/. $FFBUILD_PREFIX
COPY --from=layer-50-rav1e $FFBUILD_PREFIX/. $FFBUILD_PREFIX
COPY --from=layer-50-rav1e /opt/dlls /opt/dlls
COPY --from=layer-50-soxr $FFBUILD_PREFIX/. $FFBUILD_PREFIX
COPY --from=layer-50-twolame $FFBUILD_PREFIX/. $FFBUILD_PREFIX
COPY --from=layer-50-vulkan $FFBUILD_PREFIX/. $FFBUILD_PREFIX
COPY --from=layer-50-x264 $FFBUILD_PREFIX/. $FFBUILD_PREFIX
COPY --from=layer-50-x265 $FFBUILD_PREFIX/. $FFBUILD_PREFIX
COPY --from=layer-50-x265 /opt/dlls /opt/dlls
COPY --from=layer-50-xvid $FFBUILD_PREFIX/. $FFBUILD_PREFIX
COPY --from=layer-50-zimg $FFBUILD_PREFIX/. $FFBUILD_PREFIX
FROM layer-50 AS layer-99-libheif
@ -243,6 +193,8 @@ RUN cd /opt/dlls/bin \
RUN find /opt/dlls -type d -delete || true
RUN find /opt/dlls/lib \( -name '*dav1d*' -o -name '*.def' \) -delete || true
FROM scratch
COPY --from=layer-99 /opt/dlls /dlls

View file

@ -1,24 +0,0 @@
From cc9db1c519dc00966ba8d8cdb4328698dfff9f80 Mon Sep 17 00:00:00 2001
From: BtbN <btbn@btbn.de>
Date: Thu, 15 Apr 2021 21:38:32 +0200
Subject: [PATCH] Fall back to built-in vmaf model on load failure
---
aom_dsp/vmaf.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/aom_dsp/vmaf.c b/aom_dsp/vmaf.c
index 219e27830..6625f05c1 100644
--- a/aom_dsp/vmaf.c
+++ b/aom_dsp/vmaf.c
@@ -37,6 +37,7 @@ void aom_init_vmaf_model(VmafModel **vmaf_model, const char *model_path) {
model_cfg.name = "vmaf";
if (vmaf_model_load_from_path(vmaf_model, &model_cfg, model_path)) {
+ if (vmaf_model_load(vmaf_model, &model_cfg, "vmaf_v0.6.1"))
vmaf_fatal_error("Failed to load VMAF model.");
}
}
--
2.25.1

View file

@ -0,0 +1,24 @@
#!/bin/bash
SCRIPT_REPO="https://github.com/google/brotli.git"
SCRIPT_COMMIT="50ebce107f5b1eb36760c7ec2d4726ec56784373"
ffbuild_dockerbuild() {
git-mini-clone "$SCRIPT_REPO" "$SCRIPT_COMMIT" brotli
cd brotli
mkdir build && cd build
cmake -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN" \
-DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DBUILD_SHARED_LIBS=OFF \
-DBROTLI_DISABLE_TESTS=ON \
-DBROTLI_BUNDLED_MODE=OFF \
..
ninja -j"$(nproc)"
ninja install
}

View file

@ -0,0 +1,25 @@
#!/bin/bash
SCRIPT_REPO="https://git.savannah.gnu.org/git/libiconv.git"
SCRIPT_TAG="v1.17"
ffbuild_dockerbuild() {
git-mini-clone "$SCRIPT_REPO" "$SCRIPT_TAG" libiconv
cd libiconv
retry-tool ./gitsub.sh pull
(unset CC CFLAGS GMAKE && ./autogen.sh)
local myconf=(
--host="$FFBUILD_TOOLCHAIN"
--prefix="$FFBUILD_PREFIX"
--enable-extra-encodings
--disable-shared
--enable-static
--with-pic
)
./configure "${myconf[@]}"
make -j"$(nproc)"
make install
}

View file

@ -12,13 +12,8 @@ ffbuild_dockerbuild() {
--static
)
if [[ $TARGET == win* || $TARGET == linux* ]]; then
export CC="${FFBUILD_CROSS_PREFIX}gcc"
export AR="${FFBUILD_CROSS_PREFIX}ar"
else
echo "Unknown target"
return 255
fi
export CC="${FFBUILD_CROSS_PREFIX}gcc"
export AR="${FFBUILD_CROSS_PREFIX}ar"
./configure "${myconf[@]}"
make -j"$(nproc)"

View file

@ -10,21 +10,13 @@ ffbuild_dockerbuild() {
./autogen.sh
local myconf=(
--host="$FFBUILD_TOOLCHAIN"
--prefix="$FFBUILD_PREFIX"
--disable-shared
--enable-static
--with-pic
)
if [[ $TARGET == win* || $TARGET == linux* ]]; then
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
echo "Unknown target"
return 255
fi
./configure "${myconf[@]}"
make -j"$(nproc)"
make install

View file

@ -1,6 +1,6 @@
#!/bin/bash
SCRIPT_REPO="https://github.com/xz-mirror/xz.git"
SCRIPT_REPO="https://github.com/tukaani-project/xz.git"
SCRIPT_TAG="v5.4.3"
ffbuild_dockerbuild() {
@ -10,22 +10,22 @@ ffbuild_dockerbuild() {
./autogen.sh --no-po4a --no-doxygen
local myconf=(
--host="$FFBUILD_TOOLCHAIN"
--prefix="$FFBUILD_PREFIX"
--enable-small
--disable-xz
--disable-xzdec
--disable-lzmadec
--disable-lzmainfo
--disable-lzma-links
--disable-scripts
--disable-doc
--disable-symbol-versions
--disable-shared
--enable-static
--with-pic
)
if [[ $TARGET == win* || $TARGET == linux* ]]; then
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
echo "Unknown target"
return 255
fi
./configure "${myconf[@]}"
make -j"$(nproc)"
make install

View file

@ -1,16 +0,0 @@
#!/bin/bash
SCRIPT_REPO="https://github.com/google/brotli.git"
SCRIPT_COMMIT="ed1995b6bda19244070ab5d331111f16f67c8054"
ffbuild_dockerbuild() {
git-mini-clone "$SCRIPT_REPO" "$SCRIPT_COMMIT" brotli
cd brotli
mkdir build && cd build
cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=OFF ..
ninja -j"$(nproc)"
ninja install
}

View file

@ -10,21 +10,13 @@ ffbuild_dockerbuild() {
./autogen.sh
local myconf=(
--host="$FFBUILD_TOOLCHAIN"
--prefix="$FFBUILD_PREFIX"
--disable-shared
--enable-static
--disable-oggtest
)
if [[ $TARGET == win* || $TARGET == linux* ]]; then
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
echo "Unknown target"
return 255
fi
./configure "${myconf[@]}"
make -j"$(nproc)"
make install

View file

@ -1,40 +0,0 @@
#!/bin/bash
SCRIPT_REPO="https://github.com/Netflix/vmaf.git"
SCRIPT_COMMIT="5ee0051cd7b1337e033558910c30525d73edfd76"
ffbuild_dockerbuild() {
git-mini-clone "$SCRIPT_REPO" "$SCRIPT_COMMIT" vmaf
cd vmaf
# Kill build of unused and broken tools
echo > libvmaf/tools/meson.build
mkdir build && cd build
local myconf=(
--prefix="$FFBUILD_PREFIX"
--buildtype=release
--default-library=static
-Dbuilt_in_models=true
-Denable_tests=false
-Denable_docs=false
-Denable_avx512=true
-Denable_float=true
)
if [[ $TARGET == win* || $TARGET == linux* ]]; then
myconf+=(
--cross-file=/cross.meson
)
else
echo "Unknown target"
return 255
fi
meson "${myconf[@]}" ../libvmaf
ninja -j"$(nproc)"
ninja install
sed -i 's/Libs.private:/Libs.private: -lstdc++/; t; $ a Libs.private: -lstdc++' "$FFBUILD_PREFIX"/lib/pkgconfig/libvmaf.pc
}

View file

@ -10,6 +10,7 @@ ffbuild_dockerbuild() {
mkdir build && cd build
local myconf=(
--cross-file=/cross.meson
-Denable_docs=false
-Denable_tools=false
-Denable_tests=false
@ -19,15 +20,6 @@ ffbuild_dockerbuild() {
--default-library=shared
)
if [[ $TARGET == win* || $TARGET == linux* ]]; then
myconf+=(
--cross-file=/cross.meson
)
else
echo "Unknown target"
return 255
fi
meson "${myconf[@]}" ..
ninja -j"$(nproc)"
ninja install
@ -37,5 +29,5 @@ ffbuild_dockerbuild() {
mkdir -p /opt/dlls/
cp -nav /opt/dav1d/* /opt/dlls/
rm -r /opt/dlls/lib/pkgconfig
rm -r /opt/dlls/include /opt/dlls/lib/pkgconfig
}

View file

@ -1,33 +0,0 @@
#!/bin/bash
SCRIPT_REPO="https://github.com/ultravideo/kvazaar.git"
SCRIPT_TAG="v2.2.0"
ffbuild_dockerbuild() {
git-mini-clone "$SCRIPT_REPO" "$SCRIPT_TAG" kvazaar
cd kvazaar
./autogen.sh
local myconf=(
--prefix="$FFBUILD_PREFIX"
--disable-shared
--enable-static
--with-pic
)
if [[ $TARGET == win* || $TARGET == linux* ]]; then
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
echo "Unknown target"
return 255
fi
./configure "${myconf[@]}"
make -j"$(nproc)"
make install
echo "Cflags.private: -DKVZ_STATIC_LIB" >>"$FFBUILD_PREFIX"/lib/pkgconfig/kvazaar.pc
}

View file

@ -10,6 +10,7 @@ ffbuild_dockerbuild() {
autoreconf -i
local myconf=(
--host="$FFBUILD_TOOLCHAIN"
--prefix="$FFBUILD_PREFIX"
--disable-shared
--enable-static
@ -17,15 +18,6 @@ ffbuild_dockerbuild() {
--disable-sherlock265
)
if [[ $TARGET == win* || $TARGET == linux* ]]; then
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
echo "Unknown target"
return 255
fi
./configure "${myconf[@]}"
make -j"$(nproc)"
make install

View file

@ -1,37 +0,0 @@
#!/bin/bash
SCRIPT_REPO="https://svn.code.sf.net/p/lame/svn/trunk/lame"
SCRIPT_REV="6507"
ffbuild_dockerbuild() {
retry-tool sh -c "rm -rf lame && svn checkout '${SCRIPT_REPO}@${SCRIPT_REV}' lame"
cd lame
autoreconf -i
local myconf=(
--prefix="$FFBUILD_PREFIX"
--disable-shared
--enable-static
--enable-nasm
--disable-gtktest
--disable-cpml
--disable-frontend
--disable-decoder
)
if [[ $TARGET == win* || $TARGET == linux* ]]; then
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
echo "Unknown target"
return 255
fi
export CFLAGS="$CFLAGS -DNDEBUG"
./configure "${myconf[@]}"
make -j"$(nproc)"
make install
}

View file

@ -10,21 +10,13 @@ ffbuild_dockerbuild() {
./autogen.sh
local myconf=(
--host="$FFBUILD_TOOLCHAIN"
--prefix="$FFBUILD_PREFIX"
--disable-shared
--enable-static
--disable-extra-programs
)
if [[ $TARGET == win* || $TARGET == linux* ]]; then
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
echo "Unknown target"
return 255
fi
./configure "${myconf[@]}"
make -j"$(nproc)"
make install

View file

@ -1,36 +0,0 @@
#!/bin/bash
SCRIPT_REPO="https://github.com/xiph/theora.git"
SCRIPT_COMMIT="7180717276af1ebc7da15c83162d6c5d6203aabf"
ffbuild_dockerbuild() {
git-mini-clone "$SCRIPT_REPO" "$SCRIPT_COMMIT" theora
cd theora
./autogen.sh
local myconf=(
--prefix="$FFBUILD_PREFIX"
--disable-shared
--enable-static
--with-pic
--disable-examples
--disable-oggtest
--disable-vorbistest
--disable-spec
--disable-doc
)
if [[ $TARGET == win* || $TARGET == linux* ]]; then
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
echo "Unknown target"
return 255
fi
./configure "${myconf[@]}"
make -j"$(nproc)"
make install
}

View file

@ -1,39 +1,28 @@
#!/bin/bash
SCRIPT_REPO="https://chromium.googlesource.com/webm/libwebp"
SCRIPT_TAG="v1.3.1-rc1"
SCRIPT_REPO="https://github.com/webmproject/libwebp.git"
SCRIPT_TAG="1.3.1"
ffbuild_dockerbuild() {
git-mini-clone "$SCRIPT_REPO" "$SCRIPT_TAG" webp
cd webp
git-mini-clone "$SCRIPT_REPO" "$SCRIPT_TAG" libwebp
cd libwebp
./autogen.sh
local myconf=(
--host="$FFBUILD_TOOLCHAIN"
--prefix="$FFBUILD_PREFIX"
--disable-shared
--enable-static
--with-pic
--enable-libwebpmux
--disable-libwebpextras
--disable-libwebpdemux
--enable-everything
--disable-sdl
--disable-gl
--disable-png
--disable-jpeg
--disable-tiff
--disable-gif
)
if [[ $TARGET == win* || $TARGET == linux* ]]; then
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
echo "Unknown target"
return 255
fi
./configure "${myconf[@]}"
make -j"$(nproc)"
make install

View file

@ -1,49 +0,0 @@
#!/bin/bash
SCRIPT_REPO="https://github.com/xiph/rav1e.git"
SCRIPT_TAG="v0.6.6"
ffbuild_dockerbuild() {
git-mini-clone "$SCRIPT_REPO" "$SCRIPT_TAG" rav1e
cd rav1e
local myconf=(
--prefix=/opt/rav1e
--library-type=cdylib
--release
)
if [[ -n "$FFBUILD_RUST_TARGET" ]]; then
unset PKG_CONFIG_LIBDIR
export CC="gcc"
export CXX="g++"
export TARGET_CC="${FFBUILD_CROSS_PREFIX}gcc"
export TARGET_CXX="${FFBUILD_CROSS_PREFIX}g++"
export CROSS_COMPILE=1
export TARGET_CFLAGS="$CFLAGS"
export TARGET_CXXFLAGS="$CFLAGS"
unset CFLAGS
unset CXXFLAGS
myconf+=(
--target="$FFBUILD_RUST_TARGET"
)
cat <<EOF >$CARGO_HOME/config.toml
[target.$FFBUILD_RUST_TARGET]
linker = "${FFBUILD_CROSS_PREFIX}gcc"
ar = "${FFBUILD_CROSS_PREFIX}ar"
EOF
fi
cargo cinstall -v "${myconf[@]}"
chmod 644 /opt/rav1e/lib/*rav1e*
sed -i "s@^prefix=/opt/rav1e\$@prefix=${FFBUILD_PREFIX}@" /opt/rav1e/lib/pkgconfig/rav1e.pc
cp -nav /opt/rav1e/* "${FFBUILD_PREFIX}/"
mkdir -p /opt/dlls/
cp -nav /opt/rav1e/* /opt/dlls/
rm -r /opt/dlls/lib/pkgconfig
}

View file

@ -1,10 +1,9 @@
#!/bin/bash
SCRIPT_REPO="https://git.code.sf.net/p/soxr/code"
SCRIPT_TAG="0.1.3"
ARTIFACT_URL='https://sourceforge.net/projects/soxr/files/soxr-0.1.3-Source.tar.xz'
ffbuild_dockerbuild() {
git-mini-clone "$SCRIPT_REPO" "$SCRIPT_TAG" soxr
retry-tool sh -c "rm -rf soxr && mkdir -p soxr && curl -LSs '${ARTIFACT_URL}' | tar -xJf- --strip-components=1 -C soxr"
cd soxr
mkdir build && cd build

View file

@ -1,35 +0,0 @@
#!/bin/bash
SCRIPT_REPO="https://github.com/njh/twolame.git"
SCRIPT_COMMIT="90b694b6125dbe23a346bd5607a7fb63ad2785dc"
ffbuild_dockerbuild() {
git-mini-clone "$SCRIPT_REPO" "$SCRIPT_COMMIT" twolame
cd twolame
NOCONFIGURE=1 ./autogen.sh
touch doc/twolame.1
local myconf=(
--prefix="$FFBUILD_PREFIX"
--with-pic
--disable-shared
--enable-static
--disable-sndfile
)
if [[ $TARGET == win* || $TARGET == linux* ]]; then
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
echo "Unknown target"
return 255
fi
./configure "${myconf[@]}"
make -j"$(nproc)"
make install
sed -i 's/Cflags:/Cflags: -DLIBTWOLAME_STATIC/' "$FFBUILD_PREFIX"/lib/pkgconfig/twolame.pc
}

View file

@ -1,32 +0,0 @@
#!/bin/bash
SCRIPT_REPO="https://github.com/mirror/x264.git"
SCRIPT_COMMIT="eaa68fad9e5d201d42fde51665f2d137ae96baf0"
ffbuild_dockerbuild() {
git-mini-clone "$SCRIPT_REPO" "$SCRIPT_COMMIT" x264
cd x264
local myconf=(
--disable-cli
--enable-static
--enable-pic
--disable-lavf
--disable-swscale
--prefix="$FFBUILD_PREFIX"
)
if [[ $TARGET == win* || $TARGET == linux* ]]; then
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
--cross-prefix="$FFBUILD_CROSS_PREFIX"
)
else
echo "Unknown target"
return 255
fi
./configure "${myconf[@]}"
make -j"$(nproc)"
make install
}

View file

@ -1,62 +0,0 @@
#!/bin/bash
SCRIPT_REPO="https://bitbucket.org/multicoreware/x265_git.git"
SCRIPT_COMMIT="34532bda12a3a3141880582aa186a59cd4538ae6"
ffbuild_dockerbuild() {
git clone "$SCRIPT_REPO" x265
cd x265
git checkout "$SCRIPT_COMMIT"
local common_config=(
-DCMAKE_INSTALL_PREFIX="/opt/x265"
-DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN"
-DCMAKE_BUILD_TYPE=Release
-DENABLE_CLI=OFF
-DCMAKE_ASM_NASM_FLAGS=-w-macro-params-legacy
)
mkdir 8bit 10bit 12bit
cmake -S source -B 12bit -G Ninja \
"${common_config[@]}" \
-DHIGH_BIT_DEPTH=ON \
-DEXPORT_C_API=OFF \
-DENABLE_SHARED=OFF \
-DENABLE_STATIC=ON \
-DMAIN12=ON
ninja -C 12bit -j"$(nproc)"
cmake -S source -B 10bit -G Ninja \
"${common_config[@]}" \
-DENABLE_HDRDENABLE_HDR10_PLUS=ON \
-DHIGH_BIT_DEPTH=ON \
-DEXPORT_C_API=OFF \
-DENABLE_SHARED=OFF \
-DENABLE_STATIC=ON
ninja -C 10bit -j"$(nproc)"
cmake -S source -B 8bit -G Ninja \
"${common_config[@]}" \
-DEXTRA_LIB='x265_main10.a;x265_main12.a' \
-DENABLE_HDRDENABLE_HDR10_PLUS=ON \
-DEXTRA_LINK_FLAGS=-L. \
-DENABLE_SHARED=ON \
-DENABLE_STATIC=OFF \
-DLINKED_10BIT=ON \
-DLINKED_12BIT=ON
ln -s ../10bit/libx265.a 8bit/libx265_main10.a
ln -s ../12bit/libx265.a 8bit/libx265_main12.a
ninja -C 8bit -j"$(nproc)"
ninja -C 8bit install
sed -ri 's/^(Libs.private:.*)$/\1 -lstdc++/' /opt/x265/lib/pkgconfig/x265.pc
sed -i "s@^prefix=/opt/x265\$@prefix=${FFBUILD_PREFIX}@" /opt/x265/lib/pkgconfig/x265.pc
cp -nav /opt/x265/* "${FFBUILD_PREFIX}/"
mkdir -p /opt/dlls/
cp -nav /opt/x265/* /opt/dlls/
rm -r /opt/dlls/lib/pkgconfig
}

View file

@ -1,41 +0,0 @@
#!/bin/bash
SCRIPT_REPO="http://svn.xvid.org/trunk/xvidcore"
SCRIPT_REV="2198"
ffbuild_dockerbuild() {
retry-tool sh -c "rm -rf xvid && svn checkout --username 'anonymous' --password '' '${SCRIPT_REPO}@${SCRIPT_REV}' xvid"
cd xvid
cd build/generic
# The original code fails on a two-digit major...
sed -i -e 's/GCC_MAJOR=.*/GCC_MAJOR=10/' \
-e 's/GCC_MINOR=.*/GCC_MINOR=0/' \
configure.in
./bootstrap.sh
local myconf=(
--prefix="$FFBUILD_PREFIX"
)
if [[ $TARGET == win* || $TARGET == linux* ]]; then
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
echo "Unknown target"
return 255
fi
./configure "${myconf[@]}"
make -j"$(nproc)"
make install
if [[ $TARGET == win* ]]; then
rm "$FFBUILD_PREFIX"/{bin/libxvidcore.dll,lib/libxvidcore.dll.a}
elif [[ $TARGET == linux* ]]; then
rm "$FFBUILD_PREFIX"/lib/libxvidcore.so*
fi
}

View file

@ -11,21 +11,13 @@ ffbuild_dockerbuild() {
./autogen.sh
local myconf=(
--host="$FFBUILD_TOOLCHAIN"
--prefix="$FFBUILD_PREFIX"
--disable-shared
--enable-static
--with-pic
)
if [[ $TARGET == win* || $TARGET == linux* ]]; then
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
)
else
echo "Unknown target"
return 255
fi
./configure "${myconf[@]}"
make -j"$(nproc)"
make install

View file

@ -8,6 +8,9 @@ ffbuild_dockerbuild() {
cd ffmpeg
# Broken configs:
# --enable-lto (Broken on Windows)
./configure \
--cpu="x86_64" \
--arch='x86_64' \
@ -16,23 +19,36 @@ ffbuild_dockerbuild() {
--pkg-config=pkg-config \
--pkg-config-flags="--static" \
--cross-prefix="$FFBUILD_CROSS_PREFIX" \
--disable-alsa \
--disable-static \
--disable-debug \
--disable-doc \
--disable-htmlpages \
--disable-txtpages \
--disable-manpages \
--disable-podpages \
--disable-indevs \
--disable-libplacebo \
--disable-neon-clobber-test \
--disable-network \
--disable-outdevs \
--disable-parser=avs2 \
--disable-parser=avs3 \
--disable-postproc \
--disable-programs \
--disable-libwebp \
--disable-sdl2 \
--disable-metal \
--disable-network \
--disable-openssl \
--disable-schannel \
--disable-static \
--disable-securetransport \
--disable-xlib \
--disable-libxcb \
--disable-libxcb-shm \
--disable-libxcb-xfixes \
--disable-libxcb-shape \
--disable-libv4l2 \
--disable-v4l2-m2m \
--disable-vaapi \
--disable-vdpau \
--disable-w32threads \
--disable-xmm-clobber-test \
--disable-neon-clobber-test \
--enable-amf \
--enable-avcodec \
--enable-avfilter \
@ -42,31 +58,23 @@ ffbuild_dockerbuild() {
--enable-ffnvcodec \
--enable-gpl \
--enable-gray \
--enable-iconv \
--enable-inline-asm \
--enable-libdav1d \
--enable-libjxl \
--enable-libkvazaar \
--enable-libmp3lame \
--enable-libopenjpeg \
--enable-libopus \
--enable-librav1e \
--enable-libshaderc \
--enable-libsoxr \
--enable-libtheora \
--enable-libtwolame \
--enable-libvmaf \
--enable-libvorbis \
--enable-libvpl \
--enable-libvpx \
--enable-libwebp \
--enable-libx264 \
--enable-libx265 \
--enable-libxvid \
--enable-libzimg \
--enable-lzma \
--enable-openal \
--enable-opencl \
--enable-opengl \
--enable-optimizations \
--enable-pic \
--enable-postproc \
--enable-pthreads \

View file

@ -19,12 +19,8 @@ ffbuild_dockerbuild() {
-DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN" \
-DBUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=ON \
-DWITH_X265=ON \
-DWITH_X265_PLUGIN=OFF \
-DWITH_DAV1D=ON \
-DWITH_DAV1D_PLUGIN=OFF \
-DWITH_RAV1E=ON \
-DWITH_RAV1E_PLUGIN=OFF \
-DWITH_LIBDE265=ON \
-DWITH_LIBDE265_PLUGIN=OFF \
-DWITH_LIBSHARPYUV=ON \
@ -45,4 +41,6 @@ ffbuild_dockerbuild() {
"${FFBUILD_CROSS_PREFIX}gendef" libheif.dll
"${FFBUILD_CROSS_PREFIX}dlltool" -m i386:x86-64 -d libheif.def -l heif.lib -D libheif.dll
mv libheif.def heif.lib ../lib/
}

View file

@ -1,11 +0,0 @@
diff --git a/build.sh b/build.sh
index eeab219ac..14b9137b5 100755
--- a/build.sh
+++ b/build.sh
@@ -50,6 +50,7 @@ case $SDK_VERSION in
12.3*) TARGET=darwin21.4; X86_64H_SUPPORTED=1; I386_SUPPORTED=0; ARM_SUPPORTED=1; NEED_TAPI_SUPPORT=1; OSX_VERSION_MIN_INT=10.9; ;;
12.4*) TARGET=darwin21.5; X86_64H_SUPPORTED=1; I386_SUPPORTED=0; ARM_SUPPORTED=1; NEED_TAPI_SUPPORT=1; OSX_VERSION_MIN_INT=10.9; ;;
13.0*) TARGET=darwin22; X86_64H_SUPPORTED=1; I386_SUPPORTED=0; ARM_SUPPORTED=1; NEED_TAPI_SUPPORT=1; OSX_VERSION_MIN_INT=10.9; ;;
+ 13.1*) TARGET=darwin22.2; X86_64H_SUPPORTED=1; I386_SUPPORTED=0; ARM_SUPPORTED=1; NEED_TAPI_SUPPORT=1; OSX_VERSION_MIN_INT=10.9; ;;
*) echo "Unsupported SDK"; exit 1 ;;
esac

View file

@ -1,15 +0,0 @@
diff --git a/tools/osxcross-macports b/tools/osxcross-macports
index f008a8da7..3e87735b8 100755
--- a/tools/osxcross-macports
+++ b/tools/osxcross-macports
@@ -81,8 +81,9 @@ case $MACOSX_DEPLOYMENT_TARGET in
10.14* ) OSXVERSION="darwin_18" ;;
10.15* ) OSXVERSION="darwin_19" ;;
10.16* ) OSXVERSION="darwin_20" ;;
- 11.* ) OSXVERSION="darwin_21" ;;
+ 11.* ) OSXVERSION="darwin_20" ;;
12.* ) OSXVERSION="darwin_21" ;;
+ 13.* ) OSXVERSION="darwin_22" ;;
* ) unsupportedDepTarget ;;
esac

View file

@ -10,11 +10,12 @@ WORKDIR /srv
# Host dependencies, required to build osxcross, gcc for macOS and ffmpeg. ~1GiB
# hadolint ignore=DL3018
RUN --mount=type=cache,target=/var/cache/apk ln -vs /var/cache/apk /etc/apk/cache && apk add --update \
bash bsd-compat-headers build-base bzip2-dev clang15 cmake curl git gmp-dev libc++-dev libc-dev libuuid libxml2-dev \
llvm15-dev llvm15-static mpc1-dev mpfr-dev musl-fts-dev openssl openssl-dev perl python3 xz yasm zlib-dev
autoconf automake bash bsd-compat-headers build-base bzip2-dev clang15 cmake curl gettext gettext-dev git gmp-dev \
libc++-dev libc-dev libtool libuuid libxml2-dev llvm15-dev llvm15-static meson mpc1-dev mpfr-dev musl-fts-dev nasm \
ninja openssl openssl-dev perl python3 xz yasm zlib-dev
# Download osxcross, use a specific commit to avoid breaking changes and allow docker to cache it
ADD https://github.com/tpoechtrager/osxcross/archive/50e86eb.zip /srv/osxcross.zip
ADD https://github.com/tpoechtrager/osxcross/archive/564e2b9.zip /srv/osxcross.zip
RUN unzip osxcross.zip && mv osxcross-* osxcross && rm osxcross.zip
WORKDIR /srv/osxcross/tarballs
@ -38,7 +39,7 @@ WORKDIR /srv/osxcross
# Some important patches from unmerged PRs
# PR 180 code needed to be updated to work with the latest osxcross
# 181 is not related to the 181 PR. It's just custom code that needed to be patched after 180 and before 379
COPY 180.diff 181.diff 314.diff 372.diff 379.diff ./
COPY 180.diff 181.diff 314.diff ./
RUN set -eux; for patch in *.diff; do patch -p1 < "$patch"; done
# Build osxcross
@ -58,10 +59,13 @@ WORKDIR /srv
# Setup macports
RUN osxcross-macports --help
# Setup meson cross-compilation toolchain file
RUN --mount=src=cross.meson.sh,dst=/srv/cross.meson.sh /srv/cross.meson.sh
LABEL org.opencontainers.image.title="osxcross" \
# Version is macOS SDK version + osxcross commit hash
org.opencontainers.image.version="12.3-50e86eb" \
org.opencontainers.image.version="12.3-564e2b9" \
org.opencontainers.image.authors="Vítor Vasconcellos <vasconcellos.dev@gmail.com>, Spacedrive <support@spacedrive.com>" \
org.opencontainers.image.revision="1" \
org.opencontainers.image.revision="8" \
org.opencontainers.image.licenses="GPL-2.0" \
org.opencontainers.image.description="macOS cross toolchain configured inside Alpine Linux"

View file

@ -1,5 +1,8 @@
# OSXCross container
# macOS cross toolchain configured inside Alpine Linux
This container is currently available at https://hub.docker.com/r/vvasconcellos/osxcross.
This container based on alpine 3.17, with the most common build decencies installed, and a built version of [`osxcross`](https://github.com/tpoechtrager/osxcross) plus the macOS SDK 12.3 (Monterey) targeting a minimum compatibility of macOS 10.15 (Catalina) for x86_64 and macOS 11.0 (BigSur) for arm64.
It is based on alpine 3.17, with the most commom build depencies installed, and a built version of [`osxcross`](https://github.com/tpoechtrager/osxcross) plus the macOS SDK 12.3 (Monterey) targetting a minimum compatibility of macOS 10.15 (Catalina) for x86_64 and macOS 11.0 (BigSur) for arm64.
__Image Tag__: macOS SDK version + osxcross commit hash + revision
This container is currently available at:
https://hub.docker.com/r/vvasconcellos/osxcross.

61
.github/scripts/osxcross/cross.meson.sh vendored Executable file
View file

@ -0,0 +1,61 @@
#!/usr/bin/env bash
set -e # exit immediate if an error occurs in a pipeline
set -E # make commands inherit ERR trap
set -u # don't allow not set variables to be utilized
set -o pipefail # trace ERR through pipes
set -o errtrace # trace ERR through 'time command' and other functions
declare -A cpu_arch_mappings=(
["x86_64"]="x86_64"
["armv8"]="aarch64"
)
# Get darwin version and build compiler triple
DARWIN_VERSION="$(basename "$(realpath "$(command -v "oa64-clang")")" | awk -F- '{print $3}')"
for TARGET_CPU in "${!cpu_arch_mappings[@]}"; do
TARGET_ARCH="${cpu_arch_mappings[$TARGET_CPU]}"
TRIPLE="${TARGET_ARCH}-apple-${DARWIN_VERSION}"
# Check macOS clang exists
CC="${TRIPLE}-clang"
if ! command -v "$CC" 2>/dev/null; then
echo "$CC not found" >&2
exit 1
fi
# Get osxcross root directory
_osxcross_root="$(dirname "$(dirname "$(command -v "$CC")")")"
# Check SDK exists
SYSROOT="${_osxcross_root}/SDK/MacOSX${MACOS_VERSION}.sdk"
if ! [ -d "$SYSROOT" ]; then
echo "Invalid MacOS version: $MACOS_VERSION" >&2
exit 1
fi
# Configure Meson for osxcross
# TODO: This should in the base osxcross image
cat <<EOF >"${_osxcross_root}/${TRIPLE}.meson"
[binaries]
c = '$CC'
cpp = '${TRIPLE}-clang++'
ld = '$CC'
ar = '${TRIPLE}-ar'
strip = '${TRIPLE}-strip'
cmake = '${TRIPLE}-cmake'
ranlib = '${TRIPLE}-ranlib'
pkgconfig = '${TRIPLE}-pkg-config'
[properties]
sys_root = '${SYSROOT}'
[host_machine]
system = 'darwin'
cpu_family = '$TARGET_ARCH'
cpu = '$TARGET_CPU'
endian = 'little'
EOF
done