From 2e6bd1ca8d4e09fa7c5f5c8a39ce110d6e9f290c Mon Sep 17 00:00:00 2001 From: Philippe Normand Date: Sat, 2 Nov 2019 16:27:16 +0100 Subject: [PATCH] gst-env: Fix the gst plugin file path regex for Linux platforms On Linux, the library file is stored in the platform triplet directory under the lib directory (hence for example lib/x86_64-linux-gnu/gstreamer-1.0/libgstfoo.so) so the regex needs to take this into account. With this change the LD_LIBRARY_PATH on Linux now contains only the directories with gst libs, ignoring the plugins, as initially intended in c6613d8da2191aaf2bd7d1ddd4130a289b02e1ba. Fixes #56 --- gst-env.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/gst-env.py b/gst-env.py index c5e2fc8..d368a21 100755 --- a/gst-env.py +++ b/gst-env.py @@ -30,8 +30,11 @@ if not os.path.exists(DEFAULT_BUILDDIR): TYPELIB_REG = re.compile(r'.*\.typelib$') SHAREDLIB_REG = re.compile(r'\.so|\.dylib|\.dll') -GSTPLUGIN_FILEPATH_REG = re.compile(r'.*/lib[^/]*/gstreamer-1.0/[^/]+$') +# libdir is expanded from option of the same name listed in the `meson +# introspect --buildoptions` output. +GSTPLUGIN_FILEPATH_REG_TEMPLATE = r'.*/{libdir}/gstreamer-1.0/[^/]+$' +GSTPLUGIN_FILEPATH_REG = None def listify(o): if isinstance(o, str): @@ -84,6 +87,10 @@ def is_library_target_and_not_plugin(target, filename): # None of the installed files in the target correspond to the built # filename, so skip return False + + global GSTPLUGIN_FILEPATH_REG + if GSTPLUGIN_FILEPATH_REG is None: + GSTPLUGIN_FILEPATH_REG = re.compile(GSTPLUGIN_FILEPATH_REG_TEMPLATE) if GSTPLUGIN_FILEPATH_REG.search(install_filename.replace('\\', '/')): return False return True @@ -194,6 +201,15 @@ def get_subprocess_env(options, gst_version): paths = set() mono_paths = set() srcdir_path = pathlib.Path(options.srcdir) + + build_options_s = subprocess.check_output(meson + ['introspect', options.builddir, '--buildoptions']) + build_options = json.loads(build_options_s.decode()) + libdir, = [o['value'] for o in build_options if o['name'] == 'libdir'] + libdir = libdir.replace('\\', '/') + + global GSTPLUGIN_FILEPATH_REG_TEMPLATE + GSTPLUGIN_FILEPATH_REG_TEMPLATE = GSTPLUGIN_FILEPATH_REG_TEMPLATE.format(libdir=libdir) + for target in targets: filenames = listify(target['filename']) for filename in filenames: -- 2.7.4