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
c6613d8da2.

Fixes #56
This commit is contained in:
Philippe Normand 2019-11-02 16:27:16 +01:00
parent aded9c617f
commit 2e6bd1ca8d

View file

@ -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: