From c25ef9499157a3c75598b8baaf0faf36482ebc7a Mon Sep 17 00:00:00 2001 From: BtbN Date: Fri, 30 Oct 2020 16:14:11 +0100 Subject: [PATCH] Add librubberband and its dependencies Closes #19 --- scripts.d/40-fftw3.sh | 56 ++++++++++++++++++++++++++++++++ scripts.d/45-libsamplerate.sh | 30 ++++++++++++++++++ scripts.d/50-rubberband.sh | 60 +++++++++++++++++++++++++++++++++++ 3 files changed, 146 insertions(+) create mode 100755 scripts.d/40-fftw3.sh create mode 100755 scripts.d/45-libsamplerate.sh create mode 100755 scripts.d/50-rubberband.sh diff --git a/scripts.d/40-fftw3.sh b/scripts.d/40-fftw3.sh new file mode 100755 index 0000000..ac6b15f --- /dev/null +++ b/scripts.d/40-fftw3.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +# http://fftw.org/download.html +FFTW3_SRC="http://fftw.org/fftw-3.3.8.tar.gz" +FFTW3_SHA512="ab918b742a7c7dcb56390a0a0014f517a6dff9a2e4b4591060deeb2c652bf3c6868aa74559a422a276b853289b4b701bdcbd3d4d8c08943acf29167a7be81a38" + +ffbuild_enabled() { + # Dependency of GPL-Only librubberband + [[ $VARIANT == gpl* ]] || return -1 + return 0 +} + +ffbuild_dockerstage() { + to_df "ADD $SELF /stage.sh" + to_df "RUN run_stage" +} + +ffbuild_dockerbuild() { + mkdir fftw3 + cd fftw3 + + check-wget fftw3.tar.gz "$FFTW3_SRC" "$FFTW3_SHA512" + tar xaf fftw3.tar.gz + rm fftw3.tar.gz + cd fftw* + + local myconf=( + --prefix="$FFBUILD_PREFIX" + --disable-shared + --enable-static + --disable-doc + --with-our-malloc + --enable-threads + --with-combined-threads + --with-incoming-stack-boundary=2 + --enable-sse2 + --enable-avx + --enable-avx2 + ) + + if [[ $TARGET == win* ]]; then + myconf+=( + --host="$FFBUILD_TOOLCHAIN" + ) + else + echo "Unknown target" + return -1 + fi + + ./configure "${myconf[@]}" + make -j$(nproc) + make install + + cd ../.. + rm -rf fftw3 +} diff --git a/scripts.d/45-libsamplerate.sh b/scripts.d/45-libsamplerate.sh new file mode 100755 index 0000000..002d160 --- /dev/null +++ b/scripts.d/45-libsamplerate.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +LIBSR_REPO="https://github.com/libsndfile/libsamplerate.git" +LIBSR_COMMIT="36dfd68836a185182775a0ca760dd2bbbcd53e30" + +ffbuild_enabled() { + # Dependency of GPL-Only librubberband + [[ $VARIANT == gpl* ]] || return -1 + 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 + + mkdir build + cd build + + cmake -DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" -DBUILD_SHARED_LIBS=NO -DBUILD_TESTING=NO -DLIBSAMPLERATE_EXAMPLES=OFF -DLIBSAMPLERATE_INSTALL=YES .. + make -j$(nproc) + make install + + cd ../.. + rm -rf libsr +} diff --git a/scripts.d/50-rubberband.sh b/scripts.d/50-rubberband.sh new file mode 100755 index 0000000..0b14748 --- /dev/null +++ b/scripts.d/50-rubberband.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +# https://breakfastquay.com/rubberband/ +RUBBERBAND_SRC="https://breakfastquay.com/files/releases/rubberband-1.9.0.tar.bz2" + +ffbuild_enabled() { + [[ $VARIANT == gpl* ]] || return -1 + return 0 +} + +ffbuild_dockerstage() { + to_df "ADD $SELF /stage.sh" + to_df "RUN run_stage" +} + +ffbuild_dockerbuild() { + mkdir rubberband + cd rubberband + + wget "$RUBBERBAND_SRC" -O rubberband.tar.gz || return -1 + tar xaf rubberband.tar.gz || return -1 + rm rubberband.tar.gz + cd rubberband* || return -1 + + local myconf=( + --prefix="$FFBUILD_PREFIX" + --disable-shared + --enable-static + --disable-ladspa + --disable-vamp + --disable-programs + ) + + if [[ $TARGET == win* ]]; then + myconf+=( + --host="$FFBUILD_TOOLCHAIN" + ) + else + echo "Unknown target" + return -1 + fi + + ./configure "${myconf[@]}" || return -1 + make -j$(nproc) || return -1 + make install || return -1 + + # Fix static linking + echo "Requires.private: fftw3 samplerate" >> "$FFBUILD_PREFIX"/lib/pkgconfig/rubberband.pc + + cd ../.. + rm -rf rubberband +} + +ffbuild_configure() { + echo --enable-librubberband +} + +ffbuild_unconfigure() { + echo --disable-librubberband +}