Skip to content

Commit 2f3fb50

Browse files
committed
Merge remote-tracking branch 'origin/master' into cvanwink/arm64-2
# Conflicts: # build-ffmpeg
2 parents 95ae637 + 7991ba6 commit 2f3fb50

File tree

1 file changed

+71
-80
lines changed

1 file changed

+71
-80
lines changed

build-ffmpeg

Lines changed: 71 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
PROGNAME=$(basename "$0")
77
FFMPEG_VERSION=4.4
8-
SCRIPT_VERSION=1.31rc1
8+
SCRIPT_VERSION=1.33rc1
99
CWD=$(pwd)
1010
PACKAGES="$CWD/packages"
1111
WORKSPACE="$CWD/workspace"
@@ -95,6 +95,10 @@ download() {
9595

9696
make_dir "$DOWNLOAD_PATH/$TARGETDIR"
9797

98+
if [[ "$DOWNLOAD_FILE" == *"patch"* ]]; then
99+
return
100+
fi
101+
98102
if [ -n "$3" ]; then
99103
if ! tar -xvf "$DOWNLOAD_PATH/$DOWNLOAD_FILE" -C "$DOWNLOAD_PATH/$TARGETDIR" 2>/dev/null >/dev/null; then
100104
echo "Failed to extract $DOWNLOAD_FILE"
@@ -334,6 +338,17 @@ fi
334338
## build tools
335339
##
336340

341+
if build "giflib" "5.2.1"; then
342+
download "https://sourceforge.net/projects/giflib/files/giflib-5.2.1.tar.gz"
343+
if [[ "$OSTYPE" == "darwin"* ]]; then
344+
download "https://sourceforge.net/p/giflib/bugs/_discuss/thread/4e811ad29b/c323/attachment/Makefile.patch"
345+
execute patch "${PACKAGES}/giflib-5.2.1/Makefile" ${PACKAGES}/Makefile.patch""
346+
fi
347+
execute make -j $MJOBS
348+
execute make PREFIX="${WORKSPACE}" install
349+
build_done "giflib" "5.2.1"
350+
fi
351+
337352
if build "pkg-config" "0.29.2"; then
338353
download "https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.2.tar.gz"
339354
execute ./configure --silent --prefix="${WORKSPACE}" --with-pc-path="${WORKSPACE}"/lib/pkgconfig --with-internal-glib
@@ -373,7 +388,6 @@ if build "zlib" "1.2.11"; then
373388
execute make install
374389
build_done "zlib" "1.2.11"
375390
fi
376-
LDFLAGS+=" -L/zlib/lib"
377391

378392
if build "m4" "1.4.19"; then
379393
download "https://ftp.gnu.org/gnu/m4/m4-1.4.19.tar.gz"
@@ -427,12 +441,12 @@ if $NONFREE_AND_GPL; then
427441
CONFIGURE_OPTIONS+=("--enable-openssl")
428442
fi
429443

430-
if build "cmake" "3.21.2"; then
431-
download "https://cmake.org/files/LatestRelease/cmake-3.21.2.tar.gz"
444+
if build "cmake" "3.22.0"; then
445+
download "https://github.com/Kitware/CMake/releases/download/v3.22.0/cmake-3.22.0.tar.gz"
432446
execute ./configure --prefix="${WORKSPACE}" --parallel="${MJOBS}" -- -DCMAKE_USE_OPENSSL=OFF
433447
execute make -j $MJOBS
434448
execute make install
435-
build_done "cmake" "3.21.2"
449+
build_done "cmake" "3.22.0"
436450
fi
437451

438452
##
@@ -450,30 +464,31 @@ if command_exists "python3"; then
450464
fi
451465
done
452466
fi
453-
if build "dav1d" "0.9.2"; then
454-
download "https://code.videolan.org/videolan/dav1d/-/archive/0.9.2/dav1d-0.9.2.tar.gz"
455-
make_dir build
456-
# [ Descript - cvanwink ]
457-
# Set extra CFLAGS for arm64
458-
# https://github.com/markus-perl/ffmpeg-build-script/issues/115
459-
if $MACOS_M1; then
460-
export CFLAGS="-arch arm64"
461-
fi
462-
if $SHARED_LIBRARIES; then
463-
execute meson build --prefix="${WORKSPACE}" --buildtype=release --default-library=shared --libdir="${WORKSPACE}"/lib
464-
else
465-
execute meson build --prefix="${WORKSPACE}" --buildtype=release --default-library=static --libdir="${WORKSPACE}"/lib
466-
fi
467-
execute ninja -C build
468-
execute ninja -C build install
469-
# [ Descript - cvanwink ]
470-
# Restore default CFLAGS from line 12
471-
if $MACOS_M1; then
472-
CFLAGS="-I$WORKSPACE/include"
467+
if command_exists "meson"; then
468+
if build "dav1d" "0.9.2"; then
469+
download "https://code.videolan.org/videolan/dav1d/-/archive/0.9.2/dav1d-0.9.2.tar.gz"
470+
make_dir build
471+
# [ Descript - cvanwink ]
472+
# Set extra CFLAGS for arm64
473+
# https://github.com/markus-perl/ffmpeg-build-script/issues/115
474+
if $MACOS_M1; then
475+
export CFLAGS="-arch arm64"
476+
fi
477+
if $SHARED_LIBRARIES; then
478+
execute meson build --prefix="${WORKSPACE}" --buildtype=release --default-library=shared --libdir="${WORKSPACE}"/lib
479+
else
480+
execute meson build --prefix="${WORKSPACE}" --buildtype=release --default-library=static --libdir="${WORKSPACE}"/lib
481+
fi
482+
execute ninja -C build
483+
execute ninja -C build install
484+
# [ Descript - cvanwink ]
485+
# Restore default CFLAGS from line 12
486+
if $MACOS_M1; then
487+
CFLAGS="-I$WORKSPACE/include"
488+
fi
489+
build_done "dav1d" "0.9.2"
473490
fi
474-
build_done "dav1d" "0.9.2"
475491
fi
476-
CONFIGURE_OPTIONS+=("--enable-libdav1d")
477492
fi
478493

479494
if ! $MACOS_M1; then
@@ -731,22 +746,17 @@ if command_exists "python3"; then
731746
execute ./waf install
732747
build_done "serd" "0.30.10"
733748
fi
734-
735-
# [ Descript - cvanwink ]
736-
# FTP for pcre looks to be down
737-
if false; then
738-
if build "pcre" "8.44"; then
739-
download "https://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz" "pcre-8.44.tar.gz"
740-
if $SHARED_LIBRARIES; then
741-
execute ./configure --prefix="${WORKSPACE}" --enable-shared --disable-static
742-
else
743-
execute ./configure --prefix="${WORKSPACE}" --disable-shared --enable-static
744-
fi
745-
execute make -j $MJOBS
746-
execute make install
747-
748-
build_done "pcre" "8.44"
749+
if build "pcre" "8.45"; then
750+
download "https://altushost-swe.dl.sourceforge.net/project/pcre/pcre/8.45/pcre-8.45.tar.gz" "pcre-8.45.tar.gz"
751+
if $SHARED_LIBRARIES; then
752+
execute ./configure --prefix="${WORKSPACE}" --enable-shared --disable-static
753+
else
754+
execute ./configure --prefix="${WORKSPACE}" --disable-shared --enable-static
749755
fi
756+
execute make -j $MJOBS
757+
execute make install
758+
759+
build_done "pcre" "8.45"
750760
fi
751761

752762
if build "sord" "0.16.8"; then
@@ -911,23 +921,16 @@ fi
911921
## image library
912922
##
913923

914-
# [ Descript - cvanwink ]
915-
# Disable libtiff on arm64 and x86_64 as it doesn't compile
916-
# ../version:1:1: error: expected unqualified-id
917-
# 4.3.0
918-
# ^
919-
if false; then
920-
if build "libtiff" "4.3.0"; then
921-
download "https://download.osgeo.org/libtiff/tiff-4.3.0.tar.gz"
922-
if $SHARED_LIBRARIES; then
923-
execute ./configure --prefix="${WORKSPACE}" --enable-shared --disable-static
924-
else
925-
execute ./configure --prefix="${WORKSPACE}" --disable-shared --enable-static
926-
fi
927-
execute make -j $MJOBS
928-
execute make install
929-
build_done "libtiff" "4.3.0"
924+
if build "libtiff" "4.2.0"; then
925+
download "https://download.osgeo.org/libtiff/tiff-4.2.0.tar.gz"
926+
if $SHARED_LIBRARIES; then
927+
execute ./configure --prefix="${WORKSPACE}" --enable-shared --disable-static --disable-dependency-tracking --disable-lzma --disable-webp --disable-zstd --without-x
928+
else
929+
execute ./configure --prefix="${WORKSPACE}" --disable-shared --enable-static --disable-dependency-tracking --disable-lzma --disable-webp --disable-zstd --without-x
930930
fi
931+
execute make -j $MJOBS
932+
execute make install
933+
build_done "libtiff" "4.2.0"
931934
fi
932935
if build "libpng" "1.6.37"; then
933936
download "https://sourceforge.net/projects/libpng/files/libpng16/1.6.37/libpng-1.6.37.tar.gz/download?use_mirror=gigenet" "libpng-1.6.37.tar.gz"
@@ -942,37 +945,24 @@ if build "libpng" "1.6.37"; then
942945
execute make install
943946
build_done "libpng" "1.6.37"
944947
fi
945-
# libwebp can fail to compile on Ubuntu if these flags were left set to CFLAGS
946-
CPPFLAGS=
947948

948-
# [ Descript - cvanwink ]
949-
# Disable libwebp on arm64 and x86_64 as it doesn't compile on x86_64
950-
# Undefined symbols for architecture x86_64:
951-
# "_PrintGifError", referenced from:
952-
# _GIFDisplayError in gifdec.c.o
953-
if false; then
954-
if build "libwebp" "1.2.0"; then
955-
download "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.2.0.tar.gz" "libwebp-1.2.0.tar.gz"
956-
if $SHARED_LIBRARIES; then
957-
execute ./configure --prefix="${WORKSPACE}" --enable-shared --disable-static
958-
else
959-
execute ./configure --prefix="${WORKSPACE}" --disable-shared --enable-static
960-
fi
949+
## does not compile on monterey -> _PrintGifError
950+
if [[ "$OSTYPE" != "darwin"* ]]; then
951+
if build "libwebp" "1.2.1"; then
952+
# libwebp can fail to compile on Ubuntu if these flags were left set to CFLAGS
953+
CPPFLAGS=
954+
download "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.2.1.tar.gz" "libwebp-1.2.1.tar.gz"
955+
execute ./configure --prefix="${WORKSPACE}" --disable-shared --enable-static --disable-dependency-tracking --disable-gl --with-zlib-include="${WORKSPACE}"/include/ --with-zlib-lib="${WORKSPACE}"/lib
961956
make_dir build
962957
cd build || exit
963-
if $SHARED_LIBRARIES; then
964-
execute cmake -DCMAKE_INSTALL_PREFIX="${WORKSPACE}" -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_BINDIR=bin -DCMAKE_INSTALL_INCLUDEDIR=include -DENABLE_SHARED=ON -DENABLE_STATIC=OFF ../
965-
else
966-
execute cmake -DCMAKE_INSTALL_PREFIX="${WORKSPACE}" -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_BINDIR=bin -DCMAKE_INSTALL_INCLUDEDIR=include -DENABLE_SHARED=OFF -DENABLE_STATIC=ON ../
967-
fi
958+
execute cmake -DCMAKE_INSTALL_PREFIX="${WORKSPACE}" -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_BINDIR=bin -DCMAKE_INSTALL_INCLUDEDIR=include -DENABLE_SHARED=OFF -DENABLE_STATIC=ON ../
968959
execute make -j $MJOBS
969960
execute make install
970961

971-
build_done "libwebp" "1.2.0"
962+
build_done "libwebp" "1.2.1"
972963
fi
973964
CONFIGURE_OPTIONS+=("--enable-libwebp")
974965
fi
975-
976966
##
977967
## other library
978968
##
@@ -1082,6 +1072,7 @@ if $SHARED_LIBRARIES; then
10821072
--extra-ldflags="${LDFLAGS}" \
10831073
--extra-libs="${EXTRALIBS}" \
10841074
--pkgconfigdir="$WORKSPACE/lib/pkgconfig" \
1075+
--pkg-config-flags="--static" \
10851076
--prefix="${WORKSPACE}" \
10861077
--extra-version="${EXTRA_VERSION}"
10871078
else

0 commit comments

Comments
 (0)