meson: build all workspaces all together

It's now possible thanks to cargo-c 0.9.3. Should reduce build time of
all plugins.

Fix #165
This commit is contained in:
Guillaume Desmottes 2021-09-22 08:57:42 +02:00 committed by Sebastian Dröge
parent 97f45a0f77
commit acce0ab4fc
2 changed files with 39 additions and 53 deletions

View file

@ -9,8 +9,9 @@ import sys
PLUGIN_DIRS = ['audio', 'generic', 'net', 'text', 'utils', 'video'] PLUGIN_DIRS = ['audio', 'generic', 'net', 'text', 'utils', 'video']
command, meson_build_dir, meson_current_source_dir, meson_build_root, target, exclude, extra_env, prefix, libdir = sys.argv[ command, meson_build_dir, meson_current_source_dir, meson_build_root, target, include, extra_env, prefix, libdir = sys.argv[
1:10] 1:10]
include = include.split(',')
cargo_target_dir = os.path.join(meson_build_dir, 'target') cargo_target_dir = os.path.join(meson_build_dir, 'target')
@ -57,15 +58,9 @@ def run(cargo_cmd, env):
sys.exit(1) sys.exit(1)
for d in PLUGIN_DIRS: for p in include:
for name in os.listdir(os.path.join(meson_current_source_dir, d)): cargo_cmd.extend(['-p', p])
if '{}/{}'.format(d, name) in exclude: run(cargo_cmd, env)
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': if command == 'build':
target_dir = os.path.join(cargo_target_dir, '**', target) target_dir = os.path.join(cargo_target_dir, '**', target)

View file

