summaryrefslogtreecommitdiff
path: root/dev-qt/qtmultimedia/qtmultimedia-6.7.2-r1.ebuild
blob: f86755c559028d9cb29674c0234ffae1b2eef18b (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# Copyright 2021-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit flag-o-matic qt6-build

DESCRIPTION="Multimedia (audio, video, radio, camera) library for the Qt6 framework"

if [[ ${QT6_BUILD_TYPE} == release ]]; then
	KEYWORDS="amd64 arm arm64 ~hppa ~loong ppc ppc64 ~riscv x86"
fi

IUSE="+X alsa eglfs +ffmpeg gstreamer opengl pulseaudio qml v4l vaapi vulkan"
# tst_qmediaplayerbackend hard requires qml, review in case becomes optional
REQUIRED_USE="
	|| ( ffmpeg gstreamer )
	eglfs? ( ffmpeg opengl )
	vaapi? ( ffmpeg opengl )
	test? ( qml )
"

RDEPEND="
	~dev-qt/qtbase-${PV}:6[gui,network,opengl=,vulkan=,widgets]
	alsa? (
		!pulseaudio? ( media-libs/alsa-lib )
	)
	ffmpeg? (
		~dev-qt/qtbase-${PV}:6[X=,concurrent,eglfs=]
		media-video/ffmpeg:=[vaapi?]
		X? (
			x11-libs/libX11
			x11-libs/libXext
			x11-libs/libXrandr
		)
	)
	gstreamer? (
		dev-libs/glib:2
		media-libs/gst-plugins-bad:1.0
		media-libs/gst-plugins-base:1.0[X=,opengl?]
		media-libs/gstreamer:1.0
	)
	opengl? ( media-libs/libglvnd )
	pulseaudio? ( media-libs/libpulse )
	qml? (
		~dev-qt/qtdeclarative-${PV}:6
		~dev-qt/qtquick3d-${PV}:6
	)
"
DEPEND="
	${RDEPEND}
	X? ( x11-base/xorg-proto )
	v4l? ( sys-kernel/linux-headers )
	vulkan? ( dev-util/vulkan-headers )
"
BDEPEND="~dev-qt/qtshadertools-${PV}:6"

PATCHES=(
	"${FILESDIR}"/${P}-gstreamer-no-v4l.patch
)

CMAKE_SKIP_TESTS=(
	# unimportant and expects all backends to be available (bug #928420)
	tst_backends
	# tries to use real alsa or pulseaudio and fails in sandbox
	tst_qaudiosink
	tst_qaudiosource
	tst_qmediacapturesession
	tst_qmediaplayerbackend
	tst_qsoundeffect
	# may try to use v4l2 or hardware acceleration depending on availability
	tst_qscreencapture_integration
	tst_qscreencapturebackend
	tst_qvideoframebackend
	# fails with offscreen rendering
	tst_qvideoframecolormanagement
	tst_qwindowcapturebackend
)

src_configure() {
	# normally passed by the build system, but needed for 32-on-64 chroots
	use x86 && append-cppflags -DPFFFT_SIMD_DISABLE

	local mycmakeargs=(
		$(cmake_use_find_package qml Qt6Qml)
		$(qt_feature ffmpeg)
		$(qt_feature gstreamer)
		$(usev gstreamer $(qt_feature opengl gstreamer_gl))
		$(qt_feature pulseaudio)
		$(qt_feature v4l linux_v4l)
		$(qt_feature vaapi)
	)

	# ALSA backend is experimental off-by-default and can take priority
	# causing problems (bug #935146), disable if USE=pulseaudio is set
	# (also do not want unnecessary usage of ALSA plugins -> pulse)
	if use alsa && use pulseaudio; then
		# einfo should be enough given pure-ALSA users tend to disable pulse
		einfo "Warning: USE=alsa is ignored when USE=pulseaudio is set"
		mycmakeargs+=( -DQT_FEATURE_alsa=OFF )
	else
		mycmakeargs+=( $(qt_feature alsa) )
	fi

	qt6-build_src_configure
}

src_install() {
	qt6-build_src_install

	if use test; then
		local delete=( # sigh
			"${D}${QT6_LIBDIR}"/cmake/Qt6Multimedia/Qt6MockMultimediaPlugin*.cmake
			"${D}${QT6_MKSPECSDIR}"/modules/qt_plugin_mockmultimediaplugin.pri
			"${D}${QT6_PLUGINDIR}"/multimedia/libmockmultimediaplugin.*
			"${D}${QT6_PLUGINDIR}"/multimedia/objects-*
		)
		# using -f given not tracking which tests may be skipped or not
		rm -rf -- "${delete[@]}" || die
	fi
}