Re: [gentoo-dev] [PATCH v2] gstreamer-meson.eclass: New eclass required for gstreamer-1.18.0+

2021-03-23 Thread Michał Górny
On Tue, 2021-03-23 at 13:44 +0100, Haelwenn (lanodan) Monnier wrote:
> Gstreamer switched to meson in 1.16.0 and removed autotools support in 1.18.0,
> this eclass is an update of gstreamer.eclass.
> 
> One significant change between autotools and meson is that in the latter we
> don't have easily extractable semantics in the buildsystem to get a list
> of plugins with extraneous dependencies that we currently split in other
> packages.
> Hence the rather ugly but currently required GST_PLUGINS_DISABLED block.
> The gstreamer_system_link function also got lost in translation.
> 
> Differences from version 1:
> - Move to EAPI-7, including moving deps from DEPEND to BDEPEND when 
> appropriate
> - Port python script to perl, this allows to avoid having to add PYTHON_COMPAT
>   into a python-unrelated eclass
> - Drop errorneous MULTILIB_USEDEP on virtual/pkgconfig
> - Fix running tests: defining multilib_src_test, media-libs/gstreamer[test] 
> dep
> - Fix ebuild emesonargs being ignored
> - Remove legacy prune_libtool_files
> - virtualx wrapped for testing
> 
> Fixes: https://bugs.gentoo.org/690468
> 
> Signed-off-by: Haelwenn (lanodan) Monnier 
> ---
>  eclass/gstreamer-meson.eclass | 320 ++
>  1 file changed, 320 insertions(+)
>  create mode 100644 eclass/gstreamer-meson.eclass
> 
> diff --git a/eclass/gstreamer-meson.eclass b/eclass/gstreamer-meson.eclass
> new file mode 100644
> index 000..14a825f76b5
> --- /dev/null
> +++ b/eclass/gstreamer-meson.eclass
> @@ -0,0 +1,320 @@
> +# Copyright 1999-2021 Gentoo Authors
> +# Distributed under the terms of the GNU General Public License v2
> +
> +# @ECLASS: gstreamer-meson.eclass
> +# @MAINTAINER:
> +# gstrea...@gentoo.org
> +# @AUTHOR:

I think the list actually goes the other way around, i.e. you should add
yourself on top.

> +# Michał Górny 
> +# Gilles Dartiguelongue 
> +# Saleem Abdulrasool 
> +# foser 
> +# zaheerm 
> +# Steven Newbury
> +# Haelwenn (lanodan) Monnier 
> +# @SUPPORTED_EAPIS: 7
> +# @BLURB: Helps building core & split gstreamer plugins.

No full stop here, it's not a proper sentence.

> +# @DESCRIPTION:
> +# Eclass to make external gst-plugins emergable on a per-plugin basis
> +# and to solve the problem with gst-plugins generating far too much
> +# unneeded dependencies.
> +#
> +# GStreamer consuming applications should depend on the specific plugins
> +# they need as defined in their source code. Usually you can find that
> +# out by grepping the source tree for 'factory_make'. If it uses playbin
> +# plugin, consider adding media-plugins/gst-plugins-meta dependency, but
> +# also list any packages that provide explicitly requested plugins.
> +
> +inherit multilib virtualx meson toolchain-funcs xdg-utils multilib-minimal

I'm pretty sure you can sort them a bit.

