From d54b70d1e5bb2fadda5971a62b414f497bdb6a2d Mon Sep 17 00:00:00 2001 From: Josh Allmann Date: Thu, 11 Jul 2024 21:34:48 +0000 Subject: [PATCH] Statically link libx264 and libvpx if building them. --- ffmpeg/ffmpeg.go | 2 +- install_ffmpeg.sh | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ffmpeg/ffmpeg.go b/ffmpeg/ffmpeg.go index 6ed3442dd9..c30d2f4c47 100755 --- a/ffmpeg/ffmpeg.go +++ b/ffmpeg/ffmpeg.go @@ -21,7 +21,7 @@ import ( pb "github.com/livepeer/lpms/ffmpeg/proto" ) -// #cgo pkg-config: libavformat libavfilter libavcodec libavutil libswscale +// #cgo pkg-config: --static libavformat libavfilter libavcodec libavutil libswscale // #include // #include "transcoder.h" // #include "extras.h" diff --git a/install_ffmpeg.sh b/install_ffmpeg.sh index 36900ba13c..abf9f99ffd 100755 --- a/install_ffmpeg.sh +++ b/install_ffmpeg.sh @@ -7,7 +7,7 @@ NPROC=${NPROC:-$(nproc)} EXTRA_CFLAGS="" EXTRA_LDFLAGS="" EXTRA_X264_FLAGS="" -EXTRA_FFMPEG_FLAGS="" +EXTRA_FFMPEG_FLAGS="--pkg-config-flags=--static " BUILD_TAGS="${BUILD_TAGS:-}" # Build platform flags @@ -154,13 +154,13 @@ if [[ ! -e "$ROOT/x264" ]]; then fi if [[ "$GOOS" == "linux" && "$BUILD_TAGS" == *"debug-video"* ]]; then - sudo apt-get install -y libnuma-dev cmake + sudo apt-get install -y cmake if [[ ! -e "$ROOT/x265" ]]; then git clone https://bitbucket.org/multicoreware/x265_git.git "$ROOT/x265" cd "$ROOT/x265" git checkout 17839cc0dc5a389e27810944ae2128a65ac39318 cd build/linux/ - cmake -DCMAKE_INSTALL_PREFIX=$ROOT/compiled -G "Unix Makefiles" ../../source + cmake -DCMAKE_INSTALL_PREFIX=$ROOT/compiled -DENABLE_SHARED=off -DENABLE_CLI=off -DENABLE_LIBNUMA=off -G "Unix Makefiles" ../../source make -j$NPROC make -j$NPROC install fi @@ -169,7 +169,7 @@ if [[ "$GOOS" == "linux" && "$BUILD_TAGS" == *"debug-video"* ]]; then git clone https://chromium.googlesource.com/webm/libvpx.git "$ROOT/libvpx" cd "$ROOT/libvpx" git checkout ab35ee100a38347433af24df05a5e1578172a2ae - ./configure --prefix="$ROOT/compiled" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --enable-shared --as=nasm + ./configure --prefix="$ROOT/compiled" --disable-examples --disable-unit-tests --disable-shared --enable-static --disable-install-bins --enable-vp9-highbitdepth --as=nasm make -j$NPROC make -j$NPROC install fi @@ -194,7 +194,7 @@ fi if [[ $BUILD_TAGS == *"debug-video"* ]]; then echo "video debug mode, building ffmpeg with tools, debug info and additional capabilities for running tests" DEV_FFMPEG_FLAGS="--enable-muxer=md5,flv --enable-demuxer=hls --enable-filter=ssim,tinterlace --enable-encoder=wrapped_avframe,pcm_s16le " - DEV_FFMPEG_FLAGS+="--enable-shared --enable-debug=3 --disable-stripping --disable-optimizations --enable-encoder=libx265,libvpx_vp8,libvpx_vp9 " + DEV_FFMPEG_FLAGS+="--disable-shared --enable-debug=3 --disable-stripping --disable-optimizations --enable-encoder=libx265,libvpx_vp8,libvpx_vp9 " DEV_FFMPEG_FLAGS+="--enable-decoder=hevc,libvpx_vp8,libvpx_vp9 --enable-libx265 --enable-libvpx --enable-bsf=noise " else # disable all unnecessary features for production build