Skip to content

Cvanwink/arm64 #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 7 commits into
base: sr/shared-lib-update
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .node-version

This file was deleted.

152 changes: 92 additions & 60 deletions build-ffmpeg
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# LICENSE: https://github.com/markus-perl/ffmpeg-build-script/blob/master/LICENSE

PROGNAME=$(basename "$0")
VERSION=1.21.rc5
VERSION=1.21.rc6
CWD=$(pwd)
PACKAGES="$CWD/packages"
WORKSPACE="$CWD/workspace"
Expand All @@ -22,6 +22,14 @@ is_mac () {
return 1
}

function get_mac_architecture {
if is_mac; then
echo $(uname -m)
else
echo "not_mac_os"
fi
}

# read by gcc and cmake
# https://cmake.org/cmake/help/latest/variable/CMAKE_OSX_DEPLOYMENT_TARGET.html
export MACOSX_DEPLOYMENT_TARGET=10.11
Expand Down Expand Up @@ -304,7 +312,7 @@ if build "meson"; then
fi

if build "cmake"; then
download "https://cmake.org/files/v3.18/cmake-3.18.4.tar.gz"
download "https://cmake.org/files/v3.21/cmake-3.21.4.tar.gz"
execute ./configure --prefix="${WORKSPACE}" --system-zlib
execute make -j $MJOBS
execute make install
Expand Down Expand Up @@ -351,29 +359,33 @@ if build "x265"; then
fi
CONFIGURE_OPTIONS+=("--enable-libx265")

if build "libvpx"; then
download "https://github.com/webmproject/libvpx/archive/v1.9.0.tar.gz" "libvpx-1.9.0.tar.gz"
# cvanwink: temporarily disable to avoid "libvpx enabled but no supported decoders found"
# ED-2726
if [ "$(get_mac_architecture)" == "x86_64" ]; then
if build "libvpx"; then
download "https://github.com/webmproject/libvpx/archive/v1.11.0.tar.gz" "libvpx-1.11.0.tar.gz"

EXTRA_FLAG=""
EXTRA_FLAG=""

if is_mac; then
echo "Applying Darwin patch"
sed "s/,--version-script//g" build/make/Makefile > build/make/Makefile.patched
sed "s/-Wl,--no-undefined -Wl,-soname/-Wl,-undefined,error -Wl,-install_name/g" build/make/Makefile.patched > build/make/Makefile
EXTRA_FLAG="--target=x86_64-darwin15-gcc"
fi
if is_mac; then
echo "Applying Darwin patch"
sed "s/,--version-script//g" build/make/Makefile > build/make/Makefile.patched
sed "s/-Wl,--no-undefined -Wl,-soname/-Wl,-undefined,error -Wl,-install_name/g" build/make/Makefile.patched > build/make/Makefile
EXTRA_FLAG="--target=x86_64-darwin15-gcc"
fi


execute ./configure --prefix="${WORKSPACE}" --disable-unit-tests --enable-shared --disable-static --as=yasm "${EXTRA_FLAG}"
execute make -j $MJOBS
execute ./configure --prefix="${WORKSPACE}" --disable-unit-tests --enable-shared --disable-static --as=yasm "${EXTRA_FLAG}"
execute make -j $MJOBS

set_mac_install_name "libvpx.6.dylib"
set_mac_install_name "libvpx.11.dylib"

execute make install
execute make install

build_done "libvpx"
build_done "libvpx"
fi
CONFIGURE_OPTIONS+=("--enable-libvpx")
fi
CONFIGURE_OPTIONS+=("--enable-libvpx")

if build "xvidcore"; then
download "https://downloads.xvid.com/downloads/xvidcore-1.3.7.tar.gz"
Expand All @@ -394,17 +406,21 @@ if build "xvidcore"; then
fi
CONFIGURE_OPTIONS+=("--enable-libxvid")

if build "vid_stab"; then
download "https://github.com/georgmartius/vid.stab/archive/v1.1.0.tar.gz" "vid.stab-1.1.0.tar.gz"
execute cmake -DBUILD_SHARED_LIBS=on -DCMAKE_INSTALL_PREFIX:PATH="${WORKSPACE}" -DUSE_OMP=OFF -DENABLE_SHARED=on .
execute make
execute make install
# cvanwink: no newer releases, but head revision has fix for arm64
# ED-2727
if [ "$(get_mac_architecture)" == "x86_64" ]; then
if build "vid_stab"; then
download "https://github.com/georgmartius/vid.stab/archive/v1.1.0.tar.gz" "vid.stab-1.1.0.tar.gz"
execute cmake -DBUILD_SHARED_LIBS=on -DCMAKE_INSTALL_PREFIX:PATH="${WORKSPACE}" -DUSE_OMP=OFF -DENABLE_SHARED=on .
execute make
execute make install

