diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2022-08-30 22:59:17 +0300 |
---|---|---|
committer | Sebastian Dröge <slomo@coaxion.net> | 2022-09-03 01:00:57 +0300 |
commit | 4ac60165a83933452965d3ade3adbb6917d2f553 (patch) | |
tree | 825d4531ee16d402c26aba1988fe82efd18f1504 /dependencies.py | |
parent | ad48d5e8f2444236305b604d0b39db9e9a8f5d94 (diff) |
meson: Define gst_plugins with list of dependencies
This is needed to link gst-full with Rust plugins. The script requires
either python11 or the tomli module.
Diffstat (limited to 'dependencies.py')
-rwxr-xr-x | dependencies.py | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/dependencies.py b/dependencies.py new file mode 100755 index 000000000..85fa04cf4 --- /dev/null +++ b/dependencies.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 + +# Parse Cargo.toml files for each plugin to collect their external dependencies. +# Meson will lookup those dependencies using pkg-config to be able to link +# static Rust plugins into gst-full. + +from argparse import ArgumentParser +from pathlib import Path + +try: + # Python11 stdlib + import tomllib +except ImportError: + import tomli as tomllib + + +PARSER = ArgumentParser() +PARSER.add_argument('src_dir', type=Path) +PARSER.add_argument('plugins', nargs='*') + + +# Map plugin name to directory name, for those that does not match. +RENAMES = { + 'rsaudiofx': 'audiofx', + 'rsfile': 'file', + 'rsflv': 'flavors', + 'rstextwrap': 'wrap', + 'rsjson': 'json', + 'rsregex': 'regex', + 'rswebp': 'webp', + 'textahead': 'ahead', + 'rsonvif': 'onvif', + 'rstracers': 'tracers', + 'rsclosedcaption': 'closedcaption', + 'rsdav1d': 'dav1d', +} + + +if __name__ == "__main__": + opts = PARSER.parse_args() + + deps = set() + for p in opts.plugins: + assert p.startswith('gst') + name = p[3:] + name = RENAMES.get(name, name) + files = list(opts.src_dir.glob(f'**/{name}/Cargo.toml')) + assert len(files) == 1 + with files[0].open('rb') as f: + data = tomllib.load(f) + try: + requires = data['package']['metadata']['capi']['pkg_config']['requires_private'] + except KeyError: + continue + deps.update([i.strip() for i in requires.split(',')]) + print(','.join(deps)) |