> +
> +case "${EAPI:-0}" in
> + 7)
> + ;;
> + *)
> + die "EAPI=\"${EAPI}\" is not supported"
> + ;;
> +esac
> +
> +# @ECLASS-VARIABLE: GST_PLUGINS_ENABLED
> +# @DESCRIPTION:
> +# Defines the plugins to be built.
> +# May be set by an ebuild and contain more than one indentifier, space
> +# seperated (only src_configure can handle mutiple plugins at this time).
> +: ${GST_PLUGINS_ENABLED:=${PN/gst-plugins-/}}
> +
> +# @ECLASS-VARIABLE: GST_PLUGINS_DISABLED
> +# @DESCRIPTION:
> +# Defines the plugins to not be built, GST_PLUGINS_ENABLED overrides it.
> +# May be set by an ebuild and contain more than one indentifier, space
> +# seperated (only src_configure can handle mutiple plugins at this time).
> +case "${GST_ORG_MODULE}" in
> + # copied GST_PLUGINS_DISABLED from media-libs/${GST_ORG_MODULE} then 
> added GST_PLUGINS_ENABLED
> + gst-plugins-bad)
> + # removed from list: shm ipcpipeline gl
> + GST_PLUGINS_DISABLED="aom avtp androidmedia applemedia 
> assrender bluez bs2b bz2 chromaprint closedcaption colormanagement curl 
> curl-ssh2 d3dvideosink d3d11 dash dc1394 decklink directfb directsound dtls 
> dts dvb faac faad fbdev fdkaac flite fluidsynth gme gsm iqa kate kms ladspa 
> libde265 libmms lv2 mediafoundation microdns modplug mpeg2enc mplex msdk 
> musepack neon nvcodec ofa openal openexr openh264 openjpeg openmpt openni2 
> opensles opus resindvd rsvg rtmp sbc sctp smoothstreaming sndfile soundtouch 
> spandsp srt srtp svthevcenc teletext tinyalsa transcode ttml uvch264 va 
> voaacenc voamrwbenc vulkan wasapi wasapi2 webp webrtc webrtcdsp wildmidi 
> winks winscreencap x265 zbar zxing wpe magicleap v4l2codecs hls opencv"
> + GST_PLUGINS_DISABLED="${GST_PLUGINS_DISABLED} accurip adpcmdec 
> adpcmenc aiff asfmux audiobuffersplit audiofxbad audiolatency audiomixmatrix 
> audiovisualizers autoconvert bayer camerabin2 coloreffects deb ugutils 
> dvbsubenc dvbsuboverlay dvdspu faceoverlay festival fieldanalysis freeverb 
> frei0r gaudieffects gdp geometrictransform id3tag inter interlace ivfpars e 
> ivtc jp2kdecimator jpegformat librfb midi mpegdemux 

[gentoo-dev] [PATCH v2] gstreamer-meson.eclass: New eclass required for gstreamer-1.18.0+

2021-03-23 Thread Haelwenn (lanodan) Monnier
Gstreamer switched to meson in 1.16.0 and removed autotools support in 1.18.0,
this eclass is an update of gstreamer.eclass.

One significant change between autotools and meson is that in the latter we
don't have easily extractable semantics in the buildsystem to get a list
of plugins with extraneous dependencies that we currently split in other
packages.
Hence the rather ugly but currently required GST_PLUGINS_DISABLED block.
The gstreamer_system_link function also got lost in translation.

Differences from version 1:
- Move to EAPI-7, including moving deps from DEPEND to BDEPEND when appropriate
- Port python script to perl, this allows to avoid having to add PYTHON_COMPAT
  into a python-unrelated eclass
- Drop errorneous MULTILIB_USEDEP on virtual/pkgconfig
- Fix running tests: defining multilib_src_test, media-libs/gstreamer[test] dep
- Fix ebuild emesonargs being ignored
- Remove legacy prune_libtool_files
- virtualx wrapped for testing

Fixes: https://bugs.gentoo.org/690468

Signed-off-by: Haelwenn (lanodan) Monnier 
---
 eclass/gstreamer-meson.eclass | 320 ++
 1 file changed, 320 insertions(+)
 create mode 100644 eclass/gstreamer-meson.eclass

