diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7636399..caf9673 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,7 +46,7 @@ jobs: strategy: fail-fast: false matrix: - target: [win32] + target: [win64,linux64] steps: - name: Checkout uses: actions/checkout@v2 @@ -70,7 +70,7 @@ jobs: strategy: fail-fast: false matrix: - target: [win32] + target: [win64,linux64] variant: [gpl,lgpl,gpl 4.4,lgpl 4.4,gpl-shared,lgpl-shared,gpl-shared 4.4,lgpl-shared 4.4] steps: - name: Checkout @@ -107,7 +107,7 @@ jobs: strategy: fail-fast: false matrix: - target: [win32] + target: [win64,linux64] variant: [gpl,lgpl,gpl 4.4,lgpl 4.4,gpl-shared,lgpl-shared,gpl-shared 4.4,lgpl-shared 4.4] steps: - name: Checkout diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 9d50e93..09a6ff1 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - target: [win32] + target: [win64,linux64] variant: [gpl,lgpl,gpl 4.4,lgpl 4.4,gpl-shared,lgpl-shared,gpl-shared 4.4,lgpl-shared 4.4] steps: - name: Checkout diff --git a/README.md b/README.md index 6318b10..d4fe615 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,9 @@ Static 32 bit Windows Builds of ffmpeg master and latest release branch. This repository is forked and well maintained. For static 64 bit Windows FFmpeg builds, you can check [BtbN's repository](https://github.com/BtbN/FFmpeg-Builds). Go to Wiki tab or go to releases for downloads. +EXPERIMENTAL Linux-Builds. Do not expect everything to work on them, specially anything that involved loading dynamic libs at runtime. +Shared Linux builds come without the programs (hopefully just for now), since they won't run without musl. + ## Auto-Builds Builds run daily at 12:00 UTC and are automatically released on success. diff --git a/build.sh b/build.sh index 6de14e8..fbfe048 100755 --- a/build.sh +++ b/build.sh @@ -40,7 +40,7 @@ FF_LIBS="$(xargs <<< "$FF_LIBS")" TESTFILE="uidtestfile" rm -f "$TESTFILE" -docker run --rm -v "$PWD:/uidtestdir" "$IMAGE" /usr/bin/touch "/uidtestdir/$TESTFILE" +docker run --rm -v "$PWD:/uidtestdir" "$IMAGE" touch "/uidtestdir/$TESTFILE" DOCKERUID="$(stat -c "%u" "$TESTFILE")" rm -f "$TESTFILE" [[ "$DOCKERUID" != "$(id -u)" ]] && UIDARGS=( -u "$(id -u):$(id -g)" ) || UIDARGS=() @@ -59,7 +59,7 @@ docker run --rm -i "${UIDARGS[@]}" -v $PWD/ffbuild:/ffbuild "$IMAGE" bash -s < "${ARTIFACTS_PATH}/${TARGET}-${VARIANT}${ADDINS_STR:+-}${ADDINS_STR}.txt" + echo "${OUTPUT_FNAME}" > "${ARTIFACTS_PATH}/${TARGET}-${VARIANT}${ADDINS_STR:+-}${ADDINS_STR}.txt" fi diff --git a/images/base-linux64/Dockerfile b/images/base-linux64/Dockerfile new file mode 100644 index 0000000..cc0d9fd --- /dev/null +++ b/images/base-linux64/Dockerfile @@ -0,0 +1,31 @@ +FROM alpine:edge + +ENV CARGO_HOME="/opt/cargo" PATH="/opt/cargo/bin:${PATH}" +RUN \ + apk add --no-cache \ + yasm nasm diffutils xxd pkgconf git ca-certificates curl wget unzip subversion autoconf automake libtool perl make cmake clang texinfo gperf gettext gettext-dev gettext-static itstool ragel musl-dev openssl-dev zlib-dev bzip2-static gtk-doc gobject-introspection gawk meson samurai p7zip python3 \ + binutils gcc g++ gfortran \ + rust cargo && \ + ln -s python3 /usr/bin/python && \ + cargo install cargo-c && rm -rf "${CARGO_HOME}"/{registry,git} && \ + git config --global user.email "builder@localhost" && \ + git config --global user.name "Builder" && \ + mkdir /opt/ffbuild + +ADD run_stage.sh /usr/bin/run_stage +ADD git-mini-clone.sh /usr/bin/git-mini-clone +ADD check-wget.sh /usr/bin/check-wget + +ADD toolchain.cmake /toolchain.cmake +ADD cross.meson /cross.meson + +ENV FFBUILD_TARGET_FLAGS="" \ + FFBUILD_TOOLCHAIN=x86_64-alpine-linux-musl \ + FFBUILD_CROSS_PREFIX="" \ + FFBUILD_RUST_TARGET="" \ + FFBUILD_PREFIX=/opt/ffbuild \ + FFBUILD_CMAKE_TOOLCHAIN=/toolchain.cmake \ + PKG_CONFIG_LIBDIR=/opt/ffbuild/lib/pkgconfig \ + CFLAGS="-static-libgcc -static-libstdc++ -I/opt/ffbuild/include -O2 -pipe -D_FORTIFY_SOURCE=2 -fstack-protector-strong" \ + CXXFLAGS="-static-libgcc -static-libstdc++ -I/opt/ffbuild/include -O2 -pipe -D_FORTIFY_SOURCE=2 -fstack-protector-strong" \ + LDFLAGS="-static-libgcc -static-libstdc++ -L/opt/ffbuild/lib -O2 -pipe -fstack-protector-strong" diff --git a/images/base-linux64/check-wget.sh b/images/base-linux64/check-wget.sh new file mode 100755 index 0000000..9e64bba --- /dev/null +++ b/images/base-linux64/check-wget.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -xe +FNAME="$1" +URL="$2" +SHA512="$3" +SHAFILE="${FNAME}.sha512" +wget -O "${FNAME}" "${URL}" +trap "rm -f ${SHAFILE}" EXIT +echo "${SHA512} ${FNAME}" > "${SHAFILE}" +sha512sum -c "${SHAFILE}" diff --git a/images/base-linux64/cross.meson b/images/base-linux64/cross.meson new file mode 100644 index 0000000..a695169 --- /dev/null +++ b/images/base-linux64/cross.meson @@ -0,0 +1,15 @@ +[binaries] +c = 'x86_64-alpine-linux-musl-gcc' +cpp = x86_64-alpine-linux-musl-g++' +ar = 'ar' +strip = 'strip' + +[properties] +c_link_args = ['-static-libgcc', '-L/opt/ffbuild/lib', '-O2', '-pipe', '-fstack-protector-strong'] +cpp_link_args = ['-static-libgcc', '-static-libstdc++', '-L/opt/ffbuild/lib', '-O2', '-pipe', '-fstack-protector-strong'] + +[host_machine] +system = 'linux' +cpu_family = 'x86_64' +cpu = 'x86_64' +endian = 'little' diff --git a/images/base-linux64/git-mini-clone.sh b/images/base-linux64/git-mini-clone.sh new file mode 100755 index 0000000..29ff3a8 --- /dev/null +++ b/images/base-linux64/git-mini-clone.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -xe +REPO="$1" +REF="$2" +DEST="$3" +git init "$DEST" +git -C "$DEST" remote add origin "$REPO" +git -C "$DEST" fetch --depth=1 origin "$REF" +git -C "$DEST" config advice.detachedHead false +git -C "$DEST" checkout FETCH_HEAD diff --git a/images/base-linux64/run_stage.sh b/images/base-linux64/run_stage.sh new file mode 100755 index 0000000..9fe0a97 --- /dev/null +++ b/images/base-linux64/run_stage.sh @@ -0,0 +1,7 @@ +#!/bin/bash +set -xe +mkdir -p /stage +source "$1" +cd /stage +ffbuild_dockerbuild +rm -rf /stage "$FFBUILD_PREFIX"/bin diff --git a/images/base-linux64/toolchain.cmake b/images/base-linux64/toolchain.cmake new file mode 100644 index 0000000..b4989ce --- /dev/null +++ b/images/base-linux64/toolchain.cmake @@ -0,0 +1,12 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR x86_64) + +set(CMAKE_C_COMPILER x86_64-alpine-linux-musl-gcc) +set(CMAKE_CXX_COMPILER x86_64-alpine-linux-musl-g++) +set(CMAKE_RANLIB ranlib) + +set(CMAKE_FIND_ROOT_PATH /usr/x86_64-alpine-linux-musl /opt/ffbuild) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/makeimage.sh b/makeimage.sh index 061fea2..7a9c2b2 100755 --- a/makeimage.sh +++ b/makeimage.sh @@ -5,7 +5,10 @@ source util/vars.sh export DOCKER_BUILDKIT=1 -docker build --tag "$BASE_IMAGE" images/base +if grep "FROM.*base.*" "images/base-${TARGET}/Dockerfile" >/dev/null 2>&1; then + docker build --tag "$BASE_IMAGE" images/base +fi + docker build --build-arg GH_REPO="$REPO" --tag "$TARGET_IMAGE" "images/base-${TARGET}" ./generate.sh "$TARGET" "$VARIANT" "${ADDINS[@]}" 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 103f87c..4a17906 100755 --- a/scripts.d/50-zimg.sh +++ b/scripts.d/50-zimg.sh @@ -1,7 +1,7 @@ #!/bin/bash ZIMG_REPO="https://github.com/sekrit-twc/zimg.git" -ZIMG_COMMIT="c0d9c49ec157fc0708129a2bb6ca8906e85eb0f0" +ZIMG_COMMIT="c8153de9aa33bf4a8b47678986e34662a532c05e" ffbuild_enabled() { return 0 @@ -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 +} diff --git a/variants/linux-install-shared.sh b/variants/linux-install-shared.sh new file mode 100644 index 0000000..b5e77bd --- /dev/null +++ b/variants/linux-install-shared.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +package_variant() { + IN="$1" + OUT="$2" + + # mkdir -p "$OUT"/bin + # cp "$IN"/bin/* "$OUT"/bin + + mkdir -p "$OUT"/lib + cp -a "$IN"/lib/*.so* "$OUT"/lib + + mkdir -p "$OUT"/include + cp -r "$IN"/include/* "$OUT"/include + + mkdir -p "$OUT"/doc + cp -r "$IN"/share/doc/ffmpeg/* "$OUT"/doc +} diff --git a/variants/linux64-gpl-shared.sh b/variants/linux64-gpl-shared.sh new file mode 100644 index 0000000..ca8fbb2 --- /dev/null +++ b/variants/linux64-gpl-shared.sh @@ -0,0 +1,3 @@ +#!/bin/bash +source "$(dirname "$BASH_SOURCE")"/linux-install-shared.sh +source "$(dirname "$BASH_SOURCE")"/defaults-gpl-shared.sh diff --git a/variants/linux64-gpl.sh b/variants/linux64-gpl.sh new file mode 100644 index 0000000..b3003a4 --- /dev/null +++ b/variants/linux64-gpl.sh @@ -0,0 +1,3 @@ +#!/bin/bash +source "$(dirname "$BASH_SOURCE")"/default-install.sh +source "$(dirname "$BASH_SOURCE")"/defaults-gpl.sh diff --git a/variants/linux64-lgpl-shared.sh b/variants/linux64-lgpl-shared.sh new file mode 100644 index 0000000..33244aa --- /dev/null +++ b/variants/linux64-lgpl-shared.sh @@ -0,0 +1,3 @@ +#!/bin/bash +source "$(dirname "$BASH_SOURCE")"/linux-install-shared.sh +source "$(dirname "$BASH_SOURCE")"/defaults-lgpl-shared.sh diff --git a/variants/linux64-lgpl.sh b/variants/linux64-lgpl.sh new file mode 100644 index 0000000..f000a33 --- /dev/null +++ b/variants/linux64-lgpl.sh @@ -0,0 +1,3 @@ +#!/bin/bash +source "$(dirname "$BASH_SOURCE")"/default-install.sh +source "$(dirname "$BASH_SOURCE")"/defaults-lgpl.sh diff --git a/variants/win32-gpl-shared.sh b/variants/win32-gpl-shared.sh index ea245b3..93ff7f1 100644 --- a/variants/win32-gpl-shared.sh +++ b/variants/win32-gpl-shared.sh @@ -1,3 +1,3 @@ #!/bin/bash -source "$(dirname "$BASH_SOURCE")"/default-install-shared.sh +source "$(dirname "$BASH_SOURCE")"/windows-install-shared.sh source "$(dirname "$BASH_SOURCE")"/defaults-gpl-shared.sh diff --git a/variants/win32-lgpl-shared.sh b/variants/win32-lgpl-shared.sh index d2c3ae4..ff44219 100644 --- a/variants/win32-lgpl-shared.sh +++ b/variants/win32-lgpl-shared.sh @@ -1,3 +1,3 @@ #!/bin/bash -source "$(dirname "$BASH_SOURCE")"/default-install-shared.sh +source "$(dirname "$BASH_SOURCE")"/windows-install-shared.sh source "$(dirname "$BASH_SOURCE")"/defaults-lgpl-shared.sh diff --git a/variants/win64-gpl-shared.sh b/variants/win64-gpl-shared.sh index ea245b3..93ff7f1 100644 --- a/variants/win64-gpl-shared.sh +++ b/variants/win64-gpl-shared.sh @@ -1,3 +1,3 @@ #!/bin/bash -source "$(dirname "$BASH_SOURCE")"/default-install-shared.sh +source "$(dirname "$BASH_SOURCE")"/windows-install-shared.sh source "$(dirname "$BASH_SOURCE")"/defaults-gpl-shared.sh diff --git a/variants/win64-lgpl-shared.sh b/variants/win64-lgpl-shared.sh index d2c3ae4..ff44219 100644 --- a/variants/win64-lgpl-shared.sh +++ b/variants/win64-lgpl-shared.sh @@ -1,3 +1,3 @@ #!/bin/bash -source "$(dirname "$BASH_SOURCE")"/default-install-shared.sh +source "$(dirname "$BASH_SOURCE")"/windows-install-shared.sh source "$(dirname "$BASH_SOURCE")"/defaults-lgpl-shared.sh diff --git a/variants/default-install-shared.sh b/variants/windows-install-shared.sh similarity index 93% rename from variants/default-install-shared.sh rename to variants/windows-install-shared.sh index 5fd177d..d44677b 100644 --- a/variants/default-install-shared.sh +++ b/variants/windows-install-shared.sh @@ -14,6 +14,6 @@ package_variant() { mkdir -p "$OUT"/include cp -r "$IN"/include/* "$OUT"/include - mkdir -p "$OUT/doc" + mkdir -p "$OUT"/doc cp -r "$IN"/share/doc/ffmpeg/* "$OUT"/doc }