set_mac_install_name "${WORKSPACE}/lib/libvidstab.1.1.dylib" "libvidstab.1.1.dylib"
set_mac_install_name "${WORKSPACE}/lib/libvidstab.1.1.dylib" "libvidstab.1.1.dylib"

build_done "vid_stab"
build_done "vid_stab"
fi
CONFIGURE_OPTIONS+=("--enable-libvidstab")
fi
CONFIGURE_OPTIONS+=("--enable-libvidstab")

if build "twolame"; then
download "https://downloads.sourceforge.net/twolame/twolame-0.4.0.tar.gz"
Expand All @@ -418,34 +434,41 @@ CONFIGURE_OPTIONS+=("--enable-libtwolame")


if build "av1"; then
download "https://aomedia.googlesource.com/aom/+archive/430d58446e1f71ec2283af0d6c1879bc7a3553dd.tar.gz" "av1.tar.gz" "av1"
download "https://aomedia.googlesource.com/aom/+archive/287164de79516c25c8c84fd544f67752c170082a.tar.gz" "av1.tar.gz" "av1"
make_dir "$PACKAGES"/aom_build
cd "$PACKAGES"/aom_build || exit
execute cmake -DBUILD_SHARED_LIBS=1 -DENABLE_TESTS=0 -DCMAKE_INSTALL_PREFIX="${WORKSPACE}" -DCMAKE_INSTALL_LIBDIR=lib "$PACKAGES"/av1
execute make -j $MJOBS

set_mac_install_name "libaom.2.0.0.dylib" "libaom.2.dylib"
set_mac_install_name "libaom.3.2.0.dylib" "libaom.3.dylib"

execute make install

build_done "av1"
fi
CONFIGURE_OPTIONS+=("--enable-libaom")

if build "dav1d"; then
download "https://code.videolan.org/videolan/dav1d/-/archive/0.7.1/dav1d-0.7.1.tar.gz"
make_dir "$PACKAGES"/dav1d_build
cd "$PACKAGES"/dav1d_build || exit
execute meson --prefix="${WORKSPACE}" ../dav1d-0.7.1
execute ninja
execute ninja install

build_done "dav1d"
# cvanwink: arm64 asm doesn't assemble
# ED-2724
if [ "$(get_mac_architecture)" == "x86_64" ]; then
if build "dav1d"; then
download "https://code.videolan.org/videolan/dav1d/-/archive/0.9.2/dav1d-0.9.2.tar.gz"
make_dir "$PACKAGES"/dav1d_build
cd "$PACKAGES"/dav1d_build || exit
execute meson --prefix="${WORKSPACE}" --buildtype=release --wrap-mode=nofallback ../dav1d-0.9.2
execute ninja
execute ninja install

build_done "dav1d"
fi
CONFIGURE_OPTIONS+=("--enable-libdav1d")
fi
CONFIGURE_OPTIONS+=("--enable-libdav1d")

# cvanwink: requires ```brew install automake``` for autoreconf
# requires ```brew install libtool``` for autoreconf
#
if build "zimg"; then
download "https://github.com/sekrit-twc/zimg/archive/release-3.0.1.tar.gz"
download "https://github.com/sekrit-twc/zimg/archive/release-3.0.3.tar.gz"
execute autoreconf -i
execute ./configure --prefix="${WORKSPACE}" --enable-shared --disable-static
execute make -j $MJOBS
Expand Down Expand Up @@ -492,16 +515,18 @@ fi
CONFIGURE_OPTIONS+=("--enable-libopus")

if build "libogg"; then
download "https://ftp.osuosl.org/pub/xiph/releases/ogg/libogg-1.3.3.tar.gz"
download "https://ftp.osuosl.org/pub/xiph/releases/ogg/libogg-1.3.5.tar.gz"
execute ./configure --prefix="${WORKSPACE}" --enable-shared --disable-static
execute make -j $MJOBS
execute make install
build_done "libogg"
fi

