| 1 | 
   | 
    
    # Copyright 2020-2023 Gentoo Authors 
   | 
  
   | 
  1 | 
    
    # Copyright 2020-2025 Gentoo Authors 
   | 
  
  | 2 | 
  2 | 
    
    # Distributed under the terms of the GNU General Public License v2 
   | 
  
  | 3 | 
  3 | 
    
    
   | 
  
  | 4 | 
  4 | 
    
    EAPI=8 
   | 
  
  | 5 | 
  5 | 
    
    
   | 
  
  | 6 | 
   | 
    
    inherit cmake-multilib flag-o-matic 
   | 
  
   | 
  6 | 
    
    inherit cmake-multilib edo multiprocessing 
   | 
  
  | 7 | 
  7 | 
    
    
   | 
  
  | 8 | 
   | 
    
    DESCRIPTION="Scalable Video Technology for AV1 (SVT-AV1 Encoder and Decoder)" 
   | 
  
   | 
  8 | 
    
    DESCRIPTION="Scalable Video Technology for AV1 (SVT-AV1 Encoder)" 
   | 
  
  | 9 | 
  9 | 
    
    HOMEPAGE="https://gitlab.com/AOMediaCodec/SVT-AV1" 
   | 
  
  | 10 | 
  10 | 
    
    
   | 
  
  | 11 | 
  11 | 
    
    if [[ ${PV} = 9999 ]]; then
   | 
  
