media-libs/svt-av1: add 4.0.1

* Hookup pgo
* Pass option for AVX512.
* Don't enable COMPILE_C_ONLY for arm64, bug #970896

Bug: https://bugs.gentoo.org/970896
Signed-off-by: Alfred Wingate <parona@protonmail.com>
Part-of: https://codeberg.org/gentoo/gentoo/pulls/406
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Alfred Wingate
2026-03-24 00:15:03 +00:00
committed by Sam James
parent 51347e50ea
commit dca772f4e3
4 changed files with 170 additions and 5 deletions
+2
View File
@@ -2,3 +2,5 @@ DIST SVT-AV1-v2.1.2.tar.bz2 11764554 BLAKE2B ad9b7a732ce3991ddbe796e52db1559928c
DIST SVT-AV1-v3.0.2.tar.bz2 10202794 BLAKE2B 29ccaa27e1c8e94e1cbe32922a5b17984d0979acf4be39556c0846e4493f00232db269d64315b0cedb94ef04f6928bb4ec295b0c977b70e47af55e6f5a998062 SHA512 dfe110011d0c249d3541c3950e96b8e1c6c3b5041cb7eee0f64a3414b8c7439bddac15e3de36305da89f05b418f2a54025fe2513c5377d2eefa4bd778ebbafb9
DIST SVT-AV1-v3.1.0.tar.bz2 10203101 BLAKE2B df479f1657383fe5585ea5b4299998e13ec56523da489186807f83a59f8365a903c424926986306f872427277cf8e7d61b6b536e3f908b96f25fa3c17b9a689a SHA512 e4195fd2ad16d218b9da9ac65a22749d922d3573764c944ffb935cf7a6af732ad9839bf81c3f060cce2ae6fb3c4c1b7bfd3ab280784605c81bd7a74179b89c7c
DIST SVT-AV1-v3.1.2.tar.bz2 10203273 BLAKE2B 4a7e43e74e3cf76f920b46224a7ddb82dd9633de2af66c93094b06ec83948d76e6cca63df049e4b2af38de8372a1fabd5fbe8a8a92792e9408220991180ea903 SHA512 d23327cf348d576643d6385f756d9354ed93801c99bf63c4fb049902f4fd2b81c816cacdcab71dffb1cc330385c89c5abef67b8f81d2abd69a70f01a3e55b25a
DIST SVT-AV1-v4.0.1.tar.bz2 10225189 BLAKE2B 27219cf2e6d36b95955a730338a9257e69fb4d64d5dc941b5cf0e83ac568a0d6881ce9f254d953ae94174e5abe029be700d1f524044cec640a566c028a089078 SHA512 29ee892117c26b582f25089e528a4a10c9b7295c29e8559b42ebef5edf2dd7afb023ab5246671d86353cf5cbb8bda1b05ea58c29e9ebe44a49bdc603a00223f2
DIST svt-av1-stefan_sif.y4m 38017846 BLAKE2B 4965ea26a877134b301fa13e0865fca03141e4f15f7ebdaed7556295a660a132cc46ec5888e981d7361311c9267442447cf2100ef46340db8d5b21b31007d57f SHA512 9c37404dcba369fe8f46398b9d571138beeed738f62d00fca2ea2469818f06b6ba0ad1489943e151a8d9b3791d712a019af4422de40e6a9d3319dbf9be3f4d55
+4
View File
@@ -7,4 +7,8 @@
<upstream>
<remote-id type="gitlab">AOMediaCodec/SVT-AV1</remote-id>
</upstream>
<use>
<flag name="pgo">Optimize the build using Profile Guided Optimization (PGO)</flag>
<flag name="tools">Build SvtAv1EncApp</flag>
</use>
</pkgmetadata>
+115
View File
@@ -0,0 +1,115 @@
# Copyright 2020-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit cmake-multilib edo multiprocessing
DESCRIPTION="Scalable Video Technology for AV1 (SVT-AV1 Encoder)"
HOMEPAGE="https://gitlab.com/AOMediaCodec/SVT-AV1"
if [[ ${PV} = 9999 ]]; then
inherit git-r3
EGIT_REPO_URI="https://gitlab.com/AOMediaCodec/SVT-AV1.git"
else
SRC_URI="https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v${PV}/SVT-AV1-v${PV}.tar.bz2"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
S="${WORKDIR}/SVT-AV1-v${PV}"
fi
# Build/obj1fastdownloader.cmake
PROFILING_VIDEO="stefan_sif.y4m"
SRC_URI+=" pgo? ( https://media.xiph.org/video/derf/y4m/${PROFILING_VIDEO} -> svt-av1-${PROFILING_VIDEO} )"
# Also see "Alliance for Open Media Patent License 1.0"
LICENSE="BSD-2 Apache-2.0 BSD ISC LGPL-2.1+ MIT"
SLOT="0/$(ver_cut 1)"
IUSE="cpu_flags_x86_avx512vl pgo test tools"
RESTRICT="!test? ( test )"
BDEPEND="
amd64? ( dev-lang/yasm )
test? ( dev-util/gtest-parallel )
"
PATCHES=(
"${FILESDIR}"/${PN}-3.1.2-fortify-no-override.patch
)
src_prepare() {
# Unused project that triggers the cmake eclasses minimum required cmake check
rm -rf gstreamer-plugin || die
cmake_src_prepare
# Lets not install tests
sed -e '/install(/d' -i test/CMakeLists.txt || die
# Needs more setup to run in the ebuild
cmake_run_in test cmake_comment_add_subdirectory api_test
# Tries to download stuff for this test
cmake_run_in test cmake_comment_add_subdirectory e2e_test
}
multilib_src_configure() {
local mycmakeargs=(
# Upstream only supports 64-bit and specially amd64 and arm64.
# Other enviroments will fail to build due to missing symbols.
-DBUILD_TESTING=$(multilib_native_usex test)
-DCMAKE_OUTPUT_DIRECTORY="${BUILD_DIR}"
-DENABLE_AVX512=$(usex cpu_flags_x86_avx512vl)
-DSVT_AV1_PGO=$(usex pgo)
-DBUILD_APPS=$(multilib_native_usex tools ON $(usex pgo))
-DCOVERAGE=OFF
# Use cflags instead
-DNATIVE=OFF
-DSVT_AV1_LTO=OFF
)
use pgo && mycmakeargs+=( -DSVT_AV1_PGO_DIR="${T}/${ARCH}-pgo" )
cmake_src_configure
}
multilib_src_compile() {
if use pgo; then
mkdir -p "${BUILD_DIR}/objective-1-fast/" || die
cp "${DISTDIR}/svt-av1-${PROFILING_VIDEO}" "${BUILD_DIR}/objective-1-fast/${PROFILING_VIDEO}" || die
## Run the targets separately for more verbose output
# equivalent to the target PGOCompileGen
edo cmake "${BUILD_DIR}" -DSVT_INTERNAL_PGO_GENERATE=ON -DSVT_INTERNAL_PGO_USE=OFF
cmake_build SvtAv1EncApp
cmake_build PGOGenerateProfile
# equivalent to the target PGOCompileUse
edo cmake "${BUILD_DIR}" -DSVT_INTERNAL_PGO_GENERATE=OFF -DSVT_INTERNAL_PGO_USE=ON
cmake_build SvtAv1EncApp
fi
cmake_src_compile
}
multilib_src_test() {
if multilib_is_native_abi; then
# Upstream uses this, and this gives a significant time save in running these tests.
# 2025-05-19T19:39:25 >>> media-libs/svt-av1-3.0.2: 1:46:14
# 2025-05-20T16:10:34 >>> media-libs/svt-av1-3.0.2: 20'35″
edo gtest-parallel --workers "$(get_makeopts_jobs)" "${BUILD_DIR}"/SvtAv1UnitTests
fi
}
multilib_src_install() {
cmake_src_install
# tool needed for pgo, remove it if not requested.
if [[ -f "${ED}/usr/bin/SvtAv1EncApp" ]] && use !tools ; then
rm "${ED}/usr/bin/SvtAv1EncApp" || die
fi
}
+49 -5
View File
@@ -1,4 +1,4 @@
# Copyright 2020-2025 Gentoo Authors
# Copyright 2020-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@@ -17,11 +17,15 @@ else
S="${WORKDIR}/SVT-AV1-v${PV}"
fi
# Build/obj1fastdownloader.cmake
PROFILING_VIDEO="stefan_sif.y4m"
SRC_URI+=" pgo? ( https://media.xiph.org/video/derf/y4m/${PROFILING_VIDEO} -> svt-av1-${PROFILING_VIDEO} )"
# Also see "Alliance for Open Media Patent License 1.0"
LICENSE="BSD-2 Apache-2.0 BSD ISC LGPL-2.1+ MIT"
SLOT="0/$(ver_cut 1)"
IUSE="test"
IUSE="cpu_flags_x86_avx512vl pgo test tools"
RESTRICT="!test? ( test )"
BDEPEND="
@@ -54,18 +58,58 @@ multilib_src_configure() {
# Other enviroments will fail to build due to missing symbols.
-DBUILD_TESTING=$(multilib_native_usex test)
-DCMAKE_OUTPUT_DIRECTORY="${BUILD_DIR}"
-DENABLE_AVX512=$(usex cpu_flags_x86_avx512vl)
-DSVT_AV1_PGO=$(usex pgo)
-DBUILD_APPS=$(multilib_native_usex tools ON $(usex pgo))
-DCOVERAGE=OFF
# Use cflags instead
-DNATIVE=OFF
-DSVT_AV1_LTO=OFF
)
[[ ${ABI} != amd64 ]] && mycmakeargs+=( -DCOMPILE_C_ONLY=ON )
use pgo && mycmakeargs+=( -DSVT_AV1_PGO_DIR="${T}/${ARCH}-pgo" )
cmake_src_configure
}
multilib_src_compile() {
if use pgo; then
mkdir -p "${BUILD_DIR}/objective-1-fast/" || die
cp "${DISTDIR}/svt-av1-${PROFILING_VIDEO}" "${BUILD_DIR}/objective-1-fast/${PROFILING_VIDEO}" || die
## Run the targets separately for more verbose output
# equivalent to the target PGOCompileGen
edo cmake "${BUILD_DIR}" -DSVT_INTERNAL_PGO_GENERATE=ON -DSVT_INTERNAL_PGO_USE=OFF
cmake_build SvtAv1EncApp
cmake_build PGOGenerateProfile
# equivalent to the target PGOCompileUse
edo cmake "${BUILD_DIR}" -DSVT_INTERNAL_PGO_GENERATE=OFF -DSVT_INTERNAL_PGO_USE=ON
cmake_build SvtAv1EncApp
fi
cmake_src_compile
}
multilib_src_test() {
if multilib_is_native_abi; then
# Upstream uses this, and this gives a significant time save in running these tests.
# 2025-05-19T19:39:25 >>> media-libs/svt-av1-3.0.2: 1:46:14
# 2025-05-20T16:10:34 >>> media-libs/svt-av1-3.0.2: 20′35″
edo gtest-parallel --workers "$(makeopts_jobs)" "${BUILD_DIR}"/SvtAv1UnitTests
# 2025-05-20T16:10:34 >>> media-libs/svt-av1-3.0.2: 20'35″
edo gtest-parallel --workers "$(get_makeopts_jobs)" "${BUILD_DIR}"/SvtAv1UnitTests
fi
}
multilib_src_install() {
cmake_src_install
# tool needed for pgo, remove it if not requested.
if [[ -f "${ED}/usr/bin/SvtAv1EncApp" ]] && use !tools ; then
rm "${ED}/usr/bin/SvtAv1EncApp" || die
fi
}