44# LICENSE: https://github.com/markus-perl/ffmpeg-build-script/blob/master/LICENSE
55
66PROGNAME=$( basename " $0 " )
7- FFMPEG_VERSION=7.0
8- SCRIPT_VERSION=1.52
7+ FFMPEG_VERSION=7.1
8+ SCRIPT_VERSION=1.53
99CWD=$( pwd)
1010PACKAGES=" $CWD /packages"
1111WORKSPACE=" $CWD /workspace"
@@ -26,6 +26,7 @@ if [[ ("$(uname -m)" == "arm64") && ("$OSTYPE" == "darwin"*) ]]; then
2626 # If arm64 AND darwin (macOS)
2727 export ARCH=arm64
2828 export MACOSX_DEPLOYMENT_TARGET=11.0
29+ export CXX=$( which clang++)
2930 MACOS_M1=true
3031fi
3132
@@ -53,7 +54,7 @@ make_dir() {
5354
5455remove_dir () {
5556 if [ -d " $1 " ]; then
56- rm -r " $1 "
57+ rm -rf " $1 "
5758 fi
5859}
5960
@@ -120,7 +121,16 @@ download() {
120121 )
121122}
122123
124+ print_flags () {
125+ echo " Flags: CFLAGS \" $CFLAGS \" , CXXFLAGS \" $CXXFLAGS \" , LDFLAGS \" $LDFLAGS \" , LDEXEFLAGS \" $LDEXEFLAGS \" "
126+ }
127+
123128execute () {
129+
130+ if [[ " $1 " == * configure* ]]; then
131+ print_flags
132+ fi
133+
124134 echo " $ $* "
125135
126136 OUTPUT=$( " $@ " 2>&1 )
@@ -251,7 +261,9 @@ while (($# > 0)); do
251261 echo " Error: A full static binary can only be build on Linux."
252262 exit 1
253263 fi
254- LDEXEFLAGS=" -static"
264+ LDEXEFLAGS=" -static -fPIC"
265+ CFLAGS+=" -fPIC"
266+ CXXFLAGS+=" -fPIC"
255267 fi
256268 if [[ " $1 " == " --latest" ]]; then
257269 LATEST=true
339351if build " pkg-config" " 0.29.2" ; then
340352 download " https://pkgconfig.freedesktop.org/releases/pkg-config-$CURRENT_PACKAGE_VERSION .tar.gz"
341353 if [[ " $OSTYPE " == " darwin" * ]]; then
342- export XXFLAGS= " -Wno-int-conversion" # pkg-config 0.29.2 has a warning that is treated as an error
343- export CFLAGS= " -Wno-error=int-conversion"
354+ export XXFLAGS += " -Wno-int-conversion" # pkg-config 0.29.2 has a warning that is treated as an error
355+ export CFLAGS += " -Wno-error=int-conversion"
344356 fi
345357 execute ./configure --silent --prefix=" ${WORKSPACE} " --with-pc-path=" ${WORKSPACE} " /lib/pkgconfig --with-internal-glib
346358 execute make -j $MJOBS
@@ -455,12 +467,15 @@ else
455467 fi
456468fi
457469
458- if build " cmake" " 3.27.7" ; then
470+ if build " cmake" " 3.31.0" ; then
471+ CXXFLAGS_BACKUP=$CXXFLAGS
472+ export CXXFLAGS+=" -std=c++11"
459473 download " https://github.com/Kitware/CMake/releases/download/v$CURRENT_PACKAGE_VERSION /cmake-$CURRENT_PACKAGE_VERSION .tar.gz"
460474 execute ./configure --prefix=" ${WORKSPACE} " --parallel=" ${MJOBS} " -- -DCMAKE_USE_OPENSSL=OFF
461475 execute make -j $MJOBS
462476 execute make install
463477 build_done " cmake" $CURRENT_PACKAGE_VERSION
478+ export CXXFLAGS=$CXXFLAGS_BACKUP
464479fi
465480
466481# #
@@ -537,6 +552,7 @@ CONFIGURE_OPTIONS+=("--enable-libsvtav1")
537552if command_exists " cargo" ; then
538553 if [[ ! " $SKIPRAV1E " == " yes" ]]; then
539554 if build " rav1e" " 0.7.1" ; then
555+ echo " if you get the message 'cannot be built because it requires rustc x.xx or newer, try to run 'rustup update'"
540556 execute cargo install cargo-c
541557 download " https://github.com/xiph/rav1e/archive/refs/tags/v$CURRENT_PACKAGE_VERSION .tar.gz"
542558 export RUSTFLAGS=" -C target-cpu=native"
10371053build " ffmpeg" " $FFMPEG_VERSION "
10381054download " https://github.com/FFmpeg/FFmpeg/archive/refs/heads/release/$FFMPEG_VERSION .tar.gz" " FFmpeg-release-$FFMPEG_VERSION .tar.gz"
10391055# shellcheck disable=SC2086
1040- ./configure " ${CONFIGURE_OPTIONS[@]} " \
1056+ execute ./configure " ${CONFIGURE_OPTIONS[@]} " \
10411057 --disable-debug \
10421058 --disable-shared \
10431059 --enable-pthreads \
0 commit comments