From 49f9181f9d5ff54a2df9a791239b354a1245af2c Mon Sep 17 00:00:00 2001 From: Levon Gevorgyan Date: Sun, 24 Aug 2025 12:44:23 -0500 Subject: [PATCH] remove libc, add patches --- lib/build.sh | 70 ++++--------------- main.sh | 3 +- ...od_implementation_of_sad_loop_kernel.patch | 1 + 3 files changed, 16 insertions(+), 58 deletions(-) diff --git a/lib/build.sh b/lib/build.sh index 8cf879f..95dad3b 100644 --- a/lib/build.sh +++ b/lib/build.sh @@ -41,7 +41,6 @@ set_compile_opts() { ) PKG_CONFIG_PATH="${LIBDIR}/pkgconfig" export PKG_CONFIG_PATH - export PKG_CONFIG_DEBUG_SPEW=1 # add prefix include C_FLAGS+=("-I${PREFIX}/include") @@ -55,7 +54,10 @@ set_compile_opts() { LTO_SWITCH='ON' LTO_FLAG='-flto' C_FLAGS+=("${LTO_FLAG}") - CONFIGURE_FLAGS+=('--enable-lto') + # https://trac.ffmpeg.org/ticket/11479 + if ! is_darwin; then + CONFIGURE_FLAGS+=('--enable-lto') + fi MESON_FLAGS+=("-Db_lto=true") RUSTFLAGS+=("-C lto=yes" "-C inline-threshold=1000" "-C codegen-units=1") CARGO_BUILD_TYPE=release @@ -177,17 +179,6 @@ set_compile_opts() { get_build_conf() { local getBuild="${1}" - local libcVer='X.X' - if test "${getBuild}" == 'libc' && has_cmd ldd; then - local srcTest="${TMP_DIR}/libc-ver" - echo '#include -#include -#include -int main() { puts(gnu_get_libc_version()); return 0; }' >"${srcTest}.c" - gcc "${srcTest}.c" -o "${srcTest}" - libcVer="$("${srcTest}")" - fi - # name version file-extension url dep1,dep2 # shellcheck disable=SC2016 local BUILDS_CONF=' @@ -203,8 +194,6 @@ libopus 1.5.2 tar.gz https://github.com/xiph/opus/releases/download libdav1d 1.5.1 tar.xz http://downloads.videolan.org/videolan/dav1d/${ver}/dav1d-${ver}.${ext} cpuinfo latest git https://github.com/pytorch/cpuinfo/ ' - BUILDS_CONF+="libc ${libcVer} tar.xz" - BUILDS_CONF+=' https://ftpmirror.gnu.org/glibc/glibc-${ver}.${ext}' local supported_builds=() unset ver ext url deps extracted_dir @@ -326,6 +315,11 @@ do_build() { get_build_conf "${build}" || return 1 echo_info "building ${build}" pushd "$extracted_dir" >/dev/null || return 1 + # check for any patches + for patch in "${PATCHES_DIR}/${build}"/*.patch; do + test -f "${patch}" || continue + patch -p1 -i "${patch}" || return 1 + done echo_if_fail build_"${build}" retval=$? popd >/dev/null || return 1 @@ -562,46 +556,6 @@ build_libvmaf() { } ### AUTOTOOLS ### -# special function mainly for arm64 builds -# since most distros do not compile libc -# with -fPIC for some reason -build_libc() ( - # only for arm64 - test "${HOSTTYPE}" != "aarch64" && exit 0 - # only for static builds - test "${STATIC}" == 'false' && exit 0 - # only for glibc - has_cmd ldd || exit 0 - # only build once - test -f "${LIBDIR}/libc.a" && exit 0 - - rm -rf build - mkdir build - cd build || exit 1 - - # manually set flags since these are - # not intended to be user-controlled - unset CFLAGS CXXFLAGS - export CFLAGS='-fPIC -O3 -U_FORTIFY_SOURCE' - export CXXFLAGS="${CFLAGS}" - libc_prefix="${PWD}/local-install" - libc_libdir="${libc_prefix}/lib" - ./../configure \ - --prefix="${libc_prefix}" \ - --libdir="${libc_libdir}" \ - --disable-werror || exit 1 - make -j"${JOBS}" all || exit 1 - - # install only the -fPIC static libraries - for picLib in ./**_pic.a; do - echo_warn "${picLib}" - done - # exit 1 - # cd "${libc_libdir}" || exit 1 - # cp ./*.a "${LIBDIR}" || exit 1 - - exit 0 -) add_project_versioning_to_ffmpeg() { local optFile local fname='ffmpeg_opt.c' @@ -653,8 +607,10 @@ build_ffmpeg() { "${FFMPEG_EXTRA_FLAGS[@]}" \ --pkg-config='pkg-config' \ --pkg-config-flags="${PKG_CFG_FLAGS}" \ - --cpu="${CPU}" --arch="${ARCH}" \ - --enable-gpl --enable-version3 \ + --arch="${ARCH}" \ + --cpu="${CPU}" \ + --enable-gpl \ + --enable-version3 \ --enable-nonfree \ --disable-htmlpages \ --disable-podpages \ diff --git a/main.sh b/main.sh index 793d04d..815e00d 100755 --- a/main.sh +++ b/main.sh @@ -14,7 +14,8 @@ DL_DIR="${IGN_DIR}/downloads" BUILD_DIR="${IGN_DIR}/builds" CCACHE_DIR="${IGN_DIR}/ccache" DOCKER_DIR="${IGN_DIR}/docker" -export REPO_DIR IGN_DIR TMP_DIR DL_DIR BUILD_DIR CCACHE_DIR DOCKER_DIR +PATCHES_DIR="${IGN_DIR}/patches" +export REPO_DIR IGN_DIR TMP_DIR DL_DIR BUILD_DIR CCACHE_DIR DOCKER_DIR PATCHES_DIR # function names, descriptions, completions unset FB_FUNC_NAMES FB_FUNC_DESCS FB_FUNC_COMPLETION diff --git a/patches/libsvtav1_psy/fix_neon_dotprod_implementation_of_sad_loop_kernel.patch b/patches/libsvtav1_psy/fix_neon_dotprod_implementation_of_sad_loop_kernel.patch index 005a969..b3bd08f 100644 --- a/patches/libsvtav1_psy/fix_neon_dotprod_implementation_of_sad_loop_kernel.patch +++ b/patches/libsvtav1_psy/fix_neon_dotprod_implementation_of_sad_loop_kernel.patch @@ -1,3 +1,4 @@ +# https://gitlab.com/AOMediaCodec/SVT-AV1/-/issues/2265 commit 5def505f7f193d890be61e869831378f212a07bd Author: Salome Thirot Date: Fri May 2 11:20:54 2025 +0100