diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.com> | 2020-11-26 18:12:42 +0300 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.com> | 2021-01-04 14:26:45 +0300 |
commit | dfdbd370f9708bccfaec71589d12da77ea0b43c7 (patch) | |
tree | d4ca594c7d41b661744976e7a45552fd64e4b2f9 | |
parent | 8bc2e5ebb872612140a986897a78b37d3e52f78e (diff) |
meson: use cargo-c
We now have to run 'cbuild' and 'ctest' on each plugin individually.
Replace plugins_rep key by the source path so we can easily discard the
excluded plugins.
-rw-r--r-- | cargo_wrapper.py | 36 | ||||
-rw-r--r-- | meson.build | 48 |
2 files changed, 45 insertions, 39 deletions
diff --git a/cargo_wrapper.py b/cargo_wrapper.py index 23c0dabc0..4a7d79b46 100644 --- a/cargo_wrapper.py +++ b/cargo_wrapper.py @@ -7,6 +7,8 @@ import shutil import subprocess import sys +PLUGIN_DIRS = ['audio', 'generic', 'net', 'text', 'utils', 'video'] + command, meson_build_dir, meson_current_source_dir, meson_build_root, target, exclude, extra_env = sys.argv[ 1:8] @@ -33,30 +35,34 @@ if command == 'build': except IndexError: ext2 = None - cargo_cmd = ['cargo', 'build', '--all-targets', - '--manifest-path', os.path.join( - meson_current_source_dir, 'Cargo.toml'), - '--workspace'] + # Build with the 'static' feature enforcing the minimal gst version required for static builds + cargo_cmd = ['cargo', 'cbuild', '--features', 'static'] if target == 'release': cargo_cmd.append('--release') elif command == 'test': # cargo test - cargo_cmd = ['cargo', 'test', '--no-fail-fast', '--color=always', '--manifest-path', - os.path.join(meson_current_source_dir, 'Cargo.toml'), - '--workspace'] + cargo_cmd = ['cargo', 'ctest', '--no-fail-fast', '--color=always'] else: print("Unknown command:", command) sys.exit(1) -if len(exclude) > 0: - for e in exclude.split(','): - cargo_cmd.append('--exclude') - cargo_cmd.append(e) -try: - subprocess.run(cargo_cmd, env=env, check=True) -except subprocess.SubprocessError: - sys.exit(1) +def run(cargo_cmd, env): + try: + subprocess.run(cargo_cmd, env=env, check=True) + except subprocess.SubprocessError: + sys.exit(1) + + +for d in PLUGIN_DIRS: + for name in os.listdir(os.path.join(meson_current_source_dir, d)): + if '{}/{}'.format(d, name) in exclude: + continue + + cargo_toml = os.path.join( + meson_current_source_dir, d, name, 'Cargo.toml') + cmd = cargo_cmd + ['--manifest-path', cargo_toml] + run(cmd, env) if command == 'build': # Copy so files to build dir diff --git a/meson.build b/meson.build index 36f104a36..006a29f50 100644 --- a/meson.build +++ b/meson.build @@ -26,43 +26,43 @@ else endif plugins_rep = { - 'gst-plugin-audiofx': 'libgstrsaudiofx', - 'gst-plugin-cdg': 'libgstcdg', - 'gst-plugin-claxon': 'libgstclaxon', - 'gst-plugin-closedcaption': 'libgstrsclosedcaption', - 'gst-plugin-fallbackswitch': 'libgstfallbackswitch', - 'gst-plugin-file': 'libgstrsfile', - 'gst-plugin-flv': 'libgstrsflv', - 'gst-plugin-gif': 'libgstgif', - 'gst-plugin-lewton': 'libgstlewton', - 'gst-plugin-rav1e': 'libgstrav1e', - 'gst-plugin-reqwest': 'libgstreqwest', - 'gst-plugin-rspng': 'libgstrspng', - 'gst-plugin-rusoto': 'libgstrusoto', - 'gst-plugin-textwrap': 'libgstrstextwrap', - 'gst-plugin-threadshare': 'libgstthreadshare', - 'gst-plugin-togglerecord': 'libgsttogglerecord', - 'gst-plugin-hsv': 'libgsthsv', + 'audio/audiofx': 'libgstrsaudiofx', + 'video/cdg': 'libgstcdg', + 'audio/claxon': 'libgstclaxon', + 'video/closedcaption': 'libgstrsclosedcaption', + 'utils/fallbackswitch': 'libgstfallbackswitch', + 'generic/file': 'libgstrsfile', + 'video/flavors': 'libgstrsflv', + 'video/gif': 'libgstgif', + 'audio/lewton': 'libgstlewton', + 'video/rav1e': 'libgstrav1e', + 'net/reqwest': 'libgstreqwest', + 'video/rspng': 'libgstrspng', + 'net/rusoto': 'libgstrusoto', + 'text/wrap': 'libgstrstextwrap', + 'generic/threadshare': 'libgstthreadshare', + 'utils/togglerecord': 'libgsttogglerecord', + 'video/hsv': 'libgsthsv', } exclude = [] extra_env = {} if dependency('dav1d', required : get_option('dav1d')).found() - plugins_rep += {'gst-plugin-dav1d' : 'libgstrsdav1d'} + plugins_rep += {'video/dav1d' : 'libgstrsdav1d'} else - exclude += ['gst-plugin-dav1d'] + exclude += ['video/dav1d'] endif sodium = get_option ('sodium') if sodium == 'system' dependency('libsodium') - plugins_rep += {'gst-plugin-sodium': 'libgstsodium'} + plugins_rep += {'generic/sodium': 'libgstsodium'} extra_env += {'SODIUM_USE_PKG_CONFIG': '1'} elif sodium == 'built-in' - plugins_rep += {'gst-plugin-sodium': 'libgstsodium'} + plugins_rep += {'generic/sodium': 'libgstsodium'} else - exclude += ['gst-plugin-sodium'] + exclude += ['generic/sodium'] endif cc = meson.get_compiler('c') @@ -82,9 +82,9 @@ if not csound_option.disabled() endif if csound_dep.found() - plugins_rep += {'gst-plugin-csound' : 'libgstcsound'} + plugins_rep += {'audio/csound' : 'libgstcsound'} else - exclude += ['gst-plugin-csound'] + exclude += ['audio/csound'] endif output = [] |