diff --git a/scripts.d/20-libiconv.sh b/scripts.d/20-libiconv.sh index bb754d8..e7531ae 100755 --- a/scripts.d/20-libiconv.sh +++ b/scripts.d/20-libiconv.sh @@ -8,8 +8,6 @@ ffbuild_enabled() { } ffbuild_dockerbuild() { - mkdir iconv - cd iconv wget -O iconv.tar.gz "$ICONV_SRC" tar xaf iconv.tar.gz rm iconv.tar.gz @@ -27,7 +25,7 @@ ffbuild_dockerbuild() { myconf+=( --host="$FFBUILD_TOOLCHAIN" ) - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi diff --git a/scripts.d/20-libxml2.sh b/scripts.d/20-libxml2.sh index 2bbf962..1548ef9 100755 --- a/scripts.d/20-libxml2.sh +++ b/scripts.d/20-libxml2.sh @@ -23,7 +23,7 @@ ffbuild_dockerbuild() { myconf+=( --host="$FFBUILD_TOOLCHAIN" ) - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi diff --git a/scripts.d/20-zlib.sh b/scripts.d/20-zlib.sh index 96520d6..c39c656 100755 --- a/scripts.d/20-zlib.sh +++ b/scripts.d/20-zlib.sh @@ -23,7 +23,7 @@ ffbuild_dockerbuild() { if [[ $TARGET == win* ]]; then export CC="${FFBUILD_CROSS_PREFIX}gcc" export AR="${FFBUILD_CROSS_PREFIX}ar" - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi diff --git a/scripts.d/25-fftw3.sh b/scripts.d/25-fftw3.sh index bc310dc..d40cb10 100755 --- a/scripts.d/25-fftw3.sh +++ b/scripts.d/25-fftw3.sh @@ -37,7 +37,7 @@ ffbuild_dockerbuild() { myconf+=( --host="$FFBUILD_TOOLCHAIN" ) - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi diff --git a/scripts.d/25-freetype.sh b/scripts.d/25-freetype.sh index af603a3..82328c4 100755 --- a/scripts.d/25-freetype.sh +++ b/scripts.d/25-freetype.sh @@ -25,7 +25,7 @@ ffbuild_dockerbuild() { myconf+=( --host="$FFBUILD_TOOLCHAIN" ) - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi diff --git a/scripts.d/25-fribidi.sh b/scripts.d/25-fribidi.sh index 9fcfffc..cf5df61 100755 --- a/scripts.d/25-fribidi.sh +++ b/scripts.d/25-fribidi.sh @@ -26,7 +26,7 @@ ffbuild_dockerbuild() { myconf+=( --cross-file=/cross.meson ) - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi diff --git a/scripts.d/25-gmp.sh b/scripts.d/25-gmp.sh index a82ef5c..3af368f 100755 --- a/scripts.d/25-gmp.sh +++ b/scripts.d/25-gmp.sh @@ -7,9 +7,6 @@ ffbuild_enabled() { } ffbuild_dockerbuild() { - mkdir gmp - cd gmp - wget "$GMP_SRC" -O gmp.tar.xz tar xaf gmp.tar.xz rm gmp.tar.xz @@ -27,7 +24,7 @@ ffbuild_dockerbuild() { myconf+=( --host="$FFBUILD_TOOLCHAIN" ) - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi diff --git a/scripts.d/25-libogg.sh b/scripts.d/25-libogg.sh index 29b5e17..1f5c196 100755 --- a/scripts.d/25-libogg.sh +++ b/scripts.d/25-libogg.sh @@ -24,7 +24,7 @@ ffbuild_dockerbuild() { myconf+=( --host="$FFBUILD_TOOLCHAIN" ) - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi diff --git a/scripts.d/25-openssl.sh b/scripts.d/25-openssl.sh index 3f1a4bb..801bbeb 100755 --- a/scripts.d/25-openssl.sh +++ b/scripts.d/25-openssl.sh @@ -31,6 +31,10 @@ ffbuild_dockerbuild() { --cross-compile-prefix="$FFBUILD_CROSS_PREFIX" mingw ) + elif [[ $TARGET == linux64 ]]; then + myconf+=( + linux-x86_64 + ) else echo "Unknown target" return -1 diff --git a/scripts.d/25-xz.sh b/scripts.d/25-xz.sh index 20bbe20..a81da03 100755 --- a/scripts.d/25-xz.sh +++ b/scripts.d/25-xz.sh @@ -26,7 +26,7 @@ ffbuild_dockerbuild() { myconf+=( --host="$FFBUILD_TOOLCHAIN" ) - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi diff --git a/scripts.d/35-fontconfig.sh b/scripts.d/35-fontconfig.sh index fe8cc06..e347cb7 100755 --- a/scripts.d/35-fontconfig.sh +++ b/scripts.d/35-fontconfig.sh @@ -28,7 +28,7 @@ ffbuild_dockerbuild() { myconf+=( --host="$FFBUILD_TOOLCHAIN" ) - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi @@ -36,6 +36,8 @@ ffbuild_dockerbuild() { ./configure "${myconf[@]}" make -j$(nproc) make install + + sed -i 's/Libs.private:/Libs.private: -lintl/' "$FFBUILD_PREFIX"/lib/pkgconfig/fontconfig.pc } ffbuild_configure() { diff --git a/scripts.d/45-harfbuzz.sh b/scripts.d/45-harfbuzz.sh index 9dfe680..4c94749 100755 --- a/scripts.d/45-harfbuzz.sh +++ b/scripts.d/45-harfbuzz.sh @@ -22,7 +22,7 @@ ffbuild_dockerbuild() { myconf+=( --host="$FFBUILD_TOOLCHAIN" ) - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi diff --git a/scripts.d/45-libudfread.sh b/scripts.d/45-libudfread.sh index 666ca60..f454966 100755 --- a/scripts.d/45-libudfread.sh +++ b/scripts.d/45-libudfread.sh @@ -24,7 +24,7 @@ ffbuild_dockerbuild() { myconf+=( --host="$FFBUILD_TOOLCHAIN" ) - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi diff --git a/scripts.d/45-libvorbis.sh b/scripts.d/45-libvorbis.sh index cdf92d2..37c8ebb 100755 --- a/scripts.d/45-libvorbis.sh +++ b/scripts.d/45-libvorbis.sh @@ -24,7 +24,7 @@ ffbuild_dockerbuild() { myconf+=( --host="$FFBUILD_TOOLCHAIN" ) - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi diff --git a/scripts.d/45-vmaf.sh b/scripts.d/45-vmaf.sh index 11b9af1..133c661 100755 --- a/scripts.d/45-vmaf.sh +++ b/scripts.d/45-vmaf.sh @@ -31,7 +31,7 @@ ffbuild_dockerbuild() { myconf+=( --cross-file=/cross.meson ) - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi diff --git a/scripts.d/45-vulkan.sh b/scripts.d/45-vulkan.sh index 4a3ecf8..e921038 100755 --- a/scripts.d/45-vulkan.sh +++ b/scripts.d/45-vulkan.sh @@ -4,6 +4,9 @@ LOADER_REPO="https://github.com/KhronosGroup/Vulkan-Loader.git" LOADER_COMMIT="7ea01c139ffc7c33cd12bd258c1bc8bf530c6d2d" ffbuild_enabled() { + # The various graphics systems(xcb, xlib, wayland, ...) need figured out first + [[ $TARGET == linux* ]] && return -1 + return 0 } diff --git a/scripts.d/50-dav1d.sh b/scripts.d/50-dav1d.sh index 11ab209..d1682ff 100755 --- a/scripts.d/50-dav1d.sh +++ b/scripts.d/50-dav1d.sh @@ -23,7 +23,7 @@ ffbuild_dockerbuild() { myconf+=( --cross-file=/cross.meson ) - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi diff --git a/scripts.d/50-davs2.sh b/scripts.d/50-davs2.sh index cabe83a..f36f5a9 100755 --- a/scripts.d/50-davs2.sh +++ b/scripts.d/50-davs2.sh @@ -26,7 +26,7 @@ ffbuild_dockerbuild() { --host="$FFBUILD_TOOLCHAIN" --cross-prefix="$FFBUILD_CROSS_PREFIX" ) - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi diff --git a/scripts.d/50-glslang.sh b/scripts.d/50-glslang.sh index 1d08426..720234f 100755 --- a/scripts.d/50-glslang.sh +++ b/scripts.d/50-glslang.sh @@ -4,6 +4,9 @@ GLSLANG_REPO="https://github.com/KhronosGroup/glslang.git" GLSLANG_COMMIT="5878bcb17e43bf22cecaf6095900a33ff7f53445" ffbuild_enabled() { + # Pointless without Vulkan + [[ $TARGET == linux* ]] && return -1 + return 0 } diff --git a/scripts.d/50-libass.sh b/scripts.d/50-libass.sh index 29daf7f..f83d7ad 100755 --- a/scripts.d/50-libass.sh +++ b/scripts.d/50-libass.sh @@ -24,7 +24,7 @@ ffbuild_dockerbuild() { myconf+=( --host="$FFBUILD_TOOLCHAIN" ) - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi diff --git a/scripts.d/50-libbluray.sh b/scripts.d/50-libbluray.sh index 145d980..05b584d 100755 --- a/scripts.d/50-libbluray.sh +++ b/scripts.d/50-libbluray.sh @@ -31,7 +31,7 @@ ffbuild_dockerbuild() { myconf+=( --host="$FFBUILD_TOOLCHAIN" ) - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi diff --git a/scripts.d/50-libmp3lame.sh b/scripts.d/50-libmp3lame.sh index 28998a3..e7d730c 100755 --- a/scripts.d/50-libmp3lame.sh +++ b/scripts.d/50-libmp3lame.sh @@ -28,7 +28,7 @@ ffbuild_dockerbuild() { myconf+=( --host="$FFBUILD_TOOLCHAIN" ) - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi diff --git a/scripts.d/50-libopus.sh b/scripts.d/50-libopus.sh index 4ecfa02..7d16052 100755 --- a/scripts.d/50-libopus.sh +++ b/scripts.d/50-libopus.sh @@ -24,7 +24,7 @@ ffbuild_dockerbuild() { myconf+=( --host="$FFBUILD_TOOLCHAIN" ) - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi diff --git a/scripts.d/50-libtheora.sh b/scripts.d/50-libtheora.sh index 9ae2a22..4c27321 100755 --- a/scripts.d/50-libtheora.sh +++ b/scripts.d/50-libtheora.sh @@ -29,7 +29,7 @@ ffbuild_dockerbuild() { myconf+=( --host="$FFBUILD_TOOLCHAIN" ) - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi diff --git a/scripts.d/50-libvpx.sh b/scripts.d/50-libvpx.sh index 0788a5b..435c558 100755 --- a/scripts.d/50-libvpx.sh +++ b/scripts.d/50-libvpx.sh @@ -32,7 +32,7 @@ ffbuild_dockerbuild() { --target=x86-win32-gcc ) export CROSS="$FFBUILD_CROSS_PREFIX" - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi diff --git a/scripts.d/50-libwebp.sh b/scripts.d/50-libwebp.sh index c28b398..ad1ac59 100755 --- a/scripts.d/50-libwebp.sh +++ b/scripts.d/50-libwebp.sh @@ -33,7 +33,7 @@ ffbuild_dockerbuild() { myconf+=( --host="$FFBUILD_TOOLCHAIN" ) - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi diff --git a/scripts.d/50-mfx.sh b/scripts.d/50-mfx.sh index 0f64c42..1d056fd 100755 --- a/scripts.d/50-mfx.sh +++ b/scripts.d/50-mfx.sh @@ -24,7 +24,7 @@ ffbuild_dockerbuild() { myconf+=( --host="$FFBUILD_TOOLCHAIN" ) - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi diff --git a/scripts.d/50-opencore-amr.sh b/scripts.d/50-opencore-amr.sh index 29099bb..e43a111 100755 --- a/scripts.d/50-opencore-amr.sh +++ b/scripts.d/50-opencore-amr.sh @@ -30,7 +30,7 @@ ffbuild_dockerbuild() { myconf+=( --host="$FFBUILD_TOOLCHAIN" ) - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi diff --git a/scripts.d/50-rav1e.sh b/scripts.d/50-rav1e.sh index 123e712..7cfcc87 100755 --- a/scripts.d/50-rav1e.sh +++ b/scripts.d/50-rav1e.sh @@ -12,12 +12,20 @@ ffbuild_dockerbuild() { git-mini-clone "$RAV1E_REPO" "$RAV1E_COMMIT" rav1e cd rav1e - cargo cinstall \ - --target="$FFBUILD_RUST_TARGET" \ + local myconf=( --prefix="$FFBUILD_PREFIX" \ --library-type=staticlib \ --crt-static \ --release + ) + + if [[ -n "$FFBUILD_RUST_TARGET" ]]; then + myconf+=( + --target="$FFBUILD_RUST_TARGET" + ) + fi + + cargo cinstall "${myconf[@]}" } ffbuild_configure() { diff --git a/scripts.d/50-rubberband.sh b/scripts.d/50-rubberband.sh index f2b8006..38cbece 100755 --- a/scripts.d/50-rubberband.sh +++ b/scripts.d/50-rubberband.sh @@ -31,7 +31,7 @@ ffbuild_dockerbuild() { myconf+=( --cross-file=/cross.meson ) - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi diff --git a/scripts.d/50-sdl.sh b/scripts.d/50-sdl.sh index 982ac27..6445ac4 100755 --- a/scripts.d/50-sdl.sh +++ b/scripts.d/50-sdl.sh @@ -27,7 +27,7 @@ ffbuild_dockerbuild() { myconf+=( --host="$FFBUILD_TOOLCHAIN" ) - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi diff --git a/scripts.d/50-soxr.sh b/scripts.d/50-soxr.sh index 3086b83..83ad6a0 100755 --- a/scripts.d/50-soxr.sh +++ b/scripts.d/50-soxr.sh @@ -14,7 +14,13 @@ ffbuild_dockerbuild() { mkdir build && cd build - cmake -DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" -DBUILD_TESTS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_SHARED_LIBS=OFF .. + if [[ $VARIANT == *shared* && $TARGET == linux* ]]; then + USE_OMP="OFF" + else + USE_OMP="ON" + fi + + cmake -DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" -DWITH_OPENMP="$USE_OMP" -DBUILD_TESTS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_SHARED_LIBS=OFF .. make -j$(nproc) make install } @@ -32,5 +38,5 @@ ffbuild_ldflags() { } ffbuild_libs() { - echo -lgomp + [[ $VARIANT == *shared* && $TARGET == linux* ]] || echo -lgomp } diff --git a/scripts.d/50-twolame.sh b/scripts.d/50-twolame.sh index 170e296..69d6e6c 100755 --- a/scripts.d/50-twolame.sh +++ b/scripts.d/50-twolame.sh @@ -26,7 +26,7 @@ ffbuild_dockerbuild() { myconf+=( --host="$FFBUILD_TOOLCHAIN" ) - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi diff --git a/scripts.d/50-vidstab.sh b/scripts.d/50-vidstab.sh index 6c18458..8106cd3 100755 --- a/scripts.d/50-vidstab.sh +++ b/scripts.d/50-vidstab.sh @@ -15,7 +15,13 @@ ffbuild_dockerbuild() { mkdir build && cd build - cmake -DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" -DBUILD_SHARED_LIBS=OFF .. + if [[ $VARIANT == *shared* && $TARGET == linux* ]]; then + USE_OMP="OFF" + else + USE_OMP="ON" + fi + + cmake -DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" -DBUILD_SHARED_LIBS=OFF -DUSE_OMP="$USE_OMP" .. make -j$(nproc) make install } diff --git a/scripts.d/50-x264.sh b/scripts.d/50-x264.sh index 7f4d5b4..e12b15e 100755 --- a/scripts.d/50-x264.sh +++ b/scripts.d/50-x264.sh @@ -26,7 +26,7 @@ ffbuild_dockerbuild() { --host="$FFBUILD_TOOLCHAIN" --cross-prefix="$FFBUILD_CROSS_PREFIX" ) - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi diff --git a/scripts.d/50-xavs2.sh b/scripts.d/50-xavs2.sh index 424e479..be9ef6a 100755 --- a/scripts.d/50-xavs2.sh +++ b/scripts.d/50-xavs2.sh @@ -33,7 +33,7 @@ ffbuild_dockerbuild() { --host="$FFBUILD_TOOLCHAIN" --cross-prefix="$FFBUILD_CROSS_PREFIX" ) - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi diff --git a/scripts.d/50-xvid.sh b/scripts.d/50-xvid.sh index eb26655..233f0b0 100755 --- a/scripts.d/50-xvid.sh +++ b/scripts.d/50-xvid.sh @@ -33,7 +33,7 @@ ffbuild_dockerbuild() { myconf+=( --host="$FFBUILD_TOOLCHAIN" ) - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi @@ -42,8 +42,12 @@ ffbuild_dockerbuild() { make -j$(nproc) make install - rm "$FFBUILD_PREFIX"/{bin/xvidcore.dll,lib/xvidcore.dll.a} - mv "$FFBUILD_PREFIX"/lib/{,lib}xvidcore.a + if [[ $TARGET == win* ]]; then + rm "$FFBUILD_PREFIX"/{bin/xvidcore.dll,lib/xvidcore.dll.a} + mv "$FFBUILD_PREFIX"/lib/{,lib}xvidcore.a + elif [[ $TARGET == linux* ]]; then + rm "$FFBUILD_PREFIX"/lib/libxvidcore.so* + fi } ffbuild_configure() { diff --git a/scripts.d/50-zimg.sh b/scripts.d/50-zimg.sh index 203fb12..4a17906 100755 --- a/scripts.d/50-zimg.sh +++ b/scripts.d/50-zimg.sh @@ -17,13 +17,14 @@ ffbuild_dockerbuild() { --prefix="$FFBUILD_PREFIX" --disable-shared --enable-static + --with-pic ) if [[ $TARGET == win* ]]; then myconf+=( --host="$FFBUILD_TOOLCHAIN" ) - else + elif [[ $TARGET != linux* ]]; then echo "Unknown target" return -1 fi diff --git a/scripts.d/99-staticify.sh b/scripts.d/99-staticify.sh new file mode 100755 index 0000000..2c807c5 --- /dev/null +++ b/scripts.d/99-staticify.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +ffbuild_enabled() { + [[ $TARGET == linux* ]] +} + +ffbuild_dockerfinal() { + to_df "RUN find /lib /usr/lib -maxdepth 1 -and -type l -and -name '*.so' -delete" +} + +ffbuild_dockerlayer() { + return 0 +} + +ffbuild_dockerstage() { + return 0 +} + +ffbuild_dockerbuild() { + return 0 +} + +ffbuild_ldflags() { + if [[ $VARIANT == *shared* ]]; then + #if [[ $TARGET == *64* ]]; then + # echo "-Wl,--dynamic-linker=/lib64/ld-linux-x86-64.so.2" + #else + # echo "-Wl,--dynamic-linker=/lib/ld-linux.so.2" + #fi + return 0 + else + echo "-pie -fPIE -static" + fi +} + +ffbuild_configure() { + # Any dynamic executables linked against musl need its dynamic loader to run + # Thus it's impossible to build both the libraries and the programs, since + # with shared libs, the programs need to be dynamic, and in turn needs the musl + # dynamic loader at runtime. + [[ $VARIANT == *shared* ]] && echo --disable-programs +}