From 042de8118b91c8750fa41b97c8567431b8b8b499 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Mon, 5 Sep 2016 17:55:42 -0300 Subject: [PATCH] meson: Properly find where other GStreamer plugins are when using subprojects --- tests/check/getpluginsdir | 25 +++++++++++++++++++++++++ tests/check/meson.build | 12 ++++++------ 2 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 tests/check/getpluginsdir diff --git a/tests/check/getpluginsdir b/tests/check/getpluginsdir new file mode 100644 index 0000000000..102e3c8230 --- /dev/null +++ b/tests/check/getpluginsdir @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 + +import os +import sys +import subprocess + +builddir = os.environ['MESON_BUILD_ROOT'] + +res = '' +args = sys.argv[1:] +for i in range(0, len(args), 2): + project = args[i] + pkg_name = args[i + 1] + path = os.path.join(builddir, 'subprojects', project) + if os.path.exists(path): + res += ':' + path + else: + try: + res += ':' + subprocess.check_output(['pkg-config', + '--variable=pluginsdir', + pkg_name]).decode() + except subprocess.CalledProcessError: + exit(1) + +print(res.strip(":")) diff --git a/tests/check/meson.build b/tests/check/meson.build index f79916b960..797f9757d1 100644 --- a/tests/check/meson.build +++ b/tests/check/meson.build @@ -32,13 +32,13 @@ test_defines = [ '-DGST_USE_UNSTABLE_API', ] -runcmd = run_command('pkg-config', '--variable=pluginsdir', 'gstreamer-1.0', - 'gstreamer-plugins-base-1.0', 'gstreamer-plugins-bad-1.0') +getpluginsdir = find_program('getpluginsdir') +runcmd = run_command(getpluginsdir, 'gstreamer', 'gstreamer-' + apiversion, + 'gst-plugins-base', 'gstreamer-plugins-base-' + apiversion, + 'gst-plugins-bad', 'gstreamer-plugins-bad-' + apiversion) if runcmd.returncode() == 0 - needed_plugins_dirs = meson.build_root() + 'plugins/nle' - foreach path: runcmd.stdout().strip().split(' ') - needed_plugins_dirs = needed_plugins_dirs + ':' + path - endforeach + needed_plugins_dirs = runcmd.stdout().strip() + ':' + meson.build_root() + '/plugins/nle' + message('Using GStreamer plug-ins in ' + needed_plugins_dirs) else error('Could not determine GStreamer core plugins directory for unit tests.') endif