2019-11-19 08:56:01 +00:00
|
|
|
project('gst-plugins-rs',
|
|
|
|
'rust',
|
2020-01-10 01:52:31 +00:00
|
|
|
'c',
|
2022-10-24 14:50:58 +00:00
|
|
|
version: '0.9.0',
|
2022-08-25 22:30:08 +00:00
|
|
|
meson_version : '>= 0.60')
|
2019-11-19 08:56:01 +00:00
|
|
|
|
2022-09-01 19:15:46 +00:00
|
|
|
python = import('python').find_installation()
|
2022-08-30 19:59:17 +00:00
|
|
|
fs = import('fs')
|
2022-09-01 19:15:46 +00:00
|
|
|
|
2019-11-19 08:56:01 +00:00
|
|
|
if get_option('debug')
|
|
|
|
target = 'debug'
|
|
|
|
else
|
|
|
|
target = 'release'
|
|
|
|
endif
|
|
|
|
|
2020-02-25 12:44:46 +00:00
|
|
|
cargo = find_program('cargo', version:'>=1.40')
|
2020-01-02 16:07:47 +00:00
|
|
|
cargo_wrapper = find_program('cargo_wrapper.py')
|
2021-11-09 21:14:20 +00:00
|
|
|
cargo_c = find_program('cargo-cbuild', version:'>=0.9.3', required: false)
|
2021-05-14 10:40:31 +00:00
|
|
|
rustc = find_program('rustc', version:'>=1.52')
|
2021-01-04 14:19:23 +00:00
|
|
|
|
|
|
|
if not cargo_c.found()
|
|
|
|
error('cargo-c missing, install it with: \'cargo install cargo-c\'')
|
|
|
|
endif
|
2019-11-19 08:56:01 +00:00
|
|
|
|
|
|
|
system = build_machine.system()
|
2022-10-20 17:10:43 +00:00
|
|
|
ext_exe = ''
|
2019-11-19 08:56:01 +00:00
|
|
|
if system == 'windows'
|
2022-10-20 17:10:43 +00:00
|
|
|
ext_exe = 'exe'
|
2020-11-16 14:23:51 +00:00
|
|
|
ext_dynamic = 'dll'
|
|
|
|
ext_static = 'lib'
|
2019-11-19 08:56:01 +00:00
|
|
|
elif system == 'darwin'
|
2020-11-16 14:23:51 +00:00
|
|
|
ext_dynamic = 'dylib'
|
|
|
|
ext_static = 'a'
|
2019-11-19 08:56:01 +00:00
|
|
|
else
|
2020-11-16 14:23:51 +00:00
|
|
|
ext_dynamic = 'so'
|
|
|
|
ext_static = 'a'
|
2019-11-19 08:56:01 +00:00
|
|
|
endif
|
|
|
|
|
2021-09-22 06:57:42 +00:00
|
|
|
# workspace name -> lib name
|
2022-10-23 08:51:02 +00:00
|
|
|
# kept in the same order as the `members` list in Cargo.toml
|
2021-09-22 06:57:42 +00:00
|
|
|
plugins = {
|
|
|
|
'gst-plugin-audiofx': 'libgstrsaudiofx',
|
|
|
|
'gst-plugin-claxon': 'libgstclaxon',
|
2022-10-23 08:51:02 +00:00
|
|
|
# csound has an external dependency, see below
|
2021-09-22 06:57:42 +00:00
|
|
|
'gst-plugin-lewton': 'libgstlewton',
|
2022-10-23 08:51:02 +00:00
|
|
|
'gst-plugin-spotify': 'libgstspotify',
|
|
|
|
|
|
|
|
'gst-plugin-file': 'libgstrsfile',
|
|
|
|
# sodium has an external dependency, see below
|
|
|
|
'gst-plugin-threadshare': 'libgstthreadshare',
|
|
|
|
|
2022-10-23 15:23:45 +00:00
|
|
|
'gst-plugin-fmp4': 'libgstfmp4',
|
|
|
|
|
2022-10-23 08:51:02 +00:00
|
|
|
'gst-plugin-aws': 'libgstaws',
|
|
|
|
'gst-plugin-hlssink3': 'libgsthlssink3',
|
|
|
|
'gst-plugin-ndi': 'libgstndi',
|
|
|
|
'gst-plugin-onvif': 'libgstrsonvif',
|
2022-02-27 10:30:09 +00:00
|
|
|
'gst-plugin-raptorq': 'libgstraptorq',
|
2021-09-22 06:57:42 +00:00
|
|
|
'gst-plugin-reqwest': 'libgstreqwest',
|
2022-10-23 08:55:25 +00:00
|
|
|
'gst-plugin-rtp': 'libgstrsrtp',
|
2022-10-23 08:51:02 +00:00
|
|
|
'gst-plugin-webrtchttp': 'libgstwebrtchttp',
|
|
|
|
'gst-plugin-webrtc': 'libgstrswebrtc',
|
|
|
|
|
|
|
|
'gst-plugin-textahead': 'libgsttextahead',
|
2022-10-23 09:13:23 +00:00
|
|
|
'gst-plugin-json': 'libgstjson',
|
|
|
|
'gst-plugin-regex': 'libgstregex',
|
|
|
|
'gst-plugin-textwrap': 'libgsttextwrap',
|
2022-10-23 08:51:02 +00:00
|
|
|
|
|
|
|
'gst-plugin-fallbackswitch': 'libgstfallbackswitch',
|
2021-09-22 06:57:42 +00:00
|
|
|
'gst-plugin-togglerecord': 'libgsttogglerecord',
|
2022-10-23 08:51:02 +00:00
|
|
|
'gst-plugin-tracers': 'libgstrstracers',
|
|
|
|
'gst-plugin-uriplaylistbin': 'libgsturiplaylistbin',
|
|
|
|
|
|
|
|
'gst-plugin-cdg': 'libgstcdg',
|
|
|
|
# closedcaption has an external dependency, see below
|
|
|
|
# dav1d has an external dependency, see below
|
|
|
|
'gst-plugin-ffv1': 'libgstffv1',
|
|
|
|
'gst-plugin-flavors': 'libgstrsflv',
|
|
|
|
'gst-plugin-gif': 'libgstgif',
|
|
|
|
# gtk4 has an external dependency, see below
|
2021-09-22 06:57:42 +00:00
|
|
|
'gst-plugin-hsv': 'libgsthsv',
|
2022-10-23 09:13:23 +00:00
|
|
|
'gst-plugin-png': 'libgstrspng',
|
2022-10-23 08:51:02 +00:00
|
|
|
'gst-plugin-rav1e': 'libgstrav1e',
|
|
|
|
# videofx has an external dependency, see below
|
|
|
|
|
2021-03-16 22:43:55 +00:00
|
|
|
# FIXME: libwebp-sys2 will build its bundled version on msvc and apple platforms
|
|
|
|
# https://github.com/qnighy/libwebp-sys2-rs/issues/4
|
2021-09-22 06:57:42 +00:00
|
|
|
'gst-plugin-webp': 'libgstrswebp',
|
2019-11-19 08:56:01 +00:00
|
|
|
}
|
|
|
|
|
2020-01-17 04:53:43 +00:00
|
|
|
extra_env = {}
|
2020-01-02 04:07:55 +00:00
|
|
|
|
2022-10-15 23:33:30 +00:00
|
|
|
if dependency('cairo-gobject', required : get_option('videofx')).found()
|
2022-10-23 09:13:23 +00:00
|
|
|
plugins += {'gst-plugin-videofx': 'libgstrsvideofx',}
|
2022-10-15 23:33:30 +00:00
|
|
|
endif
|
|
|
|
|
2021-08-15 11:59:58 +00:00
|
|
|
if dependency('pangocairo', required : get_option('closedcaption')).found()
|
2021-09-22 06:57:42 +00:00
|
|
|
plugins += {'gst-plugin-closedcaption' : 'libgstrsclosedcaption',}
|
2021-08-15 11:59:58 +00:00
|
|
|
endif
|
|
|
|
|
2022-09-19 20:04:05 +00:00
|
|
|
if dependency('dav1d', version : '>= 1.0.0', required : get_option('dav1d')).found()
|
2022-10-23 09:13:23 +00:00
|
|
|
plugins += {'gst-plugin-dav1d' : 'libgstdav1d'}
|
2020-01-02 04:07:55 +00:00
|
|
|
endif
|
|
|
|
|
2020-01-17 04:53:43 +00:00
|
|
|
sodium = get_option ('sodium')
|
|
|
|
if sodium == 'system'
|
|
|
|
dependency('libsodium')
|
2021-09-22 06:57:42 +00:00
|
|
|
plugins += {'gst-plugin-sodium': 'libgstsodium'}
|
2020-01-17 04:53:43 +00:00
|
|
|
extra_env += {'SODIUM_USE_PKG_CONFIG': '1'}
|
|
|
|
elif sodium == 'built-in'
|
2021-09-22 06:57:42 +00:00
|
|
|
plugins += {'gst-plugin-sodium': 'libgstsodium'}
|
2020-01-17 04:53:43 +00:00
|
|
|
endif
|
|
|
|
|
2020-01-10 01:52:31 +00:00
|
|
|
cc = meson.get_compiler('c')
|
|
|
|
csound_option = get_option('csound')
|
2021-05-26 09:07:27 +00:00
|
|
|
# try first to find csound using pkg-config
|
|
|
|
csound_dep = dependency('', required: false)
|
|
|
|
if not csound_dep.found() and not csound_option.disabled()
|
|
|
|
# if csound isn't distributed with pkg-config then user needs to define CSOUND_LIB_DIR with its location
|
2022-09-01 19:15:46 +00:00
|
|
|
|
2022-10-22 15:34:59 +00:00
|
|
|
res = run_command(python, '-c', 'import os; print(os.environ["CSOUND_LIB_DIR"])', check: false)
|
2021-05-26 09:07:27 +00:00
|
|
|
if res.returncode() == 0
|
|
|
|
csound_libdir = res.stdout().strip()
|
|
|
|
csound_dep = cc.find_library('csound64', dirs: csound_libdir, required: false)
|
|
|
|
if csound_dep.found()
|
|
|
|
extra_env += {'CSOUND_LIB_DIR': csound_libdir}
|
2020-01-10 01:52:31 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2020-04-23 20:05:57 +00:00
|
|
|
if csound_dep.found()
|
2021-09-22 06:57:42 +00:00
|
|
|
plugins += {'gst-plugin-csound' : 'libgstcsound'}
|
2021-05-26 09:07:27 +00:00
|
|
|
elif csound_option.enabled()
|
|
|
|
error('csound option is enabled, but csound64 library could not be found and CSOUND_LIB_DIR was not set')
|
2020-01-10 01:52:31 +00:00
|
|
|
else
|
2021-05-26 09:07:27 +00:00
|
|
|
message('csound not found, disabling its plugin')
|
2020-01-10 01:52:31 +00:00
|
|
|
endif
|
|
|
|
|
2021-04-09 12:38:02 +00:00
|
|
|
if dependency('gtk4', required : get_option('gtk4')).found()
|
2021-09-22 06:57:42 +00:00
|
|
|
plugins += {'gst-plugin-gtk4' : 'libgstgtk4',}
|
2021-04-09 12:38:02 +00:00
|
|
|
endif
|
|
|
|
|
2019-11-19 08:56:01 +00:00
|
|
|
output = []
|
|
|
|
|
2020-11-16 14:23:51 +00:00
|
|
|
extensions = []
|
|
|
|
|
|
|
|
# Add the plugin file as output
|
|
|
|
if get_option('default_library') == 'shared' or get_option('default_library') == 'both'
|
|
|
|
extensions += [ext_dynamic]
|
2021-09-22 06:57:42 +00:00
|
|
|
foreach p, lib : plugins
|
2020-11-16 14:23:51 +00:00
|
|
|
output += [lib + '.' + ext_dynamic]
|
|
|
|
endforeach
|
|
|
|
endif
|
|
|
|
|
2022-08-25 22:30:08 +00:00
|
|
|
static_build = get_option('default_library') == 'static'
|
|
|
|
if static_build or get_option('default_library') == 'both'
|
2020-11-16 14:23:51 +00:00
|
|
|
extensions += [ext_static]
|
2021-09-22 06:57:42 +00:00
|
|
|
foreach p, lib : plugins
|
2020-11-16 14:23:51 +00:00
|
|
|
output += [lib + '.' + ext_static]
|
|
|
|
endforeach
|
|
|
|
endif
|
2019-11-19 08:56:01 +00:00
|
|
|
|
2019-12-23 05:51:55 +00:00
|
|
|
# Need to depends on all gstreamer-rs deps to ensure they are built
|
|
|
|
# before gstreamer-rs when building with gst-build.
|
|
|
|
# Custom targets can't depend on dependency() objects so we have to depend
|
|
|
|
# on the library variable from the subproject instead.
|
2022-07-19 06:02:47 +00:00
|
|
|
gst_req = '>= 1.18.0'
|
2019-12-23 05:51:55 +00:00
|
|
|
depends = []
|
|
|
|
|
|
|
|
deps = [
|
|
|
|
# name, subproject name, subproject dep, library object
|
|
|
|
['gstreamer-1.0', 'gstreamer', 'gst_dep', 'libgst'],
|
|
|
|
['gstreamer-app-1.0', 'gst-plugins-base', 'app_dep', 'gstapp'],
|
|
|
|
['gstreamer-audio-1.0', 'gst-plugins-base', 'audio_dep', 'gstaudio'],
|
|
|
|
['gstreamer-base-1.0', 'gstreamer', 'gst_base_dep', 'gst_base'],
|
|
|
|
['gstreamer-check-1.0', 'gstreamer', 'gst_check_dep', 'gst_check'],
|
|
|
|
['gstreamer-net-1.0', 'gstreamer', 'gst_net_dep', 'gst_net'],
|
|
|
|
['gstreamer-rtp-1.0', 'gst-plugins-base', 'rtp_dep', 'gst_rtp'],
|
|
|
|
['gstreamer-video-1.0', 'gst-plugins-base', 'video_dep', 'gstvideo'],
|
2022-09-03 08:21:03 +00:00
|
|
|
['gstreamer-sdp-1.0', 'gst-plugins-base', 'sdp_dep', 'gstsdp'],
|
|
|
|
['gstreamer-webrtc-1.0', 'gst-plugins-bad', 'gstwebrtc_dep', 'gstwebrtc'],
|
2019-12-23 05:51:55 +00:00
|
|
|
]
|
|
|
|
|
2022-08-30 19:59:17 +00:00
|
|
|
# Used to not lookup the same dependency multiple times which clutters logs
|
|
|
|
deps_cache = {}
|
|
|
|
|
2019-12-23 05:51:55 +00:00
|
|
|
foreach d: deps
|
|
|
|
dep = dependency(d[0], version : gst_req,
|
|
|
|
fallback : [d[1], d[2]])
|
2022-08-25 22:30:08 +00:00
|
|
|
set_variable(d[2], dep)
|
2022-08-30 19:59:17 +00:00
|
|
|
deps_cache += {d[0]: dep}
|
2019-12-23 05:51:55 +00:00
|
|
|
if dep.type_name() == 'internal'
|
|
|
|
lib = subproject(d[1]).get_variable(d[3])
|
|
|
|
depends += lib
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
2021-09-22 06:57:42 +00:00
|
|
|
include = ','.join(plugins.keys())
|
2020-01-07 08:36:39 +00:00
|
|
|
|
2020-01-17 04:53:43 +00:00
|
|
|
# serialize extra_env
|
|
|
|
extra_env_list = []
|
|
|
|
foreach key, value : extra_env
|
|
|
|
extra_env_list += key + ':' + value
|
|
|
|
endforeach
|
|
|
|
extra_env_str = ','.join(extra_env_list)
|
|
|
|
|
2020-07-29 13:41:30 +00:00
|
|
|
plugins_install_dir = get_option('libdir') / 'gstreamer-1.0'
|
2020-11-26 15:50:04 +00:00
|
|
|
pkgconfig_install_dir = get_option('libdir') / 'pkgconfig'
|
2020-07-29 13:41:30 +00:00
|
|
|
|
2022-08-25 22:30:08 +00:00
|
|
|
if get_option('doc').disabled()
|
|
|
|
disable_doc = ['--disable-doc']
|
|
|
|
else
|
|
|
|
disable_doc = []
|
|
|
|
endif
|
2022-01-11 18:36:41 +00:00
|
|
|
|
2019-11-19 08:56:01 +00:00
|
|
|
rs_plugins = custom_target('gst-plugins-rs',
|
|
|
|
build_by_default: true,
|
|
|
|
output: output,
|
|
|
|
console: true,
|
2020-07-29 13:41:30 +00:00
|
|
|
install: true,
|
|
|
|
install_dir: plugins_install_dir,
|
2019-12-23 05:51:55 +00:00
|
|
|
depends: depends,
|
2022-04-20 13:45:12 +00:00
|
|
|
depfile: 'gst-plugins-rs.dep',
|
2020-01-02 16:07:47 +00:00
|
|
|
command: [cargo_wrapper,
|
2020-01-07 06:10:12 +00:00
|
|
|
'build',
|
2019-11-19 08:56:01 +00:00
|
|
|
meson.current_build_dir(),
|
|
|
|
meson.current_source_dir(),
|
2022-09-02 14:15:15 +00:00
|
|
|
meson.global_build_root(),
|
2019-11-19 08:56:01 +00:00
|
|
|
target,
|
2021-09-22 06:57:42 +00:00
|
|
|
include,
|
2020-01-17 04:53:43 +00:00
|
|
|
extra_env_str,
|
2020-11-26 15:50:04 +00:00
|
|
|
get_option('prefix'),
|
|
|
|
get_option('libdir'),
|
2022-04-20 13:45:12 +00:00
|
|
|
'--depfile', '@DEPFILE@',
|
|
|
|
'--exts', extensions,
|
2022-08-25 22:30:08 +00:00
|
|
|
] + disable_doc)
|
2019-11-19 08:56:01 +00:00
|
|
|
|
2020-11-17 08:22:03 +00:00
|
|
|
plugins = rs_plugins.to_list()
|
2020-01-07 08:36:39 +00:00
|
|
|
|
2022-08-30 19:59:17 +00:00
|
|
|
# This is used by GStreamer to static link Rust plugins into gst-full
|
|
|
|
gst_plugins = []
|
|
|
|
pc_files = []
|
2022-10-20 14:00:37 +00:00
|
|
|
plugin_names = []
|
2022-08-30 19:59:17 +00:00
|
|
|
foreach plugin : plugins
|
|
|
|
# skip the 'lib' prefix and extension from plugin path
|
|
|
|
plugin_name = fs.stem(plugin.full_path()).substring(3)
|
|
|
|
|
|
|
|
# Extract plugin dependencies from their Cargo.toml file
|
|
|
|
plugin_deps = []
|
|
|
|
p = run_command('dependencies.py', meson.current_source_dir(), plugin_name,
|
|
|
|
capture: true,
|
|
|
|
check: true)
|
|
|
|
foreach dep_name : p.stdout().strip().split(',')
|
2022-08-16 14:44:41 +00:00
|
|
|
dep_name_version = dep_name.split('|')
|
|
|
|
dep_name = dep_name_version.get(0)
|
|
|
|
if dep_name_version.length() > 1
|
|
|
|
extras = {'version': dep_name_version.get(1)}
|
|
|
|
else
|
|
|
|
extras = {}
|
|
|
|
endif
|
2022-08-30 19:59:17 +00:00
|
|
|
if deps_cache.has_key(dep_name)
|
|
|
|
plugin_deps += deps_cache[dep_name]
|
|
|
|
else
|
2022-08-16 14:44:41 +00:00
|
|
|
dep = dependency(dep_name, required: false, kwargs: extras)
|
2022-08-30 19:59:17 +00:00
|
|
|
plugin_deps += dep
|
|
|
|
deps_cache += {dep_name: dep}
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
|
|
|
dep = declare_dependency(
|
|
|
|
link_with: plugin,
|
|
|
|
dependencies: plugin_deps,
|
|
|
|
variables: {'full_path': plugin.full_path()},
|
|
|
|
)
|
|
|
|
meson.override_dependency(plugin_name, dep)
|
2022-09-02 14:10:26 +00:00
|
|
|
|
|
|
|
if static_build and plugin_name in ['gstcsound', 'gstthreadshare']
|
|
|
|
warning('Static plugin @0@ is known to fail. It will not be included in libgstreamer-full.'.format(plugin_name))
|
|
|
|
else
|
|
|
|
gst_plugins += dep
|
|
|
|
endif
|
|
|
|
|
2022-08-30 19:59:17 +00:00
|
|
|
pc_files += [plugin_name + '.pc']
|
2022-10-20 14:00:37 +00:00
|
|
|
if plugin_name.startswith('gst')
|
|
|
|
plugin_names += [plugin_name.substring(3)]
|
|
|
|
else
|
|
|
|
plugin_names += [plugin_name]
|
|
|
|
endif
|
2022-08-30 19:59:17 +00:00
|
|
|
endforeach
|
|
|
|
|
2022-08-25 22:30:08 +00:00
|
|
|
subdir('docs')
|
|
|
|
|
2020-11-26 15:50:04 +00:00
|
|
|
# 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', '""'])
|
|
|
|
|
2022-10-20 17:10:43 +00:00
|
|
|
|
|
|
|
custom_target('gst-webrtc-signalling-server',
|
|
|
|
build_by_default: true,
|
|
|
|
output: 'gst-webrtc-signalling-server',
|
|
|
|
console: true,
|
|
|
|
install: true,
|
|
|
|
install_dir: get_option('bindir'),
|
|
|
|
depfile: 'gst-webrtc-signalling-server.dep',
|
|
|
|
command: [cargo_wrapper,
|
|
|
|
'build',
|
|
|
|
meson.current_build_dir(),
|
|
|
|
meson.current_source_dir(),
|
|
|
|
meson.global_build_root(),
|
|
|
|
target,
|
|
|
|
'',
|
|
|
|
'',
|
|
|
|
get_option('prefix'),
|
|
|
|
get_option('libdir'),
|
|
|
|
'--depfile', '@DEPFILE@',
|
|
|
|
'--exts', ext_exe,
|
|
|
|
'--bin', 'gst-webrtc-signalling-server'
|
|
|
|
])
|
|
|
|
|
2020-01-07 08:36:39 +00:00
|
|
|
test('tests',
|
|
|
|
cargo_wrapper,
|
|
|
|
args: ['test',
|
|
|
|
meson.current_build_dir(),
|
|
|
|
meson.current_source_dir(),
|
2022-08-25 22:30:08 +00:00
|
|
|
meson.global_build_root(),
|
2020-01-07 08:36:39 +00:00
|
|
|
target,
|
2021-09-22 06:57:42 +00:00
|
|
|
include,
|
2020-11-26 15:50:04 +00:00
|
|
|
extra_env_str,
|
|
|
|
get_option('prefix'),
|
|
|
|
get_option('libdir')],
|
2020-01-07 08:36:39 +00:00
|
|
|
timeout: 600)
|
2022-10-20 14:00:37 +00:00
|
|
|
|
|
|
|
summary({
|
|
|
|
'Plugins': plugin_names,
|
|
|
|
}, list_sep: ', ')
|