@ -31,55 +31,49 @@ else
ext_static = 'a' ext_static = 'a'
endif endif
plugins_rep = { # workspace name -> lib name
'audio/audiofx': 'libgstrsaudiofx', plugins = {
'video/cdg': 'libgstcdg', 'gst-plugin-audiofx': 'libgstrsaudiofx',
'audio/claxon': 'libgstclaxon', 'gst-plugin-cdg': 'libgstcdg',
'utils/fallbackswitch': 'libgstfallbackswitch', 'gst-plugin-claxon': 'libgstclaxon',
'video/ffv1': 'libgstffv1', 'gst-plugin-fallbackswitch': 'libgstfallbackswitch',
'generic/file': 'libgstrsfile', 'gst-plugin-ffv1': 'libgstffv1',
'video/flavors': 'libgstrsflv', 'gst-plugin-file': 'libgstrsfile',
'video/gif': 'libgstgif', 'gst-plugin-flavors': 'libgstrsflv',
'audio/lewton': 'libgstlewton', 'gst-plugin-gif': 'libgstgif',
'video/rav1e': 'libgstrav1e', 'gst-plugin-lewton': 'libgstlewton',
'net/reqwest': 'libgstreqwest', 'gst-plugin-rav1e': 'libgstrav1e',
'video/rspng': 'libgstrspng', 'gst-plugin-reqwest': 'libgstreqwest',
'net/rusoto': 'libgstrusoto', 'gst-plugin-rspng': 'libgstrspng',
'text/wrap': 'libgstrstextwrap', 'gst-plugin-rusoto': 'libgstrusoto',
'generic/threadshare': 'libgstthreadshare', 'gst-plugin-textwrap': 'libgstrstextwrap',
'utils/togglerecord': 'libgsttogglerecord', 'gst-plugin-threadshare': 'libgstthreadshare',
'video/hsv': 'libgsthsv', 'gst-plugin-togglerecord': 'libgsttogglerecord',
'text/json': 'libgstrsjson', 'gst-plugin-hsv': 'libgsthsv',
'text/regex': 'libgstrsregex', 'gst-plugin-json': 'libgstrsjson',
'gst-plugin-regex': 'libgstrsregex',
# FIXME: libwebp-sys2 will build its bundled version on msvc and apple platforms # FIXME: libwebp-sys2 will build its bundled version on msvc and apple platforms
# https://github.com/qnighy/libwebp-sys2-rs/issues/4 # https://github.com/qnighy/libwebp-sys2-rs/issues/4
'video/webp': 'libgstrswebp', 'gst-plugin-webp': 'libgstrswebp',
} }
exclude = []
extra_env = {} extra_env = {}
if dependency('pangocairo', required : get_option('closedcaption')).found() if dependency('pangocairo', required : get_option('closedcaption')).found()
plugins_rep += {'video/closedcaption' : 'libgstrsclosedcaption',} plugins += {'gst-plugin-closedcaption' : 'libgstrsclosedcaption',}
else
exclude += ['video/closedcaption']
endif endif
if dependency('dav1d', required : get_option('dav1d')).found() if dependency('dav1d', required : get_option('dav1d')).found()
plugins_rep += {'video/dav1d' : 'libgstrsdav1d'} plugins += {'gst-plugin-dav1d' : 'libgstrsdav1d'}
else
exclude += ['video/dav1d']
endif endif
sodium = get_option ('sodium') sodium = get_option ('sodium')
if sodium == 'system' if sodium == 'system'
dependency('libsodium') dependency('libsodium')
plugins_rep += {'generic/sodium': 'libgstsodium'} plugins += {'gst-plugin-sodium': 'libgstsodium'}
extra_env += {'SODIUM_USE_PKG_CONFIG': '1'} extra_env += {'SODIUM_USE_PKG_CONFIG': '1'}
elif sodium == 'built-in' elif sodium == 'built-in'
plugins_rep += {'generic/sodium': 'libgstsodium'} plugins += {'gst-plugin-sodium': 'libgstsodium'}
else
exclude += ['generic/sodium']
endif endif
cc = meson.get_compiler('c') cc = meson.get_compiler('c')
@ -100,18 +94,15 @@ if not csound_dep.found() and not csound_option.disabled()
endif endif
if csound_dep.found() if csound_dep.found()
plugins_rep += {'audio/csound' : 'libgstcsound'} plugins += {'gst-plugin-csound' : 'libgstcsound'}
elif csound_option.enabled() elif csound_option.enabled()
error('csound option is enabled, but csound64 library could not be found and CSOUND_LIB_DIR was not set') error('csound option is enabled, but csound64 library could not be found and CSOUND_LIB_DIR was not set')
else else
message('csound not found, disabling its plugin') message('csound not found, disabling its plugin')
exclude += ['audio/csound']
endif endif
if dependency('gtk4', required : get_option('gtk4')).found() if dependency('gtk4', required : get_option('gtk4')).found()
plugins_rep += {'video/gtk4' : 'libgstgtk4',} plugins += {'gst-plugin-gtk4' : 'libgstgtk4',}
else
exclude += ['video/gtk4']
endif endif
output = [] output = []
@ -121,20 +112,20 @@ extensions = []
# Add the plugin file as output # Add the plugin file as output
if get_option('default_library') == 'shared' or get_option('default_library') == 'both' if get_option('default_library') == 'shared' or get_option('default_library') == 'both'
extensions += [ext_dynamic] extensions += [ext_dynamic]
foreach p, lib : plugins_rep foreach p, lib : plugins
output += [lib + '.' + ext_dynamic] output += [lib + '.' + ext_dynamic]
endforeach endforeach
endif endif
if get_option('default_library') == 'static' or get_option('default_library') == 'both' if get_option('default_library') == 'static' or get_option('default_library') == 'both'
extensions += [ext_static] extensions += [ext_static]
foreach p, lib : plugins_rep foreach p, lib : plugins
output += [lib + '.' + ext_static] output += [lib + '.' + ext_static]
endforeach endforeach
endif endif
pc_files = [] pc_files = []
foreach p, lib : plugins_rep foreach p, lib : plugins
# skip the 'lib' prefix in plugin name # skip the 'lib' prefix in plugin name
pc_files += [lib.substring(3) + '.pc'] pc_files += [lib.substring(3) + '.pc']
endforeach endforeach
@ -167,7 +158,7 @@ foreach d: deps
endif endif
endforeach endforeach
exclude = ','.join(exclude) include = ','.join(plugins.keys())
# serialize extra_env # serialize extra_env
extra_env_list = [] extra_env_list = []
@ -194,7 +185,7 @@ rs_plugins = custom_target('gst-plugins-rs',
meson.current_source_dir(), meson.current_source_dir(),
meson.build_root(), meson.build_root(),
target, target,
exclude, include,
extra_env_str, extra_env_str,
get_option('prefix'), get_option('prefix'),
get_option('libdir'), get_option('libdir'),
@ -222,7 +213,7 @@ test('tests',
meson.current_source_dir(), meson.current_source_dir(),
meson.build_root(), meson.build_root(),
target, target,
exclude, include,
extra_env_str, extra_env_str,
get_option('prefix'), get_option('prefix'),
get_option('libdir')], get_option('libdir')],