From e20a907e3147339b742ff39f4bcf943989e69b52 Mon Sep 17 00:00:00 2001 From: BtbN Date: Mon, 5 Apr 2021 18:46:32 +0200 Subject: [PATCH 01/11] Use Docker BuildKit --- .github/workflows/build.yml | 3 +++ .github/workflows/pr.yml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c369d30..a0b8d4c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,6 +7,9 @@ on: schedule: - cron: '0 12 * * *' +env: + DOCKER_BUILDKIT: 1 + jobs: purge_artifacts: name: Purge old artifacts diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 91dea4d..4e535c4 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -4,6 +4,9 @@ on: branches: - master +env: + DOCKER_BUILDKIT: 1 + jobs: build: name: Build ffmpeg From e38500bb7df272ed0186f6af7cf4c3f8581d52d8 Mon Sep 17 00:00:00 2001 From: BtbN Date: Mon, 5 Apr 2021 19:22:03 +0200 Subject: [PATCH 02/11] Use BuildKit features to reduce amount of layers --- images/base/run_stage.sh | 4 ++-- scripts.d/10-mingw.sh | 5 ----- scripts.d/20-libiconv.sh | 5 ----- scripts.d/20-zlib.sh | 5 ----- scripts.d/21-libxml2.sh | 5 ----- scripts.d/25-freetype.sh | 5 ----- scripts.d/25-fribidi.sh | 5 ----- scripts.d/25-gmp.sh | 5 ----- scripts.d/25-libogg.sh | 5 ----- scripts.d/25-openssl.sh | 5 ----- scripts.d/25-xz.sh | 5 ----- scripts.d/35-fontconfig.sh | 5 ----- scripts.d/40-fftw3.sh | 5 ----- scripts.d/45-harfbuzz.sh | 5 ----- scripts.d/45-libsamplerate.sh | 5 ----- scripts.d/45-libudfread.sh | 5 ----- scripts.d/45-lv2.sh | 5 ----- scripts.d/45-opencl.sh | 5 ----- scripts.d/45-serd.sh | 5 ----- scripts.d/45-vmaf.sh | 5 ----- scripts.d/45-vulkan.sh | 6 ++---- scripts.d/46-sord.sh | 5 ----- scripts.d/47-sratom.sh | 5 ----- scripts.d/49-libvorbis.sh | 5 ----- scripts.d/50-amf.sh | 5 ----- scripts.d/50-aom.sh | 5 ----- scripts.d/50-avisynth.sh | 5 ----- scripts.d/50-dav1d.sh | 5 ----- scripts.d/50-davs2.sh | 5 ----- scripts.d/50-ffnvcodec.sh | 5 ----- scripts.d/50-glslang.sh | 5 ----- scripts.d/50-gme.sh | 5 ----- scripts.d/50-libass.sh | 5 ----- scripts.d/50-libbluray.sh | 5 ----- scripts.d/50-libmp3lame.sh | 5 ----- scripts.d/50-libopus.sh | 5 ----- scripts.d/50-libtheora.sh | 5 ----- scripts.d/50-libvpx.sh | 5 ----- scripts.d/50-libwebp.sh | 5 ----- scripts.d/50-lilv.sh | 5 ----- scripts.d/50-mfx.sh | 5 ----- scripts.d/50-opencore-amr.sh | 5 ----- scripts.d/50-openjpeg.sh | 5 ----- scripts.d/50-rav1e.sh | 5 ----- scripts.d/50-rubberband.sh | 5 ----- scripts.d/50-sdl.sh | 5 ----- scripts.d/50-soxr.sh | 5 ----- scripts.d/50-srt.sh | 5 ----- scripts.d/50-svtav1.sh | 5 ----- scripts.d/50-twolame.sh | 5 ----- scripts.d/50-uavs3d.sh | 5 ----- scripts.d/50-vidstab.sh | 5 ----- scripts.d/50-x264.sh | 5 ----- scripts.d/50-x265.sh | 5 ----- scripts.d/50-xavs2.sh | 5 ----- scripts.d/50-xvid.sh | 5 ----- scripts.d/50-zimg.sh | 5 ----- util/vars.sh | 4 ++++ 58 files changed, 8 insertions(+), 281 deletions(-) diff --git a/images/base/run_stage.sh b/images/base/run_stage.sh index d51438a..9fe0a97 100755 --- a/images/base/run_stage.sh +++ b/images/base/run_stage.sh @@ -1,7 +1,7 @@ #!/bin/bash set -xe mkdir -p /stage +source "$1" cd /stage -source /stage.sh ffbuild_dockerbuild -rm -rf /stage /stage.sh "$FFBUILD_PREFIX"/bin +rm -rf /stage "$FFBUILD_PREFIX"/bin diff --git a/scripts.d/10-mingw.sh b/scripts.d/10-mingw.sh index 85b77ca..4a7c198 100755 --- a/scripts.d/10-mingw.sh +++ b/scripts.d/10-mingw.sh @@ -8,11 +8,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$MINGW_REPO" "$MINGW_COMMIT" mingw cd mingw/mingw-w64-headers diff --git a/scripts.d/20-libiconv.sh b/scripts.d/20-libiconv.sh index a0bd22a..bb754d8 100755 --- a/scripts.d/20-libiconv.sh +++ b/scripts.d/20-libiconv.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { mkdir iconv cd iconv diff --git a/scripts.d/20-zlib.sh b/scripts.d/20-zlib.sh index afe216c..96520d6 100755 --- a/scripts.d/20-zlib.sh +++ b/scripts.d/20-zlib.sh @@ -6,11 +6,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { mkdir zlib cd zlib diff --git a/scripts.d/21-libxml2.sh b/scripts.d/21-libxml2.sh index b58bb95..2bbf962 100755 --- a/scripts.d/21-libxml2.sh +++ b/scripts.d/21-libxml2.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$LIBXML2_REPO" "$LIBXML2_COMMIT" libxml2 cd libxml2 diff --git a/scripts.d/25-freetype.sh b/scripts.d/25-freetype.sh index 5769c57..af603a3 100755 --- a/scripts.d/25-freetype.sh +++ b/scripts.d/25-freetype.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { mkdir ft cd ft diff --git a/scripts.d/25-fribidi.sh b/scripts.d/25-fribidi.sh index c69f463..c106c47 100755 --- a/scripts.d/25-fribidi.sh +++ b/scripts.d/25-fribidi.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$FRIBIDI_REPO" "$FRIBIDI_COMMIT" fribidi cd fribidi diff --git a/scripts.d/25-gmp.sh b/scripts.d/25-gmp.sh index 1124954..a82ef5c 100755 --- a/scripts.d/25-gmp.sh +++ b/scripts.d/25-gmp.sh @@ -6,11 +6,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { mkdir gmp cd gmp diff --git a/scripts.d/25-libogg.sh b/scripts.d/25-libogg.sh index 47d0c77..29b5e17 100755 --- a/scripts.d/25-libogg.sh +++ b/scripts.d/25-libogg.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$OGG_REPO" "$OGG_COMMIT" ogg cd ogg diff --git a/scripts.d/25-openssl.sh b/scripts.d/25-openssl.sh index 0db996e..3f1a4bb 100755 --- a/scripts.d/25-openssl.sh +++ b/scripts.d/25-openssl.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$OPENSSL_REPO" "$OPENSSL_COMMIT" openssl cd openssl diff --git a/scripts.d/25-xz.sh b/scripts.d/25-xz.sh index 952ddc2..20bbe20 100755 --- a/scripts.d/25-xz.sh +++ b/scripts.d/25-xz.sh @@ -6,11 +6,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { mkdir xz cd xz diff --git a/scripts.d/35-fontconfig.sh b/scripts.d/35-fontconfig.sh index 6394756..fe8cc06 100755 --- a/scripts.d/35-fontconfig.sh +++ b/scripts.d/35-fontconfig.sh @@ -6,11 +6,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { mkdir fc cd fc diff --git a/scripts.d/40-fftw3.sh b/scripts.d/40-fftw3.sh index 3222d87..bc310dc 100755 --- a/scripts.d/40-fftw3.sh +++ b/scripts.d/40-fftw3.sh @@ -10,11 +10,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { mkdir fftw3 cd fftw3 diff --git a/scripts.d/45-harfbuzz.sh b/scripts.d/45-harfbuzz.sh index f6c2cf8..9dfe680 100755 --- a/scripts.d/45-harfbuzz.sh +++ b/scripts.d/45-harfbuzz.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$HARFBUZZ_REPO" "$HARFBUZZ_COMMIT" harfbuzz cd harfbuzz diff --git a/scripts.d/45-libsamplerate.sh b/scripts.d/45-libsamplerate.sh index 79c5d1b..ee9539b 100755 --- a/scripts.d/45-libsamplerate.sh +++ b/scripts.d/45-libsamplerate.sh @@ -9,11 +9,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$LIBSR_REPO" "$LIBSR_COMMIT" libsr cd libsr diff --git a/scripts.d/45-libudfread.sh b/scripts.d/45-libudfread.sh index 589505e..666ca60 100755 --- a/scripts.d/45-libudfread.sh +++ b/scripts.d/45-libudfread.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$LIBUDFREAD_REPO" "$LIBUDFREAD_COMMIT" libudfread cd libudfread diff --git a/scripts.d/45-lv2.sh b/scripts.d/45-lv2.sh index d10533a..d8d43d7 100755 --- a/scripts.d/45-lv2.sh +++ b/scripts.d/45-lv2.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$LV2_REPO" "$LV2_COMMIT" lv2 cd lv2 diff --git a/scripts.d/45-opencl.sh b/scripts.d/45-opencl.sh index 17d7d1e..e902cdc 100755 --- a/scripts.d/45-opencl.sh +++ b/scripts.d/45-opencl.sh @@ -10,11 +10,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { mkdir opencl && cd opencl diff --git a/scripts.d/45-serd.sh b/scripts.d/45-serd.sh index 075a05b..d62d57e 100755 --- a/scripts.d/45-serd.sh +++ b/scripts.d/45-serd.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$SERD_REPO" "$SERD_COMMIT" serd cd serd diff --git a/scripts.d/45-vmaf.sh b/scripts.d/45-vmaf.sh index 2739f20..b298921 100755 --- a/scripts.d/45-vmaf.sh +++ b/scripts.d/45-vmaf.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$VMAF_REPO" "$VMAF_COMMIT" vmaf cd vmaf diff --git a/scripts.d/45-vulkan.sh b/scripts.d/45-vulkan.sh index 900830a..63b92b6 100755 --- a/scripts.d/45-vulkan.sh +++ b/scripts.d/45-vulkan.sh @@ -8,16 +8,14 @@ ffbuild_enabled() { } ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "ADD patches/vulkan /stage/patches" - to_df "RUN run_stage" + to_df "RUN --mount=src=${SELF},dst=/stage.sh --mount=src=patches/vulkan,dst=/patches run_stage /stage.sh" } ffbuild_dockerbuild() { git clone "$LOADER_REPO" loader git -C loader checkout "$LOADER_COMMIT" - for patch in patches/*.patch; do + for patch in /patches/*.patch; do echo "Applying $patch" git -C loader am -3 < "$patch" done diff --git a/scripts.d/46-sord.sh b/scripts.d/46-sord.sh index 0b6b17b..0930117 100755 --- a/scripts.d/46-sord.sh +++ b/scripts.d/46-sord.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$SORD_REPO" "$SORD_COMMIT" sord cd sord diff --git a/scripts.d/47-sratom.sh b/scripts.d/47-sratom.sh index 340fb74..b325e2f 100755 --- a/scripts.d/47-sratom.sh +++ b/scripts.d/47-sratom.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$SRATOM_REPO" "$SRATOM_COMMIT" sratom cd sratom diff --git a/scripts.d/49-libvorbis.sh b/scripts.d/49-libvorbis.sh index a0bc8ef..cdf92d2 100755 --- a/scripts.d/49-libvorbis.sh +++ b/scripts.d/49-libvorbis.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$VORBIS_REPO" "$VORBIS_COMMIT" vorbis cd vorbis diff --git a/scripts.d/50-amf.sh b/scripts.d/50-amf.sh index 83ebb89..b40bd84 100755 --- a/scripts.d/50-amf.sh +++ b/scripts.d/50-amf.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$AMF_REPO" "$AMF_COMMIT" amf cd amf diff --git a/scripts.d/50-aom.sh b/scripts.d/50-aom.sh index 0ac6cb9..a15bb49 100755 --- a/scripts.d/50-aom.sh +++ b/scripts.d/50-aom.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$AOM_REPO" "$AOM_COMMIT" aom cd aom diff --git a/scripts.d/50-avisynth.sh b/scripts.d/50-avisynth.sh index 8061338..475f398 100755 --- a/scripts.d/50-avisynth.sh +++ b/scripts.d/50-avisynth.sh @@ -8,11 +8,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$AVISYNTH_REPO" "$AVISYNTH_COMMIT" avisynth cd avisynth diff --git a/scripts.d/50-dav1d.sh b/scripts.d/50-dav1d.sh index b97da75..11ab209 100755 --- a/scripts.d/50-dav1d.sh +++ b/scripts.d/50-dav1d.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$DAV1D_REPO" "$DAV1D_COMMIT" dav1d cd dav1d diff --git a/scripts.d/50-davs2.sh b/scripts.d/50-davs2.sh index 3731427..cabe83a 100755 --- a/scripts.d/50-davs2.sh +++ b/scripts.d/50-davs2.sh @@ -9,11 +9,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git clone "$DAVS2_REPO" davs2 cd davs2 diff --git a/scripts.d/50-ffnvcodec.sh b/scripts.d/50-ffnvcodec.sh index 01d209c..87b6bf9 100755 --- a/scripts.d/50-ffnvcodec.sh +++ b/scripts.d/50-ffnvcodec.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$FFNVCODEC_REPO" "$FFNVCODEC_COMMIT" ffnvcodec cd ffnvcodec diff --git a/scripts.d/50-glslang.sh b/scripts.d/50-glslang.sh index aad706c..1d08426 100755 --- a/scripts.d/50-glslang.sh +++ b/scripts.d/50-glslang.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$GLSLANG_REPO" "$GLSLANG_COMMIT" glslang cd glslang diff --git a/scripts.d/50-gme.sh b/scripts.d/50-gme.sh index 0366a25..5a7a0c7 100755 --- a/scripts.d/50-gme.sh +++ b/scripts.d/50-gme.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git clone "$GME_REPO" gme cd gme diff --git a/scripts.d/50-libass.sh b/scripts.d/50-libass.sh index d8ef168..29daf7f 100755 --- a/scripts.d/50-libass.sh +++ b/scripts.d/50-libass.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$ASS_REPO" "$ASS_COMMIT" ass cd ass diff --git a/scripts.d/50-libbluray.sh b/scripts.d/50-libbluray.sh index 0942bbb..145d980 100755 --- a/scripts.d/50-libbluray.sh +++ b/scripts.d/50-libbluray.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$LIBBLURAY_REPO" "$LIBBLURAY_COMMIT" libbluray cd libbluray diff --git a/scripts.d/50-libmp3lame.sh b/scripts.d/50-libmp3lame.sh index f299d2d..28998a3 100755 --- a/scripts.d/50-libmp3lame.sh +++ b/scripts.d/50-libmp3lame.sh @@ -6,11 +6,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { mkdir lame cd lame diff --git a/scripts.d/50-libopus.sh b/scripts.d/50-libopus.sh index 7fb4051..4ecfa02 100755 --- a/scripts.d/50-libopus.sh +++ b/scripts.d/50-libopus.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$OPUS_REPO" "$OPUS_COMMIT" opus cd opus diff --git a/scripts.d/50-libtheora.sh b/scripts.d/50-libtheora.sh index 46e9ef9..9ae2a22 100755 --- a/scripts.d/50-libtheora.sh +++ b/scripts.d/50-libtheora.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$THEORA_REPO" "$THEORA_COMMIT" theora cd theora diff --git a/scripts.d/50-libvpx.sh b/scripts.d/50-libvpx.sh index fa62b6c..0788a5b 100755 --- a/scripts.d/50-libvpx.sh +++ b/scripts.d/50-libvpx.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$LIBVPX_REPO" "$LIBVPX_COMMIT" libvpx cd libvpx diff --git a/scripts.d/50-libwebp.sh b/scripts.d/50-libwebp.sh index 5847f58..c28b398 100755 --- a/scripts.d/50-libwebp.sh +++ b/scripts.d/50-libwebp.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$WEBP_REPO" "$WEBP_COMMIT" webp cd webp diff --git a/scripts.d/50-lilv.sh b/scripts.d/50-lilv.sh index c31cd58..5a15b13 100755 --- a/scripts.d/50-lilv.sh +++ b/scripts.d/50-lilv.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$LILV_REPO" "$LILV_COMMIT" lilv cd lilv diff --git a/scripts.d/50-mfx.sh b/scripts.d/50-mfx.sh index 4955890..0f64c42 100755 --- a/scripts.d/50-mfx.sh +++ b/scripts.d/50-mfx.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$MFX_REPO" "$MFX_COMMIT" mfx cd mfx diff --git a/scripts.d/50-opencore-amr.sh b/scripts.d/50-opencore-amr.sh index 91b1d57..29099bb 100755 --- a/scripts.d/50-opencore-amr.sh +++ b/scripts.d/50-opencore-amr.sh @@ -6,11 +6,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { mkdir opencore cd opencore diff --git a/scripts.d/50-openjpeg.sh b/scripts.d/50-openjpeg.sh index dc89bcf..c3fa832 100755 --- a/scripts.d/50-openjpeg.sh +++ b/scripts.d/50-openjpeg.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$OPENJPEG_REPO" "$OPENJPEG_COMMIT" openjpeg cd openjpeg diff --git a/scripts.d/50-rav1e.sh b/scripts.d/50-rav1e.sh index 40c1ead..6a86493 100755 --- a/scripts.d/50-rav1e.sh +++ b/scripts.d/50-rav1e.sh @@ -8,11 +8,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$RAV1E_REPO" "$RAV1E_COMMIT" rav1e cd rav1e diff --git a/scripts.d/50-rubberband.sh b/scripts.d/50-rubberband.sh index d143dcd..f2b8006 100755 --- a/scripts.d/50-rubberband.sh +++ b/scripts.d/50-rubberband.sh @@ -8,11 +8,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { mkdir rubberband cd rubberband diff --git a/scripts.d/50-sdl.sh b/scripts.d/50-sdl.sh index 1cbd674..982ac27 100755 --- a/scripts.d/50-sdl.sh +++ b/scripts.d/50-sdl.sh @@ -6,11 +6,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { mkdir sdl cd sdl diff --git a/scripts.d/50-soxr.sh b/scripts.d/50-soxr.sh index 19d1db6..3086b83 100755 --- a/scripts.d/50-soxr.sh +++ b/scripts.d/50-soxr.sh @@ -8,11 +8,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$SOXR_REPO" "$SOXR_COMMIT" soxr cd soxr diff --git a/scripts.d/50-srt.sh b/scripts.d/50-srt.sh index 3ed3b3e..0488921 100755 --- a/scripts.d/50-srt.sh +++ b/scripts.d/50-srt.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$SRT_REPO" "$SRT_COMMIT" srt cd srt diff --git a/scripts.d/50-svtav1.sh b/scripts.d/50-svtav1.sh index 45d266f..8b68225 100755 --- a/scripts.d/50-svtav1.sh +++ b/scripts.d/50-svtav1.sh @@ -9,11 +9,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git clone "$SVTAV1_REPO" svtav1 cd svtav1 diff --git a/scripts.d/50-twolame.sh b/scripts.d/50-twolame.sh index 8ae383e..170e296 100755 --- a/scripts.d/50-twolame.sh +++ b/scripts.d/50-twolame.sh @@ -6,11 +6,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { mkdir twolame cd twolame diff --git a/scripts.d/50-uavs3d.sh b/scripts.d/50-uavs3d.sh index 9a64017..4651fec 100755 --- a/scripts.d/50-uavs3d.sh +++ b/scripts.d/50-uavs3d.sh @@ -9,11 +9,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git clone "$UAVS3D_REPO" uavs3d cd uavs3d diff --git a/scripts.d/50-vidstab.sh b/scripts.d/50-vidstab.sh index 1eb625a..6c18458 100755 --- a/scripts.d/50-vidstab.sh +++ b/scripts.d/50-vidstab.sh @@ -9,11 +9,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$VIDSTAB_REPO" "$VIDSTAB_COMMIT" vidstab cd vidstab diff --git a/scripts.d/50-x264.sh b/scripts.d/50-x264.sh index cf25a0d..7f4d5b4 100755 --- a/scripts.d/50-x264.sh +++ b/scripts.d/50-x264.sh @@ -8,11 +8,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$X264_REPO" "$X264_COMMIT" x264 cd x264 diff --git a/scripts.d/50-x265.sh b/scripts.d/50-x265.sh index 36c933f..fc012d6 100755 --- a/scripts.d/50-x265.sh +++ b/scripts.d/50-x265.sh @@ -8,11 +8,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git clone "$X265_REPO" x265 cd x265 diff --git a/scripts.d/50-xavs2.sh b/scripts.d/50-xavs2.sh index a3b01d8..424e479 100755 --- a/scripts.d/50-xavs2.sh +++ b/scripts.d/50-xavs2.sh @@ -9,11 +9,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git clone "$XAVS2_REPO" xavs2 cd xavs2 diff --git a/scripts.d/50-xvid.sh b/scripts.d/50-xvid.sh index e8a2728..ca5fe14 100755 --- a/scripts.d/50-xvid.sh +++ b/scripts.d/50-xvid.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { mkdir xvid cd xvid diff --git a/scripts.d/50-zimg.sh b/scripts.d/50-zimg.sh index f413cc2..103f87c 100755 --- a/scripts.d/50-zimg.sh +++ b/scripts.d/50-zimg.sh @@ -7,11 +7,6 @@ ffbuild_enabled() { return 0 } -ffbuild_dockerstage() { - to_df "ADD $SELF /stage.sh" - to_df "RUN run_stage" -} - ffbuild_dockerbuild() { git-mini-clone "$ZIMG_REPO" "$ZIMG_COMMIT" zimg cd zimg diff --git a/util/vars.sh b/util/vars.sh index 6f06fc6..72ea500 100644 --- a/util/vars.sh +++ b/util/vars.sh @@ -35,6 +35,10 @@ BASE_IMAGE="${REGISTRY}/${REPO}/base:latest" TARGET_IMAGE="${REGISTRY}/${REPO}/base-${TARGET}:latest" IMAGE="${REGISTRY}/${REPO}/${TARGET}-${VARIANT}${ADDINS_STR:+-}${ADDINS_STR}:latest" +ffbuild_dockerstage() { + to_df "RUN --mount=src=${SELF},dst=/stage.sh run_stage /stage.sh" +} + ffbuild_configure() { return 0 } From 56c81f32753fb5dc8c8668239d23cee4583c55c3 Mon Sep 17 00:00:00 2001 From: BtbN Date: Mon, 5 Apr 2021 19:51:41 +0200 Subject: [PATCH 03/11] Migrate to ghcr.io --- .github/workflows/build.yml | 14 +++++++------- generate.sh | 2 +- images/base-win32/Dockerfile | 2 +- images/base-win64/Dockerfile | 2 +- util/vars.sh | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a0b8d4c..69a5332 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,12 +29,12 @@ jobs: - name: Login to Docker uses: docker/login-action@v1 with: - registry: docker.pkg.github.com + registry: ghcr.io username: ${{ github.actor }} password: ${{ github.token }} - name: Image Name id: imagename - run: echo "::set-output name=name::docker.pkg.github.com/${GITHUB_REPOSITORY,,}/base:latest" + run: echo "::set-output name=name::ghcr.io/${GITHUB_REPOSITORY,,}/base:latest" - name: Pull latest run: docker pull ${{ steps.imagename.outputs.name }} || true - name: Build base image @@ -55,12 +55,12 @@ jobs: - name: Login to Docker uses: docker/login-action@v1 with: - registry: docker.pkg.github.com + registry: ghcr.io username: ${{ github.actor }} password: ${{ github.token }} - name: Image Name id: imagename - run: echo "::set-output name=name::docker.pkg.github.com/${GITHUB_REPOSITORY,,}/base-${{ matrix.target }}:latest" + run: echo "::set-output name=name::ghcr.io/${GITHUB_REPOSITORY,,}/base-${{ matrix.target }}:latest" - name: Pull latest run: docker pull ${{ steps.imagename.outputs.name }} || true - name: Build target base image @@ -84,13 +84,13 @@ jobs: - name: Login to Docker uses: docker/login-action@v1 with: - registry: docker.pkg.github.com + registry: ghcr.io username: ${{ github.actor }} password: ${{ github.token }} - name: Image Name id: imagename run: | - IMG="docker.pkg.github.com/${GITHUB_REPOSITORY,,}/${{ matrix.target }}-${{ matrix.variant }}:latest" + IMG="ghcr.io/${GITHUB_REPOSITORY,,}/${{ matrix.target }}-${{ matrix.variant }}:latest" echo "::set-output name=name::${IMG/ /-}" - name: Pull latest run: docker pull ${{ steps.imagename.outputs.name }} || true @@ -113,7 +113,7 @@ jobs: - name: Login to Docker uses: docker/login-action@v1 with: - registry: docker.pkg.github.com + registry: ghcr.io username: ${{ github.actor }} password: ${{ github.token }} - name: Build ffmpeg diff --git a/generate.sh b/generate.sh index 716e7c9..fbfe5ed 100755 --- a/generate.sh +++ b/generate.sh @@ -10,7 +10,7 @@ to_df() { echo >> Dockerfile } -to_df "FROM docker.pkg.github.com/${REPO}/base-${TARGET}:latest" +to_df "FROM ${REGISTRY}/${REPO}/base-${TARGET}:latest" to_df "ENV TARGET=$TARGET VARIANT=$VARIANT REPO=$REPO ADDINS_STR=$ADDINS_STR" for script in scripts.d/*.sh; do diff --git a/images/base-win32/Dockerfile b/images/base-win32/Dockerfile index 6b3c39b..cff8f9c 100644 --- a/images/base-win32/Dockerfile +++ b/images/base-win32/Dockerfile @@ -1,5 +1,5 @@ ARG GH_REPO=btbn/ffmpeg-builds -FROM docker.pkg.github.com/$GH_REPO/base:latest +FROM ghcr.io/$GH_REPO/base:latest ENV DEBIAN_FRONTEND noninteractive diff --git a/images/base-win64/Dockerfile b/images/base-win64/Dockerfile index eb49e02..df6f12c 100644 --- a/images/base-win64/Dockerfile +++ b/images/base-win64/Dockerfile @@ -1,5 +1,5 @@ ARG GH_REPO=btbn/ffmpeg-builds -FROM docker.pkg.github.com/$GH_REPO/base:latest +FROM ghcr.io/$GH_REPO/base:latest ENV DEBIAN_FRONTEND noninteractive diff --git a/util/vars.sh b/util/vars.sh index 72ea500..1be3bb1 100644 --- a/util/vars.sh +++ b/util/vars.sh @@ -30,7 +30,7 @@ done REPO="${GITHUB_REPOSITORY:-btbn/ffmpeg-builds}" REPO="${REPO,,}" -REGISTRY="docker.pkg.github.com" +REGISTRY="ghcr.io" BASE_IMAGE="${REGISTRY}/${REPO}/base:latest" TARGET_IMAGE="${REGISTRY}/${REPO}/base-${TARGET}:latest" IMAGE="${REGISTRY}/${REPO}/${TARGET}-${VARIANT}${ADDINS_STR:+-}${ADDINS_STR}:latest" From 77f11e2be7658a5d8d7e61230b51a26641bfadc9 Mon Sep 17 00:00:00 2001 From: BtbN Date: Mon, 5 Apr 2021 21:30:32 +0200 Subject: [PATCH 04/11] Disable glslang on 4.3 --- scripts.d/50-glslang.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts.d/50-glslang.sh b/scripts.d/50-glslang.sh index 1d08426..113bdc2 100755 --- a/scripts.d/50-glslang.sh +++ b/scripts.d/50-glslang.sh @@ -4,6 +4,7 @@ GLSLANG_REPO="https://github.com/KhronosGroup/glslang.git" GLSLANG_COMMIT="5878bcb17e43bf22cecaf6095900a33ff7f53445" ffbuild_enabled() { + [[ $ADDINS_STR == *4.3* ]] && return -1 return 0 } From d3518d093340f817b722eea4dad6be159172beea Mon Sep 17 00:00:00 2001 From: BtbN Date: Mon, 5 Apr 2021 21:37:38 +0200 Subject: [PATCH 05/11] Enable BuildKit inline cache --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 69a5332..faeec1a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,7 +38,7 @@ jobs: - name: Pull latest run: docker pull ${{ steps.imagename.outputs.name }} || true - name: Build base image - run: docker build --pull --cache-from ${{ steps.imagename.outputs.name }} --tag ${{ steps.imagename.outputs.name }} images/base + run: docker build --pull --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from ${{ steps.imagename.outputs.name }} --tag ${{ steps.imagename.outputs.name }} images/base - name: Push base image run: docker push ${{ steps.imagename.outputs.name }} build_target_bases: @@ -64,7 +64,7 @@ jobs: - name: Pull latest run: docker pull ${{ steps.imagename.outputs.name }} || true - name: Build target base image - run: docker build --pull --build-arg GH_REPO=${GITHUB_REPOSITORY,,} --cache-from ${{ steps.imagename.outputs.name }} --tag ${{ steps.imagename.outputs.name }} images/base-${{ matrix.target }} + run: docker build --pull --build-arg BUILDKIT_INLINE_CACHE=1 --build-arg GH_REPO=${GITHUB_REPOSITORY,,} --cache-from ${{ steps.imagename.outputs.name }} --tag ${{ steps.imagename.outputs.name }} images/base-${{ matrix.target }} - name: Push target base image run: docker push ${{ steps.imagename.outputs.name }} build_targets: @@ -95,7 +95,7 @@ jobs: - name: Pull latest run: docker pull ${{ steps.imagename.outputs.name }} || true - name: Build variant image - run: docker build --pull --cache-from ${{ steps.imagename.outputs.name }} --tag ${{ steps.imagename.outputs.name }} . + run: docker build --pull --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from ${{ steps.imagename.outputs.name }} --tag ${{ steps.imagename.outputs.name }} . - name: Push variant image run: docker push ${{ steps.imagename.outputs.name }} build_ffmpeg: From c419c549b9a1db32d307ae5a6ad62f6b41540e78 Mon Sep 17 00:00:00 2001 From: BtbN Date: Tue, 6 Apr 2021 03:41:36 +0200 Subject: [PATCH 06/11] Add fully layered build --- generate.sh | 72 ++++++++++++++++++---- scripts.d/10-mingw.sh | 8 +++ scripts.d/{21-libxml2.sh => 20-libxml2.sh} | 0 util/vars.sh | 8 +++ 4 files changed, 77 insertions(+), 11 deletions(-) rename scripts.d/{21-libxml2.sh => 20-libxml2.sh} (100%) diff --git a/generate.sh b/generate.sh index fbfe5ed..b5ceb93 100755 --- a/generate.sh +++ b/generate.sh @@ -5,19 +5,69 @@ source util/vars.sh rm -f Dockerfile -to_df() { - printf "$@" >> Dockerfile - echo >> Dockerfile +layername() { + printf "layer-" + basename "$1" | sed 's/.sh$//' } -to_df "FROM ${REGISTRY}/${REPO}/base-${TARGET}:latest" +exec_dockerstage() { + SCRIPT="$1" + ( + SELF="$SCRIPT" + source "$SCRIPT" + ffbuild_enabled || exit 0 + ffbuild_dockerstage || exit $? + ) +} + +to_df() { + _of="${TODF:-Dockerfile}" + printf "$@" >> "$_of" + echo >> "$_of" +} + +to_df "FROM ${REGISTRY}/${REPO}/base-${TARGET}:latest AS base" to_df "ENV TARGET=$TARGET VARIANT=$VARIANT REPO=$REPO ADDINS_STR=$ADDINS_STR" -for script in scripts.d/*.sh; do -( - SELF="$script" - source $script - ffbuild_enabled || exit 0 - ffbuild_dockerstage || exit $? -) +PREVLAYER="base" +for ID in $(ls -1d scripts.d/??-* | sed -s 's|^.*/\(..\).*|\1|' | sort -u); do + LAYER="layer-$ID" + + for STAGE in scripts.d/$ID-*; do + to_df "FROM $PREVLAYER AS $(layername "$STAGE")" + + if [[ -f "$STAGE" ]]; then + exec_dockerstage "$STAGE" + else + for STAGE in "${STAGE}"/??-*; do + exec_dockerstage "$STAGE" + done + fi + done + + to_df "FROM $PREVLAYER AS $LAYER" + for STAGE in scripts.d/$ID-*; do + if [[ -f "$STAGE" ]]; then + SCRIPT="$STAGE" + else + SCRIPTS=( "$STAGE"/??-* ) + SCRIPT="${SCRIPTS[-1]}" + fi + + ( + SELF="$SCRIPT" + SELFLAYER="$(layername "$STAGE")" + source "$SCRIPT" + ffbuild_enabled || exit 0 + ffbuild_dockerlayer || exit $? + TODF="Dockerfile.final" PREVLAYER="__PREVLAYER__" \ + ffbuild_dockerfinal || exit $? + ) + done + + PREVLAYER="$LAYER" done + +to_df "FROM base" +sed "s/__PREVLAYER__/$PREVLAYER/g" Dockerfile.final | sort -u >> Dockerfile +rm Dockerfile.final diff --git a/scripts.d/10-mingw.sh b/scripts.d/10-mingw.sh index 4a7c198..aba0743 100755 --- a/scripts.d/10-mingw.sh +++ b/scripts.d/10-mingw.sh @@ -8,6 +8,14 @@ ffbuild_enabled() { return 0 } +ffbuild_dockerlayer() { + to_df "COPY --from=${SELFLAYER} /usr/\$FFBUILD_TOOLCHAIN/. /usr/\$FFBUILD_TOOLCHAIN" +} + +ffbuild_dockerfinal() { + to_df "COPY --from=${PREVLAYER} /usr/\$FFBUILD_TOOLCHAIN/. /usr/\$FFBUILD_TOOLCHAIN" +} + ffbuild_dockerbuild() { git-mini-clone "$MINGW_REPO" "$MINGW_COMMIT" mingw cd mingw/mingw-w64-headers diff --git a/scripts.d/21-libxml2.sh b/scripts.d/20-libxml2.sh similarity index 100% rename from scripts.d/21-libxml2.sh rename to scripts.d/20-libxml2.sh diff --git a/util/vars.sh b/util/vars.sh index 1be3bb1..f8643e3 100644 --- a/util/vars.sh +++ b/util/vars.sh @@ -39,6 +39,14 @@ ffbuild_dockerstage() { to_df "RUN --mount=src=${SELF},dst=/stage.sh run_stage /stage.sh" } +ffbuild_dockerlayer() { + to_df "COPY --from=${SELFLAYER} \$FFBUILD_PREFIX/. \$FFBUILD_PREFIX" +} + +ffbuild_dockerfinal() { + to_df "COPY --from=${PREVLAYER} \$FFBUILD_PREFIX/. \$FFBUILD_PREFIX" +} + ffbuild_configure() { return 0 } From 487c68037b6e04d9ada09e4357ddf5d3c13cd867 Mon Sep 17 00:00:00 2001 From: BtbN Date: Tue, 6 Apr 2021 03:49:21 +0200 Subject: [PATCH 07/11] Consolidate lilv dependencies into single layer --- scripts.d/{45-lv2.sh => 50-lilv/96-lv2.sh} | 0 scripts.d/{45-serd.sh => 50-lilv/96-serd.sh} | 0 scripts.d/{46-sord.sh => 50-lilv/97-sord.sh} | 0 scripts.d/{47-sratom.sh => 50-lilv/98-sratom.sh} | 0 scripts.d/{50-lilv.sh => 50-lilv/99-lilv.sh} | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename scripts.d/{45-lv2.sh => 50-lilv/96-lv2.sh} (100%) rename scripts.d/{45-serd.sh => 50-lilv/96-serd.sh} (100%) rename scripts.d/{46-sord.sh => 50-lilv/97-sord.sh} (100%) rename scripts.d/{47-sratom.sh => 50-lilv/98-sratom.sh} (100%) rename scripts.d/{50-lilv.sh => 50-lilv/99-lilv.sh} (100%) diff --git a/scripts.d/45-lv2.sh b/scripts.d/50-lilv/96-lv2.sh similarity index 100% rename from scripts.d/45-lv2.sh rename to scripts.d/50-lilv/96-lv2.sh diff --git a/scripts.d/45-serd.sh b/scripts.d/50-lilv/96-serd.sh similarity index 100% rename from scripts.d/45-serd.sh rename to scripts.d/50-lilv/96-serd.sh diff --git a/scripts.d/46-sord.sh b/scripts.d/50-lilv/97-sord.sh similarity index 100% rename from scripts.d/46-sord.sh rename to scripts.d/50-lilv/97-sord.sh diff --git a/scripts.d/47-sratom.sh b/scripts.d/50-lilv/98-sratom.sh similarity index 100% rename from scripts.d/47-sratom.sh rename to scripts.d/50-lilv/98-sratom.sh diff --git a/scripts.d/50-lilv.sh b/scripts.d/50-lilv/99-lilv.sh similarity index 100% rename from scripts.d/50-lilv.sh rename to scripts.d/50-lilv/99-lilv.sh From d98ab0239ea3135435d4ac58925261b25a30a5f6 Mon Sep 17 00:00:00 2001 From: BtbN Date: Tue, 6 Apr 2021 04:38:26 +0200 Subject: [PATCH 08/11] Ensure use of BuildKit --- makeimage.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/makeimage.sh b/makeimage.sh index 6dfd87c..061fea2 100755 --- a/makeimage.sh +++ b/makeimage.sh @@ -3,6 +3,8 @@ set -xe cd "$(dirname "$0")" source util/vars.sh +export DOCKER_BUILDKIT=1 + docker build --tag "$BASE_IMAGE" images/base docker build --build-arg GH_REPO="$REPO" --tag "$TARGET_IMAGE" "images/base-${TARGET}" From 6aa734be0a931b0cb9d946b6a5de36919e99d8fa Mon Sep 17 00:00:00 2001 From: BtbN Date: Tue, 6 Apr 2021 04:42:56 +0200 Subject: [PATCH 09/11] Fix build flag enumeration of scripts.d with subdirs --- build.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 5d6e4df..6de14e8 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,6 @@ #!/bin/bash set -xe +shopt -s globstar cd "$(dirname "$0")" source util/vars.sh @@ -23,7 +24,7 @@ done export FFBUILD_PREFIX="$(docker run --rm "$IMAGE" bash -c 'echo $FFBUILD_PREFIX')" -for script in scripts.d/*.sh; do +for script in scripts.d/**/*.sh; do FF_CONFIGURE+=" $(get_output $script configure)" FF_CFLAGS+=" $(get_output $script cflags)" FF_CXXFLAGS+=" $(get_output $script cxxflags)" From 8a8d78815d97e13abfdf66c5e5aa092752289f5b Mon Sep 17 00:00:00 2001 From: BtbN Date: Tue, 6 Apr 2021 05:08:33 +0200 Subject: [PATCH 10/11] Shuffle packages into fewer layers --- scripts.d/{40-fftw3.sh => 25-fftw3.sh} | 0 scripts.d/{49-libvorbis.sh => 45-libvorbis.sh} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename scripts.d/{40-fftw3.sh => 25-fftw3.sh} (100%) rename scripts.d/{49-libvorbis.sh => 45-libvorbis.sh} (100%) diff --git a/scripts.d/40-fftw3.sh b/scripts.d/25-fftw3.sh similarity index 100% rename from scripts.d/40-fftw3.sh rename to scripts.d/25-fftw3.sh diff --git a/scripts.d/49-libvorbis.sh b/scripts.d/45-libvorbis.sh similarity index 100% rename from scripts.d/49-libvorbis.sh rename to scripts.d/45-libvorbis.sh From b2e9d1a9edef06f00edd3f8a47f52cb1c1624c7f Mon Sep 17 00:00:00 2001 From: BtbN Date: Tue, 6 Apr 2021 06:23:15 +0200 Subject: [PATCH 11/11] Reduce MinGW layer size --- scripts.d/10-mingw.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts.d/10-mingw.sh b/scripts.d/10-mingw.sh index aba0743..9f5ca40 100755 --- a/scripts.d/10-mingw.sh +++ b/scripts.d/10-mingw.sh @@ -9,11 +9,12 @@ ffbuild_enabled() { } ffbuild_dockerlayer() { - to_df "COPY --from=${SELFLAYER} /usr/\$FFBUILD_TOOLCHAIN/. /usr/\$FFBUILD_TOOLCHAIN" + to_df "COPY --from=${SELFLAYER} /opt/mingw/. /" + to_df "COPY --from=${SELFLAYER} /opt/mingw/. /opt/mingw" } ffbuild_dockerfinal() { - to_df "COPY --from=${PREVLAYER} /usr/\$FFBUILD_TOOLCHAIN/. /usr/\$FFBUILD_TOOLCHAIN" + to_df "COPY --from=${PREVLAYER} /opt/mingw/. /" } ffbuild_dockerbuild() { @@ -36,7 +37,7 @@ ffbuild_dockerbuild() { ./configure "${myconf[@]}" make -j$(nproc) - make install + make install DESTDIR="/opt/mingw" cd ../mingw-w64-libraries/winpthreads @@ -52,7 +53,7 @@ ffbuild_dockerbuild() { ./configure "${myconf[@]}" make -j$(nproc) - make install + make install DESTDIR="/opt/mingw" } ffbuild_configure() {