2024-03-01 19:02:00 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -ex
|
|
|
|
DEPS_DIR=$(dirname ${BASH_SOURCE[0]})
|
|
|
|
cd "$DEPS_DIR"
|
|
|
|
. common
|
2024-11-22 21:14:05 +00:00
|
|
|
process_args "$@"
|
2024-03-01 19:02:00 +00:00
|
|
|
|
2024-10-01 19:17:09 +00:00
|
|
|
VERSION=7.1
|
2024-03-01 19:02:00 +00:00
|
|
|
FILENAME=ffmpeg-$VERSION.tar.xz
|
|
|
|
PROJECT_DIR=ffmpeg-$VERSION
|
2024-10-01 19:17:09 +00:00
|
|
|
SHA256SUM=40973D44970DBC83EF302B0609F2E74982BE2D85916DD2EE7472D30678A7ABE6
|
2024-03-01 19:02:00 +00:00
|
|
|
|
|
|
|
cd "$SOURCES_DIR"
|
|
|
|
|
|
|
|
if [[ -d "$PROJECT_DIR" ]]
|
|
|
|
then
|
|
|
|
echo "$PWD/$PROJECT_DIR" found
|
|
|
|
else
|
|
|
|
get_file "https://ffmpeg.org/releases/$FILENAME" "$FILENAME" "$SHA256SUM"
|
|
|
|
tar xf "$FILENAME" # First level directory is "$PROJECT_DIR"
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p "$BUILD_DIR/$PROJECT_DIR"
|
|
|
|
cd "$BUILD_DIR/$PROJECT_DIR"
|
|
|
|
|
2024-11-21 22:16:18 +00:00
|
|
|
if [[ -d "$DIRNAME" ]]
|
2024-03-01 19:02:00 +00:00
|
|
|
then
|
2024-11-21 22:16:18 +00:00
|
|
|
echo "'$PWD/$DIRNAME' already exists, not reconfigured"
|
|
|
|
cd "$DIRNAME"
|
2024-03-01 19:02:00 +00:00
|
|
|
else
|
2024-11-21 22:16:18 +00:00
|
|
|
mkdir "$DIRNAME"
|
|
|
|
cd "$DIRNAME"
|
2024-03-01 19:02:00 +00:00
|
|
|
|
2024-11-21 22:16:18 +00:00
|
|
|
if [[ "$HOST" == win* ]]
|
|
|
|
then
|
|
|
|
# -static-libgcc to avoid missing libgcc_s_dw2-1.dll
|
|
|
|
# -static to avoid dynamic dependency to zlib
|
|
|
|
export CFLAGS='-static-libgcc -static'
|
|
|
|
export CXXFLAGS="$CFLAGS"
|
|
|
|
export LDFLAGS='-static-libgcc -static'
|
2024-11-22 21:23:27 +00:00
|
|
|
elif [[ "$HOST" == "macos" ]]
|
|
|
|
then
|
|
|
|
export LDFLAGS="$LDFLAGS -L/opt/homebrew/opt/zlib/lib"
|
|
|
|
export CPPFLAGS="$CPPFLAGS -I/opt/homebrew/opt/zlib/include"
|
|
|
|
|
|
|
|
export LDFLAGS="$LDFLAGS-L/opt/homebrew/opt/libiconv/lib"
|
|
|
|
export CPPFLAGS="$CPPFLAGS -I/opt/homebrew/opt/libiconv/include"
|
|
|
|
export PKG_CONFIG_PATH="/opt/homebrew/opt/zlib/lib/pkgconfig"
|
2024-11-21 22:16:18 +00:00
|
|
|
fi
|
2024-03-01 19:02:00 +00:00
|
|
|
|
2024-11-21 21:44:12 +00:00
|
|
|
conf=(
|
2024-11-21 22:16:18 +00:00
|
|
|
--prefix="$INSTALL_DIR/$DIRNAME"
|
2024-11-21 21:44:12 +00:00
|
|
|
--extra-cflags="-O2 -fPIC"
|
|
|
|
--disable-programs
|
|
|
|
--disable-doc
|
|
|
|
--disable-swscale
|
|
|
|
--disable-postproc
|
|
|
|
--disable-avfilter
|
|
|
|
--disable-network
|
|
|
|
--disable-everything
|
|
|
|
--disable-vulkan
|
|
|
|
--disable-vaapi
|
|
|
|
--disable-vdpau
|
|
|
|
--enable-swresample
|
|
|
|
--enable-decoder=h264
|
|
|
|
--enable-decoder=hevc
|
|
|
|
--enable-decoder=av1
|
|
|
|
--enable-decoder=pcm_s16le
|
|
|
|
--enable-decoder=opus
|
|
|
|
--enable-decoder=aac
|
|
|
|
--enable-decoder=flac
|
|
|
|
--enable-decoder=png
|
|
|
|
--enable-protocol=file
|
|
|
|
--enable-demuxer=image2
|
|
|
|
--enable-parser=png
|
|
|
|
--enable-zlib
|
|
|
|
--enable-muxer=matroska
|
|
|
|
--enable-muxer=mp4
|
|
|
|
--enable-muxer=opus
|
|
|
|
--enable-muxer=flac
|
|
|
|
--enable-muxer=wav
|
|
|
|
)
|
|
|
|
|
2024-11-22 20:41:56 +00:00
|
|
|
if [[ "$HOST" != linux ]]
|
|
|
|
then
|
|
|
|
# libavdevice is only used for V4L2 on Linux
|
|
|
|
conf+=(
|
|
|
|
--disable-avdevice
|
|
|
|
)
|
|
|
|
fi
|
|
|
|
|
2024-11-21 22:16:18 +00:00
|
|
|
if [[ "$LINK_TYPE" == static ]]
|
|
|
|
then
|
|
|
|
conf+=(
|
|
|
|
--enable-static
|
|
|
|
--disable-shared
|
|
|
|
)
|
|
|
|
else
|
|
|
|
conf+=(
|
|
|
|
--disable-static
|
|
|
|
--enable-shared
|
|
|
|
)
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "$BUILD_TYPE" == cross ]]
|
|
|
|
then
|
|
|
|
conf+=(
|
|
|
|
--enable-cross-compile
|
|
|
|
--cross-prefix="${HOST_TRIPLET}-"
|
|
|
|
--cc="${HOST_TRIPLET}-gcc"
|
|
|
|
)
|
|
|
|
|
|
|
|
case "$HOST" in
|
|
|
|
win32)
|
|
|
|
conf+=(
|
|
|
|
--target-os=mingw32
|
|
|
|
--arch=x86
|
|
|
|
)
|
|
|
|
;;
|
|
|
|
|
|
|
|
win64)
|
|
|
|
conf+=(
|
|
|
|
--target-os=mingw32
|
|
|
|
--arch=x86_64
|
|
|
|
)
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
echo "Unsupported host: $HOST" >&2
|
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2024-11-21 21:44:12 +00:00
|
|
|
"$SOURCES_DIR/$PROJECT_DIR"/configure "${conf[@]}"
|
2024-03-01 19:02:00 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
make -j
|
|
|
|
make install
|