Generate the GST_PLUGIN_PATH using the plugins variable in subprojects

To build the documentation, we are maintaining a 'standardise' `plugins`
variable accross all modules to list all plugins and generate
documentation for them.

This is also used to get the right plugin path when inspecting plugins
for the documentation.
This commit is contained in:
Thibault Saunier 2018-11-11 20:06:04 -03:00
parent 3d24de2f24
commit fbb81c6c78
3 changed files with 33 additions and 15 deletions

View file

@ -81,7 +81,6 @@ def get_subprocess_env(options, gst_version):
sharedlib_reg = re.compile(r'\.so|\.dylib|\.dll') sharedlib_reg = re.compile(r'\.so|\.dylib|\.dll')
typelib_reg = re.compile(r'.*\.typelib$') typelib_reg = re.compile(r'.*\.typelib$')
pluginpath_reg = re.compile(r'lib.*' + re.escape(os.path.normpath('/gstreamer-1.0/')))
if os.name is 'nt': if os.name is 'nt':
lib_path_envvar = 'PATH' lib_path_envvar = 'PATH'
@ -133,16 +132,16 @@ def get_subprocess_env(options, gst_version):
elif sharedlib_reg.search(filename): elif sharedlib_reg.search(filename):
if not target['type'].startswith('shared'): if not target['type'].startswith('shared'):
continue continue
if target['installed']:
if pluginpath_reg.search(os.path.normpath(stringify(target['install_filename']))):
prepend_env_var(env, "GST_PLUGIN_PATH", os.path.join(options.builddir, root))
continue
prepend_env_var(env, lib_path_envvar, prepend_env_var(env, lib_path_envvar,
os.path.join(options.builddir, root)) os.path.join(options.builddir, root))
elif target['type'] == 'executable' and target['installed']: elif target['type'] == 'executable' and target['installed']:
paths.add(os.path.join(options.builddir, root)) paths.add(os.path.join(options.builddir, root))
with open(os.path.join(options.builddir, 'GstPluginsPath.json')) as f:
for plugin_path in json.load(f):
prepend_env_var(env, 'GST_PLUGIN_PATH', plugin_path)
for p in paths: for p in paths:
prepend_env_var(env, 'PATH', p) prepend_env_var(env, 'PATH', p)

View file

@ -80,17 +80,13 @@ foreach sp : subprojects
subproj = subproject(project_name, required: is_required) subproj = subproject(project_name, required: is_required)
endif endif
if subproj.found() if subproj.found() and build_infos.has_key('build-hotdoc', default: false)
if build_infos.has_key('build-hotdoc', default: false)
foreach plugin: subproj.get_variable('plugins') foreach plugin: subproj.get_variable('plugins')
all_plugins += plugin.full_path() all_plugins += plugin.full_path()
endforeach endforeach
if documented_projects != '' if documented_projects != ''
documented_projects += ',' documented_projects += ','
endif endif
documented_projects += project_name
endif
documented_projects += project_name documented_projects += project_name
subprojects_names += [project_name] subprojects_names += [project_name]
@ -123,6 +119,10 @@ else
endif endif
endif endif
cmdres = run_command(python3, find_program('scripts/generate_plugins_path.py'), '--builddir',
meson.build_root(), all_plugins)
assert(cmdres.returncode() == 0, 'Could not create plugins path: @0@'.format(cmdres.stderr()))
message('Building subprojects: ' + ', '.join(subprojects_names)) message('Building subprojects: ' + ', '.join(subprojects_names))
setenv = find_program('gst-uninstalled.py') setenv = find_program('gst-uninstalled.py')
run_target('uninstalled', command : [setenv, '--builddir=@0@'.format(meson.build_root()), run_target('uninstalled', command : [setenv, '--builddir=@0@'.format(meson.build_root()),

View file

@ -0,0 +1,19 @@
#!/usr/bin/env python3
import argparse
import os
import json
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--builddir", help="The meson build directory")
parser.add_argument(dest="plugins", help="The list of plugins", nargs="+")
options = parser.parse_args()
all_paths = set()
for plugin in options.plugins:
all_paths.add(os.path.dirname(plugin))
with open(os.path.join(options.builddir, 'GstPluginsPath.json'), "w") as f:
json.dump(list(all_paths), f, indent=4, sort_keys=True)