diff options
author | L. E. Segovia <amy@centricular.com> | 2023-08-18 04:09:10 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2023-09-20 19:23:37 +0300 |
commit | 3362d16492583a6121da3b9db014c4d68c13325c (patch) | |
tree | 967beb0955bd0fb0b49442b8773de7a082564f8d | |
parent | 8c1361efbfd752e0bfff695cd0f82b494184ab99 (diff) |
meson: Disable plugins and related outputs if features are disabled
Previously, there was no check performed on features of plugins if these
specify GStreamer plugins. This commit adds that, and ensures that the
plugins and pkg-config targets are skipped if no outputs are to be
generated (this is already done for examples).
Closes #369
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1330>
-rw-r--r-- | meson.build | 123 |
1 files changed, 70 insertions, 53 deletions
diff --git a/meson.build b/meson.build index d802e3e65..5d4a5ae10 100644 --- a/meson.build +++ b/meson.build @@ -142,21 +142,6 @@ plugins = { 'regex': {'library': 'libgstregex'}, 'textwrap': {'library': 'libgsttextwrap'}, - 'fallbackswitch': { - 'library': 'libgstfallbackswitch', - 'examples': ['gtk-fallbackswitch'], - 'features': ['gtk', 'gio', 'gst-plugin-gtk4'], - }, - 'livesync': { - 'library': 'libgstlivesync', - 'examples': ['gtk-livesync'], - 'features': ['gtk', 'gio', 'gst-plugin-gtk4'], - }, - 'togglerecord': { - 'library': 'libgsttogglerecord', - 'examples': ['gtk-recording'], - 'features': ['gtk', 'gio', 'gst-plugin-gtk4'], - }, 'tracers': {'library': 'libgstrstracers'}, 'uriplaylistbin': { 'library': 'libgsturiplaylistbin', @@ -267,12 +252,29 @@ if get_option('gtk4').allowed() gtk4_features += 'winegl' endif endif - plugins += {'gtk4': { - 'library': 'libgstgtk4', - 'examples': ['gtksink'], - 'extra-deps': {'gtk4': '>=4.6'}, - 'features': gtk4_features, - }} + plugins += { + 'gtk4': { + 'library': 'libgstgtk4', + 'examples': ['gtksink'], + 'extra-deps': {'gtk4': '>=4.6'}, + 'features': gtk4_features, + }, + 'fallbackswitch': { + 'library': 'libgstfallbackswitch', + 'examples': ['gtk-fallbackswitch'], + 'features': ['gtk', 'gio', 'gst-plugin-gtk4'], + }, + 'livesync': { + 'library': 'libgstlivesync', + 'examples': ['gtk-livesync'], + 'features': ['gtk', 'gio', 'gst-plugin-gtk4'], + }, + 'togglerecord': { + 'library': 'libgsttogglerecord', + 'examples': ['gtk-recording'], + 'features': ['gtk', 'gio', 'gst-plugin-gtk4'], + }, + } endif # Process plugins list @@ -335,11 +337,22 @@ foreach plugin_name, details: plugins deps_cache += {dep_name: dep} if not dep.found() plugin_deps_found = false + break endif endforeach + plugin_features = details.get('features', []) + if plugin_deps_found + # Validate gst-plugin features + foreach feature: features + if feature.startswith('gst-plugin') and not packages.contains(feature) + plugin_deps_found = false + break + endif + endforeach + endif if plugin_deps_found packages += f'gst-plugin-@plugin_name@' - features += details.get('features', []) + features += plugin_features extra_features = run_command('dependencies.py', meson.current_source_dir(), plugin_name, '--feature', '--gst-version', gst_dep.version(), capture: true, check: true).stdout().strip() if extra_features != '' @@ -389,29 +402,31 @@ endif # get cmdline for rust extra_env += {'RUSTC': ' '.join(rustc.cmd_array())} -rs_plugins = custom_target('gst-plugins-rs', - build_by_default: true, - output: output, - console: true, - install: true, - install_dir: plugins_install_dir, - depends: depends, - depfile: 'gst-plugins-rs.dep', - env: extra_env, - command: [cargo_wrapper, - 'build', - meson.current_build_dir(), - meson.current_source_dir(), - meson.global_build_root(), - target, - get_option('prefix'), - get_option('libdir'), - '--packages', packages, - '--depfile', '@DEPFILE@', - '--lib-suffixes', library_suffixes, - ] + feature_args + extra_args) - -plugins = rs_plugins.to_list() +plugins = [] +if output.length() > 0 + rs_plugins = custom_target('gst-plugins-rs', + build_by_default: true, + output: output, + console: true, + install: true, + install_dir: plugins_install_dir, + depends: depends, + depfile: 'gst-plugins-rs.dep', + env: extra_env, + command: [cargo_wrapper, + 'build', + meson.current_build_dir(), + meson.current_source_dir(), + meson.global_build_root(), + target, + get_option('prefix'), + get_option('libdir'), + '--packages', packages, + '--depfile', '@DEPFILE@', + '--lib-suffixes', library_suffixes, + ] + feature_args + extra_args) + plugins = rs_plugins.to_list() +endif # This is used by GStreamer to static link Rust plugins into gst-full gst_plugins = [] @@ -480,14 +495,16 @@ subdir('docs') # We don't need to pass a command as we depends on the target above # but it is currently mandatory ( https://github.com/mesonbuild/meson/issues/8059 ) # so use python as it's guaranteed to be present on any setup -custom_target('gst-plugins-rs-pc-files', - build_by_default: true, - output: pc_files, - console: true, - install: true, - install_dir: pkgconfig_install_dir, - depends: rs_plugins, - command: [python, '-c', '""']) +if pc_files.length() > 0 + custom_target('gst-plugins-rs-pc-files', + build_by_default: true, + output: pc_files, + console: true, + install: true, + install_dir: pkgconfig_install_dir, + depends: rs_plugins, + command: [python, '-c', '""']) +endif if get_option('webrtc').allowed() custom_target('gst-webrtc-signalling-server', |