From caec318b084482a3332d1ad942c4eeec5075b5a0 Mon Sep 17 00:00:00 2001 From: tjayz <90593277+tjayz@users.noreply.github.com> Date: Tue, 11 Mar 2025 11:19:24 -0400 Subject: [PATCH 01/26] Add files via upload --- build.sh | 1 + 1 file changed, 1 insertion(+) create mode 100644 build.sh diff --git a/build.sh b/build.sh new file mode 100644 index 00000000..4d93af71 --- /dev/null +++ b/build.sh @@ -0,0 +1 @@ +./cross_compile_ffmpeg.sh --build-dependencies=y --enable-gpl=y --disable-nonfree=n --prefer-stable=y --build-ffmpeg-static=y --fdk-aac-git-checkout-version=v2.0.1 --compiler-flavors=win64 \ No newline at end of file From cede4d8150c5a752835c6ca0e5c27984688cb85f Mon Sep 17 00:00:00 2001 From: tjayz <90593277+tjayz@users.noreply.github.com> Date: Tue, 11 Mar 2025 11:20:06 -0400 Subject: [PATCH 02/26] Add files via upload --- patches/AudioToolBox.patch | 14 ++ patches/libffi.patch | 15 ++ patches/mingw-w64-build | 490 +++++++++++++++++++++++++++++++++++++ 3 files changed, 519 insertions(+) create mode 100644 patches/AudioToolBox.patch create mode 100644 patches/libffi.patch create mode 100644 patches/mingw-w64-build diff --git a/patches/AudioToolBox.patch b/patches/AudioToolBox.patch new file mode 100644 index 00000000..4196ffa5 --- /dev/null +++ b/patches/AudioToolBox.patch @@ -0,0 +1,14 @@ +diff --git a/configure b/configure +# Patch for ffmpeg release/7.1/7.1.1 +--- a/configure ++++ b/configure +@@ -6676,7 +6676,7 @@ written by + check_lib camera2ndk "stdbool.h stdint.h camera/NdkCameraManager.h" ACameraManager_create -lcamera2ndk + + enabled appkit && check_apple_framework AppKit +-enabled audiotoolbox && check_apple_framework AudioToolbox ++enabled audiotoolbox && check_apple_framework CoreAudioToolbox + enabled avfoundation && check_apple_framework AVFoundation + enabled coreimage && check_apple_framework CoreImage + enabled metal && check_apple_framework Metal +# Tjayz diff --git a/patches/libffi.patch b/patches/libffi.patch new file mode 100644 index 00000000..420569c0 --- /dev/null +++ b/patches/libffi.patch @@ -0,0 +1,15 @@ +diff --git a/configure b/configure +# Patch for wsl libffi v3.4.7, harmless to non wsl +--- a/configure ++++ b/configure +@@ -3340,7 +3340,7 @@ written by + srcdir=`echo "$ax_enable_builddir" | + sed -e 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g;s,[/]$,,;'` + # going to restart from subdirectory location +- test -f $srcdir/config.log && mv $srcdir/config.log . ++ test -f $srcdir/config.log && cp $srcdir/config.log . + test -f $srcdir/confdefs.h && mv $srcdir/confdefs.h . + test -f $srcdir/conftest.log && mv $srcdir/conftest.log . + test -f $srcdir/$cache_file && mv $srcdir/$cache_file . + +# Tjayz diff --git a/patches/mingw-w64-build b/patches/mingw-w64-build new file mode 100644 index 00000000..e1687813 --- /dev/null +++ b/patches/mingw-w64-build @@ -0,0 +1,490 @@ +#!/bin/bash +# +# Copyright (C) 2024 Kyle Schwarz +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +ROOT_PATH=$(pwd) + +MINGW_W64_BRANCH="master" +BINUTILS_BRANCH="binutils-2_44-branch" +GCC_BRANCH="releases/gcc-14" + +ENABLE_THREADS="--enable-threads=posix" + +JOB_COUNT=$(($(getconf _NPROCESSORS_ONLN) + 2)) + +LINKED_RUNTIME="msvcrt" + +show_help() +{ +cat <... + +Archs: + i586 Windows 32-bit for old CPUs (Intel Pentium (MMX), AMD K5, K6, K6-2, K6-III) + i686 Windows 32-bit (Intel P6 [Pentium Pro], AMD K7 and newer) + x86_64 Windows 64-bit + +Options: + -h, --help show help + -j , --jobs override make job count (default: $JOB_COUNT) + -p , --prefix install location (default: $ROOT_PATH/) + -r , --root location for sources, build artifacts and the resulting compiler (default: $ROOT_PATH) + --keep-artifacts don't remove source and build files after a successful build + --disable-threads disable pthreads and STL + --cached-sources use existing sources instead of downloading new ones + --binutils-branch set Binutils branch (default: $BINUTILS_BRANCH) + --gcc-branch set GCC branch (default: $GCC_BRANCH) + --mingw-w64-branch set MinGW-w64 branch (default: $MINGW_W64_BRANCH) + --linked-runtime set MinGW Linked Runtime (default: $LINKED_RUNTIME) +EOF +} + +error_exit() +{ + local error_msg="$1" + shift 1 + + if [ "$error_msg" ]; then + printf "%s\n" "$error_msg" >&2 + else + printf "an error occured\n" >&2 + fi + exit 1 +} + +arg_error() +{ + local error_msg="$1" + shift 1 + + error_exit "$error_msg, see --help for options" "$error_msg" +} + +execute() +{ + local info_msg="$1" + local error_msg="$2" + shift 2 + + if [ ! "$error_msg" ]; then + error_msg="error" + fi + + if [ "$info_msg" ]; then + printf "(%d/%d): %s\n" "$CURRENT_STEP" "$TOTAL_STEPS" "$info_msg" + CURRENT_STEP=$((CURRENT_STEP + 1)) + fi + "$@" >>"$LOG_FILE" 2>&1 || error_exit "$error_msg, check $LOG_FILE for details" +} + +create_dir() +{ + local path="$1" + shift 1 + + execute "" "unable to create directory '$path'" \ + mkdir -p "$path" +} + +remove_path() +{ + local path="$1" + shift 1 + + execute "" "unable to remove path '$path'" \ + rm -fr "$path" +} + +change_dir() +{ + local path="$1" + shift 1 + + execute "" "unable to cd to directory '$path'" \ + cd "$path" +} + +download_sources() +{ + remove_path "$SRC_PATH" + create_dir "$SRC_PATH" + change_dir "$SRC_PATH" + + execute "downloading MinGW-w64 source" "" \ + git clone --depth 1 -b "$MINGW_W64_BRANCH" \ + https://git.code.sf.net/p/mingw-w64/mingw-w64 mingw-w64 + + execute "downloading Binutils source" "" \ + git clone --depth 1 -b "$BINUTILS_BRANCH" \ + https://sourceware.org/git/binutils-gdb.git binutils + + execute "downloading GCC source" "" \ + git clone --depth 1 -b "$GCC_BRANCH" \ + https://gcc.gnu.org/git/gcc.git gcc + + execute "downloading config.guess" "" \ + curl -o config.guess \ + "https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD" +} + +build() +{ + local arch="$1" + local prefix="$2" + shift 2 + + local bld_path="$BLD_PATH/$arch" + local host="$arch-w64-mingw32" + + export PATH="$prefix/bin:$PATH" + + remove_path "$bld_path" + # don't remove a user defined prefix (could be /usr/local) + if [ ! "$PREFIX" ]; then + remove_path "$prefix" + fi + + if [ "$arch" = "i586" ] || [ "$arch" = "i686" ]; then + local x86_dwarf2="--disable-sjlj-exceptions --with-dwarf2" + local crt_lib="--enable-lib32 --disable-lib64" + else + local x86_dwarf2="" + local crt_lib="--enable-lib64 --disable-lib32" + fi + + create_dir "$bld_path/binutils" + change_dir "$bld_path/binutils" + + execute "($arch): configuring Binutils" "" \ + "$SRC_PATH/binutils/configure" --prefix="$prefix" --disable-shared \ + --enable-static --with-sysroot="$prefix" --target="$host" \ + --disable-multilib --disable-nls --enable-lto --disable-gdb + + execute "($arch): building Binutils" "" \ + make -j $JOB_COUNT + + execute "($arch): installing Binutils" "" \ + make install + + create_dir "$bld_path/mingw-w64-headers" + change_dir "$bld_path/mingw-w64-headers" + + execute "($arch): configuring MinGW-w64 headers" "" \ + "$SRC_PATH/mingw-w64/mingw-w64-headers/configure" --build="$BUILD" \ + --host="$host" --prefix="$prefix/$host" \ + --with-default-msvcrt=$LINKED_RUNTIME + + execute "($arch): installing MinGW-w64 headers" "" \ + make install + + create_dir "$bld_path/gcc" + change_dir "$bld_path/gcc" + + execute "($arch): configuring GCC" "" \ + "$SRC_PATH/gcc/configure" --target="$host" --disable-shared \ + --enable-static --disable-multilib --prefix="$prefix" \ + --enable-languages=c,c++ --disable-nls $ENABLE_THREADS \ + $x86_dwarf2 + + execute "($arch): building GCC (all-gcc)" "" \ + make -j $JOB_COUNT all-gcc + execute "($arch): installing GCC (install-gcc)" "" \ + make install-gcc + + create_dir "$bld_path/mingw-w64-crt" + change_dir "$bld_path/mingw-w64-crt" + + execute "($arch): configuring MinGW-w64 CRT" "" \ + "$SRC_PATH/mingw-w64/mingw-w64-crt/configure" --build="$BUILD" \ + --host="$host" --prefix="$prefix/$host" \ + --with-default-msvcrt=$LINKED_RUNTIME \ + --with-sysroot="$prefix/$host" $crt_lib + + execute "($arch): building MinGW-w64 CRT" "" \ + make -j $JOB_COUNT + execute "($arch): installing MinGW-w64 CRT" "" \ + make install + + if [ "$ENABLE_THREADS" ]; then + create_dir "$bld_path/mingw-w64-winpthreads" + change_dir "$bld_path/mingw-w64-winpthreads" + + execute "($arch): configuring winpthreads" "" \ + "$SRC_PATH/mingw-w64/mingw-w64-libraries/winpthreads/configure" \ + --build="$BUILD" --host="$host" --disable-shared \ + --enable-static --prefix="$prefix/$host" + + execute "($arch): building winpthreads" "" \ + make -j $JOB_COUNT + + execute "($arch): installing winpthreads" "" \ + make install + fi + + change_dir "$bld_path/gcc" + + execute "($arch): building GCC" "" \ + make -j $JOB_COUNT + execute "($arch): installing GCC" "" \ + make install +} + +while :; do + case $1 in + -h|--help) + show_help + exit 0 + ;; + -j|--jobs) + if [ "$2" ]; then + JOB_COUNT=$2 + shift + else + arg_error "'--jobs' requires a non-empty option argument" + fi + ;; + -p|--prefix) + if [ "$2" ]; then + PREFIX="$2" + shift + else + arg_error "'--prefix' requires a non-empty option argument" + fi + ;; + --prefix=?*) + PREFIX=${1#*=} + ;; + --prefix=) + arg_error "'--prefix' requires a non-empty option argument" + ;; + -r|--root) + if [ "$2" ]; then + ROOT_PATH_ARG="$2" + shift + else + arg_error "'--root' requires a non-empty option argument" + fi + ;; + --root=?*) + ROOT_PATH_ARG="${1#*=}" + ;; + --root=) + arg_error "'--root' requires a non-empty option argument" + ;; + --keep-artifacts) + KEEP_ARTIFACTS=1 + ;; + --disable-threads) + ENABLE_THREADS="" + ;; + --cached-sources) + CACHED_SOURCES=1 + ;; + --binutils-branch) + if [ "$2" ]; then + BINUTILS_BRANCH="$2" + shift + else + arg_error "'--binutils-branch' requires a non-empty option argument" + fi + ;; + --binutils-branch=?*) + BINUTILS_BRANCH=${1#*=} + ;; + --binutils-branch=) + arg_error "'--binutils-branch' requires a non-empty option argument" + ;; + --gcc-branch) + if [ "$2" ]; then + GCC_BRANCH="$2" + shift + else + arg_error "'--gcc-branch' requires a non-empty option argument" + fi + ;; + --gcc-branch=?*) + GCC_BRANCH=${1#*=} + ;; + --gcc-branch=) + arg_error "'--gcc-branch' requires a non-empty option argument" + ;; + --linked-runtime) + if [ "$2" ]; then + LINKED_RUNTIME="$2" + shift + else + arg_error "'--linked-runtime' requires a non-empty option argument" + fi + ;; + --linked-runtime=?*) + LINKED_RUNTIME=${1#*=} + ;; + --linked-runtime=) + arg_error "'--linked-runtime' requires a non-empty option argument" + ;; + --mingw-w64-branch) + if [ "$2" ]; then + MINGW_W64_BRANCH="$2" + shift + else + arg_error "'--mingw-w64-branch' requires a non-empty option argument" + fi + ;; + --mingw-w64-branch=?*) + MINGW_W64_BRANCH=${1#*=} + ;; + --mingw-w64-branch=) + arg_error "'--mingw-w64-branch' requires a non-empty option argument" + ;; + i586) + BUILD_I586=1 + ;; + i686) + BUILD_I686=1 + ;; + x86_64) + BUILD_X86_64=1 + ;; + --) + shift + break + ;; + -?*) + arg_error "unknown option '$1'" + ;; + ?*) + arg_error "unknown arch '$1'" + ;; + *) + break + esac + + shift +done + +NUM_BUILDS=$((BUILD_I586 + BUILD_I686 + BUILD_X86_64)) +if [ "$NUM_BUILDS" -eq 0 ]; then + arg_error "no ARCH was specified" +fi + +MISSING_EXECS="" +for exec in g++ flex bison git makeinfo m4 bzip2 curl make diff; do + if ! command -v "$exec" >/dev/null; then + MISSING_EXECS="$MISSING_EXECS $exec" + fi +done +if [ "$MISSING_EXECS" ]; then + error_exit "missing required executable(s):$MISSING_EXECS" +fi + +TOTAL_STEPS=0 + +if [ ! "$CACHED_SOURCES" ]; then + TOTAL_STEPS=$((TOTAL_STEPS + 4)) +fi + +if [ "$ENABLE_THREADS" ]; then + THREADS_STEPS=3 +else + THREADS_STEPS=0 +fi + +THREADS_STEPS=$((THREADS_STEPS * NUM_BUILDS)) +BUILD_STEPS=$((13 * NUM_BUILDS)) + +TOTAL_STEPS=$((TOTAL_STEPS + THREADS_STEPS + BUILD_STEPS)) + +if [ "$ROOT_PATH_ARG" ]; then + ROOT_PATH=$(mkdir -p "$ROOT_PATH_ARG" && cd "$ROOT_PATH_ARG" && pwd) +fi + +SRC_PATH="$ROOT_PATH/src" +BLD_PATH="$ROOT_PATH/bld" +LOG_FILE="$ROOT_PATH/build.log" + +if [ "$PREFIX" ]; then + I586_PREFIX="$PREFIX" + I686_PREFIX="$PREFIX" + X86_64_PREFIX="$PREFIX" +else + I586_PREFIX="$ROOT_PATH/mingw-w64-i586" + I686_PREFIX="$ROOT_PATH/mingw-w64-i686" + X86_64_PREFIX="$ROOT_PATH/mingw-w64-x86_64" +fi + +CURRENT_STEP=1 + +# clean log file for execute() +mkdir -p "$ROOT_PATH" +rm -f "$LOG_FILE" +touch "$LOG_FILE" + + +if [ ! "$CACHED_SOURCES" ]; then + download_sources +else + if [ ! -f "$SRC_PATH/config.guess" ]; then + arg_error "no sources found, run with --keep-artifacts first" + fi +fi + + +BUILD=$(sh "$SRC_PATH/config.guess") + +change_dir "$SRC_PATH/gcc" + +execute "" "failed to download GCC dependencies" \ + ./contrib/download_prerequisites + +for i in mpc isl mpfr gmp; do + ln -s "$SRC_PATH/gcc/$i" "$SRC_PATH/binutils/$i" +done + +export CFLAGS="-g0" +export CXXFLAGS="-g0" +export LDFLAGS="-s" + +ADD_TO_PATH=() + +if [ "$BUILD_I586" ]; then + build i586 "$I586_PREFIX" + ADD_TO_PATH+=("'$I586_PREFIX/bin'") +fi + +if [ "$BUILD_I686" ]; then + build i686 "$I686_PREFIX" + ADD_TO_PATH+=("'$I686_PREFIX/bin'") +fi + +if [ "$BUILD_X86_64" ]; then + build x86_64 "$X86_64_PREFIX" + ADD_TO_PATH+=("'$X86_64_PREFIX/bin'") +fi + +if [ ! "$KEEP_ARTIFACTS" ]; then + remove_path "$SRC_PATH" + remove_path "$BLD_PATH" + remove_path "$LOG_FILE" +fi + +echo "complete, to use MinGW-w64 everywhere add these to your \$PATH:" +for add_to_path in "${ADD_TO_PATH[@]}"; do + printf "\t%s\n" "$add_to_path" +done + +exit 0 From c5617ce5d7270f7316c6d16c4d352edad97467e7 Mon Sep 17 00:00:00 2001 From: tjayz <90593277+tjayz@users.noreply.github.com> Date: Tue, 11 Mar 2025 12:11:04 -0400 Subject: [PATCH 03/26] Update cross_compile_ffmpeg.sh --- cross_compile_ffmpeg.sh | 557 +++++++++++++++++++++++++--------------- 1 file changed, 348 insertions(+), 209 deletions(-) diff --git a/cross_compile_ffmpeg.sh b/cross_compile_ffmpeg.sh index 0dd94528..70145ba6 100755 --- a/cross_compile_ffmpeg.sh +++ b/cross_compile_ffmpeg.sh @@ -59,7 +59,7 @@ check_missing_packages () { VENDOR="redhat" fi # zeranoe's build scripts use wget, though we don't here... - local check_packages=('ragel' 'curl' 'pkg-config' 'make' 'git' 'svn' 'gcc' 'autoconf' 'automake' 'yasm' 'cvs' 'flex' 'bison' 'makeinfo' 'g++' 'ed' 'pax' 'unzip' 'patch' 'wget' 'xz' 'nasm' 'gperf' 'autogen' 'bzip2' 'realpath' 'meson' 'clang' 'python') + local check_packages=('ragel' 'curl' 'pkg-config' 'make' 'git' 'svn' 'gcc' 'autoconf' 'automake' 'yasm' 'cvs' 'flex' 'bison' 'makeinfo' 'g++' 'ed' 'pax' 'unzip' 'patch' 'wget' 'xz' 'nasm' 'gperf' 'autogen' 'bzip2' 'realpath' 'meson' 'clang' 'python' 'bc' 'autopoint') # autoconf-archive is just for leptonica FWIW # I'm not actually sure if VENDOR being set to centos is a thing or not. On all the centos boxes I can test on it's not been set at all. # that being said, if it where set I would imagine it would be set to centos... And this contition will satisfy the "Is not initially set" @@ -86,7 +86,7 @@ check_missing_packages () { echo 'Install the missing packages before running this script.' determine_distro - apt_pkgs='subversion ragel curl texinfo g++ ed bison flex cvs yasm automake libtool autoconf gcc cmake git make pkg-config zlib1g-dev unzip pax nasm gperf autogen bzip2 autoconf-archive p7zip-full meson clang' + apt_pkgs='subversion ragel curl texinfo g++ ed bison flex cvs yasm automake libtool autoconf gcc cmake git make pkg-config zlib1g-dev unzip pax nasm gperf autogen bzip2 autoconf-archive p7zip-full meson clang wget bc tesseract-ocr-eng autopoint' [[ $DISTRO == "debian" ]] && apt_pkgs="$apt_pkgs libtool-bin ed" # extra for debian case "$DISTRO" in @@ -190,8 +190,8 @@ check_missing_packages () { exit 1 fi local meson_version=`meson --version` - if ! at_least_required_version "0.49.2" "${meson_version}"; then - echo "your meson version is too old $meson_version wanted 0.49.2" + if ! at_least_required_version "0.56.1" "${meson_version}"; then + echo "your meson version is too old $meson_version wanted 0.56.1" exit 1 fi # also check missing "setup" so it's early LOL @@ -343,15 +343,15 @@ install_cross_compiler() { echo "" # --disable-shared allows c++ to be distributed at all...which seemed necessary for some random dependency which happens to use/require c++... - local zeranoe_script_name=mingw-w64-build-r22.local - local zeranoe_script_options="--gcc-ver=10.2.0 --mingw-w64-ver=9.0.0 --default-configure --cpu-count=$gcc_cpu_count --disable-shared --clean-build --verbose --allow-overwrite --threads=winpthreads" # allow-overwrite to avoid some crufty prompts if I do rebuilds [or maybe should just nuke everything...] + local zeranoe_script_name=mingw-w64-build + local zeranoe_script_options="--gcc-branch=releases/gcc-14 --mingw-w64-branch=master --binutils-branch=binutils-2_44-branch" #--cached-sources" if [[ ($compiler_flavors == "win32" || $compiler_flavors == "multi") && ! -f ../$win32_gcc ]]; then echo "Building win32 cross compiler..." download_gcc_build_script $zeranoe_script_name if [[ `uname` =~ "5.1" ]]; then # Avoid using secure API functions for compatibility with msvcrt.dll on Windows XP. sed -i "s/ --enable-secure-api//" $zeranoe_script_name fi - CFLAGS=-O2 CXXFLAGS=-O2 nice ./$zeranoe_script_name $zeranoe_script_options --build-type=win32 || exit 1 + CFLAGS='-O2 -pipe' CXXFLAGS='-O2 -pipe' nice ./$zeranoe_script_name $zeranoe_script_options i686 || exit 1 # i586 option needs work to implement if [[ ! -f ../$win32_gcc ]]; then echo "Failure building 32 bit gcc? Recommend nuke sandbox (rm -rf sandbox) and start over..." exit 1 @@ -364,7 +364,7 @@ install_cross_compiler() { if [[ ($compiler_flavors == "win64" || $compiler_flavors == "multi") && ! -f ../$win64_gcc ]]; then echo "Building win64 x86_64 cross compiler..." download_gcc_build_script $zeranoe_script_name - CFLAGS=-O2 CXXFLAGS=-O2 nice ./$zeranoe_script_name $zeranoe_script_options --build-type=win64 || exit 1 + CFLAGS='-O2 -pipe' CXXFLAGS='-O2 -pipe' nice ./$zeranoe_script_name $zeranoe_script_options x86_64 || exit 1 if [[ ! -f ../$win64_gcc ]]; then echo "Failure building 64 bit gcc? Recommend nuke sandbox (rm -rf sandbox) and start over..." exit 1 @@ -798,16 +798,16 @@ build_bzip2() { } build_liblzma() { - download_and_unpack_file https://sourceforge.net/projects/lzmautils/files/xz-5.2.5.tar.xz - cd xz-5.2.5 + download_and_unpack_file https://sourceforge.net/projects/lzmautils/files/xz-5.6.4.tar.xz + cd xz-5.6.4 generic_configure "--disable-xz --disable-xzdec --disable-lzmadec --disable-lzmainfo --disable-scripts --disable-doc --disable-nls" do_make_and_make_install cd .. } build_zlib() { - download_and_unpack_file https://github.com/madler/zlib/archive/v1.2.11.tar.gz zlib-1.2.11 - cd zlib-1.2.11 + download_and_unpack_file https://github.com/madler/zlib/archive/v1.3.1.tar.gz zlib-1.3.1 + cd zlib-1.3.1 local make_options if [[ $compiler_flavors == "native" ]]; then export CFLAGS="$CFLAGS -fPIC" # For some reason glib needs this even though we build a static library @@ -825,13 +825,34 @@ build_zlib() { } build_iconv() { - download_and_unpack_file https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz - cd libiconv-1.16 + download_and_unpack_file https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.18.tar.gz + cd libiconv-1.18 generic_configure "--disable-nls" do_make "install-lib" # No need for 'do_make_install', because 'install-lib' already has install-instructions. cd .. } +build_brotli() { + do_git_checkout https://github.com/google/brotli.git brotli_git v1.0.9 # v1.1.0 static headache stay away + cd brotli_git + rm configure # strange useless configure already there + generic_configure + sed -i.bak -e "s/\(allow_undefined=\)yes/\1no/" libtool + do_make_and_make_install + sed -i.bak 's/Libs.*$/Libs: -L${libdir} -lbrotlicommon/' $PKG_CONFIG_PATH/libbrotlicommon.pc # remove rpaths not possible in conf + sed -i.bak 's/Libs.*$/Libs: -L${libdir} -lbrotlidec/' $PKG_CONFIG_PATH/libbrotlidec.pc + sed -i.bak 's/Libs.*$/Libs: -L${libdir} -lbrotlienc/' $PKG_CONFIG_PATH/libbrotlienc.pc + cd .. +} + +build_zstd() { + do_git_checkout https://github.com/facebook/zstd.git zstd_git v1.5.7 + cd zstd_git + do_cmake "-S build/cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DZSTD_BUILD_SHARED=OFF -DZSTD_USE_STATIC_RUNTIME=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH=OFF" + do_ninja_and_ninja_install + cd .. + } + build_sdl2() { download_and_unpack_file https://www.libsdl.org/release/SDL2-2.0.12.tar.gz cd SDL2-2.0.12 @@ -860,7 +881,6 @@ build_amd_amf_headers() { # or https://github.com/DeadSix27/AMF smaller # but even smaller! do_git_checkout https://github.com/GPUOpen-LibrariesAndSDKs/AMF.git amf_headers_git - cd amf_headers_git if [ ! -f "already_installed" ]; then #rm -rf "./Thirdparty" # ?? plus too chatty... @@ -902,9 +922,22 @@ build_intel_qsv_mfx() { # disableable via command line switch... cd .. } +build_libvpl () { + build_intel_qsv_mfx + do_git_checkout https://github.com/intel/libvpl.git libvpl_git f8d9891 # beyond this commit -lstdc++ no longer used and ffmpeg no longer sees it without it on the .pc + cd libvpl_git + if [ "$bits_target" = "32" ]; then + apply_patch "https://raw.githubusercontent.com/msys2/MINGW-packages/master/mingw-w64-libvpl/0003-cmake-fix-32bit-install.patch" -p1 + fi + do_cmake "-S . -B build -GNinja -DCMAKE_BUILD_TYPE=Release -DINSTALL_EXAMPLES=OFF -DINSTALL_DEV=ON -DBUILD_EXPERIMENTAL=OFF" + do_ninja_and_ninja_install + cd .. +} + build_libleptonica() { build_libjpeg_turbo - do_git_checkout https://github.com/DanBloomberg/leptonica.git leptonica_git 1.82.0 + generic_download_and_make_and_install https://sourceforge.net/projects/giflib/files/giflib-5.1.4.tar.gz + do_git_checkout https://github.com/DanBloomberg/leptonica.git leptonica_git cd leptonica_git export CPPFLAGS="-DOPJ_STATIC" generic_configure_make_install @@ -914,26 +947,36 @@ build_libleptonica() { build_libtiff() { build_libjpeg_turbo # auto uses it? - generic_download_and_make_and_install http://download.osgeo.org/libtiff/tiff-4.1.0.tar.gz + generic_download_and_make_and_install http://download.osgeo.org/libtiff/tiff-4.7.0.tar.gz sed -i.bak 's/-ltiff.*$/-ltiff -llzma -ljpeg -lz/' $PKG_CONFIG_PATH/libtiff-4.pc # static deps } -build_libtensorflow() { - do_git_checkout_and_make_install https://github.com/tensorflow/tensorflow.git +build_libtensorflow() { + if [[ ! -e Tensorflow && $compiler_flavors != "native" ]]; then + mkdir Tensorflow + cd Tensorflow + wget https://storage.googleapis.com/tensorflow/versions/2.18.0/libtensorflow-cpu-windows-x86_64.zip # tensorflow.dll required by ffmpeg to run + unzip -o libtensorflow-cpu-windows-x86_64.zip -d $mingw_w64_x86_64_prefix + rm libtensorflow-cpu-windows-x86_64.zip + cd .. + else echo "Tensorflow already installed" + fi } build_glib() { - export CPPFLAGS="$CPPFLAGS -DLIBXML_STATIC -liconv" # gettext build... - generic_download_and_make_and_install https://ftp.gnu.org/pub/gnu/gettext/gettext-0.21.tar.gz - reset_cppflags - generic_download_and_make_and_install https://github.com/libffi/libffi/releases/download/v3.3/libffi-3.3.tar.gz # also dep + generic_download_and_make_and_install https://ftp.gnu.org/pub/gnu/gettext/gettext-0.23.1.tar.gz + download_and_unpack_file https://github.com/libffi/libffi/releases/download/v3.4.7/libffi-3.4.7.tar.gz # also dep + cd libffi-3.4.7 + apply_patch file://$patch_dir/libffi.patch -p1 # WSL always fails here; fix >>> https://github.com/libffi/libffi/issues/552#issuecomment-766158672 patch harmless for non WSL + generic_configure_make_install + cd .. download_and_unpack_file https://gitlab.gnome.org/GNOME/glib/-/archive/2.64.3/glib-2.64.3.tar.gz cd glib-2.64.3 apply_patch file://$patch_dir/glib-2.64.3_mingw-static.patch -p1 - export CPPFLAGS="$CPPFLAGS -pthread -DGLIB_STATIC_COMPILATION" - export CXXFLAGS="$CFLAGS" # Not certain this is needed, but it doesn't hurt + export CPPFLAGS="$CPPFLAGS -DGLIB_STATIC_COMPILATION" + export CXXFLAGS="$CFLAGS -DGLIB_STATIC_COMPILATION" # Not certain this is needed, but it doesn't hurt export LDFLAGS="-L${mingw_w64_x86_64_prefix}/lib" # For some reason the frexp configure checks fail without this as math.h isn't found when cross-compiling; no negative impact for native builds - local meson_options="--prefix=${mingw_w64_x86_64_prefix} --libdir=${mingw_w64_x86_64_prefix}/lib --buildtype=release --default-library=static -Dinternal_pcre=true -Dforce_posix_threads=true . build" + local meson_options="setup --backend=ninja --prefix=${mingw_w64_x86_64_prefix} --libdir=${mingw_w64_x86_64_prefix}/lib --buildtype=release --default-library=static -Dinternal_pcre=true -Dforce_posix_threads=true . build" if [[ $compiler_flavors != "native" ]]; then get_local_meson_cross_with_propeties # Need to add flags to meson properties; otherwise ran into some issues meson_options+=" --cross-file=meson-cross.mingw.txt" @@ -941,9 +984,9 @@ build_glib() { do_meson "$meson_options" do_ninja_and_ninja_install if [[ $compiler_flavors == "native" ]]; then - sed -i.bak 's/-lglib-2.0.*$/-lglib-2.0 -pthread -lm -liconv/' $PKG_CONFIG_PATH/glib-2.0.pc + sed -i.bak 's/-lglib-2.0.*$/-lglib-2.0 -lm -liconv/' $PKG_CONFIG_PATH/glib-2.0.pc else - sed -i.bak 's/-lglib-2.0.*$/-lglib-2.0 -lintl -pthread -lws2_32 -lwinmm -lm -liconv -lole32/' $PKG_CONFIG_PATH/glib-2.0.pc + sed -i.bak 's/-lglib-2.0.*$/-lglib-2.0 -lintl -lws2_32 -lwinmm -lm -liconv -lole32/' $PKG_CONFIG_PATH/glib-2.0.pc fi reset_cppflags unset CXXFLAGS @@ -953,44 +996,122 @@ build_glib() { build_lensfun() { build_glib - do_git_checkout https://github.com/lensfun/lensfun.git lensfun_git v0.3.3 + do_git_checkout https://github.com/lensfun/lensfun.git lensfun_git cd lensfun_git - export CMAKE_STATIC_LINKER_FLAGS='-lws2_32 -pthread' - do_cmake "-DBUILD_STATIC=on -DCMAKE_INSTALL_DATAROOTDIR=$mingw_w64_x86_64_prefix" - do_make - do_make_install + export CPPFLAGS="$CPPFLAGS-DGLIB_STATIC_COMPILATION" + export CXXFLAGS="$CFLAGS -DGLIB_STATIC_COMPILATION" + do_cmake "-DBUILD_STATIC=on -DCMAKE_INSTALL_DATAROOTDIR=$mingw_w64_x86_64_prefix -DBUILD_TESTS=off -DBUILD_LENSTOOL=off -DBUILD_DOC=off -DINSTALL_HELPER_SCRIPTS=off -DINSTALL_PYTHON_MODULE=OFF" + do_make_and_make_install sed -i.bak 's/-llensfun/-llensfun -lstdc++/' "$PKG_CONFIG_PATH/lensfun.pc" - unset CMAKE_STATIC_LINKER_FLAGS + reset_cppflags + unset CXXFLAGS cd .. } +build_lz4 () { + download_and_unpack_file https://github.com/lz4/lz4/releases/download/v1.10.0/lz4-1.10.0.tar.gz + cd lz4-1.10.0 + do_cmake "-S build/cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Release -DBUILD_STATIC_LIBS=ON" + do_ninja_and_ninja_install + cd .. +} + + build_libarchive () { + build_lz4 + download_and_unpack_file https://github.com/libarchive/libarchive/releases/download/v3.7.7/libarchive-3.7.7.tar.gz + cd libarchive-3.7.7 + generic_configure "--with-nettle --bindir=$mingw_w64_x86_64_prefix/bin --without-mbedtls --without-iconv" # with-iconv = fail + do_make_install + sed -i.bak 's/Requires.private.*$/Requires.private:/' $PKG_CONFIG_PATH/libarchive.pc # tesseract only sees it like this... + cd .. +} + +build_flac () { + do_git_checkout https://github.com/xiph/flac.git flac_git + cd flac_git + do_cmake "-S . -B build -DCMAKE_BUILD_TYPE=Release -DINSTALL_MANPAGES=OFF -GNinja" + do_ninja_and_ninja_install + cd .. +} + +build_openmpt () { + build_flac + do_git_checkout https://github.com/OpenMPT/openmpt.git openmpt_git OpenMPT-1.30 + cd openmpt_git + do_make_and_make_install "PREFIX=$mingw_w64_x86_64_prefix CONFIG=mingw64-win64 EXESUFFIX=.exe SOSUFFIX=.dll SOSUFFIXWINDOWS=1 DYNLINK=0 SHARED_LIB=0 STATIC_LIB=1 + SHARED_SONAME=0 IS_CROSS=1 NO_ZLIB=0 NO_LTDL=0 NO_DL=0 NO_MPG123=0 NO_OGG=0 NO_VORBIS=0 NO_VORBISFILE=0 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL=0 + NO_SDL2=0 NO_SNDFILE=0 NO_FLAC=0 EXAMPLES=0 OPENMPT123=0 TEST=0" # OPENMPT123=1 >>> fail + sed -i.bak 's/Libs.private.*/& -lrpcrt4/' $PKG_CONFIG_PATH/libopenmpt.pc + cd .. +} + +build_libpsl () { + export CFLAGS="-DPSL_STATIC" + download_and_unpack_file https://github.com/rockdaboot/libpsl/releases/download/0.21.5/libpsl-0.21.5.tar.gz + cd libpsl-0.21.5 + generic_configure "--disable-nls --disable-rpath --disable-gtk-doc-html --disable-man --disable-runtime" + do_make_and_make_install + sed -i.bak "s/Libs: .*/& -lidn2 -lunistring -lws2_32 -liconv/" $PKG_CONFIG_PATH/libpsl.pc + reset_cflags + cd .. +} + +build_nghttp2 () { + export CFLAGS="-DNGHTTP2_STATICLIB" + download_and_unpack_file https://github.com/nghttp2/nghttp2/releases/download/v1.65.0/nghttp2-1.65.0.tar.gz + cd nghttp2-1.65.0 + do_cmake "-S . -B build -DENABLE_LIB_ONLY=1 -DBUILD_SHARED_LIBS=0 -DBUILD_STATIC_LIBS=1 -GNinja" + do_ninja_and_ninja_install + reset_cflags + cd .. +} + +build_curl () { + generic_download_and_make_and_install https://github.com/libssh2/libssh2/releases/download/libssh2-1.11.1/libssh2-1.11.1.tar.gz + build_libpsl + build_nghttp2 + local config_options="" + if [[ $compiler_flavors == "native" ]]; then + local config_options+="-DGNUTLS_INTERNAL_BUILD" + fi + export CPPFLAGS+="$CPPFLAGS -DNGHTTP2_STATICLIB -DPSL_STATIC $config_options" + do_git_checkout https://github.com/curl/curl.git curl_git curl-8_12_1 + cd curl_git + if [[ $compiler_flavors != "native" ]]; then + generic_configure "--with-brotli --enable-versioned-symbols --with-libssh2 --with-libpsl --with-libidn2 --disable-debug --enable-hsts --enable-sspi --with-schannel" + else + generic_configure "--with-gnutls --with-libssh2 --with-libpsl --with-libidn2 --disable-debug --enable-hsts --with-brotli --enable-versioned-symbols" # checking for gnutls_x509_crt_get_dn2 in -lgnutls... no ; untested on native + fi + do_make_and_make_install + reset_cppflags + cd .. +} + build_libtesseract() { - build_libtiff # no disable configure option for this in tesseract? odd... - build_libleptonica - do_git_checkout https://github.com/tesseract-ocr/tesseract.git tesseract_git 4.1.1 + build_libtiff + build_libleptonica + build_libarchive + do_git_checkout https://github.com/tesseract-ocr/tesseract.git tesseract_git cd tesseract_git - sed -i.bak 's/libcurl/libbcurl_disabled/g' configure.ac # --disable-curl hard disable, sometimes it's here but they link it wrong so punt... - if [[ $compiler_flavors != "native" ]]; then - apply_patch file://$patch_dir/tesseract-4.1.1_mingw-std-threads.patch - generic_configure "--disable-openmp" - do_make_and_make_install - sed -i.bak 's/-ltesseract.*$/-ltesseract -lstdc++ -lws2_32 -llept -ltiff -llzma -ljpeg -lz/' $PKG_CONFIG_PATH/tesseract.pc # why does it needs winsock? LOL plus all of libtiff's - else - generic_configure_make_install - sed -i.bak 's/-ltesseract.*$/-ltesseract -lstdc++ -llept -ltiff -llzma -ljpeg -lz -lgomp/' $PKG_CONFIG_PATH/tesseract.pc # see above, gomp for linux native + export CPPFLAGS="$CPPFLAGS -DCURL_STATICLIB" + generic_configure "--disable-openmp --with-archive --disable-graphics --disable-tessdata-prefix --with-curl LIBLEPT_HEADERSDIR=$mingw_w64_x86_64_prefix/include --datadir=$mingw_w64_x86_64_prefix/bin" + do_make_and_make_install + sed -i.bak 's/Requires.private.*/& lept libarchive liblzma libtiff-4 libcurl/' $PKG_CONFIG_PATH/tesseract.pc + sed -i 's/-ltesseract.*$/-ltesseract -lstdc++ -lws2_32 -lbz2 -lz -liconv -lpthread -lgdi32 -lcrypt32/' $PKG_CONFIG_PATH/tesseract.pc + if [[ ! -f $mingw_w64_x86_64_prefix/bin/tessdata/tessdata/eng.traineddata ]]; then + mkdir -p $mingw_w64_x86_64_prefix/bin/tessdata + cp -f /usr/share/tesseract-ocr/**/tessdata/eng.traineddata $mingw_w64_x86_64_prefix/bin/tessdata/ # needs work for some distros? fi + reset_cppflags cd .. } build_libzimg() { - do_git_checkout https://github.com/sekrit-twc/zimg.git zimg_git - cd zimg_git - generic_configure_make_install - cd .. + do_git_checkout_and_make_install https://github.com/sekrit-twc/zimg.git zimg_git } build_libopenjpeg() { - do_git_checkout https://github.com/uclouvain/openjpeg.git openjpeg_git v2.5.0 + do_git_checkout https://github.com/uclouvain/openjpeg.git openjpeg_git v2.5.3 cd openjpeg_git do_cmake_and_install "-DBUILD_CODEC=0" cd .. @@ -1009,22 +1130,18 @@ build_glew() { } build_glfw() { - download_and_unpack_file https://github.com/glfw/glfw/releases/download/3.3.2/glfw-3.3.2.zip glfw-3.3.2 - cd glfw-3.3.2 + download_and_unpack_file https://github.com/glfw/glfw/releases/download/3.4/glfw-3.4.zip glfw-3.4 + cd glfw-3.4 do_cmake_and_install cd .. } build_libpng() { - do_git_checkout https://github.com/glennrp/libpng.git - cd libpng_git - generic_configure - do_make_and_make_install - cd .. + do_git_checkout_and_make_install https://github.com/glennrp/libpng.git } build_libwebp() { - do_git_checkout https://chromium.googlesource.com/webm/libwebp.git libwebp_git v1.2.4 + do_git_checkout https://chromium.googlesource.com/webm/libwebp.git libwebp_git cd libwebp_git export LIBPNG_CONFIG="$mingw_w64_x86_64_prefix/bin/libpng-config --static" # LibPNG somehow doesn't get autodetected. generic_configure "--disable-wic" @@ -1039,7 +1156,6 @@ build_harfbuzz() { if [ ! -f harfbuzz_git/already_done_harf ]; then # Not done or new master, so build new_build=true fi - # basically gleaned from https://gist.github.com/roxlu/0108d45308a0434e27d4320396399153 build_freetype "--without-harfbuzz" $new_build # Check for initial or new freetype or force rebuild if needed local new_freetype=$? @@ -1071,10 +1187,10 @@ build_harfbuzz() { build_freetype() { local force_build=$2 local new_build=1 - if [[ ! -f freetype-2.10.4/already_done_freetype || $force_build = true ]]; then - download_and_unpack_file https://sourceforge.net/projects/freetype/files/freetype2/2.10.4/freetype-2.10.4.tar.xz - rm -f freetype-2.10.4/already* - cd freetype-2.10.4 + if [[ ! -f freetype-2.13.3/already_done_freetype || $force_build = true ]]; then + download_and_unpack_file https://sourceforge.net/projects/freetype/files/freetype2/2.13.3/freetype-2.13.3.tar.xz + rm -f freetype-2.13.3/already* + cd freetype-2.13.3 apply_patch file://$patch_dir/freetype2-crosscompiled-apinames.diff # src/tools/apinames.c gets crosscompiled and makes the compilation fail # harfbuzz autodetect :| generic_configure "--with-bzip2 $1" @@ -1087,43 +1203,32 @@ build_freetype() { } build_libxml2() { - download_and_unpack_file http://xmlsoft.org/sources/libxml2-2.9.10.tar.gz libxml2-2.9.10 - cd libxml2-2.9.10 + do_git_checkout https://gitlab.gnome.org/GNOME/libxml2.git libxml2_git + cd libxml2_git generic_configure "--with-ftp=no --with-http=no --with-python=no" do_make_and_make_install cd .. } build_libvmaf() { - do_git_checkout https://github.com/Netflix/vmaf.git vmaf_git v2.3.0 - cd vmaf_git - cd libvmaf - export CFLAGS="$CFLAGS -pthread" - export CXXFLAGS="$CFLAGS -pthread" - export LDFLAGS="-pthread" # Needed here too for some reason + do_git_checkout https://github.com/Netflix/vmaf.git vmaf_git # meson >= 0.56.1 + cd vmaf_git/libvmaf mkdir build - local meson_options="--prefix=${mingw_w64_x86_64_prefix} --libdir=${mingw_w64_x86_64_prefix}/lib --buildtype=release --default-library=static . build" + local meson_options="setup -Denable_float=true -Dbuilt_in_models=true -Denable_tests=false -Denable_docs=false --prefix=${mingw_w64_x86_64_prefix} + --libdir=${mingw_w64_x86_64_prefix}/lib --backend=ninja --buildtype=release --default-library=static . build" if [[ $compiler_flavors != "native" ]]; then get_local_meson_cross_with_propeties # Need to add flags to meson properties; otherwise ran into some issues meson_options+=" --cross-file=meson-cross.mingw.txt" fi do_meson "$meson_options" do_ninja_and_ninja_install - reset_cflags - unset CXXFLAGS - unset LDFLAGS - if [[ $compiler_flavors == "native" ]]; then # Can't find a way to not build these; meson is already set to --default-library=static but it still builds both - rm -f ${mingw_w64_x86_64_prefix}/lib/libvmaf.so - else - rm -f ${mingw_w64_x86_64_prefix}/lib/libvmaf.dll.a - fi - sed -i.bak "s/Libs: .*/& -lstdc++/" "$PKG_CONFIG_PATH/libvmaf.pc" # .pc is still broken + sed -i.bak "s/Libs: .*/& -lstdc++/" "$PKG_CONFIG_PATH/libvmaf.pc" cd ../.. } build_fontconfig() { - download_and_unpack_file https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.13.92.tar.xz - cd fontconfig-2.13.92 + download_and_unpack_file https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.16.0.tar.xz + cd fontconfig-2.16.0 #export CFLAGS= # compile fails with -march=sandybridge ... with mingw 4.0.6 at least ... generic_configure "--enable-iconv --enable-libxml2 --disable-docs --with-libiconv" # Use Libxml2 instead of Expat. do_make_and_make_install @@ -1132,8 +1237,8 @@ build_fontconfig() { } build_gmp() { - download_and_unpack_file https://ftp.gnu.org/pub/gnu/gmp/gmp-6.2.1.tar.xz - cd gmp-6.2.1 + download_and_unpack_file https://ftp.gnu.org/pub/gnu/gmp/gmp-6.3.0.tar.xz + cd gmp-6.3.0 export CC_FOR_BUILD=/usr/bin/gcc # WSL seems to need this.. export CPP_FOR_BUILD=usr/bin/cpp generic_configure "ABI=$bits_target" @@ -1146,7 +1251,7 @@ build_gmp() { build_librtmfp() { # needs some version of openssl... # build_openssl-1.0.2 # fails OS X - build_openssl-1.1.1 + build_openssl-1.1.1 # fails WSL do_git_checkout https://github.com/MonaSolutions/librtmfp.git cd librtmfp_git/include/Base do_git_checkout https://github.com/meganz/mingw-std-threads.git mingw-std-threads # our g++ apparently doesn't have std::mutex baked in...weird...this replaces it... @@ -1170,8 +1275,8 @@ build_librtmfp() { } build_libnettle() { - download_and_unpack_file https://ftp.gnu.org/gnu/nettle/nettle-3.6.tar.gz - cd nettle-3.6 + download_and_unpack_file https://ftp.gnu.org/gnu/nettle/nettle-3.10.tar.gz + cd nettle-3.10 local config_options="--disable-openssl --disable-documentation" # in case we have both gnutls and openssl, just use gnutls [except that gnutls uses this so...huh? if [[ $compiler_flavors == "native" ]]; then config_options+=" --libdir=${mingw_w64_x86_64_prefix}/lib" # Otherwise native builds install to /lib32 or /lib64 which gnutls doesn't find @@ -1182,27 +1287,31 @@ build_libnettle() { } build_unistring() { - generic_download_and_make_and_install https://ftp.gnu.org/gnu/libunistring/libunistring-0.9.10.tar.xz + generic_download_and_make_and_install https://ftp.gnu.org/gnu/libunistring/libunistring-1.3.tar.gz } build_libidn2() { - generic_download_and_make_and_install https://ftp.gnu.org/gnu/libidn/libidn2-2.3.0.tar.gz + download_and_unpack_file https://ftp.gnu.org/gnu/libidn/libidn2-2.3.7.tar.gz + cd libidn2-2.3.7 + generic_configure "--disable-doc --disable-rpath --disable-nls --disable-gtk-doc-html --disable-fast-install" + do_make_and_make_install + cd .. } build_gnutls() { - download_and_unpack_file https://www.gnupg.org/ftp/gcrypt/gnutls/v3.6/gnutls-3.6.15.tar.xz - cd gnutls-3.6.15 - # --disable-cxx don't need the c++ version, in an effort to cut down on size... XXXX test size difference... - # --enable-local-libopts to allow building with local autogen installed, - # --disable-guile is so that if it finds guile installed (cygwin did/does) it won't try and link/build to it and fail... - # libtasn1 is some dependency, appears provided is an option [see also build_libnettle] - # pks #11 hopefully we don't need kit - apply_patch file://$patch_dir/gnutls-windows8.patch -p1 # defaults to win 8 kind of, either this or setWINNT_VER :| - generic_configure "--disable-doc --disable-tools --disable-cxx --disable-tests --disable-gtk-doc-html --disable-libdane --disable-nls --enable-local-libopts --disable-guile --with-included-libtasn1 --without-p11-kit" + download_and_unpack_file https://www.gnupg.org/ftp/gcrypt/gnutls/v3.8/gnutls-3.8.9.tar.xz + cd gnutls-3.8.9 + CFLAGS="-Wno-int-conversion" + local config_options="" + if [[ $compiler_flavors != "native" ]]; then + local config_options+=" --disable-non-suiteb-curves" + fi + generic_configure "--disable-cxx --disable-doc --disable-tools --disable-tests --disable-nls --disable-rpath --disable-libdane --disable-gcc-warnings --disable-code-coverage + --without-p11-kit --with-idn --without-tpm --with-included-unistring --with-included-libtasn1 -disable-gtk-doc-html --with-brotli $config_options" do_make_and_make_install + reset_cflags if [[ $compiler_flavors != "native" ]]; then - # libsrt doesn't know how to use its pkg deps, so put them in as non-static deps :| https://github.com/Haivision/srt/issues/565 - sed -i.bak 's/-lgnutls.*/-lgnutls -lcrypt32 -lnettle -lhogweed -lgmp -lidn2 -liconv -lunistring/' "$PKG_CONFIG_PATH/gnutls.pc" + sed -i.bak 's/-lgnutls.*/-lgnutls -lcrypt32 -lnettle -lhogweed -lgmp -liconv -lunistring/' "$PKG_CONFIG_PATH/gnutls.pc" if [[ $OSTYPE == darwin* ]]; then sed -i.bak 's/-lgnutls.*/-lgnutls -framework Security -framework Foundation/' "$PKG_CONFIG_PATH/gnutls.pc" fi @@ -1309,10 +1418,7 @@ build_openssl-1.1.1() { } build_libogg() { - do_git_checkout https://github.com/xiph/ogg.git - cd ogg_git - generic_configure_make_install - cd .. + do_git_checkout_and_make_install https://github.com/xiph/ogg.git } build_libvorbis() { @@ -1378,15 +1484,14 @@ build_libsndfile() { build_mpg123() { do_svn_checkout svn://scm.orgis.org/mpg123/trunk mpg123_svn r5008 # avoid Think again failure cd mpg123_svn - generic_configure - do_make_and_make_install + generic_configure_make_install cd .. } build_lame() { - do_svn_checkout https://svn.code.sf.net/p/lame/svn/trunk/lame lame_svn + do_svn_checkout https://svn.code.sf.net/p/lame/svn/trunk/lame lame_svn r6525 # anything other than r6525 fails? cd lame_svn - sed -i.bak '1s/^\xEF\xBB\xBF//' libmp3lame/i386/nasm.h # Remove a UTF-8 BOM that breaks nasm if it's still there; should be fixed in trunk eventually https://sourceforge.net/p/lame/patches/81/ + # sed -i.bak '1s/^\xEF\xBB\xBF//' libmp3lame/i386/nasm.h # Remove a UTF-8 BOM that breaks nasm if it's still there; should be fixed in trunk eventually https://sourceforge.net/p/lame/patches/81/ generic_configure "--enable-nasm --enable-libmpg123" do_make_and_make_install cd .. @@ -1420,15 +1525,27 @@ local checkout_dir=fdk-aac_git cd .. } +build_AudioToolboxWrapper() { + do_git_checkout https://github.com/cynagenautes/AudioToolboxWrapper.git AudioToolboxWrapper_git + cd AudioToolboxWrapper_git + do_cmake "-S . -B build -GNinja" + do_ninja_and_ninja_install + # This wrapper library enables FFmpeg to use AudioToolbox codecs on Windows, with DLLs shipped with iTunes. + # i.e. You need to install iTunes, or be able to LoadLibrary("CoreAudioToolbox.dll"), for this to work. + # test ffmpeg build can use it [ffmpeg -f lavfi -i sine=1000 -c aac_at -f mp4 -y NUL] + cd .. +} + build_libopencore() { - generic_download_and_make_and_install https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-0.1.5.tar.gz + generic_download_and_make_and_install https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-0.1.6.tar.gz generic_download_and_make_and_install https://sourceforge.net/projects/opencore-amr/files/vo-amrwbenc/vo-amrwbenc-0.1.3.tar.gz } build_libilbc() { - do_git_checkout https://github.com/TimothyGu/libilbc.git libilbc_git v2.0.2 + do_git_checkout https://github.com/TimothyGu/libilbc.git libilbc_git cd libilbc_git - generic_configure_make_install + do_cmake "-S . -B build -GNinja" + do_ninja_and_ninja_install cd .. } @@ -1544,24 +1661,27 @@ build_libsoxr() { } build_libflite() { - # download_and_unpack_file http://www.festvox.org/flite/packed/flite-2.1/flite-2.1-release.tar.bz2 - # original link is not working so using a substitute - # from a trusted source - download_and_unpack_file http://deb.debian.org/debian/pool/main/f/flite/flite_2.1-release.orig.tar.bz2 flite-2.1-release - cd flite-2.1-release - apply_patch file://$patch_dir/flite-2.1.0_mingw-w64-fixes.patch - if [[ ! -f main/Makefile.bak ]]; then - sed -i.bak "s/cp -pd/cp -p/" main/Makefile # friendlier cp for OS X + do_git_checkout https://github.com/festvox/flite.git flite_git + cd flite_git + apply_patch "https://raw.githubusercontent.com/m-ab-s/mabs-patches/master/flite/0001-tools-find_sts_main.c-Include-windows.h-before-defin.patch" -p1 + # if [[ ! -f main/Makefile.bak ]]; then + # sed -i.bak "s/cp -pd/cp -p/" main/Makefile # friendlier cp for OS X + # fi + generic_configure "--bindir=$mingw_w64_x86_64_prefix/bin --with-audio=none" + do_make + # /usr/bin/install: cannot stat '../bin/flite': No such file or directory; should be looking for /bin/flite.exe etc... + if [[ ! -f $mingw_w64_x86_64_prefix/lib/libflite.a ]]; then + cp -rf ./build/x86_64-mingw32/lib/libflite* $mingw_w64_x86_64_prefix/lib/ + mkdir $mingw_w64_x86_64_prefix/include/flite && cp -rf ./include/* $mingw_w64_x86_64_prefix/include/flite + # cp -rf ./bin/*.exe $mingw_w64_x86_64_prefix/bin fi - generic_configure - do_make_and_make_install cd .. } build_libsnappy() { - do_git_checkout https://github.com/google/snappy.git snappy_git 1.1.8 # got weird failure once + do_git_checkout https://github.com/google/snappy.git snappy_git # got weird failure once 1.1.8 cd snappy_git - do_cmake_and_install "-DBUILD_BINARY=OFF -DCMAKE_BUILD_TYPE=Release -DSNAPPY_BUILD_TESTS=OFF" # extra params from deadsix27 and from new cMakeLists.txt content + do_cmake_and_install "-DBUILD_BINARY=OFF -DCMAKE_BUILD_TYPE=Release -DSNAPPY_BUILD_TESTS=OFF -DSNAPPY_BUILD_BENCHMARKS=OFF" # extra params from deadsix27 and from new cMakeLists.txt content rm -f $mingw_w64_x86_64_prefix/lib/libsnappy.dll.a # unintall shared :| cd .. } @@ -1583,8 +1703,8 @@ build_vamp_plugin() { } build_fftw() { - download_and_unpack_file http://fftw.org/fftw-3.3.8.tar.gz - cd fftw-3.3.8 + download_and_unpack_file http://fftw.org/fftw-3.3.10.tar.gz + cd fftw-3.3.10 generic_configure "--disable-doc" do_make_and_make_install cd .. @@ -1592,11 +1712,7 @@ build_fftw() { build_libsamplerate() { # I think this didn't work with ubuntu 14.04 [too old automake or some odd] :| - do_git_checkout https://github.com/erikd/libsamplerate.git - cd libsamplerate_git - generic_configure - do_make_and_make_install - cd .. + do_git_checkout_and_make_install https://github.com/erikd/libsamplerate.git # but OS X can't use 0.1.9 :| # rubberband can use this, but uses speex bundled by default [any difference? who knows!] } @@ -1650,20 +1766,22 @@ build_svt-hevc() { build_svt-vp9() { do_git_checkout https://github.com/OpenVisualCloud/SVT-VP9.git - cd SVT-VP9_git - cd Build + cd SVT-VP9_git/Build do_cmake_from_build_dir .. "-DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_PROCESSOR=AMD64" do_make_and_make_install cd ../.. } build_svt-av1() { - do_git_checkout https://gitlab.com/AOMediaCodec/SVT-AV1.git + do_git_checkout https://github.com/pytorch/cpuinfo.git + cd cpuinfo_git + do_cmake_and_install " -DCMAKE_SYSTEM_PROCESSOR=AMD64" # builds included cpuinfo bugged, save time do this + cd .. + do_git_checkout https://gitlab.com/AOMediaCodec/SVT-AV1.git SVT-AV1_git cd SVT-AV1_git - cd Build - do_cmake_from_build_dir .. "-DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_PROCESSOR=AMD64" - do_make_and_make_install - cd ../.. + do_cmake "-S . -B build -GNinja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DUSE_CPUINFO=SYSTEM" # -DSVT_AV1_LTO=OFF might be needed + do_ninja_and_ninja_install + cd .. } build_vidstab() { @@ -1716,22 +1834,16 @@ build_libdecklink() { } build_zvbi() { - download_and_unpack_file https://sourceforge.net/projects/zapping/files/zvbi/0.2.35/zvbi-0.2.35.tar.bz2 - cd zvbi-0.2.35 - if [[ $compiler_flavors != "native" ]]; then - apply_patch file://$patch_dir/zvbi-win32.patch - fi - apply_patch file://$patch_dir/zvbi-no-contrib.diff # weird issues with some stuff in contrib... - apply_patch file://$patch_dir/zvbi-aarch64.patch - generic_configure " --disable-dvb --disable-bktr --disable-proxy --disable-nls --without-doxygen --without-libiconv-prefix" - # Without '--without-libiconv-prefix' 'configure' would otherwise search for and only accept a shared Libiconv library. + do_git_checkout https://github.com/zapping-vbi/zvbi.git zvbi_git + cd zvbi_git + generic_configure "--disable-dvb --disable-bktr --disable-proxy --disable-nls --without-doxygen --disable-examples --disable-tests --without-libiconv-prefix" do_make_and_make_install cd .. } build_fribidi() { - download_and_unpack_file https://github.com/fribidi/fribidi/releases/download/v1.0.9/fribidi-1.0.9.tar.xz # Get c2man errors building from repo - cd fribidi-1.0.9 + download_and_unpack_file https://github.com/fribidi/fribidi/releases/download/v1.0.16/fribidi-1.0.16.tar.xz # Get c2man errors building from repo + cd fribidi-1.0.16 generic_configure "--disable-debug --disable-deprecated --disable-docs" do_make_and_make_install cd .. @@ -1739,8 +1851,8 @@ build_fribidi() { build_libsrt() { # do_git_checkout https://github.com/Haivision/srt.git # might be able to use these days...? - download_and_unpack_file https://github.com/Haivision/srt/archive/v1.4.1.tar.gz srt-1.4.1 - cd srt-1.4.1 + download_and_unpack_file https://github.com/Haivision/srt/archive/v1.5.4.tar.gz srt-1.5.4 + cd srt-1.5.4 if [[ $compiler_flavors != "native" ]]; then apply_patch file://$patch_dir/srt.app.patch -p1 fi @@ -1764,28 +1876,25 @@ build_vulkan() { } build_libaribb24() { - do_git_checkout https://github.com/nkoriyama/aribb24 - cd aribb24 - generic_configure_make_install - cd .. + do_git_checkout_and_make_install https://github.com/nkoriyama/aribb24 } build_libaribcaption() { do_git_checkout https://github.com/xqq/libaribcaption - cd libaribcaption - mkdir build - cd build + mkdir libaribcaption/build + cd libaribcaption/build do_cmake_from_build_dir .. "-DCMAKE_BUILD_TYPE=Release" do_make_and_make_install cd ../.. } build_libxavs() { - do_svn_checkout https://svn.code.sf.net/p/xavs/code/trunk xavs_svn - cd xavs_svn + do_git_checkout https://github.com/Distrotech/xavs.git xavs_git + cd xavs_git if [[ ! -f Makefile.bak ]]; then sed -i.bak "s/O4/O2/" configure # Change CFLAGS. fi + apply_patch https://patch-diff.githubusercontent.com/raw/Distrotech/xavs/pull/1.patch -p1 do_configure "--host=$host_target --prefix=$mingw_w64_x86_64_prefix --cross-prefix=$cross_prefix" # see https://github.com/rdp/ffmpeg-windows-build-helpers/issues/3 do_make_and_make_install "$make_prefix_options" rm -f NUL # cygwin causes windows explorer to not be able to delete this folder if it has this oddly named file in it... @@ -1793,10 +1902,14 @@ build_libxavs() { } build_libxavs2() { - do_git_checkout https://github.com/pkuvcl/xavs2.git - cd xavs2_git/build/linux - do_configure "--cross-prefix=$cross_prefix --host=$host_target --prefix=$mingw_w64_x86_64_prefix --enable-pic" - do_make_and_make_install + do_git_checkout https://github.com/pkuvcl/xavs2.git xavs2_git + cd xavs2_git + if [ ! -e $PWD/build/linux/xavs2.exe ]; then + curl https://github.com/pkuvcl/xavs2/compare/master...1480c1:xavs2:gcc14/pointerconversion.patch | git apply -v + fi + cd build/linux + do_configure "--cross-prefix=$cross_prefix --host=$host_target --prefix=$mingw_w64_x86_64_prefix --enable-strip" # --enable-pic + do_make_and_make_install cd ../../.. } @@ -1824,7 +1937,7 @@ build_libxvid() { build_libvpx() { do_git_checkout https://chromium.googlesource.com/webm/libvpx.git libvpx_git "origin/main" cd libvpx_git - apply_patch file://$patch_dir/vpx_160_semaphore.patch -p1 # perhaps someday can remove this after 1.6.0 or mingw fixes it LOL + # apply_patch file://$patch_dir/vpx_160_semaphore.patch -p1 # perhaps someday can remove this after 1.6.0 or mingw fixes it LOL if [[ $compiler_flavors == "native" ]]; then local config_options="" elif [[ "$bits_target" = "32" ]]; then @@ -1863,7 +1976,7 @@ build_dav1d() { apply_patch file://$patch_dir/david_no_asm.patch -p1 # XXX report fi cpu_count=1 # XXX report :| - local meson_options="--prefix=${mingw_w64_x86_64_prefix} --libdir=${mingw_w64_x86_64_prefix}/lib --buildtype=release --default-library=static . build" + local meson_options="setup --prefix=${mingw_w64_x86_64_prefix} --libdir=${mingw_w64_x86_64_prefix}/lib --buildtype=release --default-library=static . build" if [[ $compiler_flavors != "native" ]]; then meson_options+=" --cross-file=${top_dir}/meson-cross.mingw.txt" fi @@ -1883,6 +1996,22 @@ build_avisynth() { cd ../.. } +build_libvvenc() { + do_git_checkout https://github.com/fraunhoferhhi/vvenc.git libvvenc_git + cd libvvenc_git + do_cmake "-S . -B build -DCMAKE_BUILD_TYPE=Release -DVVENC_ENABLE_LINK_TIME_OPT=OFF -DVVENC_INSTALL_FULLFEATURE_APP=ON -GNinja" + do_ninja_and_ninja_install + cd .. +} + +build_libvvdec() { + do_git_checkout https://github.com/fraunhoferhhi/vvdec.git libvvdec_git + cd libvvdec_git + do_cmake "-S . -B build -DCMAKE_BUILD_TYPE=Release -DVVDEC_ENABLE_LINK_TIME_OPT=OFF -DVVDEC_INSTALL_VVDECAPP=ON -GNinja" + do_ninja_and_ninja_install + cd .. +} + build_libx265() { local checkout_dir=x265 local remote="https://bitbucket.org/multicoreware/x265_git" @@ -1960,7 +2089,7 @@ EOF } build_libopenh264() { - do_git_checkout "https://github.com/cisco/openh264.git" openh264_git 75b9fcd2669c75a99791 # wels/codec_api.h weirdness + do_git_checkout "https://github.com/cisco/openh264.git" openh264_git v2.6.0 #75b9fcd2669c75a99791 # wels/codec_api.h weirdness cd openh264_git sed -i.bak "s/_M_X64/_M_DISABLED_X64/" codec/encoder/core/inc/param_svc.h # for 64 bit, avoid missing _set_FMA3_enable, it needed to link against msvcrt120 to get this or something weird? if [[ $bits_target == 32 ]]; then @@ -2109,14 +2238,6 @@ build_lua() { cd .. } -build_libcurl() { - download_and_unpack_file https://curl.haxx.se/download/curl-7.86.0.tar.gz - cd curl-7.86.0 - generic_configure "--without-ssl" # XXX use --with-gnutls but it needed pkg-config or some odd? - do_make_and_make_install - cd .. -} - build_libhdhomerun() { exit 1 # still broken unfortunately, for cross compile :| download_and_unpack_file https://download.silicondust.com/hdhomerun/libhdhomerun_20150826.tgz libhdhomerun @@ -2127,7 +2248,7 @@ build_libhdhomerun() { build_dvbtee_app() { build_iconv # said it needed it - build_libcurl # it "can use this" so why not + build_curl # it "can use this" so why not # build_libhdhomerun # broken but possible dependency apparently :| do_git_checkout https://github.com/mkrufky/libdvbtee.git libdvbtee_git cd libdvbtee_git @@ -2426,50 +2547,59 @@ build_ffmpeg() { init_options+=" --disable-schannel" # Fix WinXP incompatibility by disabling Microsoft's Secure Channel, because Windows XP doesn't support TLS 1.1 and 1.2, but with GnuTLS or OpenSSL it does. XP compat! fi + # alphabetized :) config_options="$init_options" - config_options+=" --enable-libcaca" - config_options+=" --enable-gray" - config_options+=" --enable-libtesseract" + config_options+=" --enable-avx" + config_options+=" --enable-avx2" + config_options+=" --enable-cuda-llvm" config_options+=" --enable-fontconfig" config_options+=" --enable-gmp" - config_options+=" --enable-libass" + config_options+=" --enable-gnutls" + config_options+=" --enable-gray" + config_options+=" --enable-libass" config_options+=" --enable-libbluray" config_options+=" --enable-libbs2b" + config_options+=" --enable-libcaca" + config_options+=" --enable-libdav1d" config_options+=" --enable-libflite" config_options+=" --enable-libfreetype" config_options+=" --enable-libfribidi" config_options+=" --enable-libgme" - config_options+=" --enable-libgsm" + config_options+=" --enable-libgsm" + config_options+=" --enable-libharfbuzz" config_options+=" --enable-libilbc" + config_options+=" --enable-liblensfun" config_options+=" --enable-libmodplug" config_options+=" --enable-libmp3lame" + config_options+=" --enable-libmysofa" config_options+=" --enable-libopencore-amrnb" config_options+=" --enable-libopencore-amrwb" + config_options+=" --enable-libopenh264" + config_options+=" --enable-libopenjpeg" + config_options+=" --enable-libopenmpt" config_options+=" --enable-libopus" config_options+=" --enable-libsnappy" config_options+=" --enable-libsoxr" config_options+=" --enable-libspeex" + config_options+=" --enable-libsrt" + config_options+=" --enable-libtensorflow" + config_options+=" --enable-libtesseract" config_options+=" --enable-libtheora" config_options+=" --enable-libtwolame" + config_options+=" --enable-libvmaf" config_options+=" --enable-libvo-amrwbenc" config_options+=" --enable-libvorbis" + config_options+=" --enable-libvvdec" && apply_patch "https://raw.githubusercontent.com/wiki/fraunhoferhhi/vvdec/data/patch/v6-0001-avcodec-add-external-dec-libvvdec-for-H266-VVC.patch" -p1 + config_options+=" --enable-libvvenc" config_options+=" --enable-libwebp" - config_options+=" --enable-libzimg" - config_options+=" --enable-libzvbi" - config_options+=" --enable-libmysofa" - config_options+=" --enable-libopenjpeg" - config_options+=" --enable-libopenh264" - config_options+=" --enable-libvmaf" - config_options+=" --enable-libsrt" config_options+=" --enable-libxml2" + config_options+=" --enable-libzvbi" + config_options+=" --enable-libzimg" config_options+=" --enable-opengl" - config_options+=" --enable-libdav1d" - config_options+=" --enable-gnutls" - if [[ $OSTYPE != darwin* ]]; then config_options+=" --enable-vulkan" fi - + # config_options+=" --enable-librtmfp" # not working openssl fails if [[ "$bits_target" != "32" ]]; then if [[ $build_svt_hevc = y ]]; then # SVT-HEVC @@ -2478,7 +2608,7 @@ build_ffmpeg() { if [[ $ffmpeg_git_checkout_version == *"n4.4"* ]] || [[ $ffmpeg_git_checkout_version == *"n4.3"* ]] || [[ $ffmpeg_git_checkout_version == *"n4.2"* ]]; then git apply "$work_dir/SVT-HEVC_git/ffmpeg_plugin/n4.4-0001-lavc-svt_hevc-add-libsvt-hevc-encoder-wrapper.patch" git apply "$patch_dir/SVT-HEVC-0002-doc-Add-libsvt_hevc-encoder-docs.patch" # upstream patch does not apply on current ffmpeg master - elif [[ $ffmpeg_git_checkout_version == *"n4.1"* ]] || [[ $ffmpeg_git_checkout_version == *"n3"* ]] || [[ $ffmpeg_git_checkout_version == *"n2"* ]]; then + elif [[ $ffmpeg_git_checkout_version == *"n4.1"* ]] || [[ $ffmpeg_git_checkout_version == *"n3"* ]] || [[ $ffmpeg_git_checkout_version == *"n2"* ]]; then : # too old... else # newer: @@ -2535,13 +2665,13 @@ build_ffmpeg() { config_options+=" --enable-amf" # This is actually autodetected but for consistency.. we might as well set it. fi - if [[ $build_intel_qsv = y && $compiler_flavors != "native" ]]; then # Broken for native builds right now: https://github.com/lu-zero/mfx_dispatch/issues/71 - config_options+=" --enable-libmfx" + if [[ $build_intel_qsv = y && $compiler_flavors != "native" ]]; then + config_options+=" --enable-libvpl" else - config_options+=" --disable-libmfx" + config_options+=" --disable-libvpl" fi - if [[ $ffmpeg_git_checkout_version != *"n6.0"* ]] && [[ $ffmpeg_git_checkout_version != *"n5"* ]] && [[ $ffmpeg_git_checkout_version != *"n4"* ]] && [[ $ffmpeg_git_checkout_version != *"n3"* ]] && [[ $ffmpeg_git_checkout_version != *"n2"* ]]; then + if [[ $ffmpeg_git_checkout_version != *"n6.0"* ]] && [[ $ffmpeg_git_checkout_version != *"n5"* ]] && [[ $ffmpeg_git_checkout_version != *"n4"* ]] && [[ $ffmpeg_git_checkout_version != *"n3"* ]] && [[ $ffmpeg_git_checkout_version != *"n2"* ]]; then # Disable libaribcatption on old versions config_options+=" --enable-libaribcaption" # libaribcatption (MIT licensed) fi @@ -2572,7 +2702,9 @@ build_ffmpeg() { if [[ "$non_free" = "y" ]]; then config_options+=" --enable-nonfree --enable-libfdk-aac" - + if [[ $OSTYPE != darwin* ]]; then + config_options+=" --enable-audiotoolbox --disable-outdev=audiotoolbox --extra-libs=-lAudioToolboxWrapper" && apply_patch file://$patch_dir/AudioToolBox.patch -p1 + fi if [[ $compiler_flavors != "native" ]]; then config_options+=" --enable-decklink" # Error finding rpc.h in native builds even if it's available fi @@ -2702,7 +2834,6 @@ build_ffmpeg_dependencies() { if [[ $host_target != 'i686-w64-mingw32' ]]; then build_libxavs2 fi - build_meson_cross build_mingw_std_threads build_zlib # Zlib in FFmpeg is autodetected. @@ -2714,8 +2845,8 @@ build_ffmpeg_dependencies() { if [[ $build_amd_amf = y ]]; then build_amd_amf_headers fi - if [[ $build_intel_qsv = y && $compiler_flavors != "native" ]]; then # Broken for native builds right now: https://github.com/lu-zero/mfx_dispatch/issues/71 - build_intel_qsv_mfx + if [[ $build_intel_qsv = y && $compiler_flavors != "native" ]]; then + build_libvpl fi build_nv_headers build_libzimg # Uses dlfcn. @@ -2735,7 +2866,10 @@ build_ffmpeg_dependencies() { build_libnettle # Needs gmp >= 3.0. Uses dlfcn. build_unistring build_libidn2 # needs iconv and unistring + build_zstd + build_brotli build_gnutls # Needs nettle >= 3.1, hogweed (nettle) >= 3.1. Uses libidn2, unistring, zlib, and dlfcn. + build_curl #if [[ "$non_free" = "y" ]]; then # build_openssl-1.0.2 # Nonfree alternative to GnuTLS. 'build_openssl-1.0.2 "dllonly"' to build shared libraries only. # build_openssl-1.1.1 # Nonfree alternative to GnuTLS. Can't be used with LibRTMP. 'build_openssl-1.1.1 "dllonly"' to build shared libraries only. @@ -2750,6 +2884,7 @@ build_ffmpeg_dependencies() { build_mpg123 build_lame # Uses dlfcn, mpg123 build_twolame # Uses libsndfile >= 1.0.0 and dlfcn. + build_openmpt build_libopencore # Uses dlfcn. build_libilbc # Uses dlfcn. build_libmodplug # Uses dlfcn. @@ -2778,6 +2913,7 @@ build_ffmpeg_dependencies() { build_libmysofa # Needed for FFmpeg's SOFAlizer filter (https://ffmpeg.org/ffmpeg-filters.html#sofalizer). Uses dlfcn. if [[ "$non_free" = "y" ]]; then build_fdk-aac # Uses dlfcn. + build_AudioToolboxWrapper # This wrapper library enables FFmpeg to use AudioToolbox codecs on Windows, with DLLs shipped with iTunes. if [[ $compiler_flavors != "native" ]]; then build_libdecklink # Error finding rpc.h in native builds even if it's available fi @@ -2788,14 +2924,14 @@ build_ffmpeg_dependencies() { build_libxvid # FFmpeg now has native support, but libxvid still provides a better image. build_libsrt # requires gnutls, mingw-std-threads - if [[ $ffmpeg_git_checkout_version != *"n6.0"* ]] && [[ $ffmpeg_git_checkout_version != *"n5"* ]] && [[ $ffmpeg_git_checkout_version != *"n4"* ]] && [[ $ffmpeg_git_checkout_version != *"n3"* ]] && [[ $ffmpeg_git_checkout_version != *"n2"* ]]; then - # Disable libaribcatption on old versions + if [[ $ffmpeg_git_checkout_version != *"n6.0"* ]] && [[ $ffmpeg_git_checkout_version != *"n5"* ]] && [[ $ffmpeg_git_checkout_version != *"n4"* ]] && [[ $ffmpeg_git_checkout_version != *"n3"* ]] && [[ $ffmpeg_git_checkout_version != *"n2"* ]]; then +# Disable libaribcatption on old versions build_libaribcaption fi build_libaribb24 build_libtesseract build_lensfun # requires png, zlib, iconv - # build_libtensorflow # broken + build_libtensorflow # requires .dll build_libvpx build_libx265 build_libopenh264 @@ -2805,6 +2941,8 @@ build_ffmpeg_dependencies() { build_vulkan fi build_avisynth + build_libvvenc + build_libvvdec build_libx264 # at bottom as it might internally build a copy of ffmpeg (which needs all the above deps... } @@ -2874,13 +3012,14 @@ build_lsw=n # To build x264 with L-Smash-Works. build_dependencies=y git_get_latest=y prefer_stable=y # Only for x264 and x265. -build_intel_qsv=y # note: not windows xp friendly! +build_intel_qsv=y # libvpl build_amd_amf=y disable_nonfree=y # comment out to force user y/n selection -original_cflags='-mtune=generic -O3' # high compatible by default, see #219, some other good options are listed below, or you could use -march=native to target your local box: -original_cppflags='-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0' # Needed for mingw-w64 7 as FORTIFY_SOURCE is now partially implemented, but not actually working +original_cflags='-mtune=generic -O3 -pipe' # high compatible by default, see #219, some other good options are listed below, or you could use -march=native to target your local box: +original_cppflags='-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3' # Needed for mingw-w64 7 as FORTIFY_SOURCE is now partially implemented, but not actually working # if you specify a march it needs to first so x264's configure will use it :| [ is that still the case ?] - +# original_cflags='-mtune=generic -O3' +# original_cflags='-march=native -mtune=znver2 -O3 -pipe' #flags=$(cat /proc/cpuinfo | grep flags) #if [[ $flags =~ "ssse3" ]]; then # See https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html, https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html and https://stackoverflow.com/questions/19689014/gcc-difference-between-o3-and-os. # original_cflags='-march=core2 -O2' From bc090590bcf867edaf96544381b3bef9c1b3162b Mon Sep 17 00:00:00 2001 From: tjayz <90593277+tjayz@users.noreply.github.com> Date: Tue, 11 Mar 2025 12:12:23 -0400 Subject: [PATCH 04/26] Update cross_compile_ffmpeg.sh From bc830b100e8eacc4d9ad6f5ffd6705530d920768 Mon Sep 17 00:00:00 2001 From: tjayz <90593277+tjayz@users.noreply.github.com> Date: Tue, 11 Mar 2025 21:17:27 -0400 Subject: [PATCH 05/26] Update cross_compile_ffmpeg.sh --- cross_compile_ffmpeg.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/cross_compile_ffmpeg.sh b/cross_compile_ffmpeg.sh index 70145ba6..4ed36a48 100755 --- a/cross_compile_ffmpeg.sh +++ b/cross_compile_ffmpeg.sh @@ -2549,8 +2549,6 @@ build_ffmpeg() { fi # alphabetized :) config_options="$init_options" - config_options+=" --enable-avx" - config_options+=" --enable-avx2" config_options+=" --enable-cuda-llvm" config_options+=" --enable-fontconfig" config_options+=" --enable-gmp" @@ -2578,6 +2576,7 @@ build_ffmpeg() { config_options+=" --enable-libopenjpeg" config_options+=" --enable-libopenmpt" config_options+=" --enable-libopus" + # config_options+=" --enable-librtmfp" # not working openssl fails config_options+=" --enable-libsnappy" config_options+=" --enable-libsoxr" config_options+=" --enable-libspeex" @@ -2599,7 +2598,6 @@ build_ffmpeg() { if [[ $OSTYPE != darwin* ]]; then config_options+=" --enable-vulkan" fi - # config_options+=" --enable-librtmfp" # not working openssl fails if [[ "$bits_target" != "32" ]]; then if [[ $build_svt_hevc = y ]]; then # SVT-HEVC @@ -2925,7 +2923,7 @@ build_ffmpeg_dependencies() { build_libxvid # FFmpeg now has native support, but libxvid still provides a better image. build_libsrt # requires gnutls, mingw-std-threads if [[ $ffmpeg_git_checkout_version != *"n6.0"* ]] && [[ $ffmpeg_git_checkout_version != *"n5"* ]] && [[ $ffmpeg_git_checkout_version != *"n4"* ]] && [[ $ffmpeg_git_checkout_version != *"n3"* ]] && [[ $ffmpeg_git_checkout_version != *"n2"* ]]; then -# Disable libaribcatption on old versions + # Disable libaribcatption on old versions build_libaribcaption fi build_libaribb24 @@ -3018,7 +3016,6 @@ disable_nonfree=y # comment out to force user y/n selection original_cflags='-mtune=generic -O3 -pipe' # high compatible by default, see #219, some other good options are listed below, or you could use -march=native to target your local box: original_cppflags='-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3' # Needed for mingw-w64 7 as FORTIFY_SOURCE is now partially implemented, but not actually working # if you specify a march it needs to first so x264's configure will use it :| [ is that still the case ?] -# original_cflags='-mtune=generic -O3' # original_cflags='-march=native -mtune=znver2 -O3 -pipe' #flags=$(cat /proc/cpuinfo | grep flags) #if [[ $flags =~ "ssse3" ]]; then # See https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html, https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html and https://stackoverflow.com/questions/19689014/gcc-difference-between-o3-and-os. From 8510ff482883dbf865e1ab08441521c11c840895 Mon Sep 17 00:00:00 2001 From: tjayz <90593277+tjayz@users.noreply.github.com> Date: Sat, 22 Mar 2025 13:02:57 -0400 Subject: [PATCH 06/26] Update cross_compile_ffmpeg.sh removed meson requirement by adding activate_meson function updated build_meson_cross Added if statement to incorportate CMAKE_SYSTEM_PROCESSOR into do_cmake Modified unused gerneric_meson to be utilized by native Simplified fontconfig and harbuzz code by using meson Added libplacebo vulkan-loader spriv-cross unwind xxhash libdovi shaderc Commented out old code to patch ffmpeg for libmfx --- cross_compile_ffmpeg.sh | 481 +++++++++++++++++++++++++--------------- 1 file changed, 303 insertions(+), 178 deletions(-) diff --git a/cross_compile_ffmpeg.sh b/cross_compile_ffmpeg.sh index 4ed36a48..d56be735 100755 --- a/cross_compile_ffmpeg.sh +++ b/cross_compile_ffmpeg.sh @@ -59,7 +59,7 @@ check_missing_packages () { VENDOR="redhat" fi # zeranoe's build scripts use wget, though we don't here... - local check_packages=('ragel' 'curl' 'pkg-config' 'make' 'git' 'svn' 'gcc' 'autoconf' 'automake' 'yasm' 'cvs' 'flex' 'bison' 'makeinfo' 'g++' 'ed' 'pax' 'unzip' 'patch' 'wget' 'xz' 'nasm' 'gperf' 'autogen' 'bzip2' 'realpath' 'meson' 'clang' 'python' 'bc' 'autopoint') + local check_packages=('ragel' 'curl' 'pkg-config' 'make' 'git' 'svn' 'gcc' 'autoconf' 'automake' 'yasm' 'cvs' 'flex' 'bison' 'makeinfo' 'g++' 'ed' 'pax' 'unzip' 'patch' 'wget' 'xz' 'nasm' 'gperf' 'autogen' 'bzip2' 'realpath' 'clang' 'python' 'bc' 'autopoint') # autoconf-archive is just for leptonica FWIW # I'm not actually sure if VENDOR being set to centos is a thing or not. On all the centos boxes I can test on it's not been set at all. # that being said, if it where set I would imagine it would be set to centos... And this contition will satisfy the "Is not initially set" @@ -86,7 +86,7 @@ check_missing_packages () { echo 'Install the missing packages before running this script.' determine_distro - apt_pkgs='subversion ragel curl texinfo g++ ed bison flex cvs yasm automake libtool autoconf gcc cmake git make pkg-config zlib1g-dev unzip pax nasm gperf autogen bzip2 autoconf-archive p7zip-full meson clang wget bc tesseract-ocr-eng autopoint' + apt_pkgs='subversion ragel curl texinfo g++ ed bison flex cvs yasm automake libtool autoconf gcc cmake git make pkg-config zlib1g-dev unzip pax nasm gperf autogen bzip2 autoconf-archive p7zip-full clang wget bc tesseract-ocr-eng autopoint python3-full' [[ $DISTRO == "debian" ]] && apt_pkgs="$apt_pkgs libtool-bin ed" # extra for debian case "$DISTRO" in @@ -99,6 +99,9 @@ check_missing_packages () { fi if at_least_required_version "20.04" "$ubuntu_ver"; then apt_pkgs="$apt_pkgs python-is-python3" # needed + fi + if at_least_required_version "22.04" "$ubuntu_ver"; then + apt_pkgs="$apt_pkgs ninja-build" # needed fi echo "$ sudo apt-get install $apt_pkgs -y" if uname -a | grep -q -- "-microsoft" ; then @@ -134,7 +137,7 @@ check_missing_packages () { echo "$ sudo apt-get install $apt_missing -y" ;; *) - echo "for OS X (homebrew): brew install ragel wget cvs yasm autogen automake autoconf cmake libtool xz pkg-config nasm bzip2 autoconf-archive p7zip coreutils meson llvm" # if edit this edit docker/Dockerfile also :| + echo "for OS X (homebrew): brew install ragel wget cvs yasm autogen automake autoconf cmake libtool xz pkg-config nasm bzip2 autoconf-archive p7zip coreutils llvm" # if edit this edit docker/Dockerfile also :| echo " and set llvm to your PATH if on catalina" echo "for RHEL/CentOS: First ensure you have epel repo available, then run $ sudo yum install ragel subversion texinfo libtool autogen gperf nasm patch unzip pax ed gcc-c++ bison flex yasm automake autoconf gcc zlib-devel cvs bzip2 cmake3 -y" echo "for fedora: if your distribution comes with a modern version of cmake then use the same as RHEL/CentOS but replace cmake3 with cmake." @@ -189,11 +192,11 @@ check_missing_packages () { echo "your yasm version is too old $yasm_version wanted ${REQUIRED_YASM_VERSION}" exit 1 fi - local meson_version=`meson --version` - if ! at_least_required_version "0.56.1" "${meson_version}"; then - echo "your meson version is too old $meson_version wanted 0.56.1" - exit 1 - fi + # local meson_version=`meson --version` + # if ! at_least_required_version "0.60.0" "${meson_version}"; then + # echo "your meson version is too old $meson_version wanted 0.60.0" + # exit 1 + # fi # also check missing "setup" so it's early LOL #check if WSL @@ -344,7 +347,7 @@ install_cross_compiler() { # --disable-shared allows c++ to be distributed at all...which seemed necessary for some random dependency which happens to use/require c++... local zeranoe_script_name=mingw-w64-build - local zeranoe_script_options="--gcc-branch=releases/gcc-14 --mingw-w64-branch=master --binutils-branch=binutils-2_44-branch" #--cached-sources" + local zeranoe_script_options="--gcc-branch=releases/gcc-14 --mingw-w64-branch=master --binutils-branch=binutils-2_44-branch" # --cached-sources" if [[ ($compiler_flavors == "win32" || $compiler_flavors == "multi") && ! -f ../$win32_gcc ]]; then echo "Building win32 cross compiler..." download_gcc_build_script $zeranoe_script_name @@ -408,7 +411,7 @@ do_svn_checkout() { # params: git url, to_dir retry_git_or_die() { # originally from https://stackoverflow.com/a/76012343/32453 local RETRIES_NO=50 - local RETRY_DELAY=3 + local RETRY_DELAY=30 local repo_url=$1 local to_dir=$2 @@ -576,11 +579,17 @@ do_cmake() { if [ ! -f $touch_name ]; then rm -f already_* # reset so that make will run again if option just changed local cur_dir2=$(pwd) + local config_options="" + if [ $bits_target = 32 ]; then + local config_options+="-DCMAKE_SYSTEM_PROCESSOR=x86" + else + local config_options+="-DCMAKE_SYSTEM_PROCESSOR=AMD64" + fi echo doing cmake in $cur_dir2 with PATH=$mingw_bin_path:\$PATH with extra_args=$extra_args like this: if [[ $compiler_flavors != "native" ]]; then - local command="${build_from_dir} -DENABLE_STATIC_RUNTIME=1 -DBUILD_SHARED_LIBS=0 -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_FIND_ROOT_PATH=$mingw_w64_x86_64_prefix -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY -DCMAKE_RANLIB=${cross_prefix}ranlib -DCMAKE_C_COMPILER=${cross_prefix}gcc -DCMAKE_CXX_COMPILER=${cross_prefix}g++ -DCMAKE_RC_COMPILER=${cross_prefix}windres -DCMAKE_INSTALL_PREFIX=$mingw_w64_x86_64_prefix $extra_args" - else - local command="${build_from_dir} -DENABLE_STATIC_RUNTIME=1 -DBUILD_SHARED_LIBS=0 -DCMAKE_INSTALL_PREFIX=$mingw_w64_x86_64_prefix $extra_args" + local command="${build_from_dir} -DENABLE_STATIC_RUNTIME=1 -DBUILD_SHARED_LIBS=0 -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_FIND_ROOT_PATH=$mingw_w64_x86_64_prefix -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY -DCMAKE_RANLIB=${cross_prefix}ranlib -DCMAKE_C_COMPILER=${cross_prefix}gcc -DCMAKE_CXX_COMPILER=${cross_prefix}g++ -DCMAKE_RC_COMPILER=${cross_prefix}windres -DCMAKE_INSTALL_PREFIX=$mingw_w64_x86_64_prefix $config_options $extra_args" + else + local command="${build_from_dir} -DENABLE_STATIC_RUNTIME=1 -DBUILD_SHARED_LIBS=0 -DCMAKE_INSTALL_PREFIX=$mingw_w64_x86_64_prefix $config_options $extra_args" fi echo "doing ${cmake_command} -G\"Unix Makefiles\" $command" nice -n 5 ${cmake_command} -G"Unix Makefiles" $command || exit 1 @@ -599,6 +608,20 @@ do_cmake_and_install() { do_make_and_make_install } +activate_meson() { + if [[ ! -e meson_git ]]; then + do_git_checkout https://github.com/mesonbuild/meson.git meson_git 1.7 + fi + cd meson_git # requires python3-full + if [[ ! -e tutorial_env ]]; then + python3 -m venv tutorial_env + source tutorial_env/bin/activate + python3 -m pip install meson + else source tutorial_env/bin/activate + fi + cd .. +} + do_meson() { local configure_options="$1 --unity=off" local configure_name="$2" @@ -628,7 +651,7 @@ do_meson() { generic_meson() { local extra_configure_options="$1" mkdir -pv build - do_meson "--prefix=${mingw_w64_x86_64_prefix} --libdir=${mingw_w64_x86_64_prefix}/lib --buildtype=release --default-library=static --cross-file=${top_dir}/meson-cross.mingw.txt $extra_configure_options . build" + do_meson "--prefix=${mingw_w64_x86_64_prefix} --libdir=${mingw_w64_x86_64_prefix}/lib --buildtype=release --default-library=static $extra_configure_options" # --cross-file=${top_dir}/meson-cross.mingw.txt } generic_meson_ninja_install() { @@ -806,8 +829,8 @@ build_liblzma() { } build_zlib() { - download_and_unpack_file https://github.com/madler/zlib/archive/v1.3.1.tar.gz zlib-1.3.1 - cd zlib-1.3.1 + do_git_checkout https://github.com/madler/zlib.git zlib_git + cd zlib_git local make_options if [[ $compiler_flavors == "native" ]]; then export CFLAGS="$CFLAGS -fPIC" # For some reason glib needs this even though we build a static library @@ -835,7 +858,9 @@ build_iconv() { build_brotli() { do_git_checkout https://github.com/google/brotli.git brotli_git v1.0.9 # v1.1.0 static headache stay away cd brotli_git - rm configure # strange useless configure already there + if [ ! -f already* ]; then + rm configure + fi generic_configure sed -i.bak -e "s/\(allow_undefined=\)yes/\1no/" libtool do_make_and_make_install @@ -923,14 +948,15 @@ build_intel_qsv_mfx() { # disableable via command line switch... } build_libvpl () { - build_intel_qsv_mfx - do_git_checkout https://github.com/intel/libvpl.git libvpl_git f8d9891 # beyond this commit -lstdc++ no longer used and ffmpeg no longer sees it without it on the .pc + # build_intel_qsv_mfx + do_git_checkout https://github.com/intel/libvpl.git libvpl_git # f8d9891 cd libvpl_git if [ "$bits_target" = "32" ]; then apply_patch "https://raw.githubusercontent.com/msys2/MINGW-packages/master/mingw-w64-libvpl/0003-cmake-fix-32bit-install.patch" -p1 fi - do_cmake "-S . -B build -GNinja -DCMAKE_BUILD_TYPE=Release -DINSTALL_EXAMPLES=OFF -DINSTALL_DEV=ON -DBUILD_EXPERIMENTAL=OFF" + do_cmake "-B build -GNinja -DCMAKE_BUILD_TYPE=Release -DINSTALL_EXAMPLES=OFF -DINSTALL_DEV=ON -DBUILD_EXPERIMENTAL=OFF" do_ninja_and_ninja_install + sed -i.bak "s/Libs: .*/& -lstdc++/" "$PKG_CONFIG_PATH/vpl.pc" cd .. } @@ -952,7 +978,7 @@ build_libtiff() { } build_libtensorflow() { - if [[ ! -e Tensorflow && $compiler_flavors != "native" ]]; then + if [[ ! -e Tensorflow ]]; then mkdir Tensorflow cd Tensorflow wget https://storage.googleapis.com/tensorflow/versions/2.18.0/libtensorflow-cpu-windows-x86_64.zip # tensorflow.dll required by ffmpeg to run @@ -967,30 +993,28 @@ build_glib() { generic_download_and_make_and_install https://ftp.gnu.org/pub/gnu/gettext/gettext-0.23.1.tar.gz download_and_unpack_file https://github.com/libffi/libffi/releases/download/v3.4.7/libffi-3.4.7.tar.gz # also dep cd libffi-3.4.7 - apply_patch file://$patch_dir/libffi.patch -p1 # WSL always fails here; fix >>> https://github.com/libffi/libffi/issues/552#issuecomment-766158672 patch harmless for non WSL + apply_patch file://$patch_dir/libffi.patch -p1 generic_configure_make_install cd .. - download_and_unpack_file https://gitlab.gnome.org/GNOME/glib/-/archive/2.64.3/glib-2.64.3.tar.gz - cd glib-2.64.3 - apply_patch file://$patch_dir/glib-2.64.3_mingw-static.patch -p1 - export CPPFLAGS="$CPPFLAGS -DGLIB_STATIC_COMPILATION" - export CXXFLAGS="$CFLAGS -DGLIB_STATIC_COMPILATION" # Not certain this is needed, but it doesn't hurt - export LDFLAGS="-L${mingw_w64_x86_64_prefix}/lib" # For some reason the frexp configure checks fail without this as math.h isn't found when cross-compiling; no negative impact for native builds - local meson_options="setup --backend=ninja --prefix=${mingw_w64_x86_64_prefix} --libdir=${mingw_w64_x86_64_prefix}/lib --buildtype=release --default-library=static -Dinternal_pcre=true -Dforce_posix_threads=true . build" + + do_git_checkout https://github.com/GNOME/glib.git glib_git + activate_meson + cd glib_git + local meson_options="setup --force-fallback-for=libpcre -Dforce_posix_threads=true -Dman-pages=disabled -Dsysprof=disabled -Dglib_debug=disabled -Dtests=false --wrap-mode=default . build" if [[ $compiler_flavors != "native" ]]; then - get_local_meson_cross_with_propeties # Need to add flags to meson properties; otherwise ran into some issues - meson_options+=" --cross-file=meson-cross.mingw.txt" - fi - do_meson "$meson_options" - do_ninja_and_ninja_install + # get_local_meson_cross_with_propeties + meson_options+=" --cross-file=${top_dir}/meson-cross.mingw.txt" + do_meson "$meson_options" + else + generic_meson "$meson_options" + fi + do_ninja_and_ninja_install if [[ $compiler_flavors == "native" ]]; then sed -i.bak 's/-lglib-2.0.*$/-lglib-2.0 -lm -liconv/' $PKG_CONFIG_PATH/glib-2.0.pc else sed -i.bak 's/-lglib-2.0.*$/-lglib-2.0 -lintl -lws2_32 -lwinmm -lm -liconv -lole32/' $PKG_CONFIG_PATH/glib-2.0.pc fi - reset_cppflags - unset CXXFLAGS - unset LDFLAGS + deactivate cd .. } @@ -1000,7 +1024,7 @@ build_lensfun() { cd lensfun_git export CPPFLAGS="$CPPFLAGS-DGLIB_STATIC_COMPILATION" export CXXFLAGS="$CFLAGS -DGLIB_STATIC_COMPILATION" - do_cmake "-DBUILD_STATIC=on -DCMAKE_INSTALL_DATAROOTDIR=$mingw_w64_x86_64_prefix -DBUILD_TESTS=off -DBUILD_LENSTOOL=off -DBUILD_DOC=off -DINSTALL_HELPER_SCRIPTS=off -DINSTALL_PYTHON_MODULE=OFF" + do_cmake "-DBUILD_STATIC=on -DCMAKE_INSTALL_DATAROOTDIR=$mingw_w64_x86_64_prefix -DBUILD_TESTS=off -DBUILD_DOC=off -DINSTALL_HELPER_SCRIPTS=off -DINSTALL_PYTHON_MODULE=OFF" do_make_and_make_install sed -i.bak 's/-llensfun/-llensfun -lstdc++/' "$PKG_CONFIG_PATH/lensfun.pc" reset_cppflags @@ -1022,14 +1046,14 @@ build_lz4 () { cd libarchive-3.7.7 generic_configure "--with-nettle --bindir=$mingw_w64_x86_64_prefix/bin --without-mbedtls --without-iconv" # with-iconv = fail do_make_install - sed -i.bak 's/Requires.private.*$/Requires.private:/' $PKG_CONFIG_PATH/libarchive.pc # tesseract only sees it like this... + sed -i.bak 's/Requires.private.*$/Requires.private:/' $PKG_CONFIG_PATH/libarchive.pc cd .. } build_flac () { do_git_checkout https://github.com/xiph/flac.git flac_git cd flac_git - do_cmake "-S . -B build -DCMAKE_BUILD_TYPE=Release -DINSTALL_MANPAGES=OFF -GNinja" + do_cmake "-B build -DCMAKE_BUILD_TYPE=Release -DINSTALL_MANPAGES=OFF -GNinja" do_ninja_and_ninja_install cd .. } @@ -1060,7 +1084,7 @@ build_nghttp2 () { export CFLAGS="-DNGHTTP2_STATICLIB" download_and_unpack_file https://github.com/nghttp2/nghttp2/releases/download/v1.65.0/nghttp2-1.65.0.tar.gz cd nghttp2-1.65.0 - do_cmake "-S . -B build -DENABLE_LIB_ONLY=1 -DBUILD_SHARED_LIBS=0 -DBUILD_STATIC_LIBS=1 -GNinja" + do_cmake "-B build -DENABLE_LIB_ONLY=1 -DBUILD_SHARED_LIBS=0 -DBUILD_STATIC_LIBS=1 -GNinja" do_ninja_and_ninja_install reset_cflags cd .. @@ -1068,6 +1092,8 @@ build_nghttp2 () { build_curl () { generic_download_and_make_and_install https://github.com/libssh2/libssh2/releases/download/libssh2-1.11.1/libssh2-1.11.1.tar.gz + build_zstd + build_brotli build_libpsl build_nghttp2 local config_options="" @@ -1078,9 +1104,9 @@ build_curl () { do_git_checkout https://github.com/curl/curl.git curl_git curl-8_12_1 cd curl_git if [[ $compiler_flavors != "native" ]]; then - generic_configure "--with-brotli --enable-versioned-symbols --with-libssh2 --with-libpsl --with-libidn2 --disable-debug --enable-hsts --enable-sspi --with-schannel" + generic_configure "--with-libssh2 --with-libpsl --with-libidn2 --disable-debug --enable-hsts --with-brotli --enable-versioned-symbols --enable-sspi --with-schannel" else - generic_configure "--with-gnutls --with-libssh2 --with-libpsl --with-libidn2 --disable-debug --enable-hsts --with-brotli --enable-versioned-symbols" # checking for gnutls_x509_crt_get_dn2 in -lgnutls... no ; untested on native + generic_configure "--with-gnutls --with-libssh2 --with-libpsl --with-libidn2 --disable-debug --enable-hsts --with-brotli --enable-versioned-symbols" # untested on native fi do_make_and_make_install reset_cppflags @@ -1100,7 +1126,7 @@ build_libtesseract() { sed -i 's/-ltesseract.*$/-ltesseract -lstdc++ -lws2_32 -lbz2 -lz -liconv -lpthread -lgdi32 -lcrypt32/' $PKG_CONFIG_PATH/tesseract.pc if [[ ! -f $mingw_w64_x86_64_prefix/bin/tessdata/tessdata/eng.traineddata ]]; then mkdir -p $mingw_w64_x86_64_prefix/bin/tessdata - cp -f /usr/share/tesseract-ocr/**/tessdata/eng.traineddata $mingw_w64_x86_64_prefix/bin/tessdata/ # needs work for some distros? + cp -f /usr/share/tesseract-ocr/**/tessdata/eng.traineddata $mingw_w64_x86_64_prefix/bin/tessdata/ fi reset_cppflags cd .. @@ -1111,7 +1137,7 @@ build_libzimg() { } build_libopenjpeg() { - do_git_checkout https://github.com/uclouvain/openjpeg.git openjpeg_git v2.5.3 + do_git_checkout https://github.com/uclouvain/openjpeg.git openjpeg_git cd openjpeg_git do_cmake_and_install "-DBUILD_CODEC=0" cd .. @@ -1151,55 +1177,20 @@ build_libwebp() { } build_harfbuzz() { - local new_build=false - do_git_checkout https://github.com/harfbuzz/harfbuzz.git harfbuzz_git "93930fb1c49b85" # keep old autogen build :) - if [ ! -f harfbuzz_git/already_done_harf ]; then # Not done or new master, so build - new_build=true - fi - # basically gleaned from https://gist.github.com/roxlu/0108d45308a0434e27d4320396399153 - build_freetype "--without-harfbuzz" $new_build # Check for initial or new freetype or force rebuild if needed - local new_freetype=$? - if $new_build || [ $new_freetype = 0 ]; then # 0 is true - rm -f harfbuzz_git/already* # Force rebuilding in case only freetype has changed - # cmake no .pc file generated so use configure :| - cd harfbuzz_git - if [ ! -f configure ]; then - ./autogen.sh # :| - fi - export LDFLAGS=-lpthread # :| - generic_configure "--with-freetype=yes --with-fontconfig=no --with-icu=no" # no fontconfig, don't want another circular what? icu is #372 - unset LDFLAGS - do_make_and_make_install - cd .. - - build_freetype "--with-harfbuzz" true # with harfbuzz now... - touch harfbuzz_git/already_done_harf - echo "Done harfbuzz" - else - echo "Already done harfbuzz" - fi - sed -i.bak 's/-lfreetype.*/-lfreetype -lharfbuzz -lpng -lbz2 -lpthread/' "$PKG_CONFIG_PATH/freetype2.pc" # for some reason it lists harfbuzz as Requires.private only?? - sed -i.bak 's/-lharfbuzz.*/-lfreetype -lharfbuzz -lpng -lbz2 -lpthread/' "$PKG_CONFIG_PATH/harfbuzz.pc" # does anything even use this? - sed -i.bak 's/libfreetype.la -lbz2/libfreetype.la -lharfbuzz -lpng -lbz2 -lpthread/' "${mingw_w64_x86_64_prefix}/lib/libfreetype.la" # XXX what the..needed? - sed -i.bak 's/libfreetype.la -lbz2/libfreetype.la -lharfbuzz -lpng -lbz2 -lpthread/' "${mingw_w64_x86_64_prefix}/lib/libharfbuzz.la" -} - -build_freetype() { - local force_build=$2 - local new_build=1 - if [[ ! -f freetype-2.13.3/already_done_freetype || $force_build = true ]]; then - download_and_unpack_file https://sourceforge.net/projects/freetype/files/freetype2/2.13.3/freetype-2.13.3.tar.xz - rm -f freetype-2.13.3/already* - cd freetype-2.13.3 - apply_patch file://$patch_dir/freetype2-crosscompiled-apinames.diff # src/tools/apinames.c gets crosscompiled and makes the compilation fail - # harfbuzz autodetect :| - generic_configure "--with-bzip2 $1" - do_make_and_make_install - touch already_done_freetype - new_build=0 - cd .. - fi - return $new_build # Give caller a way to know if a new build was done + do_git_checkout https://github.com/harfbuzz/harfbuzz.git harfbuzz_git + activate_meson + cd harfbuzz_git + local meson_options="setup -Dglib=disabled -Dgobject=disabled -Dcairo=disabled -Dicu=disabled -Dtests=disabled -Dintrospection=disabled -Ddocs=disabled -Dbenchmark=disabled . build" + if [[ $compiler_flavors != "native" ]]; then + # get_local_meson_cross_with_propeties + meson_options+=" --cross-file=${top_dir}/meson-cross.mingw.txt" + do_meson "$meson_options" + else + generic_meson "$meson_options" + fi + do_ninja_and_ninja_install + deactivate + cd .. } build_libxml2() { @@ -1211,28 +1202,37 @@ build_libxml2() { } build_libvmaf() { - do_git_checkout https://github.com/Netflix/vmaf.git vmaf_git # meson >= 0.56.1 + do_git_checkout https://github.com/Netflix/vmaf.git vmaf_git + activate_meson cd vmaf_git/libvmaf - mkdir build - local meson_options="setup -Denable_float=true -Dbuilt_in_models=true -Denable_tests=false -Denable_docs=false --prefix=${mingw_w64_x86_64_prefix} - --libdir=${mingw_w64_x86_64_prefix}/lib --backend=ninja --buildtype=release --default-library=static . build" + local meson_options="setup -Denable_float=true -Dbuilt_in_models=true -Denable_tests=false -Denable_docs=false . build" if [[ $compiler_flavors != "native" ]]; then - get_local_meson_cross_with_propeties # Need to add flags to meson properties; otherwise ran into some issues - meson_options+=" --cross-file=meson-cross.mingw.txt" - fi - do_meson "$meson_options" - do_ninja_and_ninja_install + # get_local_meson_cross_with_propeties + meson_options+=" --cross-file=${top_dir}/meson-cross.mingw.txt" + do_meson "$meson_options" + else + generic_meson "$meson_options" + fi + do_ninja_and_ninja_install sed -i.bak "s/Libs: .*/& -lstdc++/" "$PKG_CONFIG_PATH/libvmaf.pc" + deactivate cd ../.. } build_fontconfig() { - download_and_unpack_file https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.16.0.tar.xz - cd fontconfig-2.16.0 - #export CFLAGS= # compile fails with -march=sandybridge ... with mingw 4.0.6 at least ... - generic_configure "--enable-iconv --enable-libxml2 --disable-docs --with-libiconv" # Use Libxml2 instead of Expat. - do_make_and_make_install - #reset_cflags + do_git_checkout https://gitlab.freedesktop.org/fontconfig/fontconfig.git fontconfig_git 59e53da82d471c20ba5e43b6aac07a9273303d50 # beyond this commit static broken, mabs patches do not fix 3-21-25 + activate_meson + cd fontconfig_git + local meson_options="setup -Diconv=enabled -Dtests=disabled -Ddoc=disabled -Dxml-backend=libxml2 --wrap-mode=default . build" + if [[ $compiler_flavors != "native" ]]; then + # get_local_meson_cross_with_propeties + meson_options+=" --cross-file=${top_dir}/meson-cross.mingw.txt" + do_meson "$meson_options" + else + generic_meson "$meson_options" + fi + do_ninja_and_ninja_install + deactivate cd .. } @@ -1291,8 +1291,8 @@ build_unistring() { } build_libidn2() { - download_and_unpack_file https://ftp.gnu.org/gnu/libidn/libidn2-2.3.7.tar.gz - cd libidn2-2.3.7 + download_and_unpack_file https://ftp.gnu.org/gnu/libidn/libidn2-2.3.8.tar.gz + cd libidn2-2.3.8 generic_configure "--disable-doc --disable-rpath --disable-nls --disable-gtk-doc-html --disable-fast-install" do_make_and_make_install cd .. @@ -1301,7 +1301,7 @@ build_libidn2() { build_gnutls() { download_and_unpack_file https://www.gnupg.org/ftp/gcrypt/gnutls/v3.8/gnutls-3.8.9.tar.xz cd gnutls-3.8.9 - CFLAGS="-Wno-int-conversion" + export CFLAGS="-Wno-int-conversion" local config_options="" if [[ $compiler_flavors != "native" ]]; then local config_options+=" --disable-non-suiteb-curves" @@ -1489,7 +1489,7 @@ build_mpg123() { } build_lame() { - do_svn_checkout https://svn.code.sf.net/p/lame/svn/trunk/lame lame_svn r6525 # anything other than r6525 fails? + do_svn_checkout https://svn.code.sf.net/p/lame/svn/trunk/lame lame_svn r6525 # anything other than r6525 fails cd lame_svn # sed -i.bak '1s/^\xEF\xBB\xBF//' libmp3lame/i386/nasm.h # Remove a UTF-8 BOM that breaks nasm if it's still there; should be fixed in trunk eventually https://sourceforge.net/p/lame/patches/81/ generic_configure "--enable-nasm --enable-libmpg123" @@ -1528,7 +1528,7 @@ local checkout_dir=fdk-aac_git build_AudioToolboxWrapper() { do_git_checkout https://github.com/cynagenautes/AudioToolboxWrapper.git AudioToolboxWrapper_git cd AudioToolboxWrapper_git - do_cmake "-S . -B build -GNinja" + do_cmake "-B build -GNinja" do_ninja_and_ninja_install # This wrapper library enables FFmpeg to use AudioToolbox codecs on Windows, with DLLs shipped with iTunes. # i.e. You need to install iTunes, or be able to LoadLibrary("CoreAudioToolbox.dll"), for this to work. @@ -1544,7 +1544,7 @@ build_libopencore() { build_libilbc() { do_git_checkout https://github.com/TimothyGu/libilbc.git libilbc_git cd libilbc_git - do_cmake "-S . -B build -GNinja" + do_cmake "-B build -GNinja" do_ninja_and_ninja_install cd .. } @@ -1664,16 +1664,16 @@ build_libflite() { do_git_checkout https://github.com/festvox/flite.git flite_git cd flite_git apply_patch "https://raw.githubusercontent.com/m-ab-s/mabs-patches/master/flite/0001-tools-find_sts_main.c-Include-windows.h-before-defin.patch" -p1 - # if [[ ! -f main/Makefile.bak ]]; then - # sed -i.bak "s/cp -pd/cp -p/" main/Makefile # friendlier cp for OS X - # fi + if [[ ! -f main/Makefile.bak ]]; then + sed -i.bak "s/cp -pd/cp -p/" main/Makefile # friendlier cp for OS X + fi generic_configure "--bindir=$mingw_w64_x86_64_prefix/bin --with-audio=none" do_make # /usr/bin/install: cannot stat '../bin/flite': No such file or directory; should be looking for /bin/flite.exe etc... if [[ ! -f $mingw_w64_x86_64_prefix/lib/libflite.a ]]; then cp -rf ./build/x86_64-mingw32/lib/libflite* $mingw_w64_x86_64_prefix/lib/ - mkdir $mingw_w64_x86_64_prefix/include/flite && cp -rf ./include/* $mingw_w64_x86_64_prefix/include/flite - # cp -rf ./bin/*.exe $mingw_w64_x86_64_prefix/bin + cp -rf include $mingw_w64_x86_64_prefix/include/flite + # cp -rf ./bin/*.exe $mingw_w64_x86_64_prefix/bin # if want .exe's uncomment fi cd .. } @@ -1759,7 +1759,7 @@ build_svt-hevc() { do_git_checkout https://github.com/OpenVisualCloud/SVT-HEVC.git mkdir -p SVT-HEVC_git/release cd SVT-HEVC_git/release - do_cmake_from_build_dir .. "-DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_PROCESSOR=AMD64" + do_cmake_from_build_dir .. "-DCMAKE_BUILD_TYPE=Release" do_make_and_make_install cd ../.. } @@ -1767,7 +1767,7 @@ build_svt-hevc() { build_svt-vp9() { do_git_checkout https://github.com/OpenVisualCloud/SVT-VP9.git cd SVT-VP9_git/Build - do_cmake_from_build_dir .. "-DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_PROCESSOR=AMD64" + do_cmake_from_build_dir .. "-DCMAKE_BUILD_TYPE=Release" do_make_and_make_install cd ../.. } @@ -1775,11 +1775,11 @@ build_svt-vp9() { build_svt-av1() { do_git_checkout https://github.com/pytorch/cpuinfo.git cd cpuinfo_git - do_cmake_and_install " -DCMAKE_SYSTEM_PROCESSOR=AMD64" # builds included cpuinfo bugged, save time do this + do_cmake_and_install # builds included cpuinfo bugged cd .. do_git_checkout https://gitlab.com/AOMediaCodec/SVT-AV1.git SVT-AV1_git cd SVT-AV1_git - do_cmake "-S . -B build -GNinja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DUSE_CPUINFO=SYSTEM" # -DSVT_AV1_LTO=OFF might be needed + do_cmake "-B build -GNinja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DUSE_CPUINFO=SYSTEM" # -DSVT_AV1_LTO=OFF if fails try adding this do_ninja_and_ninja_install cd .. } @@ -1859,7 +1859,7 @@ build_libsrt() { # CMake Warning at CMakeLists.txt:893 (message): # On MinGW, some C++11 apps are blocked due to lacking proper C++11 headers # for . FIX IF POSSIBLE. - do_cmake "-DUSE_GNUTLS=ON -DENABLE_SHARED=OFF -DENABLE_CXX11=OFF" + do_cmake "-DUSE_ENCLIB=gnutls -DENABLE_SHARED=OFF -DENABLE_CXX11=OFF" do_make_and_make_install cd .. } @@ -1869,9 +1869,122 @@ build_libass() { } build_vulkan() { - do_git_checkout https://github.com/KhronosGroup/Vulkan-Headers.git + do_git_checkout https://github.com/KhronosGroup/Vulkan-Headers.git Vulkan-Headers_git v1.4.310 cd Vulkan-Headers_git - do_cmake_and_install "-DCMAKE_BUILD_TYPE=Release" + do_cmake_and_install "-DCMAKE_BUILD_TYPE=Release -DVULKAN_HEADERS_ENABLE_MODULE=OFF" + cd .. +} + +build_vulkan_loader() { + do_git_checkout https://github.com/KhronosGroup/Vulkan-Loader.git Vulkan-Loader_git v1.4.310 + cd Vulkan-Loader_git + do_cmake_and_install "-DCMAKE_BUILD_TYPE=Release -DUSE_GAS=ON" + cd .. +} + +build_libunwind() { + do_git_checkout https://github.com/libunwind/libunwind.git libunwind_git + cd libunwind_git + autoreconf -i + do_configure "--host=x86_64-linux-gnu --prefix=$mingw_w64_x86_64_prefix --disable-shared --enable-static" + do_make_and_make_install + cd .. +} + +build_libxxhash() { + do_git_checkout https://github.com/Cyan4973/xxHash.git xxHash_git dev + cd xxHash_git + do_cmake "-S cmake_unofficial -B build -DCMAKE_BUILD_TYPE=release -GNinja" + do_ninja_and_ninja_install + cd .. +} + +build_spirv-cross() { + do_git_checkout https://github.com/KhronosGroup/SPIRV-Cross.git SPIRV-Cross_git # 1823c11 # if breaks in future go back to this commit + cd SPIRV-Cross_git + do_cmake "-B build -GNinja -DSPIRV_CROSS_STATIC=ON -DSPIRV_CROSS_SHARED=OFF" + do_ninja_and_ninja_install + mv $PKG_CONFIG_PATH/spirv-cross-c.pc $PKG_CONFIG_PATH/spirv-cross-c-shared.pc + cd .. +} + +build_libdovi() { + do_git_checkout https://github.com/quietvoid/dovi_tool.git dovi_tool_git + cd dovi_tool_git + if [[ ! -e $mingw_w64_x86_64_prefix/lib/libdovi.a ]]; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && . "$HOME/.cargo/env" && rustup update && rustup target add x86_64-pc-windows-gnu # rustup self uninstall + if [[ $compiler_flavors != "native" ]]; then + wget https://github.com/quietvoid/dovi_tool/releases/download/2.2.0/dovi_tool-2.2.0-x86_64-pc-windows-msvc.zip + unzip -o dovi_tool-2.2.0-x86_64-pc-windows-msvc.zip -d $mingw_w64_x86_64_prefix/bin + rm dovi_tool-2.2.0-x86_64-pc-windows-msvc.zip + fi + + unset PKG_CONFIG_PATH + if [[ $compiler_flavors == "native" ]]; then + cargo build --release --no-default-features --features internal-font && cp /target/release//dovi_tool $mingw_w64_x86_64_prefix/bin + fi + cd dolby_vision + cargo install cargo-c --features=vendored-openssl + if [[ $compiler_flavors == "native" ]]; then + cargo cinstall --release --prefix=$mingw_w64_x86_64_prefix --libdir=$mingw_w64_x86_64_prefix/lib --library-type=staticlib + fi + + export PKG_CONFIG_PATH="$mingw_w64_x86_64_prefix/lib/pkgconfig" + if [[ $compiler_flavors != "native" ]]; then + cargo cinstall --release --prefix=$mingw_w64_x86_64_prefix --libdir=$mingw_w64_x86_64_prefix/lib --library-type=staticlib --target x86_64-pc-windows-gnu + fi + cd .. + else echo "libdovi already installed" + fi + cd .. +} + +build_shaderc() { + do_git_checkout https://github.com/google/shaderc.git shaderc_git known-good # 8ce49eb # if breaks in future, go back to this commit + cd shaderc_git + if [[ ! -e src ]]; then + ./update_shaderc_sources.py + fi + cd src + do_cmake "-B build -DCMAKE_BUILD_TYPE=release -GNinja -DSHADERC_SKIP_EXAMPLES=ON -DSHADERC_SKIP_TESTS=ON -DGLSLANG_TESTS=OFF -DSPIRV_HEADERS_SKIP_EXAMPLES=ON -DSPIRV_SKIP_TESTS=ON -DSKIP_GOOGLETEST_INSTALL=ON" + do_ninja_and_ninja_install + cp -r libshaderc_util/include/libshaderc_util $mingw_w64_x86_64_prefix/include + sed -i.bak "s/Libs: .*/& -lstdc++/" "$PKG_CONFIG_PATH/shaderc_combined.pc" + sed -i.bak "s/Libs: .*/& -lstdc++/" "$PKG_CONFIG_PATH/shaderc_static.pc" + sed -i.bak "s/Libs: .*/& -lstdc++/" "$PKG_CONFIG_PATH/shaderc.pc" + sed -i.bak "s/Libs: .*/& -lstdc++/" "$PKG_CONFIG_PATH/SPIRV-Tools.pc" + cd ../.. +} + +build_libplacebo() { + if [[ $OSTYPE != darwin* ]]; then + build_vulkan_loader + fi + do_git_checkout_and_make_install https://github.com/ImageMagick/lcms.git + build_libunwind + build_libxxhash + build_spirv-cross + build_libdovi + build_shaderc + do_git_checkout https://code.videolan.org/videolan/libplacebo.git libplacebo_git # 51ea4290a6342ebe67daa34cd4483476bed4e03d # if breaks in future, go back to this commit + activate_meson + cd libplacebo_git + git submodule update --init + local config_options="" + if [[ $OSTYPE != darwin* ]]; then + local config_options+=" -Dvulkan-registry=$mingw_w64_x86_64_prefix/share/vulkan/registry/vk.xml" + fi + local meson_options="setup -Ddemos=false -Dc_link_args=-static -Dcpp_link_args=-static $config_options . build" # https://mesonbuild.com/Dependencies.html#shaderc trigger use of shaderc_combined + if [[ $compiler_flavors != "native" ]]; then + # get_local_meson_cross_with_propeties + meson_options+=" --cross-file=${top_dir}/meson-cross.mingw.txt" + do_meson "$meson_options" + else + generic_meson "$meson_options" + fi + do_ninja_and_ninja_install + sed -i.bak 's/-lplacebo.*$/-lplacebo -lm -lshlwapi -lunwind -lxxhash -lversion -lstdc++/' "$PKG_CONFIG_PATH/libplacebo.pc" + deactivate cd .. } @@ -1894,7 +2007,7 @@ build_libxavs() { if [[ ! -f Makefile.bak ]]; then sed -i.bak "s/O4/O2/" configure # Change CFLAGS. fi - apply_patch https://patch-diff.githubusercontent.com/raw/Distrotech/xavs/pull/1.patch -p1 + apply_patch "https://patch-diff.githubusercontent.com/raw/Distrotech/xavs/pull/1.patch" -p1 do_configure "--host=$host_target --prefix=$mingw_w64_x86_64_prefix --cross-prefix=$cross_prefix" # see https://github.com/rdp/ffmpeg-windows-build-helpers/issues/3 do_make_and_make_install "$make_prefix_options" rm -f NUL # cygwin causes windows explorer to not be able to delete this folder if it has this oddly named file in it... @@ -1904,8 +2017,8 @@ build_libxavs() { build_libxavs2() { do_git_checkout https://github.com/pkuvcl/xavs2.git xavs2_git cd xavs2_git - if [ ! -e $PWD/build/linux/xavs2.exe ]; then - curl https://github.com/pkuvcl/xavs2/compare/master...1480c1:xavs2:gcc14/pointerconversion.patch | git apply -v + if [ ! -e $PWD/build/linux/already_configured* ]; then + curl "https://github.com/pkuvcl/xavs2/compare/master...1480c1:xavs2:gcc14/pointerconversion.patch" | git apply -v fi cd build/linux do_configure "--cross-prefix=$cross_prefix --host=$host_target --prefix=$mingw_w64_x86_64_prefix --enable-strip" # --enable-pic @@ -1971,19 +2084,24 @@ build_libaom() { build_dav1d() { do_git_checkout https://code.videolan.org/videolan/dav1d.git libdav1d + activate_meson cd libdav1d if [[ $bits_target == 32 || $bits_target == 64 ]]; then # XXX why 64??? apply_patch file://$patch_dir/david_no_asm.patch -p1 # XXX report fi cpu_count=1 # XXX report :| - local meson_options="setup --prefix=${mingw_w64_x86_64_prefix} --libdir=${mingw_w64_x86_64_prefix}/lib --buildtype=release --default-library=static . build" + local meson_options="setup -Denable_tests=false -Denable_examples=false . build" if [[ $compiler_flavors != "native" ]]; then + # get_local_meson_cross_with_propeties meson_options+=" --cross-file=${top_dir}/meson-cross.mingw.txt" - fi - do_meson "$meson_options" - do_ninja_and_ninja_install + do_meson "$meson_options" + else + generic_meson "$meson_options" + fi + do_ninja_and_ninja_install cp build/src/libdav1d.a $mingw_w64_x86_64_prefix/lib || exit 1 # avoid 'run ranlib' weird failure, possibly older meson's https://github.com/mesonbuild/meson/issues/4138 :| cpu_count=$original_cpu_count + deactivate cd .. } @@ -1999,7 +2117,7 @@ build_avisynth() { build_libvvenc() { do_git_checkout https://github.com/fraunhoferhhi/vvenc.git libvvenc_git cd libvvenc_git - do_cmake "-S . -B build -DCMAKE_BUILD_TYPE=Release -DVVENC_ENABLE_LINK_TIME_OPT=OFF -DVVENC_INSTALL_FULLFEATURE_APP=ON -GNinja" + do_cmake "-B build -DCMAKE_BUILD_TYPE=Release -DVVENC_ENABLE_LINK_TIME_OPT=OFF -DVVENC_INSTALL_FULLFEATURE_APP=ON -GNinja" do_ninja_and_ninja_install cd .. } @@ -2007,7 +2125,7 @@ build_libvvenc() { build_libvvdec() { do_git_checkout https://github.com/fraunhoferhhi/vvdec.git libvvdec_git cd libvvdec_git - do_cmake "-S . -B build -DCMAKE_BUILD_TYPE=Release -DVVDEC_ENABLE_LINK_TIME_OPT=OFF -DVVDEC_INSTALL_VVDECAPP=ON -GNinja" + do_cmake "-B build -DCMAKE_BUILD_TYPE=Release -DVVDEC_ENABLE_LINK_TIME_OPT=OFF -DVVDEC_INSTALL_VVDECAPP=ON -GNinja" do_ninja_and_ninja_install cd .. } @@ -2353,51 +2471,51 @@ build_meson_cross() { cpu_family="x86" fi rm -fv meson-cross.mingw.txt - cat >> meson-cross.mingw.txt << EOF + cat >> meson-cross.mingw.txt << EOF + +[built-in options] +buildtype = 'release' +wrap_mode = 'nofallback' +default_library = 'static' +prefer_static = 'true' +default_both_libraries = 'static' +backend = 'ninja' +prefix = '$mingw_w64_x86_64_prefix' +libdir = '$mingw_w64_x86_64_prefix/lib' + [binaries] c = '${cross_prefix}gcc' cpp = '${cross_prefix}g++' ld = '${cross_prefix}ld' ar = '${cross_prefix}ar' strip = '${cross_prefix}strip' -pkgconfig = '${cross_prefix}pkg-config' nm = '${cross_prefix}nm' windres = '${cross_prefix}windres' +dlltool = '${cross_prefix}dlltool' +pkg-config = 'pkg-config' +nasm = 'nasm' +cmake = 'cmake' [host_machine] system = 'windows' cpu_family = '$cpu_family' cpu = '$cpu_family' endian = 'little' + +[properties] +pkg_config_sysroot_dir = '$mingw_w64_x86_64_prefix' +pkg_config_libdir = '$pkg_config_sysroot_dir/lib/pkgconfig' EOF mv -v meson-cross.mingw.txt ../.. } get_local_meson_cross_with_propeties() { local local_dir="$1" - local c_args= - local cpp_args= - local link_args= if [[ -z $local_dir ]]; then local_dir="." fi cp ${top_dir}/meson-cross.mingw.txt "$local_dir" - if [[ -n "$CFLAGS" ]]; then - c_args="'$(echo ${CFLAGS} | sed "s/ /\',\'/g")'" - fi - if [[ -n "$CXXFLAGS" ]]; then - cpp_args="'$(echo ${CXXFLAGS} | sed "s/ /\',\'/g")'" - fi - if [[ -n "$LDFLAGS" ]]; then - link_args="'$(echo ${LDFLAGS} | sed "s/ /\',\'/g")'" - fi cat >> meson-cross.mingw.txt << EOF - -[properties] -c_args = [$c_args] -c_link_args = [$link_args] -cpp_args = [$cpp_args] -cpp_link_args = [$link_args] EOF } @@ -2531,7 +2649,7 @@ build_ffmpeg() { if [ "$bits_target" = "32" ]; then local arch=x86 else - local arch=x86_64 + local arch=amd64 fi init_options="--pkg-config=pkg-config --pkg-config-flags=--static --extra-version=ffmpeg-windows-build-helpers --enable-version3 --disable-debug --disable-w32threads" @@ -2546,10 +2664,12 @@ build_ffmpeg() { if [[ `uname` =~ "5.1" ]]; then init_options+=" --disable-schannel" # Fix WinXP incompatibility by disabling Microsoft's Secure Channel, because Windows XP doesn't support TLS 1.1 and 1.2, but with GnuTLS or OpenSSL it does. XP compat! - fi - # alphabetized :) + fi config_options="$init_options" + # alphabetized :) + config_options+=" --enable-cuda" config_options+=" --enable-cuda-llvm" + config_options+=" --enable-cuvid" config_options+=" --enable-fontconfig" config_options+=" --enable-gmp" config_options+=" --enable-gnutls" @@ -2576,7 +2696,8 @@ build_ffmpeg() { config_options+=" --enable-libopenjpeg" config_options+=" --enable-libopenmpt" config_options+=" --enable-libopus" - # config_options+=" --enable-librtmfp" # not working openssl fails + config_options+=" --enable-libplacebo" + # config_options+=" --enable-librtmfp" # currently broken config_options+=" --enable-libsnappy" config_options+=" --enable-libsoxr" config_options+=" --enable-libspeex" @@ -2730,17 +2851,17 @@ build_ffmpeg() { make tools/ismindex.exe || exit 1 fi - # XXX really ffmpeg should have set this up right but doesn't, patch FFmpeg itself instead... - if [[ $1 == "static" ]]; then - # nb we can just modify this every time, it getes recreated, above.. - if [[ $build_intel_qsv = y && $compiler_flavors != "native" ]]; then # Broken for native builds right now: https://github.com/lu-zero/mfx_dispatch/issues/71 - sed -i.bak 's/-lavutil -pthread -lm /-lavutil -pthread -lm -lmfx -lstdc++ -lmpg123 -lshlwapi /' "$PKG_CONFIG_PATH/libavutil.pc" - else - sed -i.bak 's/-lavutil -pthread -lm /-lavutil -pthread -lm -lmpg123 -lshlwapi /' "$PKG_CONFIG_PATH/libavutil.pc" - fi - fi + # # XXX really ffmpeg should have set this up right but doesn't, patch FFmpeg itself instead... + # if [[ $1 == "static" ]]; then + # # nb we can just modify this every time, it getes recreated, above.. + # if [[ $build_intel_qsv = y && $compiler_flavors != "native" ]]; then # Broken for native builds right now: https://github.com/lu-zero/mfx_dispatch/issues/71 + # sed -i.bak 's/-lavutil -pthread -lm /-lavutil -pthread -lm -lmfx -lstdc++ -lmpg123 -lshlwapi /' "$PKG_CONFIG_PATH/libavutil.pc" + # else + # sed -i.bak 's/-lavutil -pthread -lm /-lavutil -pthread -lm -lmpg123 -lshlwapi /' "$PKG_CONFIG_PATH/libavutil.pc" + # fi + # fi - sed -i.bak 's/-lswresample -lm.*/-lswresample -lm -lsoxr/' "$PKG_CONFIG_PATH/libswresample.pc" # XXX patch ffmpeg + # sed -i.bak 's/-lswresample -lm.*/-lswresample -lm -lsoxr/' "$PKG_CONFIG_PATH/libswresample.pc" # XXX patch ffmpeg if [[ $non_free == "y" ]]; then if [[ $build_type == "shared" ]]; then @@ -2854,18 +2975,17 @@ build_ffmpeg_dependencies() { #build_libjpeg_turbo # mplayer can use this, VLC qt might need it? [replaces libjpeg] (ffmpeg seems to not need it so commented out here) build_libpng # Needs zlib >= 1.0.4. Uses dlfcn. build_libwebp # Uses dlfcn. - build_harfbuzz - # harf does now include build_freetype # Uses zlib, bzip2, and libpng. - build_libxml2 # Uses zlib, liblzma, iconv and dlfcn. + build_libxml2 # Uses zlib, liblzma, iconv and dlfcn + build_brotli + build_fontconfig # freetype imported as subproject, uses libpng bzip2 libxml2 and zlib + build_harfbuzz # Uses freetype zlib, bzip2, and libpng. build_libvmaf - build_fontconfig # Needs freetype and libxml >= 2.6. Uses iconv and dlfcn. build_gmp # For rtmp support configure FFmpeg with '--enable-gmp'. Uses dlfcn. #build_librtmfp # mainline ffmpeg doesn't use it yet build_libnettle # Needs gmp >= 3.0. Uses dlfcn. build_unistring build_libidn2 # needs iconv and unistring build_zstd - build_brotli build_gnutls # Needs nettle >= 3.1, hogweed (nettle) >= 3.1. Uses libidn2, unistring, zlib, and dlfcn. build_curl #if [[ "$non_free" = "y" ]]; then @@ -2911,7 +3031,9 @@ build_ffmpeg_dependencies() { build_libmysofa # Needed for FFmpeg's SOFAlizer filter (https://ffmpeg.org/ffmpeg-filters.html#sofalizer). Uses dlfcn. if [[ "$non_free" = "y" ]]; then build_fdk-aac # Uses dlfcn. - build_AudioToolboxWrapper # This wrapper library enables FFmpeg to use AudioToolbox codecs on Windows, with DLLs shipped with iTunes. + if [[ $OSTYPE != darwin* ]]; then + build_AudioToolboxWrapper # This wrapper library enables FFmpeg to use AudioToolbox codecs on Windows, with DLLs shipped with iTunes. + fi if [[ $compiler_flavors != "native" ]]; then build_libdecklink # Error finding rpc.h in native builds even if it's available fi @@ -2929,7 +3051,9 @@ build_ffmpeg_dependencies() { build_libaribb24 build_libtesseract build_lensfun # requires png, zlib, iconv - build_libtensorflow # requires .dll + if [[ $compiler_flavors != "native" ]]; then + build_libtensorflow # requires tensorflow.dll + fi build_libvpx build_libx265 build_libopenh264 @@ -2938,6 +3062,7 @@ build_ffmpeg_dependencies() { if [[ $OSTYPE != darwin* ]]; then build_vulkan fi + build_libplacebo # can use vulkan build_avisynth build_libvvenc build_libvvdec @@ -3016,7 +3141,7 @@ disable_nonfree=y # comment out to force user y/n selection original_cflags='-mtune=generic -O3 -pipe' # high compatible by default, see #219, some other good options are listed below, or you could use -march=native to target your local box: original_cppflags='-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3' # Needed for mingw-w64 7 as FORTIFY_SOURCE is now partially implemented, but not actually working # if you specify a march it needs to first so x264's configure will use it :| [ is that still the case ?] -# original_cflags='-march=native -mtune=znver2 -O3 -pipe' +# original_cflags='-march=znver2 -O3 -pipe' #flags=$(cat /proc/cpuinfo | grep flags) #if [[ $flags =~ "ssse3" ]]; then # See https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html, https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html and https://stackoverflow.com/questions/19689014/gcc-difference-between-o3-and-os. # original_cflags='-march=core2 -O2' From ed77beae0bc1b9b20a7d6cf1e13e7b9bd6f529c9 Mon Sep 17 00:00:00 2001 From: tjayz <90593277+tjayz@users.noreply.github.com> Date: Sat, 22 Mar 2025 13:05:57 -0400 Subject: [PATCH 07/26] Update mingw-w64-build let main script handle options for these --- patches/mingw-w64-build | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/patches/mingw-w64-build b/patches/mingw-w64-build index e1687813..4a73ae67 100644 --- a/patches/mingw-w64-build +++ b/patches/mingw-w64-build @@ -18,9 +18,9 @@ ROOT_PATH=$(pwd) -MINGW_W64_BRANCH="master" -BINUTILS_BRANCH="binutils-2_44-branch" -GCC_BRANCH="releases/gcc-14" +# MINGW_W64_BRANCH="master" +# BINUTILS_BRANCH="binutils-2_44-branch" +# GCC_BRANCH="releases/gcc-14" ENABLE_THREADS="--enable-threads=posix" From ca554a731f7ab9626956df8459a04cf512c41a31 Mon Sep 17 00:00:00 2001 From: tjayz <90593277+tjayz@users.noreply.github.com> Date: Sat, 22 Mar 2025 20:13:21 -0400 Subject: [PATCH 08/26] Update cross_compile_ffmpeg.sh Disabled brotli being found by freetype --- cross_compile_ffmpeg.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cross_compile_ffmpeg.sh b/cross_compile_ffmpeg.sh index d56be735..f38ccc1d 100755 --- a/cross_compile_ffmpeg.sh +++ b/cross_compile_ffmpeg.sh @@ -1223,7 +1223,7 @@ build_fontconfig() { do_git_checkout https://gitlab.freedesktop.org/fontconfig/fontconfig.git fontconfig_git 59e53da82d471c20ba5e43b6aac07a9273303d50 # beyond this commit static broken, mabs patches do not fix 3-21-25 activate_meson cd fontconfig_git - local meson_options="setup -Diconv=enabled -Dtests=disabled -Ddoc=disabled -Dxml-backend=libxml2 --wrap-mode=default . build" + local meson_options="setup -Diconv=enabled -Dtests=disabled -Ddoc=disabled -Dxml-backend=libxml2 --wrap-mode=default -Dfreetype2:brotli=disabled . build" if [[ $compiler_flavors != "native" ]]; then # get_local_meson_cross_with_propeties meson_options+=" --cross-file=${top_dir}/meson-cross.mingw.txt" @@ -2976,7 +2976,6 @@ build_ffmpeg_dependencies() { build_libpng # Needs zlib >= 1.0.4. Uses dlfcn. build_libwebp # Uses dlfcn. build_libxml2 # Uses zlib, liblzma, iconv and dlfcn - build_brotli build_fontconfig # freetype imported as subproject, uses libpng bzip2 libxml2 and zlib build_harfbuzz # Uses freetype zlib, bzip2, and libpng. build_libvmaf @@ -2986,6 +2985,7 @@ build_ffmpeg_dependencies() { build_unistring build_libidn2 # needs iconv and unistring build_zstd + build_brotli build_gnutls # Needs nettle >= 3.1, hogweed (nettle) >= 3.1. Uses libidn2, unistring, zlib, and dlfcn. build_curl #if [[ "$non_free" = "y" ]]; then From 6b1f92373ebb48e530398b6e8debbcb784fd96ba Mon Sep 17 00:00:00 2001 From: tjayz <90593277+tjayz@users.noreply.github.com> Date: Sat, 22 Mar 2025 21:51:48 -0400 Subject: [PATCH 09/26] Update cross_compile_ffmpeg.sh freetype --with-harfbuzz overlooked and added --- cross_compile_ffmpeg.sh | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/cross_compile_ffmpeg.sh b/cross_compile_ffmpeg.sh index f38ccc1d..608d52cd 100755 --- a/cross_compile_ffmpeg.sh +++ b/cross_compile_ffmpeg.sh @@ -1179,6 +1179,7 @@ build_libwebp() { build_harfbuzz() { do_git_checkout https://github.com/harfbuzz/harfbuzz.git harfbuzz_git activate_meson + build_freetype cd harfbuzz_git local meson_options="setup -Dglib=disabled -Dgobject=disabled -Dcairo=disabled -Dicu=disabled -Dtests=disabled -Dintrospection=disabled -Ddocs=disabled -Dbenchmark=disabled . build" if [[ $compiler_flavors != "native" ]]; then @@ -1189,7 +1190,27 @@ build_harfbuzz() { generic_meson "$meson_options" fi do_ninja_and_ninja_install + cd .. + build_freetype deactivate +} + +build_freetype() { + do_git_checkout https://github.com/freetype/freetype.git freetype_git + cd freetype_git + local config_options="" + if [[ -e $PKG_CONFIG_PATH/harfbuzz.pc ]]; then + local config_options+=" -Dharfbuzz=enabled" + fi + local meson_options="setup -Dbrotli=disabled $config_options . build" + if [[ $compiler_flavors != "native" ]]; then + # get_local_meson_cross_with_propeties + meson_options+=" --cross-file=${top_dir}/meson-cross.mingw.txt" + do_meson "$meson_options" + else + generic_meson "$meson_options" + fi + do_ninja_and_ninja_install cd .. } @@ -1223,7 +1244,7 @@ build_fontconfig() { do_git_checkout https://gitlab.freedesktop.org/fontconfig/fontconfig.git fontconfig_git 59e53da82d471c20ba5e43b6aac07a9273303d50 # beyond this commit static broken, mabs patches do not fix 3-21-25 activate_meson cd fontconfig_git - local meson_options="setup -Diconv=enabled -Dtests=disabled -Ddoc=disabled -Dxml-backend=libxml2 --wrap-mode=default -Dfreetype2:brotli=disabled . build" + local meson_options="setup -Diconv=enabled -Dtests=disabled -Ddoc=disabled -Dxml-backend=libxml2 . build" if [[ $compiler_flavors != "native" ]]; then # get_local_meson_cross_with_propeties meson_options+=" --cross-file=${top_dir}/meson-cross.mingw.txt" @@ -2976,9 +2997,9 @@ build_ffmpeg_dependencies() { build_libpng # Needs zlib >= 1.0.4. Uses dlfcn. build_libwebp # Uses dlfcn. build_libxml2 # Uses zlib, liblzma, iconv and dlfcn - build_fontconfig # freetype imported as subproject, uses libpng bzip2 libxml2 and zlib build_harfbuzz # Uses freetype zlib, bzip2, and libpng. build_libvmaf + build_fontconfig # uses libpng bzip2 libxml2 and zlib build_gmp # For rtmp support configure FFmpeg with '--enable-gmp'. Uses dlfcn. #build_librtmfp # mainline ffmpeg doesn't use it yet build_libnettle # Needs gmp >= 3.0. Uses dlfcn. From 454ac716651a733f29d9db96d3e2688f2c02392c Mon Sep 17 00:00:00 2001 From: tjayz <90593277+tjayz@users.noreply.github.com> Date: Mon, 24 Mar 2025 14:59:24 -0400 Subject: [PATCH 10/26] Update cross_compile_ffmpeg.sh fix freetype harfbuzz circular depends issue fix fontconfig build fix code aesthetics due to copy paste other small changes --- cross_compile_ffmpeg.sh | 303 ++++++++++++++++++++-------------------- 1 file changed, 153 insertions(+), 150 deletions(-) diff --git a/cross_compile_ffmpeg.sh b/cross_compile_ffmpeg.sh index 608d52cd..62a5c5b5 100755 --- a/cross_compile_ffmpeg.sh +++ b/cross_compile_ffmpeg.sh @@ -860,13 +860,13 @@ build_brotli() { cd brotli_git if [ ! -f already* ]; then rm configure - fi - generic_configure - sed -i.bak -e "s/\(allow_undefined=\)yes/\1no/" libtool - do_make_and_make_install - sed -i.bak 's/Libs.*$/Libs: -L${libdir} -lbrotlicommon/' $PKG_CONFIG_PATH/libbrotlicommon.pc # remove rpaths not possible in conf - sed -i.bak 's/Libs.*$/Libs: -L${libdir} -lbrotlidec/' $PKG_CONFIG_PATH/libbrotlidec.pc - sed -i.bak 's/Libs.*$/Libs: -L${libdir} -lbrotlienc/' $PKG_CONFIG_PATH/libbrotlienc.pc + fi + generic_configure + sed -i.bak -e "s/\(allow_undefined=\)yes/\1no/" libtool + do_make_and_make_install + sed -i.bak 's/Libs.*$/Libs: -L${libdir} -lbrotlicommon/' $PKG_CONFIG_PATH/libbrotlicommon.pc # remove rpaths not possible in conf + sed -i.bak 's/Libs.*$/Libs: -L${libdir} -lbrotlidec/' $PKG_CONFIG_PATH/libbrotlidec.pc + sed -i.bak 's/Libs.*$/Libs: -L${libdir} -lbrotlienc/' $PKG_CONFIG_PATH/libbrotlienc.pc cd .. } @@ -951,12 +951,12 @@ build_libvpl () { # build_intel_qsv_mfx do_git_checkout https://github.com/intel/libvpl.git libvpl_git # f8d9891 cd libvpl_git - if [ "$bits_target" = "32" ]; then - apply_patch "https://raw.githubusercontent.com/msys2/MINGW-packages/master/mingw-w64-libvpl/0003-cmake-fix-32bit-install.patch" -p1 - fi - do_cmake "-B build -GNinja -DCMAKE_BUILD_TYPE=Release -DINSTALL_EXAMPLES=OFF -DINSTALL_DEV=ON -DBUILD_EXPERIMENTAL=OFF" - do_ninja_and_ninja_install - sed -i.bak "s/Libs: .*/& -lstdc++/" "$PKG_CONFIG_PATH/vpl.pc" + if [ "$bits_target" = "32" ]; then + apply_patch "https://raw.githubusercontent.com/msys2/MINGW-packages/master/mingw-w64-libvpl/0003-cmake-fix-32bit-install.patch" -p1 + fi + do_cmake "-B build -GNinja -DCMAKE_BUILD_TYPE=Release -DINSTALL_EXAMPLES=OFF -DINSTALL_DEV=ON -DBUILD_EXPERIMENTAL=OFF" + do_ninja_and_ninja_install + sed -i.bak "s/Libs: .*/& -lstdc++/" "$PKG_CONFIG_PATH/vpl.pc" cd .. } @@ -980,11 +980,11 @@ build_libtiff() { build_libtensorflow() { if [[ ! -e Tensorflow ]]; then mkdir Tensorflow - cd Tensorflow + cd Tensorflow wget https://storage.googleapis.com/tensorflow/versions/2.18.0/libtensorflow-cpu-windows-x86_64.zip # tensorflow.dll required by ffmpeg to run - unzip -o libtensorflow-cpu-windows-x86_64.zip -d $mingw_w64_x86_64_prefix - rm libtensorflow-cpu-windows-x86_64.zip - cd .. + unzip -o libtensorflow-cpu-windows-x86_64.zip -d $mingw_w64_x86_64_prefix + rm libtensorflow-cpu-windows-x86_64.zip + cd .. else echo "Tensorflow already installed" fi } @@ -994,21 +994,21 @@ build_glib() { download_and_unpack_file https://github.com/libffi/libffi/releases/download/v3.4.7/libffi-3.4.7.tar.gz # also dep cd libffi-3.4.7 apply_patch file://$patch_dir/libffi.patch -p1 - generic_configure_make_install + generic_configure_make_install cd .. do_git_checkout https://github.com/GNOME/glib.git glib_git activate_meson cd glib_git - local meson_options="setup --force-fallback-for=libpcre -Dforce_posix_threads=true -Dman-pages=disabled -Dsysprof=disabled -Dglib_debug=disabled -Dtests=false --wrap-mode=default . build" + local meson_options="setup --force-fallback-for=libpcre -Dforce_posix_threads=true -Dman-pages=disabled -Dsysprof=disabled -Dglib_debug=disabled -Dtests=false --wrap-mode=default . build" if [[ $compiler_flavors != "native" ]]; then # get_local_meson_cross_with_propeties meson_options+=" --cross-file=${top_dir}/meson-cross.mingw.txt" do_meson "$meson_options" - else - generic_meson "$meson_options" - fi - do_ninja_and_ninja_install + else + generic_meson "$meson_options" + fi + do_ninja_and_ninja_install if [[ $compiler_flavors == "native" ]]; then sed -i.bak 's/-lglib-2.0.*$/-lglib-2.0 -lm -liconv/' $PKG_CONFIG_PATH/glib-2.0.pc else @@ -1036,7 +1036,7 @@ build_lz4 () { download_and_unpack_file https://github.com/lz4/lz4/releases/download/v1.10.0/lz4-1.10.0.tar.gz cd lz4-1.10.0 do_cmake "-S build/cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Release -DBUILD_STATIC_LIBS=ON" - do_ninja_and_ninja_install + do_ninja_and_ninja_install cd .. } @@ -1045,28 +1045,28 @@ build_lz4 () { download_and_unpack_file https://github.com/libarchive/libarchive/releases/download/v3.7.7/libarchive-3.7.7.tar.gz cd libarchive-3.7.7 generic_configure "--with-nettle --bindir=$mingw_w64_x86_64_prefix/bin --without-mbedtls --without-iconv" # with-iconv = fail - do_make_install - sed -i.bak 's/Requires.private.*$/Requires.private:/' $PKG_CONFIG_PATH/libarchive.pc + do_make_install + sed -i.bak 's/Requires.private.*$/Requires.private:/' $PKG_CONFIG_PATH/libarchive.pc cd .. } build_flac () { - do_git_checkout https://github.com/xiph/flac.git flac_git - cd flac_git - do_cmake "-B build -DCMAKE_BUILD_TYPE=Release -DINSTALL_MANPAGES=OFF -GNinja" - do_ninja_and_ninja_install - cd .. + do_git_checkout https://github.com/xiph/flac.git flac_git + cd flac_git + do_cmake "-B build -DCMAKE_BUILD_TYPE=Release -DINSTALL_MANPAGES=OFF -GNinja" + do_ninja_and_ninja_install + cd .. } build_openmpt () { - build_flac - do_git_checkout https://github.com/OpenMPT/openmpt.git openmpt_git OpenMPT-1.30 - cd openmpt_git - do_make_and_make_install "PREFIX=$mingw_w64_x86_64_prefix CONFIG=mingw64-win64 EXESUFFIX=.exe SOSUFFIX=.dll SOSUFFIXWINDOWS=1 DYNLINK=0 SHARED_LIB=0 STATIC_LIB=1 - SHARED_SONAME=0 IS_CROSS=1 NO_ZLIB=0 NO_LTDL=0 NO_DL=0 NO_MPG123=0 NO_OGG=0 NO_VORBIS=0 NO_VORBISFILE=0 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL=0 - NO_SDL2=0 NO_SNDFILE=0 NO_FLAC=0 EXAMPLES=0 OPENMPT123=0 TEST=0" # OPENMPT123=1 >>> fail - sed -i.bak 's/Libs.private.*/& -lrpcrt4/' $PKG_CONFIG_PATH/libopenmpt.pc - cd .. + build_flac + do_git_checkout https://github.com/OpenMPT/openmpt.git openmpt_git OpenMPT-1.30 + cd openmpt_git + do_make_and_make_install "PREFIX=$mingw_w64_x86_64_prefix CONFIG=mingw64-win64 EXESUFFIX=.exe SOSUFFIX=.dll SOSUFFIXWINDOWS=1 DYNLINK=0 SHARED_LIB=0 STATIC_LIB=1 + SHARED_SONAME=0 IS_CROSS=1 NO_ZLIB=0 NO_LTDL=0 NO_DL=0 NO_MPG123=0 NO_OGG=0 NO_VORBIS=0 NO_VORBISFILE=0 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL=0 + NO_SDL2=0 NO_SNDFILE=0 NO_FLAC=0 EXAMPLES=0 OPENMPT123=0 TEST=0" # OPENMPT123=1 >>> fail + sed -i.bak 's/Libs.private.*/& -lrpcrt4/' $PKG_CONFIG_PATH/libopenmpt.pc + cd .. } build_libpsl () { @@ -1074,7 +1074,7 @@ build_libpsl () { download_and_unpack_file https://github.com/rockdaboot/libpsl/releases/download/0.21.5/libpsl-0.21.5.tar.gz cd libpsl-0.21.5 generic_configure "--disable-nls --disable-rpath --disable-gtk-doc-html --disable-man --disable-runtime" - do_make_and_make_install + do_make_and_make_install sed -i.bak "s/Libs: .*/& -lidn2 -lunistring -lws2_32 -liconv/" $PKG_CONFIG_PATH/libpsl.pc reset_cflags cd .. @@ -1104,11 +1104,11 @@ build_curl () { do_git_checkout https://github.com/curl/curl.git curl_git curl-8_12_1 cd curl_git if [[ $compiler_flavors != "native" ]]; then - generic_configure "--with-libssh2 --with-libpsl --with-libidn2 --disable-debug --enable-hsts --with-brotli --enable-versioned-symbols --enable-sspi --with-schannel" - else - generic_configure "--with-gnutls --with-libssh2 --with-libpsl --with-libidn2 --disable-debug --enable-hsts --with-brotli --enable-versioned-symbols" # untested on native - fi - do_make_and_make_install + generic_configure "--with-libssh2 --with-libpsl --with-libidn2 --disable-debug --enable-hsts --with-brotli --enable-versioned-symbols --enable-sspi --with-schannel" + else + generic_configure "--with-gnutls --with-libssh2 --with-libpsl --with-libidn2 --disable-debug --enable-hsts --with-brotli --enable-versioned-symbols" # untested on native + fi + do_make_and_make_install reset_cppflags cd .. } @@ -1122,13 +1122,13 @@ build_libtesseract() { export CPPFLAGS="$CPPFLAGS -DCURL_STATICLIB" generic_configure "--disable-openmp --with-archive --disable-graphics --disable-tessdata-prefix --with-curl LIBLEPT_HEADERSDIR=$mingw_w64_x86_64_prefix/include --datadir=$mingw_w64_x86_64_prefix/bin" do_make_and_make_install - sed -i.bak 's/Requires.private.*/& lept libarchive liblzma libtiff-4 libcurl/' $PKG_CONFIG_PATH/tesseract.pc - sed -i 's/-ltesseract.*$/-ltesseract -lstdc++ -lws2_32 -lbz2 -lz -liconv -lpthread -lgdi32 -lcrypt32/' $PKG_CONFIG_PATH/tesseract.pc - if [[ ! -f $mingw_w64_x86_64_prefix/bin/tessdata/tessdata/eng.traineddata ]]; then - mkdir -p $mingw_w64_x86_64_prefix/bin/tessdata - cp -f /usr/share/tesseract-ocr/**/tessdata/eng.traineddata $mingw_w64_x86_64_prefix/bin/tessdata/ + sed -i.bak 's/Requires.private.*/& lept libarchive liblzma libtiff-4 libcurl/' $PKG_CONFIG_PATH/tesseract.pc + sed -i 's/-ltesseract.*$/-ltesseract -lstdc++ -lws2_32 -lbz2 -lz -liconv -lpthread -lgdi32 -lcrypt32/' $PKG_CONFIG_PATH/tesseract.pc + if [[ ! -f $mingw_w64_x86_64_prefix/bin/tessdata/tessdata/eng.traineddata ]]; then + mkdir -p $mingw_w64_x86_64_prefix/bin/tessdata + cp -f /usr/share/tesseract-ocr/**/tessdata/eng.traineddata $mingw_w64_x86_64_prefix/bin/tessdata/ fi - reset_cppflags + reset_cppflags cd .. } @@ -1177,22 +1177,27 @@ build_libwebp() { } build_harfbuzz() { - do_git_checkout https://github.com/harfbuzz/harfbuzz.git harfbuzz_git + do_git_checkout https://github.com/harfbuzz/harfbuzz.git harfbuzz_git 10.4.0 # 11.0.0 no longer found by ffmpeg via this method, multiple issues, breaks harfbuzz freetype circular depends hack activate_meson build_freetype cd harfbuzz_git - local meson_options="setup -Dglib=disabled -Dgobject=disabled -Dcairo=disabled -Dicu=disabled -Dtests=disabled -Dintrospection=disabled -Ddocs=disabled -Dbenchmark=disabled . build" - if [[ $compiler_flavors != "native" ]]; then - # get_local_meson_cross_with_propeties - meson_options+=" --cross-file=${top_dir}/meson-cross.mingw.txt" - do_meson "$meson_options" - else - generic_meson "$meson_options" - fi - do_ninja_and_ninja_install + if [[ ! -f DUN ]]; then + local meson_options="setup -Dglib=disabled -Dgobject=disabled -Dcairo=disabled -Dicu=disabled -Dtests=disabled -Dintrospection=disabled -Ddocs=disabled . build" + if [[ $compiler_flavors != "native" ]]; then + # get_local_meson_cross_with_propeties + meson_options+=" --cross-file=${top_dir}/meson-cross.mingw.txt" + do_meson "$meson_options" + else + generic_meson "$meson_options" + fi + do_ninja_and_ninja_install + touch DUN + fi cd .. - build_freetype + build_freetype # with harfbuzz now deactivate + sed -i.bak 's/-lfreetype.*/-lfreetype -lharfbuzz -lpng -lbz2/' "$PKG_CONFIG_PATH/freetype2.pc" + sed -i.bak 's/-lharfbuzz.*/-lfreetype -lharfbuzz -lpng -lbz2/' "$PKG_CONFIG_PATH/harfbuzz.pc" } build_freetype() { @@ -1202,14 +1207,14 @@ build_freetype() { if [[ -e $PKG_CONFIG_PATH/harfbuzz.pc ]]; then local config_options+=" -Dharfbuzz=enabled" fi - local meson_options="setup -Dbrotli=disabled $config_options . build" + local meson_options="setup $config_options . build" if [[ $compiler_flavors != "native" ]]; then # get_local_meson_cross_with_propeties meson_options+=" --cross-file=${top_dir}/meson-cross.mingw.txt" do_meson "$meson_options" - else - generic_meson "$meson_options" - fi + else + generic_meson "$meson_options" + fi do_ninja_and_ninja_install cd .. } @@ -1231,29 +1236,20 @@ build_libvmaf() { # get_local_meson_cross_with_propeties meson_options+=" --cross-file=${top_dir}/meson-cross.mingw.txt" do_meson "$meson_options" - else - generic_meson "$meson_options" - fi - do_ninja_and_ninja_install + else + generic_meson "$meson_options" + fi + do_ninja_and_ninja_install sed -i.bak "s/Libs: .*/& -lstdc++/" "$PKG_CONFIG_PATH/libvmaf.pc" deactivate cd ../.. } build_fontconfig() { - do_git_checkout https://gitlab.freedesktop.org/fontconfig/fontconfig.git fontconfig_git 59e53da82d471c20ba5e43b6aac07a9273303d50 # beyond this commit static broken, mabs patches do not fix 3-21-25 - activate_meson + do_git_checkout https://gitlab.freedesktop.org/fontconfig/fontconfig.git fontconfig_git # meson build for fontconfig no good cd fontconfig_git - local meson_options="setup -Diconv=enabled -Dtests=disabled -Ddoc=disabled -Dxml-backend=libxml2 . build" - if [[ $compiler_flavors != "native" ]]; then - # get_local_meson_cross_with_propeties - meson_options+=" --cross-file=${top_dir}/meson-cross.mingw.txt" - do_meson "$meson_options" - else - generic_meson "$meson_options" - fi - do_ninja_and_ninja_install - deactivate + generic_configure "--enable-iconv --enable-libxml2 --disable-docs --with-libiconv" # Use Libxml2 instead of Expat; will find libintl from gettext on 2nd pass build and ffmpeg rejects it + do_make_and_make_install cd .. } @@ -1315,7 +1311,7 @@ build_libidn2() { download_and_unpack_file https://ftp.gnu.org/gnu/libidn/libidn2-2.3.8.tar.gz cd libidn2-2.3.8 generic_configure "--disable-doc --disable-rpath --disable-nls --disable-gtk-doc-html --disable-fast-install" - do_make_and_make_install + do_make_and_make_install cd .. } @@ -1323,14 +1319,14 @@ build_gnutls() { download_and_unpack_file https://www.gnupg.org/ftp/gcrypt/gnutls/v3.8/gnutls-3.8.9.tar.xz cd gnutls-3.8.9 export CFLAGS="-Wno-int-conversion" - local config_options="" + local config_options="" if [[ $compiler_flavors != "native" ]]; then local config_options+=" --disable-non-suiteb-curves" fi generic_configure "--disable-cxx --disable-doc --disable-tools --disable-tests --disable-nls --disable-rpath --disable-libdane --disable-gcc-warnings --disable-code-coverage - --without-p11-kit --with-idn --without-tpm --with-included-unistring --with-included-libtasn1 -disable-gtk-doc-html --with-brotli $config_options" + --without-p11-kit --with-idn --without-tpm --with-included-unistring --with-included-libtasn1 -disable-gtk-doc-html --with-brotli $config_options" do_make_and_make_install - reset_cflags + reset_cflags if [[ $compiler_flavors != "native" ]]; then sed -i.bak 's/-lgnutls.*/-lgnutls -lcrypt32 -lnettle -lhogweed -lgmp -liconv -lunistring/' "$PKG_CONFIG_PATH/gnutls.pc" if [[ $OSTYPE == darwin* ]]; then @@ -1549,11 +1545,11 @@ local checkout_dir=fdk-aac_git build_AudioToolboxWrapper() { do_git_checkout https://github.com/cynagenautes/AudioToolboxWrapper.git AudioToolboxWrapper_git cd AudioToolboxWrapper_git - do_cmake "-B build -GNinja" - do_ninja_and_ninja_install - # This wrapper library enables FFmpeg to use AudioToolbox codecs on Windows, with DLLs shipped with iTunes. - # i.e. You need to install iTunes, or be able to LoadLibrary("CoreAudioToolbox.dll"), for this to work. - # test ffmpeg build can use it [ffmpeg -f lavfi -i sine=1000 -c aac_at -f mp4 -y NUL] + do_cmake "-B build -GNinja" + do_ninja_and_ninja_install + # This wrapper library enables FFmpeg to use AudioToolbox codecs on Windows, with DLLs shipped with iTunes. + # i.e. You need to install iTunes, or be able to LoadLibrary("CoreAudioToolbox.dll"), for this to work. + # test ffmpeg build can use it [ffmpeg -f lavfi -i sine=1000 -c aac_at -f mp4 -y NUL] cd .. } @@ -1677,7 +1673,7 @@ build_libbs2b() { build_libsoxr() { do_git_checkout https://github.com/chirlu/soxr.git soxr_git cd soxr_git - do_cmake_and_install "-DHAVE_WORDS_BIGENDIAN_EXITCODE=0 -DWITH_OPENMP=0 -DBUILD_TESTS=0 -DBUILD_EXAMPLES=0" + do_cmake_and_install "-DWITH_OPENMP=0 -DBUILD_TESTS=0 -DBUILD_EXAMPLES=0" cd .. } @@ -1916,16 +1912,16 @@ build_libxxhash() { do_git_checkout https://github.com/Cyan4973/xxHash.git xxHash_git dev cd xxHash_git do_cmake "-S cmake_unofficial -B build -DCMAKE_BUILD_TYPE=release -GNinja" - do_ninja_and_ninja_install + do_ninja_and_ninja_install cd .. } build_spirv-cross() { do_git_checkout https://github.com/KhronosGroup/SPIRV-Cross.git SPIRV-Cross_git # 1823c11 # if breaks in future go back to this commit cd SPIRV-Cross_git - do_cmake "-B build -GNinja -DSPIRV_CROSS_STATIC=ON -DSPIRV_CROSS_SHARED=OFF" - do_ninja_and_ninja_install - mv $PKG_CONFIG_PATH/spirv-cross-c.pc $PKG_CONFIG_PATH/spirv-cross-c-shared.pc + do_cmake "-B build -GNinja -DSPIRV_CROSS_STATIC=ON -DSPIRV_CROSS_SHARED=OFF" + do_ninja_and_ninja_install + mv $PKG_CONFIG_PATH/spirv-cross-c.pc $PKG_CONFIG_PATH/spirv-cross-c-shared.pc cd .. } @@ -1936,27 +1932,27 @@ build_libdovi() { curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && . "$HOME/.cargo/env" && rustup update && rustup target add x86_64-pc-windows-gnu # rustup self uninstall if [[ $compiler_flavors != "native" ]]; then wget https://github.com/quietvoid/dovi_tool/releases/download/2.2.0/dovi_tool-2.2.0-x86_64-pc-windows-msvc.zip - unzip -o dovi_tool-2.2.0-x86_64-pc-windows-msvc.zip -d $mingw_w64_x86_64_prefix/bin - rm dovi_tool-2.2.0-x86_64-pc-windows-msvc.zip - fi + unzip -o dovi_tool-2.2.0-x86_64-pc-windows-msvc.zip -d $mingw_w64_x86_64_prefix/bin + rm dovi_tool-2.2.0-x86_64-pc-windows-msvc.zip + fi - unset PKG_CONFIG_PATH + unset PKG_CONFIG_PATH if [[ $compiler_flavors == "native" ]]; then cargo build --release --no-default-features --features internal-font && cp /target/release//dovi_tool $mingw_w64_x86_64_prefix/bin - fi + fi cd dolby_vision - cargo install cargo-c --features=vendored-openssl - if [[ $compiler_flavors == "native" ]]; then - cargo cinstall --release --prefix=$mingw_w64_x86_64_prefix --libdir=$mingw_w64_x86_64_prefix/lib --library-type=staticlib - fi + cargo install cargo-c --features=vendored-openssl + if [[ $compiler_flavors == "native" ]]; then + cargo cinstall --release --prefix=$mingw_w64_x86_64_prefix --libdir=$mingw_w64_x86_64_prefix/lib --library-type=staticlib + fi - export PKG_CONFIG_PATH="$mingw_w64_x86_64_prefix/lib/pkgconfig" - if [[ $compiler_flavors != "native" ]]; then - cargo cinstall --release --prefix=$mingw_w64_x86_64_prefix --libdir=$mingw_w64_x86_64_prefix/lib --library-type=staticlib --target x86_64-pc-windows-gnu + export PKG_CONFIG_PATH="$mingw_w64_x86_64_prefix/lib/pkgconfig" + if [[ $compiler_flavors != "native" ]]; then + cargo cinstall --release --prefix=$mingw_w64_x86_64_prefix --libdir=$mingw_w64_x86_64_prefix/lib --library-type=staticlib --target x86_64-pc-windows-gnu fi - cd .. - else echo "libdovi already installed" - fi + cd .. + else echo "libdovi already installed" + fi cd .. } @@ -1964,16 +1960,16 @@ build_shaderc() { do_git_checkout https://github.com/google/shaderc.git shaderc_git known-good # 8ce49eb # if breaks in future, go back to this commit cd shaderc_git if [[ ! -e src ]]; then - ./update_shaderc_sources.py + ./update_shaderc_sources.py fi cd src - do_cmake "-B build -DCMAKE_BUILD_TYPE=release -GNinja -DSHADERC_SKIP_EXAMPLES=ON -DSHADERC_SKIP_TESTS=ON -DGLSLANG_TESTS=OFF -DSPIRV_HEADERS_SKIP_EXAMPLES=ON -DSPIRV_SKIP_TESTS=ON -DSKIP_GOOGLETEST_INSTALL=ON" - do_ninja_and_ninja_install - cp -r libshaderc_util/include/libshaderc_util $mingw_w64_x86_64_prefix/include - sed -i.bak "s/Libs: .*/& -lstdc++/" "$PKG_CONFIG_PATH/shaderc_combined.pc" - sed -i.bak "s/Libs: .*/& -lstdc++/" "$PKG_CONFIG_PATH/shaderc_static.pc" - sed -i.bak "s/Libs: .*/& -lstdc++/" "$PKG_CONFIG_PATH/shaderc.pc" - sed -i.bak "s/Libs: .*/& -lstdc++/" "$PKG_CONFIG_PATH/SPIRV-Tools.pc" + do_cmake "-B build -DCMAKE_BUILD_TYPE=release -GNinja -DSHADERC_SKIP_EXAMPLES=ON -DSHADERC_SKIP_TESTS=ON -DGLSLANG_TESTS=OFF -DSPIRV_HEADERS_SKIP_EXAMPLES=ON -DSPIRV_SKIP_TESTS=ON -DSKIP_GOOGLETEST_INSTALL=ON" + do_ninja_and_ninja_install + cp -r libshaderc_util/include/libshaderc_util $mingw_w64_x86_64_prefix/include + sed -i.bak "s/Libs: .*/& -lstdc++/" "$PKG_CONFIG_PATH/shaderc_combined.pc" + sed -i.bak "s/Libs: .*/& -lstdc++/" "$PKG_CONFIG_PATH/shaderc_static.pc" + sed -i.bak "s/Libs: .*/& -lstdc++/" "$PKG_CONFIG_PATH/shaderc.pc" + sed -i.bak "s/Libs: .*/& -lstdc++/" "$PKG_CONFIG_PATH/SPIRV-Tools.pc" cd ../.. } @@ -1990,21 +1986,21 @@ build_libplacebo() { do_git_checkout https://code.videolan.org/videolan/libplacebo.git libplacebo_git # 51ea4290a6342ebe67daa34cd4483476bed4e03d # if breaks in future, go back to this commit activate_meson cd libplacebo_git - git submodule update --init - local config_options="" + git submodule update --init + local config_options="" if [[ $OSTYPE != darwin* ]]; then local config_options+=" -Dvulkan-registry=$mingw_w64_x86_64_prefix/share/vulkan/registry/vk.xml" fi - local meson_options="setup -Ddemos=false -Dc_link_args=-static -Dcpp_link_args=-static $config_options . build" # https://mesonbuild.com/Dependencies.html#shaderc trigger use of shaderc_combined + local meson_options="setup -Ddemos=false -Dc_link_args=-static -Dcpp_link_args=-static $config_options . build" # https://mesonbuild.com/Dependencies.html#shaderc trigger use of shaderc_combined if [[ $compiler_flavors != "native" ]]; then # get_local_meson_cross_with_propeties meson_options+=" --cross-file=${top_dir}/meson-cross.mingw.txt" do_meson "$meson_options" - else - generic_meson "$meson_options" - fi - do_ninja_and_ninja_install - sed -i.bak 's/-lplacebo.*$/-lplacebo -lm -lshlwapi -lunwind -lxxhash -lversion -lstdc++/' "$PKG_CONFIG_PATH/libplacebo.pc" + else + generic_meson "$meson_options" + fi + do_ninja_and_ninja_install + sed -i.bak 's/-lplacebo.*$/-lplacebo -lm -lshlwapi -lunwind -lxxhash -lversion -lstdc++/' "$PKG_CONFIG_PATH/libplacebo.pc" deactivate cd .. } @@ -2017,8 +2013,8 @@ build_libaribcaption() { do_git_checkout https://github.com/xqq/libaribcaption mkdir libaribcaption/build cd libaribcaption/build - do_cmake_from_build_dir .. "-DCMAKE_BUILD_TYPE=Release" - do_make_and_make_install + do_cmake_from_build_dir .. "-DCMAKE_BUILD_TYPE=Release" + do_make_and_make_install cd ../.. } @@ -2050,12 +2046,12 @@ build_libxavs2() { build_libdavs2() { do_git_checkout https://github.com/pkuvcl/davs2.git cd davs2_git/build/linux - if [[ $host_target == 'i686-w64-mingw32' ]]; then - do_configure "--cross-prefix=$cross_prefix --host=$host_target --prefix=$mingw_w64_x86_64_prefix --enable-pic --disable-asm" - else - do_configure "--cross-prefix=$cross_prefix --host=$host_target --prefix=$mingw_w64_x86_64_prefix --enable-pic" - fi - do_make_and_make_install + if [[ $host_target == 'i686-w64-mingw32' ]]; then + do_configure "--cross-prefix=$cross_prefix --host=$host_target --prefix=$mingw_w64_x86_64_prefix --enable-pic --disable-asm" + else + do_configure "--cross-prefix=$cross_prefix --host=$host_target --prefix=$mingw_w64_x86_64_prefix --enable-pic" + fi + do_make_and_make_install cd ../../.. } @@ -2116,10 +2112,10 @@ build_dav1d() { # get_local_meson_cross_with_propeties meson_options+=" --cross-file=${top_dir}/meson-cross.mingw.txt" do_meson "$meson_options" - else - generic_meson "$meson_options" - fi - do_ninja_and_ninja_install + else + generic_meson "$meson_options" + fi + do_ninja_and_ninja_install cp build/src/libdav1d.a $mingw_w64_x86_64_prefix/lib || exit 1 # avoid 'run ranlib' weird failure, possibly older meson's https://github.com/mesonbuild/meson/issues/4138 :| cpu_count=$original_cpu_count deactivate @@ -2354,7 +2350,7 @@ set(CMAKE_RC_COMPILER ${cross_prefix}windres) EOF fi do_cmake_and_install "$cmake_params" - cd .. + cd .. } build_libproxy() { @@ -2388,7 +2384,7 @@ build_libhdhomerun() { build_dvbtee_app() { build_iconv # said it needed it build_curl # it "can use this" so why not -# build_libhdhomerun # broken but possible dependency apparently :| + # build_libhdhomerun # broken but possible dependency apparently :| do_git_checkout https://github.com/mkrufky/libdvbtee.git libdvbtee_git cd libdvbtee_git # checkout its submodule, apparently required @@ -2492,8 +2488,7 @@ build_meson_cross() { cpu_family="x86" fi rm -fv meson-cross.mingw.txt - cat >> meson-cross.mingw.txt << EOF - + cat >> meson-cross.mingw.txt << EOF [built-in options] buildtype = 'release' wrap_mode = 'nofallback' @@ -2688,13 +2683,16 @@ build_ffmpeg() { fi config_options="$init_options" # alphabetized :) - config_options+=" --enable-cuda" + config_options+=" --enable-bzlib" + config_options+=" --enable-cuda" config_options+=" --enable-cuda-llvm" - config_options+=" --enable-cuvid" + config_options+=" --enable-cuvid" + config_options+=" --enable-ffnvcodec" config_options+=" --enable-fontconfig" config_options+=" --enable-gmp" config_options+=" --enable-gnutls" config_options+=" --enable-gray" + config_options+=" --enable-iconv" config_options+=" --enable-libass" config_options+=" --enable-libbluray" config_options+=" --enable-libbs2b" @@ -2717,8 +2715,9 @@ build_ffmpeg() { config_options+=" --enable-libopenjpeg" config_options+=" --enable-libopenmpt" config_options+=" --enable-libopus" - config_options+=" --enable-libplacebo" - # config_options+=" --enable-librtmfp" # currently broken + config_options+=" --enable-libplacebo" + # config_options+=" --enable-librtmfp" # currently broken + config_options+=" --enable-libshaderc" config_options+=" --enable-libsnappy" config_options+=" --enable-libsoxr" config_options+=" --enable-libspeex" @@ -2735,11 +2734,15 @@ build_ffmpeg() { config_options+=" --enable-libwebp" config_options+=" --enable-libxml2" config_options+=" --enable-libzvbi" - config_options+=" --enable-libzimg" + config_options+=" --enable-libzimg" + config_options+=" --enable-lzma" + config_options+=" --enable-mediafoundation" config_options+=" --enable-opengl" + config_options+=" --enable-sdl2" if [[ $OSTYPE != darwin* ]]; then config_options+=" --enable-vulkan" fi + config_options+=" --enable-zlib" if [[ "$bits_target" != "32" ]]; then if [[ $build_svt_hevc = y ]]; then # SVT-HEVC @@ -2997,7 +3000,8 @@ build_ffmpeg_dependencies() { build_libpng # Needs zlib >= 1.0.4. Uses dlfcn. build_libwebp # Uses dlfcn. build_libxml2 # Uses zlib, liblzma, iconv and dlfcn - build_harfbuzz # Uses freetype zlib, bzip2, and libpng. + build_brotli + build_harfbuzz # Uses freetype zlib, bzip2, brotli and libpng. build_libvmaf build_fontconfig # uses libpng bzip2 libxml2 and zlib build_gmp # For rtmp support configure FFmpeg with '--enable-gmp'. Uses dlfcn. @@ -3006,7 +3010,6 @@ build_ffmpeg_dependencies() { build_unistring build_libidn2 # needs iconv and unistring build_zstd - build_brotli build_gnutls # Needs nettle >= 3.1, hogweed (nettle) >= 3.1. Uses libidn2, unistring, zlib, and dlfcn. build_curl #if [[ "$non_free" = "y" ]]; then From e98eae23a9eced93153029b19b97efeb69f159ee Mon Sep 17 00:00:00 2001 From: tjayz <90593277+tjayz@users.noreply.github.com> Date: Mon, 24 Mar 2025 16:14:37 -0400 Subject: [PATCH 11/26] Update cross_compile_ffmpeg.sh code aesthetics missed --- cross_compile_ffmpeg.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cross_compile_ffmpeg.sh b/cross_compile_ffmpeg.sh index 62a5c5b5..33cee65b 100755 --- a/cross_compile_ffmpeg.sh +++ b/cross_compile_ffmpeg.sh @@ -610,14 +610,14 @@ do_cmake_and_install() { activate_meson() { if [[ ! -e meson_git ]]; then - do_git_checkout https://github.com/mesonbuild/meson.git meson_git 1.7 + do_git_checkout https://github.com/mesonbuild/meson.git meson_git 1.7 fi cd meson_git # requires python3-full - if [[ ! -e tutorial_env ]]; then - python3 -m venv tutorial_env - source tutorial_env/bin/activate + if [[ ! -e tutorial_env ]]; then + python3 -m venv tutorial_env + source tutorial_env/bin/activate python3 -m pip install meson - else source tutorial_env/bin/activate + else source tutorial_env/bin/activate fi cd .. } @@ -1688,9 +1688,9 @@ build_libflite() { do_make # /usr/bin/install: cannot stat '../bin/flite': No such file or directory; should be looking for /bin/flite.exe etc... if [[ ! -f $mingw_w64_x86_64_prefix/lib/libflite.a ]]; then - cp -rf ./build/x86_64-mingw32/lib/libflite* $mingw_w64_x86_64_prefix/lib/ - cp -rf include $mingw_w64_x86_64_prefix/include/flite - # cp -rf ./bin/*.exe $mingw_w64_x86_64_prefix/bin # if want .exe's uncomment + cp -rf ./build/x86_64-mingw32/lib/libflite* $mingw_w64_x86_64_prefix/lib/ + cp -rf include $mingw_w64_x86_64_prefix/include/flite + # cp -rf ./bin/*.exe $mingw_w64_x86_64_prefix/bin # if want .exe's uncomment fi cd .. } From e860b976eb840a8be321e8debc8f8210992602a9 Mon Sep 17 00:00:00 2001 From: tjayz <90593277+tjayz@users.noreply.github.com> Date: Tue, 25 Mar 2025 20:51:43 -0400 Subject: [PATCH 12/26] Update cross_compile_ffmpeg.sh update libarchive --- cross_compile_ffmpeg.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cross_compile_ffmpeg.sh b/cross_compile_ffmpeg.sh index 33cee65b..1a805ecf 100755 --- a/cross_compile_ffmpeg.sh +++ b/cross_compile_ffmpeg.sh @@ -1042,11 +1042,10 @@ build_lz4 () { build_libarchive () { build_lz4 - download_and_unpack_file https://github.com/libarchive/libarchive/releases/download/v3.7.7/libarchive-3.7.7.tar.gz - cd libarchive-3.7.7 - generic_configure "--with-nettle --bindir=$mingw_w64_x86_64_prefix/bin --without-mbedtls --without-iconv" # with-iconv = fail + download_and_unpack_file https://github.com/libarchive/libarchive/releases/download/v3.7.8/libarchive-3.7.8.tar.gz + cd libarchive-3.7.8 + generic_configure "--with-nettle --bindir=$mingw_w64_x86_64_prefix/bin --without-openssl --without-iconv --disable-posix-regex-lib" do_make_install - sed -i.bak 's/Requires.private.*$/Requires.private:/' $PKG_CONFIG_PATH/libarchive.pc cd .. } From 9e44dc216bd643155e0c9b67c1edac1464ade948 Mon Sep 17 00:00:00 2001 From: tjayz <90593277+tjayz@users.noreply.github.com> Date: Tue, 6 May 2025 18:58:33 -0400 Subject: [PATCH 13/26] Update cross_compile_ffmpeg.sh --- cross_compile_ffmpeg.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cross_compile_ffmpeg.sh b/cross_compile_ffmpeg.sh index 1a805ecf..0803c17f 100755 --- a/cross_compile_ffmpeg.sh +++ b/cross_compile_ffmpeg.sh @@ -1910,9 +1910,9 @@ build_libunwind() { build_libxxhash() { do_git_checkout https://github.com/Cyan4973/xxHash.git xxHash_git dev cd xxHash_git - do_cmake "-S cmake_unofficial -B build -DCMAKE_BUILD_TYPE=release -GNinja" + do_cmake "-S build/cmake -B build -DCMAKE_BUILD_TYPE=release -GNinja" do_ninja_and_ninja_install - cd .. + cd ../.. } build_spirv-cross() { From e38f4b09f18f2de5b9f5a8fc6e532b1d81312f96 Mon Sep 17 00:00:00 2001 From: tjayz <90593277+tjayz@users.noreply.github.com> Date: Tue, 6 May 2025 19:02:30 -0400 Subject: [PATCH 14/26] Update cross_compile_ffmpeg.sh --- cross_compile_ffmpeg.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cross_compile_ffmpeg.sh b/cross_compile_ffmpeg.sh index 0803c17f..0833a7b6 100755 --- a/cross_compile_ffmpeg.sh +++ b/cross_compile_ffmpeg.sh @@ -1912,7 +1912,7 @@ build_libxxhash() { cd xxHash_git do_cmake "-S build/cmake -B build -DCMAKE_BUILD_TYPE=release -GNinja" do_ninja_and_ninja_install - cd ../.. + cd .. } build_spirv-cross() { From e655b55659fb3f15e29c4deab124605723bd933b Mon Sep 17 00:00:00 2001 From: tjayz <90593277+tjayz@users.noreply.github.com> Date: Sun, 31 Aug 2025 18:32:21 -0400 Subject: [PATCH 15/26] Update flite-2.1.0_mingw-w64-fixes.patch --- patches/flite-2.1.0_mingw-w64-fixes.patch | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/patches/flite-2.1.0_mingw-w64-fixes.patch b/patches/flite-2.1.0_mingw-w64-fixes.patch index f4b424a9..2d6d4fe3 100644 --- a/patches/flite-2.1.0_mingw-w64-fixes.patch +++ b/patches/flite-2.1.0_mingw-w64-fixes.patch @@ -1,14 +1,3 @@ ---- configure.bak 2020-05-11 18:30:54.909379626 +0000 -+++ configure 2020-05-11 18:32:22.906040345 +0000 -@@ -4081,7 +4081,7 @@ - # http://www.mingw.org - shared=false - CFLAGS="$CFLAGS -DCST_NO_SOCKETS -DUNDER_WINDOWS -DWIN32 -shared" -- MINGWPREF="i386-mingw32-" -+ MINGWPREF="${host_alias}-" - CC="${MINGWPREF}gcc" - RANLIB="${MINGWPREF}ranlib" - AR="${MINGWPREF}ar" --- main/Makefile.bak 2020-05-11 20:18:26.039219862 +0000 +++ main/Makefile 2020-05-11 20:19:09.207549064 +0000 @@ -133,12 +133,12 @@ @@ -52,7 +41,7 @@ @@ -267,7 +267,7 @@ } - #ifdef _WIN32 + #if defined _WIN32 && !defined(__GNUC__) - __inline int ts_utf8_sequence_length(char c0) + int ts_utf8_sequence_length(char c0) #else From 31531563bbc3c4648abdf8d17ce857346c97cf0d Mon Sep 17 00:00:00 2001 From: tjayz <90593277+tjayz@users.noreply.github.com> Date: Sun, 31 Aug 2025 18:36:11 -0400 Subject: [PATCH 16/26] Update mingw-w64-build --- patches/mingw-w64-build | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/patches/mingw-w64-build b/patches/mingw-w64-build index 4a73ae67..c4f30afe 100644 --- a/patches/mingw-w64-build +++ b/patches/mingw-w64-build @@ -21,6 +21,7 @@ ROOT_PATH=$(pwd) # MINGW_W64_BRANCH="master" # BINUTILS_BRANCH="binutils-2_44-branch" # GCC_BRANCH="releases/gcc-14" +WIN32_WINNT="0x0A00" ENABLE_THREADS="--enable-threads=posix" @@ -51,6 +52,9 @@ Options: --gcc-branch set GCC branch (default: $GCC_BRANCH) --mingw-w64-branch set MinGW-w64 branch (default: $MINGW_W64_BRANCH) --linked-runtime set MinGW Linked Runtime (default: $LINKED_RUNTIME) + --win32-winnt set default _WIN32_WINNT value (default: $WIN32_WINNT) + For possible _WIN32_WINNT values, see: + https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt EOF } @@ -139,7 +143,7 @@ download_sources() execute "downloading config.guess" "" \ curl -o config.guess \ - "https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD" + "https://gitweb.git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD" } build() @@ -350,6 +354,20 @@ while :; do ;; --mingw-w64-branch=) arg_error "'--mingw-w64-branch' requires a non-empty option argument" + ;; + --win32-winnt) + if [ "$2" ]; then + WIN32_WINNT="$2" + shift + else + arg_error "'--win32-winnt' requires a non-empty option argument" + fi + ;; + --win32-winnt=?*) + WIN32_WINNT=${1#*=} + ;; + --win32_winnt=) + arg_error "'--win32-winnt' requires a non-empty option argument" ;; i586) BUILD_I586=1 From e0208fd42e9728ed25c1fce35305dcec2c219ca0 Mon Sep 17 00:00:00 2001 From: tjayz <90593277+tjayz@users.noreply.github.com> Date: Sun, 31 Aug 2025 18:50:04 -0400 Subject: [PATCH 17/26] Update mingw-w64-build --- patches/mingw-w64-build | 1 + 1 file changed, 1 insertion(+) diff --git a/patches/mingw-w64-build b/patches/mingw-w64-build index c4f30afe..18f2aaf0 100644 --- a/patches/mingw-w64-build +++ b/patches/mingw-w64-build @@ -191,6 +191,7 @@ build() execute "($arch): configuring MinGW-w64 headers" "" \ "$SRC_PATH/mingw-w64/mingw-w64-headers/configure" --build="$BUILD" \ --host="$host" --prefix="$prefix/$host" \ + --with-default-win32-winnt=$WIN32_WINNT \ --with-default-msvcrt=$LINKED_RUNTIME execute "($arch): installing MinGW-w64 headers" "" \ From 4b28dd72ad97631ca499c591bb7d1b84953b11f7 Mon Sep 17 00:00:00 2001 From: tjayz <90593277+tjayz@users.noreply.github.com> Date: Sun, 31 Aug 2025 19:06:40 -0400 Subject: [PATCH 18/26] Update mingw-w64-build --- patches/mingw-w64-build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patches/mingw-w64-build b/patches/mingw-w64-build index 18f2aaf0..3abf1bbf 100644 --- a/patches/mingw-w64-build +++ b/patches/mingw-w64-build @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (C) 2024 Kyle Schwarz +# Copyright (C) 2025 Kyle Schwarz # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -367,7 +367,7 @@ while :; do --win32-winnt=?*) WIN32_WINNT=${1#*=} ;; - --win32_winnt=) + --win32-winnt=) arg_error "'--win32-winnt' requires a non-empty option argument" ;; i586) From 57e346e44efa7f636c5220bb12926a70c37c3a25 Mon Sep 17 00:00:00 2001 From: tjayz <90593277+tjayz@users.noreply.github.com> Date: Mon, 1 Sep 2025 13:27:15 -0400 Subject: [PATCH 19/26] Update cross_compile_ffmpeg.sh updates zeranoe script updated libs updated flite patch other changes to complete build --- cross_compile_ffmpeg.sh | 88 +++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 52 deletions(-) diff --git a/cross_compile_ffmpeg.sh b/cross_compile_ffmpeg.sh index 0833a7b6..f5e22455 100755 --- a/cross_compile_ffmpeg.sh +++ b/cross_compile_ffmpeg.sh @@ -821,8 +821,8 @@ build_bzip2() { } build_liblzma() { - download_and_unpack_file https://sourceforge.net/projects/lzmautils/files/xz-5.6.4.tar.xz - cd xz-5.6.4 + download_and_unpack_file https://sourceforge.net/projects/lzmautils/files/xz-5.8.1.tar.xz + cd xz-5.8.1 generic_configure "--disable-xz --disable-xzdec --disable-lzmadec --disable-lzmainfo --disable-scripts --disable-doc --disable-nls" do_make_and_make_install cd .. @@ -858,7 +858,7 @@ build_iconv() { build_brotli() { do_git_checkout https://github.com/google/brotli.git brotli_git v1.0.9 # v1.1.0 static headache stay away cd brotli_git - if [ ! -f already* ]; then + if [ ! -f "already*" ]; then rm configure fi generic_configure @@ -990,9 +990,9 @@ build_libtensorflow() { } build_glib() { - generic_download_and_make_and_install https://ftp.gnu.org/pub/gnu/gettext/gettext-0.23.1.tar.gz - download_and_unpack_file https://github.com/libffi/libffi/releases/download/v3.4.7/libffi-3.4.7.tar.gz # also dep - cd libffi-3.4.7 + generic_download_and_make_and_install https://ftp.gnu.org/pub/gnu/gettext/gettext-0.26.tar.gz + download_and_unpack_file https://github.com/libffi/libffi/releases/download/v3.5.2/libffi-3.5.2.tar.gz # also dep + cd libffi-3.5.2 apply_patch file://$patch_dir/libffi.patch -p1 generic_configure_make_install cd .. @@ -1042,8 +1042,8 @@ build_lz4 () { build_libarchive () { build_lz4 - download_and_unpack_file https://github.com/libarchive/libarchive/releases/download/v3.7.8/libarchive-3.7.8.tar.gz - cd libarchive-3.7.8 + download_and_unpack_file https://github.com/libarchive/libarchive/releases/download/v3.8.1/libarchive-3.8.1.tar.gz + cd libarchive-3.8.1 generic_configure "--with-nettle --bindir=$mingw_w64_x86_64_prefix/bin --without-openssl --without-iconv --disable-posix-regex-lib" do_make_install cd .. @@ -1081,8 +1081,8 @@ build_libpsl () { build_nghttp2 () { export CFLAGS="-DNGHTTP2_STATICLIB" - download_and_unpack_file https://github.com/nghttp2/nghttp2/releases/download/v1.65.0/nghttp2-1.65.0.tar.gz - cd nghttp2-1.65.0 + download_and_unpack_file https://github.com/nghttp2/nghttp2/releases/download/v1.66.0/nghttp2-1.66.0.tar.gz + cd nghttp2-1.66.0 do_cmake "-B build -DENABLE_LIB_ONLY=1 -DBUILD_SHARED_LIBS=0 -DBUILD_STATIC_LIBS=1 -GNinja" do_ninja_and_ninja_install reset_cflags @@ -1100,7 +1100,7 @@ build_curl () { local config_options+="-DGNUTLS_INTERNAL_BUILD" fi export CPPFLAGS+="$CPPFLAGS -DNGHTTP2_STATICLIB -DPSL_STATIC $config_options" - do_git_checkout https://github.com/curl/curl.git curl_git curl-8_12_1 + do_git_checkout https://github.com/curl/curl.git curl_git curl-8_15_0 cd curl_git if [[ $compiler_flavors != "native" ]]; then generic_configure "--with-libssh2 --with-libpsl --with-libidn2 --disable-debug --enable-hsts --with-brotli --enable-versioned-symbols --enable-sspi --with-schannel" @@ -1291,8 +1291,8 @@ build_librtmfp() { } build_libnettle() { - download_and_unpack_file https://ftp.gnu.org/gnu/nettle/nettle-3.10.tar.gz - cd nettle-3.10 + download_and_unpack_file https://ftp.gnu.org/gnu/nettle/nettle-3.10.2.tar.gz + cd nettle-3.10.2 local config_options="--disable-openssl --disable-documentation" # in case we have both gnutls and openssl, just use gnutls [except that gnutls uses this so...huh? if [[ $compiler_flavors == "native" ]]; then config_options+=" --libdir=${mingw_w64_x86_64_prefix}/lib" # Otherwise native builds install to /lib32 or /lib64 which gnutls doesn't find @@ -1315,7 +1315,7 @@ build_libidn2() { } build_gnutls() { - download_and_unpack_file https://www.gnupg.org/ftp/gcrypt/gnutls/v3.8/gnutls-3.8.9.tar.xz + download_and_unpack_file https://www.gnupg.org/ftp/gcrypt/gnutls/v3.8/gnutls-3.8.9.tar.xz # v3.8.10 not found by ffmpeg with identical .pc? cd gnutls-3.8.9 export CFLAGS="-Wno-int-conversion" local config_options="" @@ -1625,36 +1625,21 @@ build_facebooktransform360() { } build_libbluray() { - unset JDK_HOME # #268 was causing failure do_git_checkout https://code.videolan.org/videolan/libbluray.git + activate_meson cd libbluray_git - if [[ ! -d .git/modules ]]; then - git submodule update --init --remote # For UDF support [default=enabled], which strangely enough is in another repository. + apply_patch "https://raw.githubusercontent.com/m-ab-s/mabs-patches/master/libbluray/0001-dec-prefix-with-libbluray-for-now.patch" -p1 + local meson_options="setup -Denable_examples=false -Dbdj_jar=disabled --wrap-mode=default . build" + if [[ $compiler_flavors != "native" ]]; then + # get_local_meson_cross_with_propeties + meson_options+=" --cross-file=${top_dir}/meson-cross.mingw.txt" + do_meson "$meson_options" else - local local_git_version=`git --git-dir=.git/modules/contrib/libudfread rev-parse HEAD` - local remote_git_version=`git ls-remote -h https://code.videolan.org/videolan/libudfread.git | sed "s/[[:space:]].*//"` - if [[ "$local_git_version" != "$remote_git_version" ]]; then - echo "detected upstream udfread changed, attempted to update submodules" # XXX use do_git_checkout here instead somehow? - git submodule foreach -q 'git clean -fx' # Throw away local changes; 'already_configured_*' and 'udfread.c.bak' in this case. - rm -f contrib/libudfread/src/udfread-version.h - git submodule update --remote -f # Checkout even if the working tree differs from HEAD. - fi - fi - if [[ ! -f jni/win32/jni_md.h.bak ]]; then - sed -i.bak "/JNIEXPORT/s/ __declspec.*//" jni/win32/jni_md.h # Needed for building shared FFmpeg libraries. + generic_meson "$meson_options" fi - # avoid collision with newer ffmpegs, couldn't figure out better glob LOL - sed -i.bak "s/dec_init/dec__init/g" src/libbluray/disc/*.{c,h} - cd contrib/libudfread - if [[ ! -f src/udfread.c.bak ]]; then - sed -i.bak "/WIN32$/,+4d" src/udfread.c # Fix WinXP incompatibility. - fi - if [[ ! -f src/udfread-version.h ]]; then - generic_configure # Generate 'udfread-version.h', or building Libbluray fails otherwise. - fi - cd ../.. - generic_configure "--disable-examples --disable-bdjava-jar" - do_make_and_make_install "CPPFLAGS=\"-Ddec_init=libbr_dec_init\"" + do_ninja_and_ninja_install # "CPPFLAGS=\"-Ddec_init=libbr_dec_init\"" + sed -i.bak 's/-lbluray.*/-lbluray -lstdc++ -lssp -lgdi32/' "$PKG_CONFIG_PATH/libbluray.pc" + deactivate cd .. } @@ -1679,13 +1664,12 @@ build_libsoxr() { build_libflite() { do_git_checkout https://github.com/festvox/flite.git flite_git cd flite_git - apply_patch "https://raw.githubusercontent.com/m-ab-s/mabs-patches/master/flite/0001-tools-find_sts_main.c-Include-windows.h-before-defin.patch" -p1 + apply_patch file://$patch_dir/flite-2.1.0_mingw-w64-fixes.patch if [[ ! -f main/Makefile.bak ]]; then sed -i.bak "s/cp -pd/cp -p/" main/Makefile # friendlier cp for OS X fi generic_configure "--bindir=$mingw_w64_x86_64_prefix/bin --with-audio=none" do_make - # /usr/bin/install: cannot stat '../bin/flite': No such file or directory; should be looking for /bin/flite.exe etc... if [[ ! -f $mingw_w64_x86_64_prefix/lib/libflite.a ]]; then cp -rf ./build/x86_64-mingw32/lib/libflite* $mingw_w64_x86_64_prefix/lib/ cp -rf include $mingw_w64_x86_64_prefix/include/flite @@ -1746,8 +1730,8 @@ build_librubberband() { build_frei0r() { #do_git_checkout https://github.com/dyne/frei0r.git #cd frei0r_git - download_and_unpack_file https://github.com/dyne/frei0r/archive/refs/tags/v2.3.0.tar.gz frei0r-2.3.0 - cd frei0r-2.3.0 + download_and_unpack_file https://github.com/dyne/frei0r/archive/refs/tags/v2.3.3.tar.gz frei0r-2.3.3 + cd frei0r-2.3.3 sed -i.bak 's/-arch i386//' CMakeLists.txt # OS X https://github.com/dyne/frei0r/issues/64 do_cmake_and_install "-DWITHOUT_OPENCV=1" # XXX could look at this more... @@ -1885,14 +1869,14 @@ build_libass() { } build_vulkan() { - do_git_checkout https://github.com/KhronosGroup/Vulkan-Headers.git Vulkan-Headers_git v1.4.310 + do_git_checkout https://github.com/KhronosGroup/Vulkan-Headers.git Vulkan-Headers_git v1.4.321 cd Vulkan-Headers_git do_cmake_and_install "-DCMAKE_BUILD_TYPE=Release -DVULKAN_HEADERS_ENABLE_MODULE=OFF" cd .. } build_vulkan_loader() { - do_git_checkout https://github.com/KhronosGroup/Vulkan-Loader.git Vulkan-Loader_git v1.4.310 + do_git_checkout https://github.com/KhronosGroup/Vulkan-Loader.git Vulkan-Loader_git v1.4.321 cd Vulkan-Loader_git do_cmake_and_install "-DCMAKE_BUILD_TYPE=Release -DUSE_GAS=ON" cd .. @@ -1916,7 +1900,7 @@ build_libxxhash() { } build_spirv-cross() { - do_git_checkout https://github.com/KhronosGroup/SPIRV-Cross.git SPIRV-Cross_git # 1823c11 # if breaks in future go back to this commit + do_git_checkout https://github.com/KhronosGroup/SPIRV-Cross.git SPIRV-Cross_git vulkan-sdk-1.4.321.0 # 1823c11 # if breaks in future go back to this commit cd SPIRV-Cross_git do_cmake "-B build -GNinja -DSPIRV_CROSS_STATIC=ON -DSPIRV_CROSS_SHARED=OFF" do_ninja_and_ninja_install @@ -1930,9 +1914,9 @@ build_libdovi() { if [[ ! -e $mingw_w64_x86_64_prefix/lib/libdovi.a ]]; then curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && . "$HOME/.cargo/env" && rustup update && rustup target add x86_64-pc-windows-gnu # rustup self uninstall if [[ $compiler_flavors != "native" ]]; then - wget https://github.com/quietvoid/dovi_tool/releases/download/2.2.0/dovi_tool-2.2.0-x86_64-pc-windows-msvc.zip - unzip -o dovi_tool-2.2.0-x86_64-pc-windows-msvc.zip -d $mingw_w64_x86_64_prefix/bin - rm dovi_tool-2.2.0-x86_64-pc-windows-msvc.zip + wget https://github.com/quietvoid/dovi_tool/releases/download/2.3.1/dovi_tool-2.3.1-x86_64-pc-windows-msvc.zip + unzip -o dovi_tool-2.3.1-x86_64-pc-windows-msvc.zip -d $mingw_w64_x86_64_prefix/bin + rm dovi_tool-2.3.1-x86_64-pc-windows-msvc.zip fi unset PKG_CONFIG_PATH @@ -2728,7 +2712,7 @@ build_ffmpeg() { config_options+=" --enable-libvmaf" config_options+=" --enable-libvo-amrwbenc" config_options+=" --enable-libvorbis" - config_options+=" --enable-libvvdec" && apply_patch "https://raw.githubusercontent.com/wiki/fraunhoferhhi/vvdec/data/patch/v6-0001-avcodec-add-external-dec-libvvdec-for-H266-VVC.patch" -p1 + config_options+=" --enable-libvvdec" && apply_patch "https://raw.githubusercontent.com/wiki/fraunhoferhhi/vvdec/data/patch/v7-0001-avcodec-add-external-dec-libvvdec-for-H266-VVC.patch" -p1 config_options+=" --enable-libvvenc" config_options+=" --enable-libwebp" config_options+=" --enable-libxml2" @@ -3005,7 +2989,7 @@ build_ffmpeg_dependencies() { build_fontconfig # uses libpng bzip2 libxml2 and zlib build_gmp # For rtmp support configure FFmpeg with '--enable-gmp'. Uses dlfcn. #build_librtmfp # mainline ffmpeg doesn't use it yet - build_libnettle # Needs gmp >= 3.0. Uses dlfcn. + build_libnettle # Needs gmp >= 3.0. Uses dlfcn. GCC 15 does not yet detect gmp properly yet build_unistring build_libidn2 # needs iconv and unistring build_zstd From aa9fd8dfdd41e5a913e0524b03c139316f5ab65b Mon Sep 17 00:00:00 2001 From: tjayz <90593277+tjayz@users.noreply.github.com> Date: Tue, 2 Sep 2025 15:11:01 -0400 Subject: [PATCH 20/26] Update mingw-w64-build aestethics --- patches/mingw-w64-build | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/patches/mingw-w64-build b/patches/mingw-w64-build index 3abf1bbf..3316dbfc 100644 --- a/patches/mingw-w64-build +++ b/patches/mingw-w64-build @@ -52,9 +52,11 @@ Options: --gcc-branch set GCC branch (default: $GCC_BRANCH) --mingw-w64-branch set MinGW-w64 branch (default: $MINGW_W64_BRANCH) --linked-runtime set MinGW Linked Runtime (default: $LINKED_RUNTIME) - --win32-winnt set default _WIN32_WINNT value (default: $WIN32_WINNT) - For possible _WIN32_WINNT values, see: - https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt + --win32-winnt set default _WIN32_WINNT value (default: $WIN32_WINNT) + +For possible _WIN32_WINNT values, see: +https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt + EOF } @@ -191,7 +193,7 @@ build() execute "($arch): configuring MinGW-w64 headers" "" \ "$SRC_PATH/mingw-w64/mingw-w64-headers/configure" --build="$BUILD" \ --host="$host" --prefix="$prefix/$host" \ - --with-default-win32-winnt=$WIN32_WINNT \ + --with-default-win32-winnt=$WIN32_WINNT \ --with-default-msvcrt=$LINKED_RUNTIME execute "($arch): installing MinGW-w64 headers" "" \ @@ -356,7 +358,7 @@ while :; do --mingw-w64-branch=) arg_error "'--mingw-w64-branch' requires a non-empty option argument" ;; - --win32-winnt) + --win32-winnt) if [ "$2" ]; then WIN32_WINNT="$2" shift From c503df272df21da266d333d76c15e4555fa96393 Mon Sep 17 00:00:00 2001 From: tjayz <90593277+tjayz@users.noreply.github.com> Date: Mon, 8 Sep 2025 14:32:49 -0400 Subject: [PATCH 21/26] Add files via upload --- patches/SDL2-2.32.10_lib-only.diff | 52 ++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 patches/SDL2-2.32.10_lib-only.diff diff --git a/patches/SDL2-2.32.10_lib-only.diff b/patches/SDL2-2.32.10_lib-only.diff new file mode 100644 index 00000000..fbb0addb --- /dev/null +++ b/patches/SDL2-2.32.10_lib-only.diff @@ -0,0 +1,52 @@ +--- Makefile.in.bak 2020-05-09 01:16:48.374940571 +0000 ++++ Makefile.in 2020-05-09 01:19:12.707861205 +0000 +@@ -39,9 +39,6 @@ + SDLMAIN_TARGET = libSDL2main.la + SDLMAIN_OBJECTS = @SDLMAIN_OBJECTS@ + +-SDLTEST_TARGET = libSDL2_test.la +-SDLTEST_OBJECTS = @SDLTEST_OBJECTS@ +- + WAYLAND_SCANNER = @WAYLAND_SCANNER@ + + INSTALL_SDL2_CONFIG = @INSTALL_SDL2_CONFIG@ +@@ -128,7 +125,7 @@ + LT_REVISION = @LT_REVISION@ + LT_LDFLAGS = -no-undefined -rpath $(libdir) -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) + +-all: $(srcdir)/configure Makefile $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET) $(objects)/$(SDLTEST_TARGET) ++all: $(srcdir)/configure Makefile $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET) + + $(srcdir)/configure: $(srcdir)/configure.ac + @echo "Warning, configure is out of date, please re-run autogen.sh" +@@ -179,17 +173,9 @@ + $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir) + $(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(TARGET) $(DESTDIR)$(libdir)/$(TARGET) + $(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(SDLMAIN_TARGET) $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET) +- $(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(SDLTEST_TARGET) $(DESTDIR)$(libdir)/$(SDLTEST_TARGET) + install-data: +- $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(datadir)/aclocal +- $(INSTALL) -m 644 $(srcdir)/sdl2.m4 $(DESTDIR)$(datadir)/aclocal/sdl2.m4 + $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)/pkgconfig + $(INSTALL) -m 644 sdl2.pc $(DESTDIR)$(libdir)/pkgconfig +-ifeq ($(INSTALL_SDL2_CONFIG),TRUE) +- $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)/cmake/SDL2 +- $(INSTALL) -m 644 sdl2-config.cmake $(DESTDIR)$(libdir)/cmake/SDL2 +- $(INSTALL) -m 644 sdl2-config-version.cmake $(DESTDIR)$(libdir)/cmake/SDL2 +-endif + + uninstall: uninstall-bin uninstall-hdrs uninstall-lib uninstall-data + uninstall-bin: +@@ -204,12 +190,8 @@ + uninstall-lib: + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(TARGET) + rm -f $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET) +- rm -f $(DESTDIR)$(libdir)/$(SDLTEST_TARGET) + uninstall-data: +- rm -f $(DESTDIR)$(datadir)/aclocal/sdl2.m4 + rm -f $(DESTDIR)$(libdir)/pkgconfig/sdl2.pc +- rm -f $(DESTDIR)$(libdir)/cmake/SDL2/sdl2-config.cmake +- rm -f $(DESTDIR)$(libdir)/cmake/SDL2/sdl2-config-version.cmake + + clean: + rm -rf $(objects) From 62b6a7525ecb3fd872dd1e7882bbda0a994f7b58 Mon Sep 17 00:00:00 2001 From: tjayz <90593277+tjayz@users.noreply.github.com> Date: Mon, 8 Sep 2025 14:33:43 -0400 Subject: [PATCH 22/26] Update build.sh --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 4d93af71..2ec24b2c 100644 --- a/build.sh +++ b/build.sh @@ -1 +1 @@ -./cross_compile_ffmpeg.sh --build-dependencies=y --enable-gpl=y --disable-nonfree=n --prefer-stable=y --build-ffmpeg-static=y --fdk-aac-git-checkout-version=v2.0.1 --compiler-flavors=win64 \ No newline at end of file +./cross_compile_ffmpeg.sh --build-dependencies=y --enable-gpl=y --disable-nonfree=n --prefer-stable=n --build-ffmpeg-static=y --fdk-aac-git-checkout-version=v2.0.1 --compiler-flavors=win64 From f7a883a43897a09f57722ef0b4983ee6598b27b0 Mon Sep 17 00:00:00 2001 From: tjayz <90593277+tjayz@users.noreply.github.com> Date: Mon, 8 Sep 2025 14:38:54 -0400 Subject: [PATCH 23/26] Update cross_compile_ffmpeg.sh Update meson, sdl2 and patch, openmpt, nghttp2 --- cross_compile_ffmpeg.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/cross_compile_ffmpeg.sh b/cross_compile_ffmpeg.sh index f5e22455..7591fd3f 100755 --- a/cross_compile_ffmpeg.sh +++ b/cross_compile_ffmpeg.sh @@ -367,7 +367,7 @@ install_cross_compiler() { if [[ ($compiler_flavors == "win64" || $compiler_flavors == "multi") && ! -f ../$win64_gcc ]]; then echo "Building win64 x86_64 cross compiler..." download_gcc_build_script $zeranoe_script_name - CFLAGS='-O2 -pipe' CXXFLAGS='-O2 -pipe' nice ./$zeranoe_script_name $zeranoe_script_options x86_64 || exit 1 + CFLAGS='-O3 -pipe' CXXFLAGS='-O3 -pipe' nice ./$zeranoe_script_name $zeranoe_script_options x86_64 || exit 1 if [[ ! -f ../$win64_gcc ]]; then echo "Failure building 64 bit gcc? Recommend nuke sandbox (rm -rf sandbox) and start over..." exit 1 @@ -610,7 +610,7 @@ do_cmake_and_install() { activate_meson() { if [[ ! -e meson_git ]]; then - do_git_checkout https://github.com/mesonbuild/meson.git meson_git 1.7 + do_git_checkout https://github.com/mesonbuild/meson.git meson_git 1.9.0 fi cd meson_git # requires python3-full if [[ ! -e tutorial_env ]]; then @@ -858,7 +858,7 @@ build_iconv() { build_brotli() { do_git_checkout https://github.com/google/brotli.git brotli_git v1.0.9 # v1.1.0 static headache stay away cd brotli_git - if [ ! -f "already*" ]; then + if [ ! -f "brotli.exe" ]; then rm configure fi generic_configure @@ -879,9 +879,9 @@ build_zstd() { } build_sdl2() { - download_and_unpack_file https://www.libsdl.org/release/SDL2-2.0.12.tar.gz - cd SDL2-2.0.12 - apply_patch file://$patch_dir/SDL2-2.0.12_lib-only.diff + download_and_unpack_file https://www.libsdl.org/release/SDL2-2.32.10.tar.gz + cd SDL2-2.32.10 + apply_patch file://$patch_dir/SDL2-2.32.10_lib-only.diff if [[ ! -f configure.bak ]]; then sed -i.bak "s/ -mwindows//" configure # Allow ffmpeg to output anything to console. fi @@ -981,7 +981,7 @@ build_libtensorflow() { if [[ ! -e Tensorflow ]]; then mkdir Tensorflow cd Tensorflow - wget https://storage.googleapis.com/tensorflow/versions/2.18.0/libtensorflow-cpu-windows-x86_64.zip # tensorflow.dll required by ffmpeg to run + wget https://storage.googleapis.com/tensorflow/versions/2.18.1/libtensorflow-cpu-windows-x86_64.zip # tensorflow.dll required by ffmpeg to run unzip -o libtensorflow-cpu-windows-x86_64.zip -d $mingw_w64_x86_64_prefix rm libtensorflow-cpu-windows-x86_64.zip cd .. @@ -1059,7 +1059,7 @@ build_flac () { build_openmpt () { build_flac - do_git_checkout https://github.com/OpenMPT/openmpt.git openmpt_git OpenMPT-1.30 + do_git_checkout https://github.com/OpenMPT/openmpt.git openmpt_git # OpenMPT-1.30 cd openmpt_git do_make_and_make_install "PREFIX=$mingw_w64_x86_64_prefix CONFIG=mingw64-win64 EXESUFFIX=.exe SOSUFFIX=.dll SOSUFFIXWINDOWS=1 DYNLINK=0 SHARED_LIB=0 STATIC_LIB=1 SHARED_SONAME=0 IS_CROSS=1 NO_ZLIB=0 NO_LTDL=0 NO_DL=0 NO_MPG123=0 NO_OGG=0 NO_VORBIS=0 NO_VORBISFILE=0 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL=0 @@ -1081,8 +1081,8 @@ build_libpsl () { build_nghttp2 () { export CFLAGS="-DNGHTTP2_STATICLIB" - download_and_unpack_file https://github.com/nghttp2/nghttp2/releases/download/v1.66.0/nghttp2-1.66.0.tar.gz - cd nghttp2-1.66.0 + download_and_unpack_file https://github.com/nghttp2/nghttp2/releases/download/v1.67.0/nghttp2-1.67.0.tar.gz + cd nghttp2-1.67.0 do_cmake "-B build -DENABLE_LIB_ONLY=1 -DBUILD_SHARED_LIBS=0 -DBUILD_STATIC_LIBS=1 -GNinja" do_ninja_and_ninja_install reset_cflags From 4b515c3ea8e1b7f380030acddfa0c3bece41eff3 Mon Sep 17 00:00:00 2001 From: tjayz <90593277+tjayz@users.noreply.github.com> Date: Wed, 15 Oct 2025 01:55:00 -0400 Subject: [PATCH 24/26] Update cross_compile_ffmpeg.sh Restructured libplacebo Updated repo for decklink to mabs old repo prevented ffmpeg build Updated other libs to latest stable --- cross_compile_ffmpeg.sh | 77 ++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 44 deletions(-) diff --git a/cross_compile_ffmpeg.sh b/cross_compile_ffmpeg.sh index 7591fd3f..490e7909 100755 --- a/cross_compile_ffmpeg.sh +++ b/cross_compile_ffmpeg.sh @@ -260,7 +260,7 @@ EOL echo `date` # for timestamping super long builds LOL if [[ $sandbox_ok != 'y' && ! -d sandbox ]]; then echo - echo "Building in $PWD/sandbox, will use ~ 12GB space!" + echo "Building in $PWD/sandbox, will use ~ 285GB space!" echo fi mkdir -p "$cur_dir" @@ -610,7 +610,7 @@ do_cmake_and_install() { activate_meson() { if [[ ! -e meson_git ]]; then - do_git_checkout https://github.com/mesonbuild/meson.git meson_git 1.9.0 + do_git_checkout https://github.com/mesonbuild/meson.git meson_git 1.9.1 fi cd meson_git # requires python3-full if [[ ! -e tutorial_env ]]; then @@ -973,7 +973,7 @@ build_libleptonica() { build_libtiff() { build_libjpeg_turbo # auto uses it? - generic_download_and_make_and_install http://download.osgeo.org/libtiff/tiff-4.7.0.tar.gz + generic_download_and_make_and_install http://download.osgeo.org/libtiff/tiff-4.7.1.tar.gz sed -i.bak 's/-ltiff.*$/-ltiff -llzma -ljpeg -lz/' $PKG_CONFIG_PATH/libtiff-4.pc # static deps } @@ -1081,8 +1081,8 @@ build_libpsl () { build_nghttp2 () { export CFLAGS="-DNGHTTP2_STATICLIB" - download_and_unpack_file https://github.com/nghttp2/nghttp2/releases/download/v1.67.0/nghttp2-1.67.0.tar.gz - cd nghttp2-1.67.0 + download_and_unpack_file https://github.com/nghttp2/nghttp2/releases/download/v1.67.1/nghttp2-1.67.1.tar.gz + cd nghttp2-1.67.1 do_cmake "-B build -DENABLE_LIB_ONLY=1 -DBUILD_SHARED_LIBS=0 -DBUILD_STATIC_LIBS=1 -GNinja" do_ninja_and_ninja_install reset_cflags @@ -1100,7 +1100,7 @@ build_curl () { local config_options+="-DGNUTLS_INTERNAL_BUILD" fi export CPPFLAGS+="$CPPFLAGS -DNGHTTP2_STATICLIB -DPSL_STATIC $config_options" - do_git_checkout https://github.com/curl/curl.git curl_git curl-8_15_0 + do_git_checkout https://github.com/curl/curl.git curl_git curl-8_16_0 cd curl_git if [[ $compiler_flavors != "native" ]]; then generic_configure "--with-libssh2 --with-libpsl --with-libidn2 --disable-debug --enable-hsts --with-brotli --enable-versioned-symbols --enable-sspi --with-schannel" @@ -1303,7 +1303,7 @@ build_libnettle() { } build_unistring() { - generic_download_and_make_and_install https://ftp.gnu.org/gnu/libunistring/libunistring-1.3.tar.gz + generic_download_and_make_and_install https://ftp.gnu.org/gnu/libunistring/libunistring-1.4.1.tar.gz } build_libidn2() { @@ -1820,14 +1820,7 @@ build_libcaca() { } build_libdecklink() { - local url=https://notabug.org/RiCON/decklink-headers.git - git ls-remote $url - if [ $? -ne 0 ]; then - # If NotABug.org server is down , Change to use GitLab.com . - # https://gitlab.com/m-ab-s/decklink-headers - url=https://gitlab.com/m-ab-s/decklink-headers.git - fi - do_git_checkout $url + do_git_checkout https://gitlab.com/m-ab-s/decklink-headers.git decklink-headers_git 47d84f8d272ca6872b5440eae57609e36014f3b6 cd decklink-headers_git do_make_install PREFIX=$mingw_w64_x86_64_prefix cd .. @@ -1869,16 +1862,17 @@ build_libass() { } build_vulkan() { - do_git_checkout https://github.com/KhronosGroup/Vulkan-Headers.git Vulkan-Headers_git v1.4.321 + do_git_checkout https://github.com/KhronosGroup/Vulkan-Headers.git Vulkan-Headers_git v1.4.326 cd Vulkan-Headers_git - do_cmake_and_install "-DCMAKE_BUILD_TYPE=Release -DVULKAN_HEADERS_ENABLE_MODULE=OFF" + do_cmake_and_install "-DCMAKE_BUILD_TYPE=Release -DVULKAN_HEADERS_ENABLE_MODULE=NO -DVULKAN_HEADERS_ENABLE_TESTS=NO -DVULKAN_HEADERS_ENABLE_INSTALL=YES" cd .. } build_vulkan_loader() { - do_git_checkout https://github.com/KhronosGroup/Vulkan-Loader.git Vulkan-Loader_git v1.4.321 - cd Vulkan-Loader_git - do_cmake_and_install "-DCMAKE_BUILD_TYPE=Release -DUSE_GAS=ON" + do_git_checkout https://github.com/BtbN/Vulkan-Shim-Loader.git Vulkan-Shim-Loader.git 9657ca8e395ef16c79b57c8bd3f4c1aebb319137 + cd Vulkan-Shim-Loader.git + do_git_checkout https://github.com/KhronosGroup/Vulkan-Headers.git Vulkan-Headers v1.4.326 + do_cmake_and_install "-DCMAKE_BUILD_TYPE=Release -DVULKAN_SHIM_IMPERSONATE=ON" cd .. } @@ -1900,9 +1894,9 @@ build_libxxhash() { } build_spirv-cross() { - do_git_checkout https://github.com/KhronosGroup/SPIRV-Cross.git SPIRV-Cross_git vulkan-sdk-1.4.321.0 # 1823c11 # if breaks in future go back to this commit + do_git_checkout https://github.com/KhronosGroup/SPIRV-Cross.git SPIRV-Cross_git b26ac3fa8bcfe76c361b56e3284b5276b23453ce cd SPIRV-Cross_git - do_cmake "-B build -GNinja -DSPIRV_CROSS_STATIC=ON -DSPIRV_CROSS_SHARED=OFF" + do_cmake "-B build -GNinja -DSPIRV_CROSS_STATIC=ON -DSPIRV_CROSS_SHARED=OFF -DCMAKE_BUILD_TYPE=Release -DSPIRV_CROSS_CLI=OFF -DSPIRV_CROSS_ENABLE_TESTS=OFF -DSPIRV_CROSS_FORCE_PIC=ON -DSPIRV_CROSS_ENABLE_CPP=OFF" do_ninja_and_ninja_install mv $PKG_CONFIG_PATH/spirv-cross-c.pc $PKG_CONFIG_PATH/spirv-cross-c-shared.pc cd .. @@ -1940,42 +1934,35 @@ build_libdovi() { } build_shaderc() { - do_git_checkout https://github.com/google/shaderc.git shaderc_git known-good # 8ce49eb # if breaks in future, go back to this commit + do_git_checkout https://github.com/google/shaderc.git shaderc_git 3a44d5d7850da3601aa43d523a3d228f045fb43d cd shaderc_git - if [[ ! -e src ]]; then - ./update_shaderc_sources.py - fi - cd src - do_cmake "-B build -DCMAKE_BUILD_TYPE=release -GNinja -DSHADERC_SKIP_EXAMPLES=ON -DSHADERC_SKIP_TESTS=ON -DGLSLANG_TESTS=OFF -DSPIRV_HEADERS_SKIP_EXAMPLES=ON -DSPIRV_SKIP_TESTS=ON -DSKIP_GOOGLETEST_INSTALL=ON" - do_ninja_and_ninja_install - cp -r libshaderc_util/include/libshaderc_util $mingw_w64_x86_64_prefix/include + ./utils/git-sync-deps + do_cmake "-B build -DCMAKE_BUILD_TYPE=release -GNinja -DSHADERC_SKIP_EXAMPLES=ON -DSHADERC_SKIP_TESTS=ON -DSPIRV_SKIP_TESTS=ON -DSHADERC_SKIP_COPYRIGHT_CHECK=ON -DENABLE_EXCEPTIONS=ON -DENABLE_GLSLANG_BINARIES=OFF -DSPIRV_SKIP_EXECUTABLES=ON -DSPIRV_TOOLS_BUILD_STATIC=ON -DBUILD_SHARED_LIBS=OFF" + do_ninja_and_ninja_install + cp build/libshaderc_util/libshaderc_util.a $mingw_w64_x86_64_prefix/lib sed -i.bak "s/Libs: .*/& -lstdc++/" "$PKG_CONFIG_PATH/shaderc_combined.pc" sed -i.bak "s/Libs: .*/& -lstdc++/" "$PKG_CONFIG_PATH/shaderc_static.pc" - sed -i.bak "s/Libs: .*/& -lstdc++/" "$PKG_CONFIG_PATH/shaderc.pc" - sed -i.bak "s/Libs: .*/& -lstdc++/" "$PKG_CONFIG_PATH/SPIRV-Tools.pc" - cd ../.. + cd .. } build_libplacebo() { - if [[ $OSTYPE != darwin* ]]; then - build_vulkan_loader - fi + build_vulkan_loader do_git_checkout_and_make_install https://github.com/ImageMagick/lcms.git build_libunwind build_libxxhash build_spirv-cross build_libdovi build_shaderc - do_git_checkout https://code.videolan.org/videolan/libplacebo.git libplacebo_git # 51ea4290a6342ebe67daa34cd4483476bed4e03d # if breaks in future, go back to this commit + do_git_checkout https://code.videolan.org/videolan/libplacebo.git libplacebo_git 515da9548ad734d923c7d0988398053f87b454d5 activate_meson cd libplacebo_git - git submodule update --init + git submodule update --init --recursive --depth=1 --filter=blob:none local config_options="" if [[ $OSTYPE != darwin* ]]; then local config_options+=" -Dvulkan-registry=$mingw_w64_x86_64_prefix/share/vulkan/registry/vk.xml" fi - local meson_options="setup -Ddemos=false -Dc_link_args=-static -Dcpp_link_args=-static $config_options . build" # https://mesonbuild.com/Dependencies.html#shaderc trigger use of shaderc_combined - if [[ $compiler_flavors != "native" ]]; then + local meson_options="setup -Ddemos=false -Dbench=false -Dfuzz=false -Dvulkan=enabled -Dvk-proc-addr=disabled -Dshaderc=enabled -Dglslang=disabled -Dc_link_args=-static -Dcpp_link_args=-static $config_options . build" # https://mesonbuild.com/Dependencies.html#shaderc trigger use of shaderc_combined + if [[ $compiler_flavors != "native" ]]; then # get_local_meson_cross_with_propeties meson_options+=" --cross-file=${top_dir}/meson-cross.mingw.txt" do_meson "$meson_options" @@ -2651,7 +2638,7 @@ build_ffmpeg() { local arch=amd64 fi - init_options="--pkg-config=pkg-config --pkg-config-flags=--static --extra-version=ffmpeg-windows-build-helpers --enable-version3 --disable-debug --disable-w32threads" + init_options="--pkg-config=pkg-config --pkg-config-flags=--static --enable-version3 --disable-debug --disable-w32threads" if [[ $compiler_flavors != "native" ]]; then init_options+=" --arch=$arch --target-os=mingw32 --cross-prefix=$cross_prefix" else @@ -2675,7 +2662,8 @@ build_ffmpeg() { config_options+=" --enable-gmp" config_options+=" --enable-gnutls" config_options+=" --enable-gray" - config_options+=" --enable-iconv" + config_options+=" --enable-iconv" + config_options+=" --enable-lcms2" config_options+=" --enable-libass" config_options+=" --enable-libbluray" config_options+=" --enable-libbs2b" @@ -2687,6 +2675,7 @@ build_ffmpeg() { config_options+=" --enable-libgme" config_options+=" --enable-libgsm" config_options+=" --enable-libharfbuzz" + config_options+=" --enable-filter=drawtext" config_options+=" --enable-libilbc" config_options+=" --enable-liblensfun" config_options+=" --enable-libmodplug" @@ -2705,7 +2694,7 @@ build_ffmpeg() { config_options+=" --enable-libsoxr" config_options+=" --enable-libspeex" config_options+=" --enable-libsrt" - config_options+=" --enable-libtensorflow" + # config_options+=" --enable-libtensorflow" config_options+=" --enable-libtesseract" config_options+=" --enable-libtheora" config_options+=" --enable-libtwolame" @@ -3068,8 +3057,8 @@ build_ffmpeg_dependencies() { build_dav1d if [[ $OSTYPE != darwin* ]]; then build_vulkan + build_libplacebo fi - build_libplacebo # can use vulkan build_avisynth build_libvvenc build_libvvdec From df18e13a451d1a8f905bbe22265008530f7f1c9f Mon Sep 17 00:00:00 2001 From: tjayz <90593277+tjayz@users.noreply.github.com> Date: Mon, 1 Dec 2025 14:04:24 -0500 Subject: [PATCH 25/26] Update Dockerfile Add missing functions to dockerfile. Commit from nathan-disguise. --- docker/Dockerfile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 4f1faddf..2e5a34b6 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM --platform=amd64 ubuntu:20.04 +FROM --platform=amd64 ubuntu:22.04 ARG DEBIAN_FRONTEND=noninteractive @@ -30,9 +30,12 @@ RUN apt-get update && \ bzip2 \ autoconf-archive \ p7zip-full \ - meson \ clang \ - python \ + autopoint \ + bc \ + ninja-build \ + python3-venv \ + python-is-python3 \ python3-setuptools \ wget \ ed From 537cb84c73e403d0d7f18c443aac291a674471dd Mon Sep 17 00:00:00 2001 From: tjayz <90593277+tjayz@users.noreply.github.com> Date: Tue, 2 Dec 2025 03:02:47 -0500 Subject: [PATCH 26/26] Update cross_compile_ffmpeg.sh Updated binutils to master. Updated brotli and openmpt code. Switched fontconfig and rubberband to build with meson. Disabled rubberband depend builds of vamp, fftw and samplerate, simplified by meson. Switched mpg123 repo to sourceforge for latest version. Fixed opencv and enabled in ffmpeg by default and added it to frei0r. Updated other libs to latest stable version. --- cross_compile_ffmpeg.sh | 157 ++++++++++++++++++++-------------------- 1 file changed, 77 insertions(+), 80 deletions(-) diff --git a/cross_compile_ffmpeg.sh b/cross_compile_ffmpeg.sh index 490e7909..80fc8021 100755 --- a/cross_compile_ffmpeg.sh +++ b/cross_compile_ffmpeg.sh @@ -347,7 +347,7 @@ install_cross_compiler() { # --disable-shared allows c++ to be distributed at all...which seemed necessary for some random dependency which happens to use/require c++... local zeranoe_script_name=mingw-w64-build - local zeranoe_script_options="--gcc-branch=releases/gcc-14 --mingw-w64-branch=master --binutils-branch=binutils-2_44-branch" # --cached-sources" + local zeranoe_script_options="--gcc-branch=releases/gcc-14 --mingw-w64-branch=master --binutils-branch=master" # --cached-sources" if [[ ($compiler_flavors == "win32" || $compiler_flavors == "multi") && ! -f ../$win32_gcc ]]; then echo "Building win32 cross compiler..." download_gcc_build_script $zeranoe_script_name @@ -856,17 +856,10 @@ build_iconv() { } build_brotli() { - do_git_checkout https://github.com/google/brotli.git brotli_git v1.0.9 # v1.1.0 static headache stay away + do_git_checkout https://github.com/google/brotli.git brotli_git v1.2.0 cd brotli_git - if [ ! -f "brotli.exe" ]; then - rm configure - fi - generic_configure - sed -i.bak -e "s/\(allow_undefined=\)yes/\1no/" libtool - do_make_and_make_install - sed -i.bak 's/Libs.*$/Libs: -L${libdir} -lbrotlicommon/' $PKG_CONFIG_PATH/libbrotlicommon.pc # remove rpaths not possible in conf - sed -i.bak 's/Libs.*$/Libs: -L${libdir} -lbrotlidec/' $PKG_CONFIG_PATH/libbrotlidec.pc - sed -i.bak 's/Libs.*$/Libs: -L${libdir} -lbrotlienc/' $PKG_CONFIG_PATH/libbrotlienc.pc + do_cmake "-B build -G Ninja -DCMAKE_BUILD_TYPE=Release" + do_ninja_and_ninja_install cd .. } @@ -949,7 +942,7 @@ build_intel_qsv_mfx() { # disableable via command line switch... build_libvpl () { # build_intel_qsv_mfx - do_git_checkout https://github.com/intel/libvpl.git libvpl_git # f8d9891 + do_git_checkout https://github.com/intel/libvpl.git libvpl_git cd libvpl_git if [ "$bits_target" = "32" ]; then apply_patch "https://raw.githubusercontent.com/msys2/MINGW-packages/master/mingw-w64-libvpl/0003-cmake-fix-32bit-install.patch" -p1 @@ -983,6 +976,7 @@ build_libtensorflow() { cd Tensorflow wget https://storage.googleapis.com/tensorflow/versions/2.18.1/libtensorflow-cpu-windows-x86_64.zip # tensorflow.dll required by ffmpeg to run unzip -o libtensorflow-cpu-windows-x86_64.zip -d $mingw_w64_x86_64_prefix + cp $mingw_w64_x86_64_prefix/lib/tensorflow.dll ../../redist rm libtensorflow-cpu-windows-x86_64.zip cd .. else echo "Tensorflow already installed" @@ -1022,7 +1016,7 @@ build_lensfun() { build_glib do_git_checkout https://github.com/lensfun/lensfun.git lensfun_git cd lensfun_git - export CPPFLAGS="$CPPFLAGS-DGLIB_STATIC_COMPILATION" + export CPPFLAGS="$CPPFLAGS -DGLIB_STATIC_COMPILATION" export CXXFLAGS="$CFLAGS -DGLIB_STATIC_COMPILATION" do_cmake "-DBUILD_STATIC=on -DCMAKE_INSTALL_DATAROOTDIR=$mingw_w64_x86_64_prefix -DBUILD_TESTS=off -DBUILD_DOC=off -DINSTALL_HELPER_SCRIPTS=off -DINSTALL_PYTHON_MODULE=OFF" do_make_and_make_install @@ -1042,8 +1036,8 @@ build_lz4 () { build_libarchive () { build_lz4 - download_and_unpack_file https://github.com/libarchive/libarchive/releases/download/v3.8.1/libarchive-3.8.1.tar.gz - cd libarchive-3.8.1 + download_and_unpack_file https://github.com/libarchive/libarchive/releases/download/v3.8.3/libarchive-3.8.3.tar.gz + cd libarchive-3.8.3 generic_configure "--with-nettle --bindir=$mingw_w64_x86_64_prefix/bin --without-openssl --without-iconv --disable-posix-regex-lib" do_make_install cd .. @@ -1059,10 +1053,10 @@ build_flac () { build_openmpt () { build_flac - do_git_checkout https://github.com/OpenMPT/openmpt.git openmpt_git # OpenMPT-1.30 + do_git_checkout https://github.com/OpenMPT/openmpt.git openmpt_git cd openmpt_git - do_make_and_make_install "PREFIX=$mingw_w64_x86_64_prefix CONFIG=mingw64-win64 EXESUFFIX=.exe SOSUFFIX=.dll SOSUFFIXWINDOWS=1 DYNLINK=0 SHARED_LIB=0 STATIC_LIB=1 - SHARED_SONAME=0 IS_CROSS=1 NO_ZLIB=0 NO_LTDL=0 NO_DL=0 NO_MPG123=0 NO_OGG=0 NO_VORBIS=0 NO_VORBISFILE=0 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL=0 + do_make_and_make_install "PREFIX=$mingw_w64_x86_64_prefix CONFIG=mingw-w64 WINDOWS_ARCH=amd64 EXESUFFIX=.exe SOSUFFIX=.dll SOSUFFIXWINDOWS=1 DYNLINK=0 SHARED_LIB=0 STATIC_LIB=1 + SHARED_SONAME=0 IS_CROSS=1 NO_ZLIB=0 NO_LTDL=1 NO_DL=1 NO_MPG123=0 NO_OGG=0 NO_VORBIS=0 NO_VORBISFILE=0 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL=0 NO_SDL2=0 NO_SNDFILE=0 NO_FLAC=0 EXAMPLES=0 OPENMPT123=0 TEST=0" # OPENMPT123=1 >>> fail sed -i.bak 's/Libs.private.*/& -lrpcrt4/' $PKG_CONFIG_PATH/libopenmpt.pc cd .. @@ -1081,8 +1075,8 @@ build_libpsl () { build_nghttp2 () { export CFLAGS="-DNGHTTP2_STATICLIB" - download_and_unpack_file https://github.com/nghttp2/nghttp2/releases/download/v1.67.1/nghttp2-1.67.1.tar.gz - cd nghttp2-1.67.1 + download_and_unpack_file https://github.com/nghttp2/nghttp2/releases/download/v1.68.0/nghttp2-1.68.0.tar.gz + cd nghttp2-1.68.0 do_cmake "-B build -DENABLE_LIB_ONLY=1 -DBUILD_SHARED_LIBS=0 -DBUILD_STATIC_LIBS=1 -GNinja" do_ninja_and_ninja_install reset_cflags @@ -1100,7 +1094,7 @@ build_curl () { local config_options+="-DGNUTLS_INTERNAL_BUILD" fi export CPPFLAGS+="$CPPFLAGS -DNGHTTP2_STATICLIB -DPSL_STATIC $config_options" - do_git_checkout https://github.com/curl/curl.git curl_git curl-8_16_0 + do_git_checkout https://github.com/curl/curl.git curl_git curl-8_17_0 cd curl_git if [[ $compiler_flavors != "native" ]]; then generic_configure "--with-libssh2 --with-libpsl --with-libidn2 --disable-debug --enable-hsts --with-brotli --enable-versioned-symbols --enable-sspi --with-schannel" @@ -1149,7 +1143,7 @@ build_glew() { if [[ $compiler_flavors != "native" ]]; then cmake_params+=" -DWIN32=1" fi - do_cmake_from_build_dir ./cmake "$cmake_params" # "-DWITH_FFMPEG=0 -DOPENCV_GENERATE_PKGCONFIG=1 -DHAVE_DSHOW=0" + do_cmake_from_build_dir ./cmake "$cmake_params" do_make_and_make_install cd ../.. } @@ -1176,7 +1170,7 @@ build_libwebp() { } build_harfbuzz() { - do_git_checkout https://github.com/harfbuzz/harfbuzz.git harfbuzz_git 10.4.0 # 11.0.0 no longer found by ffmpeg via this method, multiple issues, breaks harfbuzz freetype circular depends hack + do_git_checkout https://github.com/harfbuzz/harfbuzz.git harfbuzz_git 9c6b699 # 11.0.0+ harfbuzz freetype circular depends hack broken per commit https://github.com/harfbuzz/harfbuzz/commit/628b868f44acce749adc08ff61f2d9c19c9e2bbe activate_meson build_freetype cd harfbuzz_git @@ -1195,8 +1189,7 @@ build_harfbuzz() { cd .. build_freetype # with harfbuzz now deactivate - sed -i.bak 's/-lfreetype.*/-lfreetype -lharfbuzz -lpng -lbz2/' "$PKG_CONFIG_PATH/freetype2.pc" - sed -i.bak 's/-lharfbuzz.*/-lfreetype -lharfbuzz -lpng -lbz2/' "$PKG_CONFIG_PATH/harfbuzz.pc" + sed -i.bak 's/-lfreetype.*/-lfreetype -lbz2/' "$PKG_CONFIG_PATH/freetype2.pc" } build_freetype() { @@ -1245,10 +1238,20 @@ build_libvmaf() { } build_fontconfig() { - do_git_checkout https://gitlab.freedesktop.org/fontconfig/fontconfig.git fontconfig_git # meson build for fontconfig no good + do_git_checkout https://gitlab.freedesktop.org/fontconfig/fontconfig.git fontconfig_git + activate_meson cd fontconfig_git - generic_configure "--enable-iconv --enable-libxml2 --disable-docs --with-libiconv" # Use Libxml2 instead of Expat; will find libintl from gettext on 2nd pass build and ffmpeg rejects it - do_make_and_make_install + local meson_options="setup -Ddoc=disabled -Dtests=disabled -Diconv=enabled -Dxml-backend=libxml2 . build" + if [[ $compiler_flavors != "native" ]]; then + # get_local_meson_cross_with_propeties + meson_options+=" --cross-file=${top_dir}/meson-cross.mingw.txt" + do_meson "$meson_options" + else + generic_meson "$meson_options" + fi + do_ninja_and_ninja_install + sed -i.bak "s/Libs: .*/& -lstdc++/" "$PKG_CONFIG_PATH/fontconfig.pc" + deactivate cd .. } @@ -1315,8 +1318,8 @@ build_libidn2() { } build_gnutls() { - download_and_unpack_file https://www.gnupg.org/ftp/gcrypt/gnutls/v3.8/gnutls-3.8.9.tar.xz # v3.8.10 not found by ffmpeg with identical .pc? - cd gnutls-3.8.9 + download_and_unpack_file https://www.gnupg.org/ftp/gcrypt/gnutls/v3.8/gnutls-3.8.11.tar.xz + cd gnutls-3.8.11 export CFLAGS="-Wno-int-conversion" local config_options="" if [[ $compiler_flavors != "native" ]]; then @@ -1498,16 +1501,15 @@ build_libsndfile() { } build_mpg123() { - do_svn_checkout svn://scm.orgis.org/mpg123/trunk mpg123_svn r5008 # avoid Think again failure - cd mpg123_svn + download_and_unpack_file https://sourceforge.net/projects/mpg123/files/mpg123/1.33.3/mpg123-1.33.3.tar.bz2 + cd mpg123-1.33.3 generic_configure_make_install cd .. } build_lame() { - do_svn_checkout https://svn.code.sf.net/p/lame/svn/trunk/lame lame_svn r6525 # anything other than r6525 fails + do_svn_checkout https://svn.code.sf.net/p/lame/svn/trunk/lame lame_svn r6527 # r6531-r6528 fail https://sourceforge.net/p/lame/svn/6531/log/?path=/trunk cd lame_svn - # sed -i.bak '1s/^\xEF\xBB\xBF//' libmp3lame/i386/nasm.h # Remove a UTF-8 BOM that breaks nasm if it's still there; should be fixed in trunk eventually https://sourceforge.net/p/lame/patches/81/ generic_configure "--enable-nasm --enable-libmpg123" do_make_and_make_install cd .. @@ -1595,20 +1597,14 @@ build_mingw_std_threads() { build_opencv() { build_mingw_std_threads - #do_git_checkout https://github.com/opencv/opencv.git # too big :| - download_and_unpack_file https://github.com/opencv/opencv/archive/3.4.5.zip opencv-3.4.5 - mkdir -p opencv-3.4.5/build - cd opencv-3.4.5 - apply_patch file://$patch_dir/opencv.detection_based.patch - cd .. - cd opencv-3.4.5/build - # could do more here, it seems to think it needs its own internal libwebp etc... - cpu_count=1 - do_cmake_from_build_dir .. "-DWITH_FFMPEG=0 -DOPENCV_GENERATE_PKGCONFIG=1 -DHAVE_DSHOW=0" # https://stackoverflow.com/q/40262928/32453, no pkg config by default on "windows", who cares ffmpeg - do_make_and_make_install - cp unix-install/opencv.pc $PKG_CONFIG_PATH - cpu_count=$original_cpu_count - cd ../.. + do_git_checkout https://github.com/opencv/opencv opencv_git 49486f6 + cd opencv_git + do_cmake "-B build -G Ninja -DCMAKE_BUILD_TYPE=release -DWITH_FFMPEG=0 -DOPENCV_GENERATE_PKGCONFIG=1 -DBUILD_TESTS=0 -DBUILD_PERF_TESTS=0 -DBUILD_ZLIB=0 -DBUILD_TIFF=0 -DBUILD_PNG=0 + -DBUILD_WEBP=0 -DBUILD_JPEG=0 -DBUILD_OPENJPEG=0 -DBUILD_opencv_apps=0" # BUILD_PACKAGE=0 to find already built package, otherwise builds from 3rdparty... + do_ninja_and_ninja_install + sed -i.bak 's/-lopencv_core4120.*/-lopencv_core4120 -lstdc++ -lwsock32 -lcomctl32 -lgdi32 -lole32 -lsetupapi -lws2_32 -ljpeg -lwebp -lwebpmux -lwebpdemux -lpng -ltiff -lopenjp2 -lz -lpthread/' "$PKG_CONFIG_PATH/opencv4.pc" + sed -i.bak "s/-lIlmImf.*/-lIlmImf/" "$PKG_CONFIG_PATH/opencv4.pc" + cd .. } build_facebooktransform360() { @@ -1687,8 +1683,8 @@ build_libsnappy() { } build_vamp_plugin() { - download_and_unpack_file https://code.soundsoftware.ac.uk/attachments/download/2691/vamp-plugin-sdk-2.10.0.tar.gz - cd vamp-plugin-sdk-2.10.0 + download_and_unpack_file https://github.com/vamp-plugins/vamp-plugin-sdk/archive/refs/tags/vamp-plugin-sdk-v2.10.zip vamp-plugin-sdk-vamp-plugin-sdk-v2.10 + cd vamp-plugin-sdk-vamp-plugin-sdk-v2.10 apply_patch file://$patch_dir/vamp-plugin-sdk-2.10_static-lib.diff if [[ $compiler_flavors != "native" && ! -f src/vamp-sdk/PluginAdapter.cpp.bak ]]; then sed -i.bak "s/#include /#include /" src/vamp-sdk/PluginAdapter.cpp @@ -1718,23 +1714,29 @@ build_libsamplerate() { } build_librubberband() { - do_git_checkout https://github.com/breakfastquay/rubberband.git rubberband_git 18c06ab8c431854056407c467f4755f761e36a8e + do_git_checkout https://github.com/breakfastquay/rubberband.git rubberband_git "default" # 18c06ab8c431854056407c467f4755f761e36a8e + activate_meson cd rubberband_git - apply_patch file://$patch_dir/rubberband_git_static-lib.diff # create install-static target - do_configure "--host=$host_target --prefix=$mingw_w64_x86_64_prefix --disable-ladspa" - do_make "install-static AR=${cross_prefix}ar" # No need for 'do_make_install', because 'install-static' already has install-instructions. - sed -i.bak 's/-lrubberband.*$/-lrubberband -lfftw3 -lsamplerate -lstdc++/' $PKG_CONFIG_PATH/rubberband.pc + local meson_options="setup -Dtests=disabled . build" + if [[ $compiler_flavors != "native" ]]; then + # get_local_meson_cross_with_propeties + meson_options+=" --cross-file=${top_dir}/meson-cross.mingw.txt" + do_meson "$meson_options" + else + generic_meson "$meson_options" + fi + do_ninja_and_ninja_install + sed -i.bak 's/-lrubberband.*$/-lrubberband -lstdc++/' $PKG_CONFIG_PATH/rubberband.pc + deactivate cd .. } build_frei0r() { - #do_git_checkout https://github.com/dyne/frei0r.git - #cd frei0r_git - download_and_unpack_file https://github.com/dyne/frei0r/archive/refs/tags/v2.3.3.tar.gz frei0r-2.3.3 - cd frei0r-2.3.3 + do_git_checkout https://github.com/dyne/frei0r.git frei0r_git v2.5.0 + cd frei0r_git sed -i.bak 's/-arch i386//' CMakeLists.txt # OS X https://github.com/dyne/frei0r/issues/64 - do_cmake_and_install "-DWITHOUT_OPENCV=1" # XXX could look at this more... - + do_cmake "-B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DWITHOUT_OPENCV=0" + do_ninja_and_ninja_install mkdir -p $cur_dir/redist # Strip and pack shared libraries. if [ $bits_target = 32 ]; then local arch=x86 @@ -1804,7 +1806,7 @@ build_libmysofa() { } build_libcaca() { - do_git_checkout https://github.com/cacalabs/libcaca.git libcaca_git 813baea7a7bc28986e474541dd1080898fac14d7 + do_git_checkout https://github.com/cacalabs/libcaca.git libcaca_git # 813baea7a7bc28986e474541dd1080898fac14d7 cd libcaca_git apply_patch file://$patch_dir/libcaca_git_stdio-cruft.diff -p1 # Fix WinXP incompatibility. cd caca @@ -1940,8 +1942,8 @@ build_shaderc() { do_cmake "-B build -DCMAKE_BUILD_TYPE=release -GNinja -DSHADERC_SKIP_EXAMPLES=ON -DSHADERC_SKIP_TESTS=ON -DSPIRV_SKIP_TESTS=ON -DSHADERC_SKIP_COPYRIGHT_CHECK=ON -DENABLE_EXCEPTIONS=ON -DENABLE_GLSLANG_BINARIES=OFF -DSPIRV_SKIP_EXECUTABLES=ON -DSPIRV_TOOLS_BUILD_STATIC=ON -DBUILD_SHARED_LIBS=OFF" do_ninja_and_ninja_install cp build/libshaderc_util/libshaderc_util.a $mingw_w64_x86_64_prefix/lib - sed -i.bak "s/Libs: .*/& -lstdc++/" "$PKG_CONFIG_PATH/shaderc_combined.pc" - sed -i.bak "s/Libs: .*/& -lstdc++/" "$PKG_CONFIG_PATH/shaderc_static.pc" + sed -i.bak "s/Libs: .*/& -lstdc++/" "$PKG_CONFIG_PATH/shaderc_combined.pc" + sed -i.bak "s/Libs: .*/& -lstdc++/" "$PKG_CONFIG_PATH/shaderc_static.pc" cd .. } @@ -1957,11 +1959,7 @@ build_libplacebo() { activate_meson cd libplacebo_git git submodule update --init --recursive --depth=1 --filter=blob:none - local config_options="" - if [[ $OSTYPE != darwin* ]]; then - local config_options+=" -Dvulkan-registry=$mingw_w64_x86_64_prefix/share/vulkan/registry/vk.xml" - fi - local meson_options="setup -Ddemos=false -Dbench=false -Dfuzz=false -Dvulkan=enabled -Dvk-proc-addr=disabled -Dshaderc=enabled -Dglslang=disabled -Dc_link_args=-static -Dcpp_link_args=-static $config_options . build" # https://mesonbuild.com/Dependencies.html#shaderc trigger use of shaderc_combined + local meson_options="setup -Ddemos=false -Dbench=false -Dfuzz=false -Dvulkan=enabled -Dvk-proc-addr=disabled -Dshaderc=enabled -Dglslang=disabled -Dvulkan-registry=$mingw_w64_x86_64_prefix/share/vulkan/registry/vk.xml -Dc_link_args=-static -Dcpp_link_args=-static . build" # https://mesonbuild.com/Dependencies.html#shaderc trigger use of shaderc_combined if [[ $compiler_flavors != "native" ]]; then # get_local_meson_cross_with_propeties meson_options+=" --cross-file=${top_dir}/meson-cross.mingw.txt" @@ -2194,7 +2192,7 @@ EOF } build_libopenh264() { - do_git_checkout "https://github.com/cisco/openh264.git" openh264_git v2.6.0 #75b9fcd2669c75a99791 # wels/codec_api.h weirdness + do_git_checkout "https://github.com/cisco/openh264.git" openh264_git v2.6.0 # wels/codec_api.h weirdness cd openh264_git sed -i.bak "s/_M_X64/_M_DISABLED_X64/" codec/encoder/core/inc/param_svc.h # for 64 bit, avoid missing _set_FMA3_enable, it needed to link against msvcrt120 to get this or something weird? if [[ $bits_target == 32 ]]; then @@ -2683,6 +2681,7 @@ build_ffmpeg() { config_options+=" --enable-libmysofa" config_options+=" --enable-libopencore-amrnb" config_options+=" --enable-libopencore-amrwb" + config_options+=" --enable-libopencv" config_options+=" --enable-libopenh264" config_options+=" --enable-libopenjpeg" config_options+=" --enable-libopenmpt" @@ -2944,7 +2943,6 @@ build_ffmpeg_dependencies() { build_dlfcn build_libxavs fi - build_libdavs2 if [[ $host_target != 'i686-w64-mingw32' ]]; then build_libxavs2 @@ -3008,11 +3006,10 @@ build_ffmpeg_dependencies() { build_libsoxr build_libflite build_libsnappy # Uses zlib (only for unittests [disabled]) and dlfcn. - build_vamp_plugin # Needs libsndfile for 'vamp-simple-host.exe' [disabled]. - build_fftw # Uses dlfcn. - build_libsamplerate # Needs libsndfile >= 1.0.6 and fftw >= 0.15.0 for tests. Uses dlfcn. - build_librubberband # Needs libsamplerate, libsndfile, fftw and vamp_plugin. 'configure' will fail otherwise. Eventhough librubberband doesn't necessarily need them (libsndfile only for 'rubberband.exe' and vamp_plugin only for "Vamp audio analysis plugin"). How to use the bundled libraries '-DUSE_SPEEX' and '-DUSE_KISSFFT'? - build_frei0r # Needs dlfcn. could use opencv... + # build_vamp_plugin # Needs libsndfile for 'vamp-simple-host.exe' [disabled]. + # build_fftw # Uses dlfcn. + # build_libsamplerate # Needs libsndfile >= 1.0.6 and fftw >= 0.15.0 for tests. Uses dlfcn. + build_librubberband # How to use the bundled libraries '-DUSE_SPEEX' and '-DUSE_KISSFFT'? if [[ "$bits_target" != "32" ]]; then if [[ $build_svt_hevc = y ]]; then build_svt-hevc @@ -3027,10 +3024,8 @@ build_ffmpeg_dependencies() { build_libmysofa # Needed for FFmpeg's SOFAlizer filter (https://ffmpeg.org/ffmpeg-filters.html#sofalizer). Uses dlfcn. if [[ "$non_free" = "y" ]]; then build_fdk-aac # Uses dlfcn. - if [[ $OSTYPE != darwin* ]]; then - build_AudioToolboxWrapper # This wrapper library enables FFmpeg to use AudioToolbox codecs on Windows, with DLLs shipped with iTunes. - fi if [[ $compiler_flavors != "native" ]]; then + build_AudioToolboxWrapper # This wrapper library enables FFmpeg to use AudioToolbox codecs on Windows, with DLLs shipped with iTunes. build_libdecklink # Error finding rpc.h in native builds even if it's available fi fi @@ -3046,9 +3041,11 @@ build_ffmpeg_dependencies() { fi build_libaribb24 build_libtesseract + build_opencv # Uses tiff png jpeg zlib webp + build_frei0r # Needs dlfcn. Uses opencv. build_lensfun # requires png, zlib, iconv if [[ $compiler_flavors != "native" ]]; then - build_libtensorflow # requires tensorflow.dll + build_libtensorflow # requires tensorflow.dll; find in redist folder with frei0r plugins fi build_libvpx build_libx265