commit:     7ec8ec4a6a650b1de58b59d2d8de34794a6b46c0
Author:     Igor V. Kovalenko <igor.v.kovalenko <AT> gmail <DOT> com>
AuthorDate: Sat Jul  3 17:55:52 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jul 10 17:28:27 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7ec8ec4a

gstreamer-meson.eclass: Add plugin dependency override helpers

Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 eclass/gstreamer-meson.eclass | 50 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/eclass/gstreamer-meson.eclass b/eclass/gstreamer-meson.eclass
index f1962073fd2..421227f412f 100644
--- a/eclass/gstreamer-meson.eclass
+++ b/eclass/gstreamer-meson.eclass
@@ -79,6 +79,56 @@ gstreamer_get_plugins() {
        )
 }
 
+# @FUNCTION: gstreamer_system_package
+# @USAGE: <gstaudio_dep:gstreamer-audio> [...]
+# @DESCRIPTION:
+# Walks through meson.build in order to make sure build will link against 
system
+# libraries.
+# Takes a list of path fragments and corresponding pkgconfig libraries
+# separated by colon (:). Will replace the path fragment by the output of
+# pkgconfig.
+gstreamer_system_package() {
+       local pdir directory libs pkgconfig pc tuple
+       pkgconfig=$(tc-getPKG_CONFIG)
+
+       for plugin_dir in ${GST_PLUGINS_BUILD_DIR} ; do
+               pdir=$(gstreamer_get_plugin_dir ${plugin_dir})
+
+               for tuple in $@ ; do
+                       dependency=${tuple%:*}
+                       pc=${tuple#*:}-${SLOT}
+                       #libs="$(${pkgconfig} --libs-only-l ${pc} || die)"
+                       sed -e "1i${dependency} = dependency('${pc}', required 
: true)" \
+                               -i "${pdir}"/meson.build || die
+               done
+       done
+}
+
+# @FUNCTION: gstreamer_system_library
+# @USAGE: <gstbasecamerabin_dep:libgstbasecamerabinsrc> [...]
+# @DESCRIPTION:
+# Walks through meson.build in order to make sure build will link against 
system
+# libraries.
+# Takes a list of path fragments and corresponding pkgconfig libraries
+# separated by colon (:). Will replace the path fragment by the output of
+# pkgconfig.
+gstreamer_system_library() {
+       local pdir directory libs pkgconfig pc tuple
+       pkgconfig=$(tc-getPKG_CONFIG)
+
+       for plugin_dir in ${GST_PLUGINS_BUILD_DIR} ; do
+               pdir=$(gstreamer_get_plugin_dir ${plugin_dir})
+
+               for tuple in $@ ; do
+                       dependency=${tuple%:*}
+                       pc=${tuple#*:}-${SLOT}
+                       #libs="$(${pkgconfig} --libs-only-l ${pc} || die)"
+                       sed -e "1i${dependency} = cc.find_library('${pc}', 
required : true)" \
+                               -i "${pdir}"/meson.build || die
+               done
+       done
+}
+
 # @ECLASS-VARIABLE: GST_PLUGINS_BUILD_DIR
 # @DESCRIPTION:
 # Actual build directories of the plugins.

Reply via email to