commit:     b70fd2a58e50cd4104cd5dca5a975170e758b22e
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Jun  1 02:44:47 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jun  1 03:09:59 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b70fd2a5

media-libs/gst-plugins-bad: avoid automagic dep on libva

As noted on the bug, I need to discuss properly with leio whether or not the
split for -va makes sense, but -va is an orphan/leaf package right now so it's
lower priority than just fixing -bad which many people have installed. So, for 
now,
just backport the relevant upstream patches to fix the automagic for this side.

Bug: https://bugs.gentoo.org/907481
Bug: https://bugs.gentoo.org/907479
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...son-Fix-libdrm-and-vaapi-configure-checks.patch |  65 ++++++++++++++
 ...eature-options-for-optional-va-deps-libdr.patch |  76 ++++++++++++++++
 .../gst-plugins-bad-1.22.3-r1.ebuild               | 100 +++++++++++++++++++++
 3 files changed, 241 insertions(+)

diff --git 
a/media-libs/gst-plugins-bad/files/0001-meson-Fix-libdrm-and-vaapi-configure-checks.patch
 
b/media-libs/gst-plugins-bad/files/0001-meson-Fix-libdrm-and-vaapi-configure-checks.patch
new file mode 100644
index 000000000000..ef944db920c2
--- /dev/null
+++ 
b/media-libs/gst-plugins-bad/files/0001-meson-Fix-libdrm-and-vaapi-configure-checks.patch
@@ -0,0 +1,65 @@
+https://bugs.gentoo.org/907479
+https://bugs.gentoo.org/907481
+https://gitlab.freedesktop.org/gstreamer/gstreamer/-/commit/55ee0635d3f63c408067dd904f8e8b718983ba0e
+https://gitlab.freedesktop.org/gstreamer/gstreamer/-/commit/479f0175b51ea74b07084c8a508b7a7224445a02
+https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4428
+
+From 864a329f7946460f9bb9dac171d0d80b2ff09a07 Mon Sep 17 00:00:00 2001
+From: Nirbheek Chauhan <nirbh...@centricular.com>
+Date: Fri, 14 Apr 2023 13:18:52 +0530
+Subject: [PATCH 1/2] meson: Fix libdrm and vaapi configure checks
+
+We do not need fallback: for libdrm checks because the wrap file
+already has a [provide] section.
+
+Part-of: 
<https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4428>
+--- a/gst-libs/gst/va/meson.build
++++ b/gst-libs/gst/va/meson.build
+@@ -31,17 +31,26 @@ if host_system != 'linux'
+   subdir_done()
+ endif
+ 
++va_opt = get_option('va')
++msdk_opt = get_option('msdk')
++qsv_opt = get_option('qsv')
++if va_opt.disabled() and msdk_opt.disabled() and qsv_opt.disabled()
++  subdir_done()
++endif
++
++va_required = va_opt.enabled() or msdk_opt.enabled() or qsv_opt.enabled()
++
+ libva_req = ['>= 1.6']
+-libva_dep = dependency('libva', version: libva_req, required: false,
++libva_dep = dependency('libva', version: libva_req, required: va_required,
+     fallback: ['libva', 'libva_dep'])
+-libva_drm_dep = dependency('libva-drm', version: libva_req, required: false,
++libva_drm_dep = dependency('libva-drm', version: libva_req, required: 
va_required,
+     fallback: ['libva', 'libva_drm_dep'])
+ 
+ if not (libva_dep.found() and libva_drm_dep.found())
+   subdir_done()
+ endif
+ 
+-libdrm_dep = dependency('libdrm', required: false, fallback: ['libdrm', 
'ext_libdrm'])
++libdrm_dep = dependency('libdrm', version: '>=2.4', required: false)
+ cdata.set10('HAVE_LIBDRM', libdrm_dep.found())
+ 
+ va_enums = gnome.mkenums_simple('va-enumtypes',
+--- a/sys/kms/meson.build
++++ b/sys/kms/meson.build
+@@ -11,11 +11,9 @@ if host_system != 'linux'
+ endif
+ 
+ libdrm_dep = dependency('libdrm', version : '>= 2.4.98',
+-                        required : get_option('kms'),
+-                        fallback: ['libdrm', 'ext_libdrm'])
++                        required : get_option('kms'))
+ libdrm_hdr_dep = dependency('libdrm', version : '>= 2.4.104',
+-                            required : false,
+-                            fallback: ['libdrm', 'ext_libdrm'])
++                            required : false)
+ mathlib = cc.find_library('m', required : false)
+ 
+ if libdrm_hdr_dep.found() and mathlib.found()
+-- 
+2.40.1

diff --git 
a/media-libs/gst-plugins-bad/files/0002-meson-Add-feature-options-for-optional-va-deps-libdr.patch
 
b/media-libs/gst-plugins-bad/files/0002-meson-Add-feature-options-for-optional-va-deps-libdr.patch
new file mode 100644
index 000000000000..55ea57fa8128
--- /dev/null
+++ 
b/media-libs/gst-plugins-bad/files/0002-meson-Add-feature-options-for-optional-va-deps-libdr.patch
@@ -0,0 +1,76 @@
+https://bugs.gentoo.org/907479
+https://bugs.gentoo.org/907481
+https://gitlab.freedesktop.org/gstreamer/gstreamer/-/commit/55ee0635d3f63c408067dd904f8e8b718983ba0e
+https://gitlab.freedesktop.org/gstreamer/gstreamer/-/commit/479f0175b51ea74b07084c8a508b7a7224445a02
+https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4428
+
+From ffecb5f1a02174c2d6ab6ca472c6c0cab10179b3 Mon Sep 17 00:00:00 2001
+From: Nirbheek Chauhan <nirbh...@centricular.com>
+Date: Fri, 14 Apr 2023 16:11:55 +0530
+Subject: [PATCH 2/2] meson: Add feature options for optional va deps libdrm
+ and gudev
+
+Part-of: 
<https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4428>
+Signed-off-by: Sam James <s...@gentoo.org>
+--- a/gst-libs/gst/va/meson.build
++++ b/gst-libs/gst/va/meson.build
+@@ -32,14 +32,20 @@ if host_system != 'linux'
+ endif
+ 
+ va_opt = get_option('va')
+-msdk_opt = get_option('msdk')
+-qsv_opt = get_option('qsv')
+-if va_opt.disabled() and msdk_opt.disabled() and qsv_opt.disabled()
+-  subdir_done()
++if host_system == 'linux'
++  msdk_opt = get_option('msdk')
++  qsv_opt = get_option('qsv')
++  if va_opt.disabled() and msdk_opt.disabled() and qsv_opt.disabled()
++    subdir_done()
++  endif
++  va_required = va_opt.enabled() or msdk_opt.enabled() or qsv_opt.enabled()
++else
++  if va_opt.disabled()
++    subdir_done()
++  endif
++  va_required = va_opt
+ endif
+ 
+-va_required = va_opt.enabled() or msdk_opt.enabled() or qsv_opt.enabled()
+-
+ libva_req = ['>= 1.6']
+ libva_dep = dependency('libva', version: libva_req, required: va_required,
+     fallback: ['libva', 'libva_dep'])
+@@ -50,7 +56,7 @@ if not (libva_dep.found() and libva_drm_dep.found())
+   subdir_done()
+ endif
+ 
+-libdrm_dep = dependency('libdrm', version: '>=2.4', required: false)
++libdrm_dep = dependency('libdrm', version: '>=2.4', required: 
get_option('drm'))
+ cdata.set10('HAVE_LIBDRM', libdrm_dep.found())
+ 
+ va_enums = gnome.mkenums_simple('va-enumtypes',
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -73,6 +73,8 @@ option('y4m', type : 'feature', value : 'auto')
+ option('opencv', type : 'feature', value : 'auto', description : 'OpenCV 
computer vision library support')
+ 
+ # Feature options for optional deps in plugins
++option('drm', type : 'feature', value : 'auto', description: 'libdrm support 
in the GstVA library')
++option('udev', type : 'feature', value : 'auto', description: 'gudev support 
in the new VA-API plugin')
+ option('wayland', type : 'feature', value : 'auto', description : 'Wayland 
plugin/library, support in the Vulkan plugin')
+ option('x11', type : 'feature', value : 'auto', description : 'X11 support in 
Vulkan, GL and rfb plugins')
+ 
+--- a/sys/va/meson.build
++++ b/sys/va/meson.build
+@@ -33,7 +33,7 @@ if va_option.disabled()
+   subdir_done()
+ endif
+ 
+-libgudev_dep = dependency('gudev-1.0', required: false)
++libgudev_dep = dependency('gudev-1.0', required: get_option('udev'), 
allow_fallback: true)
+ cdata.set10('HAVE_GUDEV', libgudev_dep.found())
+ 
+ if libva_dep.version().version_compare('>= 1.8')
+-- 
+2.40.1

diff --git a/media-libs/gst-plugins-bad/gst-plugins-bad-1.22.3-r1.ebuild 
b/media-libs/gst-plugins-bad/gst-plugins-bad-1.22.3-r1.ebuild
new file mode 100644
index 000000000000..86417a3c6347
--- /dev/null
+++ b/media-libs/gst-plugins-bad/gst-plugins-bad-1.22.3-r1.ebuild
@@ -0,0 +1,100 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+GST_ORG_MODULE="gst-plugins-bad"
+PYTHON_COMPAT=( python3_{8,9,10,11} )
+inherit gstreamer-meson python-any-r1
+
+DESCRIPTION="Less plugins for GStreamer"
+HOMEPAGE="https://gstreamer.freedesktop.org/";
+
+LICENSE="LGPL-2"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 
~riscv ~sparc ~x86"
+
+# TODO: egl and gtk IUSE only for transition
+IUSE="X bzip2 +egl gles2 gtk +introspection +opengl +orc vnc wayland qsv" # 
Keep default IUSE mirrored with gst-plugins-base where relevant
+
+# X11 is automagic for now, upstream #709530 - only used by librfb USE=vnc 
plugin
+# We mirror opengl/gles2 from -base to ensure no automagic openglmixers plugin 
(with "opengl?" it'd still get built with USE=-opengl here)
+# FIXME        gtk? ( 
>=media-plugins/gst-plugins-gtk-${PV}:${SLOT}[${MULTILIB_USEDEP}] )
+RDEPEND="
+       !media-plugins/gst-transcoder
+       >=media-libs/gstreamer-${PV}:${SLOT}[${MULTILIB_USEDEP},introspection?]
+       
>=media-libs/gst-plugins-base-${PV}:${SLOT}[${MULTILIB_USEDEP},egl?,introspection?,gles2=,opengl=]
+       introspection? ( >=dev-libs/gobject-introspection-1.31.1:= )
+
+       bzip2? ( >=app-arch/bzip2-1.0.6-r4[${MULTILIB_USEDEP}] )
+       vnc? ( X? ( x11-libs/libX11[${MULTILIB_USEDEP}] ) )
+       wayland? (
+               >=dev-libs/wayland-1.4.0[${MULTILIB_USEDEP}]
+               >=x11-libs/libdrm-2.4.55[${MULTILIB_USEDEP}]
+               >=dev-libs/wayland-protocols-1.15
+       )
+
+       orc? ( >=dev-lang/orc-0.4.33[${MULTILIB_USEDEP}] )
+
+       qsv? ( media-libs/oneVPL[wayland?,X?,${MULTILIB_USEDEP}] )
+"
+
+DEPEND="${RDEPEND}"
+
+BDEPEND="
+       ${PYTHON_DEPS}
+       dev-util/glib-utils
+"
+
+DOCS=( AUTHORS ChangeLog NEWS README.md RELEASE )
+
+# FIXME: gstharness.c:889:gst_harness_new_with_padnames: assertion failed: 
(element != NULL)
+RESTRICT="test"
+
+PATCHES=(
+       "${FILESDIR}"/0001-meson-Fix-libdrm-and-vaapi-configure-checks.patch
+       
"${FILESDIR}"/0002-meson-Add-feature-options-for-optional-va-deps-libdr.patch
+)
+
+src_prepare() {
+       default
+       addpredict /dev # Prevent sandbox violations bug #570624
+}
+
+multilib_src_configure() {
+       GST_PLUGINS_NOAUTO="shm ipcpipeline librfb msdk hls"
+
+       local emesonargs=(
+               -Dshm=enabled
+               -Dipcpipeline=enabled
+               -Dhls=disabled
+               $(meson_feature vnc librfb)
+
+               $(meson_feature wayland)
+       )
+
+       if use qsv; then
+               emesonargs+=(
+                       -Dmsdk=enabled
+                       -Dmfx_api=oneVPL
+               )
+       else
+               emesonargs+=( -Dmsdk=disabled )
+       fi
+
+       if use opengl || use gles2; then
+               myconf+=( -Dgl=enabled )
+       else
+               myconf+=( -Dgl=disabled )
+       fi
+
+       gstreamer_multilib_src_configure
+}
+
+multilib_src_test() {
+       # Tests are slower than upstream expects
+       CK_DEFAULT_TIMEOUT=300 gstreamer_multilib_src_test
+}
+
+multilib_src_install_all() {
+       einstalldocs
+       find "${ED}" -name '*.la' -delete || die
+}

Reply via email to