gst-plugins-vaapi-1.16.2.ebuild (4323B)
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 inherit multilib-minimal
7
8 MY_PN="gstreamer-vaapi"
9 DESCRIPTION="Hardware accelerated video decoding through VA-API plugin for GStreamer"
10 HOMEPAGE="https://cgit.freedesktop.org/gstreamer/gstreamer-vaapi"
11 SRC_URI="https://gstreamer.freedesktop.org/src/${MY_PN}/${MY_PN}-${PV}.tar.xz"
12
13 LICENSE="LGPL-2.1+"
14 SLOT="1.0"
15 KEYWORDS="~amd64 ~arm64 ~x86"
16 IUSE="+drm +egl gles2 +opengl wayland +X" # Keep default enabled IUSE in sync with gst-plugins-base and libva
17
18 # gst-vaapi configure is based around GL platform mainly, unlike gst-plugins-bad that goes by GL API mainly; for less surprises,
19 # we design gst-vaapi ebuild in terms of GL API as main choice as well, meaning that USE opengl and/or gles2 is required to
20 # enable opengl support at all and choices get chained from there.
21 # One or multiple video output are required: drm, x11, glx, egl and/or wayland;
22 # but GL API is our main trigger, thus USE=egl should be ineffective if neither gles2 or opengl is enabled;
23 # So "|| ( drm egl opengl wayland X )" would be wrong, because egl isn't built with USE="egl -opengl -gles2", ending up with no video outputs.
24 # As we ensure at least one working GL output with other REQUIRED_USE, we can put gles2/opengl in REQUIRED_USE instead of egl, solving the issue.
25 # gles2 API only supported windowing system (on linux) is EGL, so require it
26 # opengl API only supported windowing systems (on linux) are EGL and GLX, so require one of them (glx is enabled with USE="opengl X")
27 REQUIRED_USE="
28 || ( drm gles2 opengl wayland X )
29 gles2? ( egl )
30 opengl? ( || ( egl X ) )
31 "
32
33 # glx doesn't require libva-glx (libva[opengl]) afaics, only by tests/test-display.c
34 # USE flag behavior:
35 # 'drm' enables vaapi drm support
36 # 'egl' enables EGL platform support (but only if also 'opengl||gles2')
37 # - 'egl' is exposed as a USE flag mainly to get EGL support instead of or in addition to GLX support with desktop GL while keeping it optional for pure GLX cases;
38 # it's always required with USE=gles2, thus USE="gles2 opengl X" will require and build desktop GL EGL platform support as well on top of GLX, which doesn't add extra deps at that point.
39 # 'gles2' enables GLESv2 or GLESv3 based GL API support
40 # 'opengl' enables desktop OpenGL based GL API support
41 # 'wayland' enables non-GL Wayland support; wayland EGL support when combined with 'egl' (but only if also 'opengl||gles2')
42 # 'X' enables non-GL X support; GLX support when combined with 'opengl'
43 # gst-plugins-bad still needed for codecparsers (GL libraries moved to -base); checked for 1.14 (recheck for 1.16)
44 GST_REQ="${PV}"
45 GL_DEPS="
46 >=media-libs/gst-plugins-base-${GST_REQ}:${SLOT}[egl?,gles2?,opengl?,wayland?,X?]
47 media-libs/mesa[gles2?,egl?,X(+),${MULTILIB_USEDEP}]
48 "
49 RDEPEND="
50 >=dev-libs/glib-2.40:2[${MULTILIB_USEDEP}]
51 >=media-libs/gstreamer-${GST_REQ}:${SLOT}[${MULTILIB_USEDEP}]
52 >=media-libs/gst-plugins-base-${GST_REQ}:${SLOT}[${MULTILIB_USEDEP}]
53 >=media-libs/gst-plugins-bad-${GST_REQ}:${SLOT}[${MULTILIB_USEDEP}]
54 >=x11-libs/libva-1.4.0:=[drm?,wayland?,X?,${MULTILIB_USEDEP}]
55 drm? (
56 >=virtual/libudev-208:=[${MULTILIB_USEDEP}]
57 >=x11-libs/libdrm-2.4.46[${MULTILIB_USEDEP}]
58 )
59 gles2? ( ${GL_DEPS} )
60 opengl? ( ${GL_DEPS} )
61 wayland? ( >=dev-libs/wayland-1.11.0[${MULTILIB_USEDEP}] )
62 X? (
63 >=x11-libs/libX11-1.6.2[${MULTILIB_USEDEP}]
64 >=x11-libs/libXrandr-1.4.2[${MULTILIB_USEDEP}]
65 x11-libs/libXrender[${MULTILIB_USEDEP}] )
66 "
67 DEPEND="${RDEPEND}
68 >=dev-util/gtk-doc-am-1.12
69 >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]
70 "
71
72 S="${WORKDIR}/${MY_PN}-${PV}"
73
74 multilib_src_configure() {
75 local myconf=()
76 if use opengl || use gles2; then
77 myconf+=(
78 $(use_enable egl)
79 --with-glapi=$(usex opengl 'gl,' '')$(usex gles2 'gles2,gles3' '') # It's fine to have extra commas passed
80 )
81 else
82 myconf+=(
83 --disable-egl
84 --without-glapi
85 )
86 fi
87
88 if use opengl && use X; then
89 myconf+=( --enable-glx )
90 else
91 myconf+=( --disable-glx )
92 fi
93
94 ECONF_SOURCE=${S} \
95 econf \
96 --disable-static \
97 --disable-debug \
98 --disable-examples \
99 --enable-encoders \
100 $(use_enable drm) \
101 $(use_enable X x11) \
102 $(use_enable wayland) \
103 --without-gtk \
104 "${myconf[@]}"
105 }
106
107 multilib_src_install_all() {
108 einstalldocs
109 find "${ED}" -name '*.la' -delete || die
110 }