if build "libvorbis"; then
download "https://ftp.osuosl.org/pub/xiph/releases/vorbis/libvorbis-1.3.6.tar.gz"
OGG_CFLAGS="-I${WORKSPACE}/include/ogg" OGG_LIBS="-L${WORKSPACE}/lib -logg" execute ./configure --prefix="${WORKSPACE}" --with-ogg-libraries="${WORKSPACE}"/lib --with-ogg-includes="${WORKSPACE}"/include/ --disable-static --enable-shared --disable-oggtest
download "https://ftp.osuosl.org/pub/xiph/releases/vorbis/libvorbis-1.3.7.tar.gz"
#cvanwink: the environment variables are covered with the configure arguments and otherwise cause issues
#OGG_CFLAGS="-I${WORKSPACE}/include/ogg" OGG_LIBS="-L${WORKSPACE}/lib -logg" execute ./configure --prefix="${WORKSPACE}" --with-ogg-libraries="${WORKSPACE}"/lib --with-ogg-includes="${WORKSPACE}"/include/ --disable-static --enable-shared --disable-oggtest
execute ./configure --prefix="${WORKSPACE}" --with-ogg-libraries="${WORKSPACE}"/lib --with-ogg-includes="${WORKSPACE}"/include/ --disable-static --enable-shared --disable-oggtest
execute make -j $MJOBS
execute make install

Expand All @@ -514,7 +539,9 @@ if build "libtheora"; then
sed "s/-fforce-addr//g" configure > configure.patched
chmod +x configure.patched
mv configure.patched configure
OGG_CFLAGS="-I${WORKSPACE}/include/ogg" OGG_LIBS="-L${WORKSPACE}/lib -logg" execute ./configure --prefix="${WORKSPACE}" --with-ogg-libraries="${WORKSPACE}"/lib --with-ogg-includes="${WORKSPACE}"/include/ --with-vorbis-libraries="${WORKSPACE}"/lib --with-vorbis-includes="${WORKSPACE}"/include/ --disable-static --enable-shared --disable-oggtest --disable-vorbistest --disable-examples --disable-asm --disable-spec
#cvanwink: the environment variables are covered with the configure arguments and otherwise cause issues
#OGG_CFLAGS="-I${WORKSPACE}/include/ogg" OGG_LIBS="-L${WORKSPACE}/lib -logg" execute ./configure --prefix="${WORKSPACE}" --with-ogg-libraries="${WORKSPACE}"/lib --with-ogg-includes="${WORKSPACE}"/include/ --with-vorbis-libraries="${WORKSPACE}"/lib --with-vorbis-includes="${WORKSPACE}"/include/ --disable-static --enable-shared --disable-oggtest --disable-vorbistest --disable-examples --disable-asm --disable-spec
execute ./configure --prefix="${WORKSPACE}" --with-ogg-libraries="${WORKSPACE}"/lib --with-ogg-includes="${WORKSPACE}"/include/ --with-vorbis-libraries="${WORKSPACE}"/lib --with-vorbis-includes="${WORKSPACE}"/include/ --disable-static --enable-shared --disable-oggtest --disable-vorbistest --disable-examples --disable-asm --disable-spec
execute make -j $MJOBS
execute make install

Expand All @@ -533,17 +560,21 @@ if build "shine"; then
fi
CONFIGURE_OPTIONS+=("--enable-libshine")

if build "soxr"; then
download "http://ftp.debian.org/debian/pool/main/libs/libsoxr/libsoxr_0.1.3.orig.tar.xz" "soxr-0.1.3.tar.xz"
make_dir build
cd build || exit
execute cmake .. -DWITH_OPENMP:BOOL=OFF -Wno-dev -DCMAKE_INSTALL_PREFIX="${WORKSPACE}" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS:BOOL=ON
execute make -j $MJOBS
execute make install

build_done "soxr"
# cvanwink: SIMD doesn't compile
# ED-2725
if [ "$(get_mac_architecture)" == "x86_64" ]; then
if build "soxr"; then
download "http://ftp.debian.org/debian/pool/main/libs/libsoxr/libsoxr_0.1.3.orig.tar.xz" "soxr-0.1.3.tar.xz"
make_dir build
cd build || exit
execute cmake .. --log-level=VERBOSE -DWITH_OPENMP:BOOL=OFF -Wno-dev -DCMAKE_INSTALL_PREFIX="${WORKSPACE}" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS:BOOL=ON
execute make -j $MJOBS
execute make install

build_done "soxr"
fi
CONFIGURE_OPTIONS+=("--enable-libsoxr")
fi
CONFIGURE_OPTIONS+=("--enable-libsoxr")

if build "speex"; then
download "http://downloads.us.xiph.org/releases/speex/speex-1.2.0.tar.gz"
Expand All @@ -560,7 +591,7 @@ CONFIGURE_OPTIONS+=("--enable-libspeex")
##