diff --git a/eclass/gstreamer-meson.eclass b/eclass/gstreamer-meson.eclass
new file mode 100644
index 000..14a825f76b5
--- /dev/null
+++ b/eclass/gstreamer-meson.eclass
@@ -0,0 +1,320 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: gstreamer-meson.eclass
+# @MAINTAINER:
+# gstrea...@gentoo.org
+# @AUTHOR:
+# Michał Górny 
+# Gilles Dartiguelongue 
+# Saleem Abdulrasool 
+# foser 
+# zaheerm 
+# Steven Newbury
+# Haelwenn (lanodan) Monnier 
+# @SUPPORTED_EAPIS: 7
+# @BLURB: Helps building core & split gstreamer plugins.
+# @DESCRIPTION:
+# Eclass to make external gst-plugins emergable on a per-plugin basis
+# and to solve the problem with gst-plugins generating far too much
+# unneeded dependencies.
+#
+# GStreamer consuming applications should depend on the specific plugins
+# they need as defined in their source code. Usually you can find that
+# out by grepping the source tree for 'factory_make'. If it uses playbin
+# plugin, consider adding media-plugins/gst-plugins-meta dependency, but
+# also list any packages that provide explicitly requested plugins.
+
+inherit multilib virtualx meson toolchain-funcs xdg-utils multilib-minimal
+
+case "${EAPI:-0}" in
+   7)
+   ;;
+   *)
+   die "EAPI=\"${EAPI}\" is not supported"
+   ;;
+esac
+
+# @ECLASS-VARIABLE: GST_PLUGINS_ENABLED
+# @DESCRIPTION:
+# Defines the plugins to be built.
+# May be set by an ebuild and contain more than one indentifier, space
+# seperated (only src_configure can handle mutiple plugins at this time).
+: ${GST_PLUGINS_ENABLED:=${PN/gst-plugins-/}}
+
+# @ECLASS-VARIABLE: GST_PLUGINS_DISABLED
+# @DESCRIPTION:
+# Defines the plugins to not be built, GST_PLUGINS_ENABLED overrides it.
+# May be set by an ebuild and contain more than one indentifier, space
+# seperated (only src_configure can handle mutiple plugins at this time).
+case "${GST_ORG_MODULE}" in
+   # copied GST_PLUGINS_DISABLED from media-libs/${GST_ORG_MODULE} then 
added GST_PLUGINS_ENABLED
+   gst-plugins-bad)
+   # removed from list: shm ipcpipeline gl
+   GST_PLUGINS_DISABLED="aom avtp androidmedia applemedia 
assrender bluez bs2b bz2 chromaprint closedcaption colormanagement curl 
curl-ssh2 d3dvideosink d3d11 dash dc1394 decklink directfb directsound dtls dts 
dvb faac faad fbdev fdkaac flite fluidsynth gme gsm iqa kate kms ladspa 
libde265 libmms lv2 mediafoundation microdns modplug mpeg2enc mplex msdk 
musepack neon nvcodec ofa openal openexr openh264 openjpeg openmpt openni2 
opensles opus resindvd rsvg rtmp sbc sctp smoothstreaming sndfile soundtouch 
spandsp srt srtp svthevcenc teletext tinyalsa transcode ttml uvch264 va 
voaacenc voamrwbenc vulkan wasapi wasapi2 webp webrtc webrtcdsp wildmidi winks 
winscreencap x265 zbar zxing wpe magicleap v4l2codecs hls opencv"
+   GST_PLUGINS_DISABLED="${GST_PLUGINS_DISABLED} accurip adpcmdec 
adpcmenc aiff asfmux audiobuffersplit audiofxbad audiolatency audiomixmatrix 
audiovisualizers autoconvert bayer camerabin2 coloreffects deb ugutils 
dvbsubenc dvbsuboverlay dvdspu faceoverlay festival fieldanalysis freeverb 
frei0r gaudieffects gdp geometrictransform id3tag inter interlace ivfpars e 
ivtc jp2kdecimator jpegformat librfb midi mpegdemux mpegpsmux mpegtsdemux 
mpegtsmux mxf netsim onvif pcapparse pnm proxy rawparse removesilence rist 
rtmp2 rtp sdp segmentclip siren smooth speed subenc switchbin timecode 
videofilters videoframe_audiolevel videoparsers videosignal vmnc y4m"
+   ;;
+   gst-plugins-base)
+   GST_PLUGINS_DISABLED="cdparanoia libvisual opus tremor"
+   GST_PLUGINS_DISABLED="${GST_PLUGINS_DISABLED} adder app 
audioconvert