diff --git a/ffmpeg/cppbuild.sh b/ffmpeg/cppbuild.sh index 695919a72f1..fb3e3c12fc0 100755 --- a/ffmpeg/cppbuild.sh +++ b/ffmpeg/cppbuild.sh @@ -8,7 +8,7 @@ if [[ -z "$PLATFORM" ]]; then fi DISABLE="--disable-iconv --disable-opencl --disable-vulkan --disable-sdl2 --disable-bzlib --disable-lzma --disable-linux-perf --disable-xlib" -ENABLE="--enable-shared --enable-version3 --enable-runtime-cpudetect --enable-zlib --enable-libmp3lame --enable-libspeex --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-openssl --enable-libopenh264 --enable-libvpx --enable-libfreetype --enable-libopus --enable-libxml2 --enable-libsrt --enable-libwebp --enable-libaom --enable-libsvtav1" +ENABLE="--enable-shared --enable-version3 --enable-runtime-cpudetect --enable-zlib --enable-libmp3lame --enable-libspeex --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-openssl --enable-libopenh264 --enable-libvpx --enable-libfreetype --enable-libopus --enable-libxml2 --enable-libsrt --enable-libwebp --enable-libaom --enable-libsvtav1 --enable-libzimg" if [[ "$EXTENSION" == *gpl ]]; then # Enable GPLv3 modules @@ -26,7 +26,7 @@ LIBAOM_CONFIG="-DENABLE_TESTS:BOOL=OFF -DENABLE_TESTDATA:BOOL=OFF -DENABLE_TOOLS LIBSVTAV1_CONFIG="-DBUILD_APPS:BOOL=OFF -DBUILD_TESTING:BOOL=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_INCLUDEDIR=include -DCMAKE_INSTALL_BINDIR=bin" NASM_VERSION=2.14 -ZLIB=zlib-1.2.13 +ZLIB=zlib-1.3 LAME=lame-3.100 SPEEX=speex-1.2.1 OPUS=opus-1.3.1 @@ -46,6 +46,7 @@ LIBSRT_VERSION=1.5.1 WEBP_VERSION=1.3.0 AOMAV1_VERSION=3.6.1 SVTAV1_VERSION=1.5.0 +ZIMG_VERSION=release-3.0.5 FFMPEG_VERSION=6.0 download https://download.videolan.org/contrib/nasm/nasm-$NASM_VERSION.tar.gz nasm-$NASM_VERSION.tar.gz download http://zlib.net/$ZLIB.tar.gz $ZLIB.tar.gz @@ -68,8 +69,10 @@ download https://github.com/FFmpeg/nv-codec-headers/archive/n$NVCODEC_VERSION.ta download https://github.com/webmproject/libwebp/archive/refs/tags/v$WEBP_VERSION.tar.gz libwebp-$WEBP_VERSION.tar.gz download https://storage.googleapis.com/aom-releases/libaom-$AOMAV1_VERSION.tar.gz aom-$AOMAV1_VERSION.tar.gz download https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v$SVTAV1_VERSION/SVT-AV1-v$SVTAV1_VERSION.tar.gz SVT-AV1-$SVTAV1_VERSION.tar.gz +download https://github.com/sekrit-twc/zimg/archive/$ZIMG_VERSION.tar.gz zimg-$ZIMG_VERSION.tar.gz download http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2 ffmpeg-$FFMPEG_VERSION.tar.bz2 + mkdir -p $PLATFORM$EXTENSION cd $PLATFORM$EXTENSION INSTALL_PATH=`pwd` @@ -94,6 +97,7 @@ tar --totals -xzf ../$XML2.tar.gz tar --totals -xzf ../libwebp-$WEBP_VERSION.tar.gz tar --totals -xzf ../aom-$AOMAV1_VERSION.tar.gz tar --totals -xzf ../SVT-AV1-$SVTAV1_VERSION.tar.gz +tar --totals -xzf ../zimg-$ZIMG_VERSION.tar.gz tar --totals -xjf ../ffmpeg-$FFMPEG_VERSION.tar.bz2 if [[ "${ACLOCAL_PATH:-}" == C:\\msys64\\* ]]; then @@ -261,7 +265,13 @@ EOF $CMAKE -DCMAKE_TOOLCHAIN_FILE=${PLATFORM_ROOT}/build/cmake/android.toolchain.cmake -DANDROID_ABI=armeabi-v7a -DANDROID_NATIVE_API_LEVEL=24 -DCMAKE_C_FLAGS="-I$INSTALL_PATH/include/" -DCMAKE_CXX_FLAGS="-I$INSTALL_PATH/include/" -DCMAKE_EXE_LINKER_FLAGS="-L$INSTALL_PATH/lib/" -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH $LIBSVTAV1_CONFIG .. make -j $MAKEJ make install - cd .. + + cd ../../zimg-$ZIMG_VERSION + bash autogen.sh + ./configure --prefix=$INSTALL_PATH --enable-static --disable-shared --with-pic --host=arm-linux + make -j $MAKEJ + make install + cd ../ffmpeg-$FFMPEG_VERSION sedinplace 's/unsigned long int/unsigned int/g' libavdevice/v4l2.c LDEXEFLAGS='-Wl,-rpath,\$$ORIGIN/' ./configure --prefix=.. $DISABLE $ENABLE --enable-jni --enable-mediacodec --enable-pthreads --enable-cross-compile --cross-prefix="$ANDROID_PREFIX-" --ar="$AR" --ranlib="$RANLIB" --cc="$CC" --strip="$STRIP" --sysroot="$ANDROID_ROOT" --target-os=android --arch=arm --extra-cflags="-I../include/ -I../include/libxml2 -I../include/mfx -I../include/svt-av1 $ANDROID_FLAGS" --extra-ldflags="-L../lib/ $ANDROID_FLAGS" --extra-libs="$ANDROID_LIBS -lz -latomic" --disable-symver || cat ffbuild/config.log @@ -406,7 +416,13 @@ EOF $CMAKE -DCMAKE_TOOLCHAIN_FILE=${PLATFORM_ROOT}/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DANDROID_NATIVE_API_LEVEL=24 -DCMAKE_C_FLAGS="-I$INSTALL_PATH/include/" -DCMAKE_CXX_FLAGS="-I$INSTALL_PATH/include/" -DCMAKE_EXE_LINKER_FLAGS="-L$INSTALL_PATH/lib/" -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH $LIBSVTAV1_CONFIG .. make -j $MAKEJ make install - cd .. + + cd ../../zimg-$ZIMG_VERSION + bash autogen.sh + ./configure --prefix=$INSTALL_PATH --enable-static --disable-shared --with-pic --host=aarch64-linux + make -j $MAKEJ + make install + cd ../ffmpeg-$FFMPEG_VERSION sedinplace 's/unsigned long int/unsigned int/g' libavdevice/v4l2.c LDEXEFLAGS='-Wl,-rpath,\$$ORIGIN/' ./configure --prefix=.. $DISABLE $ENABLE --enable-jni --enable-mediacodec --enable-pthreads --enable-cross-compile --cross-prefix="$ANDROID_PREFIX-" --ar="$AR" --ranlib="$RANLIB" --cc="$CC" --strip="$STRIP" --sysroot="$ANDROID_ROOT" --target-os=android --arch=aarch64 --extra-cflags="-I../include/ -I../include/libxml2 -I../include/mfx -I../include/svt-av1 $ANDROID_FLAGS" --extra-ldflags="-L../lib/ $ANDROID_FLAGS" --extra-libs="$ANDROID_LIBS -lz -latomic" --disable-symver || cat ffbuild/config.log @@ -548,7 +564,13 @@ EOF $CMAKE -DCMAKE_TOOLCHAIN_FILE=${PLATFORM_ROOT}/build/cmake/android.toolchain.cmake -DANDROID_ABI=x86 -DANDROID_NATIVE_API_LEVEL=24 -DCMAKE_C_FLAGS="-I$INSTALL_PATH/include/" -DCMAKE_CXX_FLAGS="-I$INSTALL_PATH/include/" -DCMAKE_EXE_LINKER_FLAGS="-L$INSTALL_PATH/lib/" -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH $LIBSVTAV1_CONFIG .. make -j $MAKEJ make install - cd .. + + cd ../../zimg-$ZIMG_VERSION + bash autogen.sh + ./configure --prefix=$INSTALL_PATH --enable-static --disable-shared --with-pic --host=i686-linux + make -j $MAKEJ + make install + cd ../ffmpeg-$FFMPEG_VERSION sedinplace 's/unsigned long int/unsigned int/g' libavdevice/v4l2.c LDEXEFLAGS='-Wl,-rpath,\$$ORIGIN/' ./configure --prefix=.. $DISABLE $ENABLE --enable-jni --enable-mediacodec --enable-pthreads --enable-cross-compile --cross-prefix="$ANDROID_PREFIX-" --ar="$AR" --ranlib="$RANLIB" --cc="$CC" --strip="$STRIP" --sysroot="$ANDROID_ROOT" --target-os=android --arch=atom --extra-cflags="-I../include/ -I../include/libxml2 -I../include/mfx -I../include/svt-av1 $ANDROID_FLAGS" --extra-ldflags="-L../lib/ $ANDROID_FLAGS" --extra-libs="$ANDROID_LIBS -lz -latomic" --disable-symver || cat ffbuild/config.log @@ -689,7 +711,13 @@ EOF $CMAKE -DCMAKE_TOOLCHAIN_FILE=${PLATFORM_ROOT}/build/cmake/android.toolchain.cmake -DANDROID_ABI=x86_64 -DANDROID_NATIVE_API_LEVEL=24 -DCMAKE_C_FLAGS="-I$INSTALL_PATH/include/" -DCMAKE_CXX_FLAGS="-I$INSTALL_PATH/include/" -DCMAKE_EXE_LINKER_FLAGS="-L$INSTALL_PATH/lib/" -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH $LIBSVTAV1_CONFIG .. make -j $MAKEJ make install - cd .. + + cd ../../zimg-$ZIMG_VERSION + bash autogen.sh + ./configure --prefix=$INSTALL_PATH --enable-static --disable-shared --with-pic --host=x86_64-linux + make -j $MAKEJ + make install + cd ../ffmpeg-$FFMPEG_VERSION sedinplace 's/unsigned long int/unsigned int/g' libavdevice/v4l2.c LDEXEFLAGS='-Wl,-rpath,\$$ORIGIN/' ./configure --prefix=.. $DISABLE $ENABLE --enable-jni --enable-mediacodec --enable-pthreads --enable-cross-compile --cross-prefix="$ANDROID_PREFIX-" --ar="$AR" --ranlib="$RANLIB" --cc="$CC" --strip="$STRIP" --sysroot="$ANDROID_ROOT" --target-os=android --arch=atom --extra-cflags="-I../include/ -I../include/libxml2 -I../include/mfx -I../include/svt-av1 $ANDROID_FLAGS" --extra-ldflags="-L../lib/ $ANDROID_FLAGS" --extra-libs="$ANDROID_LIBS -lz -latomic" --disable-symver || cat ffbuild/config.log @@ -829,7 +857,13 @@ EOF CC="gcc -m32 -fPIC" CXX="g++ -m32 -fPIC" CFLAGS="-I$INSTALL_PATH/include/" CXXFLAGS="-I$INSTALL_PATH/include/" LDFLAGS="-L$INSTALL_PATH/lib/" $CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH $LIBSVTAV1_CONFIG .. make -j $MAKEJ make install - cd .. + + cd ../../zimg-$ZIMG_VERSION + bash autogen.sh + ./configure --prefix=$INSTALL_PATH --enable-static --disable-shared --with-pic --host=i686-linux CFLAGS="-m32" + make -j $MAKEJ + make install + cd ../ffmpeg-$FFMPEG_VERSION LDEXEFLAGS='-Wl,-rpath,\$$ORIGIN/' PKG_CONFIG_PATH=../lib/pkgconfig/ ./configure --prefix=.. $DISABLE $ENABLE --enable-cuda --enable-cuvid --enable-nvenc --enable-pthreads --enable-libxcb --cc="gcc -m32 -D__ILP32__" --extra-cflags="-I../include/ -I../include/libxml2 -I../include/mfx -I../include/svt-av1" --extra-ldflags="-L../lib/" --extra-libs="-lstdc++ -lpthread -ldl -lz -lm $LIBS" || cat ffbuild/config.log make -j $MAKEJ @@ -969,7 +1003,13 @@ EOF CC="gcc -m64" CXX="g++ -m64" CFLAGS="-I$INSTALL_PATH/include/" CXXFLAGS="-I$INSTALL_PATH/include/" LDFLAGS="-L$INSTALL_PATH/lib/" $CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH $LIBSVTAV1_CONFIG .. make -j $MAKEJ make install - cd .. + + cd ../../zimg-$ZIMG_VERSION + bash autogen.sh + ./configure --prefix=$INSTALL_PATH --enable-static --disable-shared --with-pic --host=x86_64-linux CFLAGS="-m64" + make -j $MAKEJ + make install + cd ../ffmpeg-$FFMPEG_VERSION LDEXEFLAGS='-Wl,-rpath,\$$ORIGIN/' PKG_CONFIG_PATH=../lib/pkgconfig/ ./configure --prefix=.. $DISABLE $ENABLE --enable-cuda --enable-cuvid --enable-nvenc --enable-pthreads --enable-libxcb --cc="gcc -m64" --extra-cflags="-I../include/ -I../include/libxml2 -I../include/mfx -I../include/svt-av1" --extra-ldflags="-L../lib/" --extra-libs="-lstdc++ -lpthread -ldl -lz -lm $LIBS" || cat ffbuild/config.log make -j $MAKEJ @@ -1168,7 +1208,13 @@ EOF fi make -j $MAKEJ make install - cd .. + +# TODO: Crosscompile + # cd ../../zimg-$ZIMG_VERSION + # ./configure --prefix=$INSTALL_PATH --enable-static --disable-shared --with-pic --host=arm-linux-gnueabihf + # make -j $MAKEJ + # make install + cd ../ffmpeg-$FFMPEG_VERSION if [ $CROSSCOMPILE -eq 1 ] then @@ -1315,7 +1361,13 @@ EOF CFLAGS="-I$INSTALL_PATH/include/" CXXFLAGS="-I$INSTALL_PATH/include/" LDFLAGS="-L$INSTALL_PATH/lib/" $CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_VERSION=1 -DCMAKE_SYSTEM_PROCESSOR=armv8 -DCMAKE_CXX_FLAGS="$CXXFLAGS -fPIC" -DCMAKE_C_FLAGS="$CFLAGS -fPIC" -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ $LIBSVTAV1_CONFIG .. make -j $MAKEJ make install - cd .. + + cd ../../zimg-$ZIMG_VERSION + bash autogen.sh + ./configure --prefix=$INSTALL_PATH --enable-static --disable-shared --with-pic --target=armv8-linux-gcc + make -j $MAKEJ + make install + cd ../ffmpeg-$FFMPEG_VERSION if [[ ! -d $USERLAND_PATH ]]; then USERLAND_PATH="$(which aarch64-linux-gnu-gcc | grep -o '.*/tools/')../userland" @@ -1526,6 +1578,14 @@ EOF fi make -j $MAKEJ make install + + # TODO: machine type. + + # cd ../../zimg-$ZIMG_VERSION + #./configure --prefix=$INSTALL_PATH --enable-static --disable-shared --with-pic --target=ppc64le-linux + # make -j $MAKEJ + # make install + cd .. cd ../ffmpeg-$FFMPEG_VERSION if [[ "$MACHINE_TYPE" =~ ppc64 ]]; then @@ -1657,7 +1717,13 @@ EOF $CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH $LIBSVTAV1_CONFIG .. make -j $MAKEJ make install - cd .. + + cd ../../zimg-$ZIMG_VERSION + bash autogen.sh + ./configure --prefix=$INSTALL_PATH --enable-static --disable-shared --with-pic --target=generic-gnu + make -j $MAKEJ + make install + cd ../ffmpeg-$FFMPEG_VERSION patch -Np1 < ../../../ffmpeg-macosx.patch LDEXEFLAGS='-Wl,-rpath,@loader_path/' PKG_CONFIG_PATH=../lib/pkgconfig/ ./configure --prefix=.. $DISABLE $ENABLE --enable-pthreads --enable-indev=avfoundation --disable-libxcb --cc="clang -arch arm64" --extra-cflags="-I../include/ -I../include/libxml2 -I../include/mfx -I../include/svt-av1" --extra-ldflags="-L../lib/" --extra-libs="-lstdc++ -ldl -lz -lm" --enable-cross-compile --arch=arm64 --target-os=darwin || cat ffbuild/config.log @@ -1781,7 +1847,13 @@ EOF $CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH $LIBSVTAV1_CONFIG .. make -j $MAKEJ make install - cd .. + + cd ../../zimg-$ZIMG_VERSION + bash autogen.sh + ./configure --prefix=$INSTALL_PATH --enable-static --disable-shared --with-pic + make -j $MAKEJ + make install + cd ../ffmpeg-$FFMPEG_VERSION patch -Np1 < ../../../ffmpeg-macosx.patch LDEXEFLAGS='-Wl,-rpath,@loader_path/' PKG_CONFIG_PATH=../lib/pkgconfig/ ./configure --prefix=.. $DISABLE $ENABLE --enable-pthreads --enable-indev=avfoundation --disable-libxcb --extra-cflags="-I../include/ -I../include/libxml2 -I../include/mfx -I../include/svt-av1" --extra-ldflags="-L../lib/" --extra-libs="-lstdc++ -ldl -lz -lm" || cat ffbuild/config.log @@ -1913,7 +1985,13 @@ EOF CC="gcc -m32" CXX="g++ -m32" CFLAGS="-I$INSTALL_PATH/include/" CXXFLAGS="-I$INSTALL_PATH/include/" LDFLAGS="-L$INSTALL_PATH/lib/" $CMAKE -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH $LIBSVTAV1_CONFIG .. make -j $MAKEJ make install - cd .. + + cd ../../zimg-$ZIMG_VERSION + bash autogen.sh + ./configure --prefix=$INSTALL_PATH --enable-static --disable-shared --with-pic --host=i686-w64-mingw32 + make -j $MAKEJ + make install + cd ../ffmpeg-$FFMPEG_VERSION PKG_CONFIG_PATH=../lib/pkgconfig/ ./configure --prefix=.. $DISABLE $ENABLE --enable-cuda --enable-cuvid --enable-nvenc --enable-libmfx --enable-w32threads --enable-indev=dshow --target-os=mingw32 --cc="gcc -m32" --extra-cflags="-DLIBXML_STATIC -I../include/ -I../include/libxml2 -I../include/mfx/ -I../include/svt-av1" --extra-ldflags="-L../lib/" --extra-libs="-static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lgcc_eh -lWs2_32 -lcrypt32 -lpthread -lz -lm -Wl,-Bdynamic -lole32 -luuid" || cat ffbuild/config.log make -j $MAKEJ @@ -2037,6 +2115,7 @@ EOF CC="gcc -m64" CXX="g++ -m64" $CMAKE -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH $LIBAOM_CONFIG .. make -j $MAKEJ make install + cd .. cd ../SVT-AV1-v$SVTAV1_VERSION mkdir -p build_release @@ -2044,7 +2123,13 @@ EOF CC="gcc -m64" CXX="g++ -m64" $CMAKE -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH $LIBSVTAV1_CONFIG .. make -j $MAKEJ make install - cd .. + + cd ../../zimg-$ZIMG_VERSION + bash autogen.sh + ./configure --prefix=$INSTALL_PATH --enable-static --disable-shared --with-pic --host=x86_64-w64-mingw32 + make -j $MAKEJ + make install + cd ../ffmpeg-$FFMPEG_VERSION PKG_CONFIG_PATH=../lib/pkgconfig/ ./configure --prefix=.. $DISABLE $ENABLE --enable-cuda --enable-cuvid --enable-nvenc --enable-libmfx --enable-w32threads --enable-indev=dshow --target-os=mingw32 --cc="gcc -m64" --extra-cflags="-DLIBXML_STATIC -I../include/ -I../include/libxml2 -I../include/mfx/ -I../include/svt-av1" --extra-ldflags="-L../lib/" --extra-libs="-static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lgcc_eh -lWs2_32 -lcrypt32 -lpthread -lz -lm -Wl,-Bdynamic -lole32 -luuid" || cat ffbuild/config.log make -j $MAKEJ @@ -2056,4 +2141,3 @@ EOF esac cd ../.. -