if build "libwebp"; then
download "https://github.com/webmproject/libwebp/archive/v1.1.0.tar.gz" "libwebp-1.1.0.tar.gz"
download "https://github.com/webmproject/libwebp/archive/v1.2.1.tar.gz" "libwebp-1.2.1.tar.gz"
make_dir build
cd build || exit
execute cmake -DCMAKE_INSTALL_PREFIX="${WORKSPACE}" -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_BINDIR=bin -DCMAKE_INSTALL_INCLUDEDIR=include -DENABLE_SHARED=ON -DENABLE_STATIC=OFF ../
Expand All @@ -572,7 +603,7 @@ fi
CONFIGURE_OPTIONS+=("--enable-libwebp")

if build "openjpeg"; then
download "https://github.com/uclouvain/openjpeg/archive/v2.3.1.tar.gz" "openjpeg-v2.3.1.tar.gz"
download "https://github.com/uclouvain/openjpeg/archive/v2.4.0.tar.gz" "openjpeg-v2.4.0.tar.gz"
make_dir build
cd build || exit
execute cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${WORKSPACE}" -DBUILD_SHARED_LIBS:bool=on
Expand All @@ -589,7 +620,7 @@ CONFIGURE_OPTIONS+=("--enable-libopenjpeg")
##

if build "libsdl"; then
download "https://www.libsdl.org/release/SDL2-2.0.12.tar.gz"
download "https://www.libsdl.org/release/SDL2-2.0.16.tar.gz"
execute ./configure --prefix="${WORKSPACE}" --enable-shared --disable-static
execute make -j $MJOBS
execute make install
Expand All @@ -598,13 +629,13 @@ if build "libsdl"; then
fi

if build "snappy"; then
download "https://github.com/google/snappy/archive/1.1.8.tar.gz"
download "https://github.com/google/snappy/archive/1.1.9.tar.gz"
make_dir build
cd build || exit
execute cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${WORKSPACE}" -DBUILD_SHARED_LIBS:bool=on
execute cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${WORKSPACE}" -DBUILD_SHARED_LIBS:bool=on -DSNAPPY_BUILD_TESTS=OFF -DSNAPPY_BUILD_BENCHMARKS=OFF
execute make -j $MJOBS

set_mac_install_name "libsnappy.1.1.8.dylib" "libsnappy.1.dylib"
set_mac_install_name "libsnappy.1.1.9.dylib" "libsnappy.1.dylib"

execute make install

Expand Down Expand Up @@ -663,7 +694,7 @@ fi
##

build "ffmpeg"
download "https://ffmpeg.org/releases/ffmpeg-4.3.1.tar.bz2"
download "https://ffmpeg.org/releases/ffmpeg-4.4.1.tar.bz2"
# shellcheck disable=SC2086
./configure "${CONFIGURE_OPTIONS[@]}" \
--disable-debug \
Expand Down Expand Up @@ -731,7 +762,8 @@ cd $CWD
if is_mac; then
node copy_mac_libs.js
cd "$WORKSPACE/mac"
execute zip --symlinks -r "ffmpeg-ffprobe-shared-darwin-x86_64.${VERSION}.zip" *

execute zip --symlinks -r "ffmpeg-ffprobe-shared-darwin-$(get_mac_architecture).${VERSION}.zip" *
fi

exit 0
4 changes: 3 additions & 1 deletion config-target.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
./build-ffmpeg -c && SKIPINSTALL=yes ./build-ffmpeg -b > ./build-ffmpeg.log

❌ don't need
✅ already in ffmpeg-build-script build
🕒 need to add to ffmpeg-build-script
Expand Down Expand Up @@ -30,7 +32,7 @@ Target (evermeet.cx static build)
🕒✅ --enable-libspeex - speex audio file format
✅ --enable-libtheora
🕒✅ --enable-libtwolame - mpeg2
--enable-libvidstab
--enable-libvidstab - video stabilization
❌ --enable-libvmaf - perceptual video quality metric
❌ --enable-libvo-amrwbenc - VisualOn AMR-WB encoder library
✅ --enable-libvorbis
Expand Down
2 changes: 1 addition & 1 deletion copy_mac_libs.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const baseLibDir = resolve(__dirname, 'workspace/lib');
const destDir = resolve(__dirname, 'workspace/mac');

try {
logAndExec(`rm -r ${destDir}`);
logAndExec(`rm -r -f ${destDir}`);
} catch (err) {
//
}
Expand Down