summaryrefslogtreecommitdiff
path: root/media-libs/virglrenderer/virglrenderer-9999-r1.ebuild
blob: bf9a5900d458b645ffc6378898a02059c3f30005 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

PYTHON_COMPAT=( python3_{13..14} )
inherit meson python-any-r1

if [[ ${PV} == "9999" ]] ; then
	EGIT_REPO_URI="https://gitlab.freedesktop.org/virgl/virglrenderer.git"
	inherit git-r3
else
	MY_P="${PN}-${P}"
	SRC_URI="https://gitlab.freedesktop.org/virgl/${PN}/-/archive/${P}/${MY_P}.tar.bz2"
	S="${WORKDIR}/${MY_P}"

	KEYWORDS="~amd64 ~arm64 ~loong ~riscv ~x86"
fi

DESCRIPTION="Library used implement a virtual 3D GPU used by qemu"
HOMEPAGE="https://virgil3d.github.io/"

LICENSE="MIT"
SLOT="0"
IUSE="static-libs test venus vaapi video_cards_amdgpu video_cards_asahi video_cards_freedreno video_cards_intel X"
RESTRICT="!test? ( test )"

RDEPEND="
	>=x11-libs/libdrm-2.4.121
	media-libs/libepoxy[X?]
	media-libs/mesa
	venus? ( media-libs/vulkan-loader )
	vaapi? ( media-libs/libva:= )
	X? ( x11-libs/libX11 )
"
DEPEND="
	${RDEPEND}
	sys-kernel/linux-headers
"
BDEPEND="
	${PYTHON_DEPS}
	$(python_gen_any_dep "
		dev-python/pyyaml[\${PYTHON_USEDEP}]
	")
	test? (
		dev-libs/check
	)
"

python_check_deps() {
	python_has_version -b "dev-python/pyyaml[${PYTHON_USEDEP}]" || return 1
}

src_configure() {
	local -a gpus=()
	use video_cards_amdgpu && gpus+=( amdgpu-experimental )
	use video_cards_asahi && gpus+=( asahi )
	use video_cards_freedreno && gpus+=( msm )
	use video_cards_intel && gpus+=( i915-experimental )

	# Build egl unconditionally. Tests and vaapi require it.
	local -a platforms=( egl )
	use X && platforms+=( glx )

	local emesonargs=(
		-Ddefault_library=$(usex static-libs both shared)
		-Ddrm-renderers=$(IFS=,; echo "${gpus[*]}")
		-Dplatforms=$(IFS=,; echo "${platforms[*]}")
		-Dvulkan-dload=false
		$(meson_use test tests)
		$(meson_use venus)
		$(meson_use vaapi video)
	)

	meson_src_configure
}

src_test() {
	# Most of the testsuite cannot run in our sandboxed environment, just don't
	# deal with it for now.  Instead lets run a subset of tests atleast.
	meson_src_test test_virgl_gbm_resources test_fuzzer_formats
}