| ... | ... |  | 
  | 13 | 
  13 | 
    
    	EGIT_REPO_URI="https://gitlab.com/AOMediaCodec/SVT-AV1.git" 
   | 
  
  | 14 | 
  14 | 
    
    else 
   | 
  
  | 15 | 
  15 | 
    
    	SRC_URI="https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v${PV}/SVT-AV1-v${PV}.tar.bz2"
   | 
  
  | 16 | 
   | 
    
    	KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv sparc x86" 
   | 
  
   | 
  16 | 
    
    	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86" 
   | 
  
  | 17 | 
  17 | 
    
    	S="${WORKDIR}/SVT-AV1-v${PV}"
   | 
  
  | 18 | 
  18 | 
    
    fi 
   | 
  
  | 19 | 
  19 | 
    
    
   | 
  
  | 20 | 
  20 | 
    
    # Also see "Alliance for Open Media Patent License 1.0" 
   | 
  
  | 21 | 
  21 | 
    
    LICENSE="BSD-2 Apache-2.0 BSD ISC LGPL-2.1+ MIT" 
   | 
  
  | 22 | 
   | 
    
    SLOT="0" 
   | 
  
   | 
  22 | 
    
    SLOT="0/$(ver_cut 1)" 
   | 
  
  | 23 | 
  23 | 
    
    
   | 
  
  | 24 | 
   | 
    
    BDEPEND="amd64? ( dev-lang/yasm )" 
   | 
  
   | 
  24 | 
    
    IUSE="test" 
   | 
  
   | 
  25 | 
    
    RESTRICT="!test? ( test )" 
   | 
  
   | 
  26 | 
    
    
   | 
  
   | 
  27 | 
    
    RDEPEND="amd64? ( dev-libs/cpuinfo )" 
   | 
  
   | 
  28 | 
    
    DEPEND="${RDEPEND}"
   | 
  
   | 
  29 | 
    
    BDEPEND=" 
   | 
  
   | 
  30 | 
    
    	amd64? ( dev-lang/yasm ) 
   | 
  
   | 
  31 | 
    
    	test? ( dev-util/gtest-parallel ) 
   | 
  
   | 
  32 | 
    
    " 
   | 
  
  | 25 | 
  33 | 
    
    
   | 
  
  | 26 | 
  34 | 
    
    PATCHES=( 
   | 
  
  | 27 | 
  35 | 
    
    	"${FILESDIR}"/${PN}-1.5.0-fortify-no-override.patch
   | 
  
  | 28 | 
  36 | 
    
    ) 
   | 
  
  | 29 | 
  37 | 
    
    
   | 
  
  | 30 | 
   | 
    
    multilib_src_configure() {
   | 
  
  | 31 | 
   | 
    
    	append-ldflags -Wl,-z,noexecstack 
   | 
  
   | 
  38 | 
    
    src_prepare() {
   | 
  
   | 
  39 | 
    
    	cmake_src_prepare 
   | 
  
   | 
  40 | 
    
    
   | 
  
   | 
  41 | 
    
    	# Lets not install tests 
   | 
  
   | 
  42 | 
    
    	sed -e '/install(/d' -i test/CMakeLists.txt || die 
   | 
  
   | 
  43 | 
    
    
   | 
  
   | 
  44 | 
    
    	# Needs more setup to run in the ebuild 
   | 
  
   | 
  45 | 
    
    	cmake_run_in test cmake_comment_add_subdirectory api_test 
   | 
  
   | 
  46 | 
    
    	# Tries to download stuff for this test 
   | 
  
   | 
  47 | 
    
    	cmake_run_in test cmake_comment_add_subdirectory e2e_test 
   | 
  
   | 
  48 | 
    
    } 
   | 
  
  | 32 | 
  49 | 
    
    
   | 
  
   | 
  50 | 
    
    multilib_src_configure() {
   | 
  
  | 33 | 
  51 | 
    
    	local mycmakeargs=( 
   | 
  
  | 34 | 
   | 
    
    		# Tests require linking against https://github.com/Cidana-Developers/aom/tree/av1-normative ? 
   | 
  
  | 35 | 
   | 
    
    		# undefined reference to `ifd_inspect' 
   | 
  
  | 36 | 
   | 
    
    		# https://github.com/Cidana-Developers/aom/commit/cfc5c9e95bcb48a5a41ca7908b44df34ea1313c0 
   | 
  
  | 37 | 
   | 
    
    		# .. and https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/.gitlab/workflows/linux/.gitlab-ci.yml implies it's all quite manual? 
   | 
  
  | 38 | 
   | 
    
    		-DBUILD_TESTING=OFF 
   | 
  
   | 
  52 | 
    
    		# Upstream only supports 64-bit and specially amd64 and arm64. 
   | 
  
   | 
  53 | 
    
    		# Other enviroments will fail to build due to missing symbols. 
   | 
  
   | 
  54 | 
    
    		-DBUILD_TESTING=$(multilib_native_usex test) 
   | 
  
  | 39 | 
  55 | 
    
    		-DCMAKE_OUTPUT_DIRECTORY="${BUILD_DIR}"
   | 
  
  | 40 | 
   | 
    
    		-DENABLE_AVX512=ON 
   | 
  
   | 
  56 | 
    
    		-DUSE_CPUINFO=SYSTEM # will only be used on amd64 
   | 
  
  | 41 | 
  57 | 
    
    	) 
   | 
  
  | 42 | 
  58 | 
    
    
   | 
  
  | 43 | 
  59 | 
    
    	[[ ${ABI} != amd64 ]] && mycmakeargs+=( -DCOMPILE_C_ONLY=ON )
   | 
  
  | 44 | 
  60 | 
    
    
   | 
  
  | 45 | 
  61 | 
    
    	cmake_src_configure 
   | 
  
  | 46 | 
  62 | 
    
    } 
   | 
  
   | 
  63 | 
    
    
   | 
  
   | 
  64 | 
    
    multilib_src_test() {
   | 
  
   | 
  65 | 
    
    	if multilib_is_native_abi; then 
   | 
  
   | 
  66 | 
    
    		# Upstream uses this, and this gives a significant time save in running these tests. 
   | 
  
   | 
  67 | 
    
    		# 2025-05-19T19:39:25 >>> media-libs/svt-av1-3.0.2: 1:46:14 
   | 
  
   | 
  68 | 
    
    		# 2025-05-20T16:10:34 >>> media-libs/svt-av1-3.0.2: 20′35″ 
   | 
  
   | 
  69 | 
    
    		edo gtest-parallel --workers "$(makeopts_jobs)" "${BUILD_DIR}"/SvtAv1UnitTests
   | 
  
   | 
  70 | 
    
    	fi 
   | 
  
   | 
  71 | 
    
    } 
   |