2019-11-19 08:56:01 +00:00
|
|
|
project('gst-plugins-rs',
|
|
|
|
'rust',
|
2020-01-10 01:52:31 +00:00
|
|
|
'c',
|
2024-08-20 18:48:21 +00:00
|
|
|
version: '0.12.9',
|
2023-10-18 12:37:35 +00:00
|
|
|
meson_version : '>= 1.1')
|
2019-11-19 08:56:01 +00:00
|
|
|
|
2022-12-27 15:49:53 +00:00
|
|
|
# dependencies.py needs a toml parsing module
|
|
|
|
python = import('python').find_installation(modules: ['tomllib'], required: false)
|
|
|
|
if not python.found()
|
|
|
|
python = import('python').find_installation(modules: ['tomli'])
|
|
|
|
endif
|
2022-08-30 19:59:17 +00:00
|
|
|
fs = import('fs')
|
2022-12-19 11:01:10 +00:00
|
|
|
host_system = host_machine.system()
|
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')
|
2023-08-14 08:07:57 +00:00
|
|
|
cargo_c = find_program('cargo-cbuild', version:'>=0.9.21', required: false)
|
2023-04-21 14:50:22 +00:00
|
|
|
|
|
|
|
rustc = meson.get_compiler('rust')
|
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
|
|
|
|
2023-04-21 14:50:22 +00:00
|
|
|
system = host_machine.system()
|
2022-12-27 18:25:16 +00:00
|
|
|
exe_suffix = ''
|
2019-11-19 08:56:01 +00:00
|
|
|
if system == 'windows'
|
2022-12-27 18:25:16 +00:00
|
|
|
exe_suffix = '.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
|
|
|
|
|
2022-12-28 22:20:34 +00:00
|
|
|
# Extra env to pass to cargo
|
|
|
|
extra_env = {}
|
|
|
|
|
|
|
|
# Used to not lookup the same dependency multiple times which clutters logs
|
|
|
|
deps_cache = {}
|
|
|
|
|
|
|
|
# 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.
|
|
|
|
glib_req = '>=2.62'
|
|
|
|
gst_req = '>=1.20.0'
|
|
|
|
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'],
|
2024-01-24 10:06:11 +00:00
|
|
|
['gstreamer-video-1.0', 'gst-plugins-base', 'video_dep', 'gstvideo'],
|
2022-12-28 22:20:34 +00:00
|
|
|
]
|
|
|
|
|
2023-10-18 09:03:22 +00:00
|
|
|
webrtc_option = get_option('webrtc')
|
2024-01-10 10:10:19 +00:00
|
|
|
rtp_option = get_option('rtp').enable_if(webrtc_option.enabled(), error_message: 'webrtc option needs rtp')
|
|
|
|
|
|
|
|
rtsp_option = get_option('rtsp')
|
2023-10-18 09:03:22 +00:00
|
|
|
|
2023-08-20 17:02:24 +00:00
|
|
|
if get_option('threadshare').allowed() \
|
|
|
|
or get_option('onvif').allowed() \
|
|
|
|
or get_option('raptorq').allowed() \
|
2023-10-18 09:03:22 +00:00
|
|
|
or rtp_option.allowed() \
|
|
|
|
or webrtc_option.allowed()
|
2023-08-20 17:02:24 +00:00
|
|
|
deps += [['gstreamer-rtp-1.0', 'gst-plugins-base', 'rtp_dep', 'gst_rtp']]
|
|
|
|
endif
|
|
|
|
if get_option('webrtc').allowed() \
|
|
|
|
or get_option('webrtchttp').allowed()
|
|
|
|
deps += [['gstreamer-webrtc-1.0', 'gst-plugins-bad', 'gstwebrtc_dep', 'gstwebrtc']]
|
|
|
|
deps += [['gstreamer-sdp-1.0', 'gst-plugins-base', 'sdp_dep', 'gstsdp']]
|
|
|
|
endif
|
|
|
|
if get_option('tests').allowed()
|
|
|
|
deps += [['gstreamer-check-1.0', 'gstreamer', 'gst_check_dep', 'gst_check']]
|
|
|
|
endif
|
|
|
|
if get_option('gtk4').allowed()
|
2024-06-06 09:43:10 +00:00
|
|
|
deps += [['gstreamer-gl-1.0', 'gst-plugins-base', 'gstgl_dep', 'gstgl', get_option('gtk4')]]
|
2023-08-20 17:02:24 +00:00
|
|
|
endif
|
2024-01-10 10:10:19 +00:00
|
|
|
if get_option('threadshare').allowed() or get_option('rtsp').allowed()
|
2023-08-20 17:02:24 +00:00
|
|
|
deps += [['gstreamer-net-1.0', 'gstreamer', 'gst_net_dep', 'gst_net']]
|
|
|
|
endif
|
|
|
|
|
2022-12-28 22:20:34 +00:00
|
|
|
glib_dep = dependency('glib-2.0', version: glib_req)
|
|
|
|
deps_cache += {'glib-2.0': glib_dep}
|
|
|
|
|
|
|
|
foreach d: deps
|
|
|
|
dep = dependency(d[0], version: gst_req,
|
2024-06-06 09:21:11 +00:00
|
|
|
fallback : [d[1], d[2]], required: d.get(4, true))
|
2022-12-28 22:20:34 +00:00
|
|
|
set_variable(d[2], dep)
|
|
|
|
deps_cache += {d[0]: dep}
|
|
|
|
if dep.type_name() == 'internal'
|
|
|
|
lib = subproject(d[1]).get_variable(d[3])
|
|
|
|
depends += lib
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
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 = {
|
2022-12-27 18:25:16 +00:00
|
|
|
'audiofx': {
|
|
|
|
'library': 'libgstrsaudiofx',
|
2022-12-27 18:27:11 +00:00
|
|
|
'examples': ['hrtfrender'],
|
2022-12-27 18:25:16 +00:00
|
|
|
},
|
|
|
|
'claxon': {'library': 'libgstclaxon'},
|
|
|
|
# csound has a non-trivial external dependency, see below
|
|
|
|
'lewton': {'library': 'libgstlewton'},
|
|
|
|
'spotify': {'library': 'libgstspotify'},
|
|
|
|
|
|
|
|
'file': {'library': 'libgstrsfile'},
|
|
|
|
# sodium can have an external dependency, see below
|
|
|
|
'threadshare': {
|
|
|
|
'library': 'libgstthreadshare',
|
2022-12-27 18:27:11 +00:00
|
|
|
'examples': [
|
|
|
|
'ts-benchmark',
|
|
|
|
'udpsrc-benchmark-sender',
|
|
|
|
'tcpclientsrc-benchmark-sender',
|
|
|
|
'ts-standalone',
|
|
|
|
],
|
2022-12-27 18:25:16 +00:00
|
|
|
},
|
2023-06-21 17:55:27 +00:00
|
|
|
'inter': {'library': 'libgstrsinter'},
|
2022-12-27 18:25:16 +00:00
|
|
|
|
|
|
|
'mp4': {'library': 'libgstmp4'},
|
|
|
|
'fmp4': {
|
|
|
|
'library': 'libgstfmp4',
|
2022-12-27 18:27:11 +00:00
|
|
|
'examples': [
|
|
|
|
'dash_vod',
|
|
|
|
'hls_live',
|
|
|
|
'hls_vod',
|
|
|
|
],
|
2022-12-27 18:25:16 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
'aws': {
|
|
|
|
'library': 'libgstaws',
|
2024-02-05 18:57:20 +00:00
|
|
|
'extra-deps': {'openssl': ['>=1.1']},
|
2022-12-27 18:25:16 +00:00
|
|
|
},
|
|
|
|
'hlssink3': {'library': 'libgsthlssink3'},
|
|
|
|
'ndi': {'library': 'libgstndi'},
|
|
|
|
'onvif': {
|
|
|
|
'library': 'libgstrsonvif',
|
2024-02-05 18:57:20 +00:00
|
|
|
'extra-deps': {'pangocairo': []},
|
2022-12-27 18:25:16 +00:00
|
|
|
},
|
|
|
|
'raptorq': {'library': 'libgstraptorq'},
|
|
|
|
'reqwest': {'library': 'libgstreqwest'},
|
2024-01-10 10:10:19 +00:00
|
|
|
'rtsp': {'library': 'libgstrsrtsp'},
|
2022-12-27 18:25:16 +00:00
|
|
|
'rtp': {'library': 'libgstrsrtp'},
|
|
|
|
'webrtchttp': {'library': 'libgstwebrtchttp'},
|
|
|
|
'webrtc': {
|
|
|
|
'library': 'libgstrswebrtc',
|
2022-12-27 18:27:11 +00:00
|
|
|
'examples': ['webrtcsink-stats-server'],
|
2022-12-27 18:25:16 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
'textahead': {'library': 'libgsttextahead'},
|
|
|
|
'json': {'library': 'libgstjson'},
|
|
|
|
'regex': {'library': 'libgstregex'},
|
|
|
|
'textwrap': {'library': 'libgsttextwrap'},
|
|
|
|
|
|
|
|
'tracers': {'library': 'libgstrstracers'},
|
|
|
|
'uriplaylistbin': {
|
|
|
|
'library': 'libgsturiplaylistbin',
|
2022-12-27 18:27:11 +00:00
|
|
|
'examples': ['playlist'],
|
|
|
|
'features': ['clap'],
|
2022-12-27 18:25:16 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
'cdg': {'library': 'libgstcdg'},
|
|
|
|
'closedcaption': {
|
|
|
|
'library': 'libgstrsclosedcaption',
|
|
|
|
'extra-deps': {
|
2024-02-05 18:57:20 +00:00
|
|
|
'pango': [],
|
|
|
|
'pangocairo': [],
|
|
|
|
'cairo-gobject': [],
|
2022-12-27 18:25:16 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
'dav1d': {
|
|
|
|
'library': 'libgstdav1d',
|
2024-02-05 18:59:06 +00:00
|
|
|
'extra-deps': {'dav1d': ['>=1.0', '<1.3']},
|
2022-12-27 18:25:16 +00:00
|
|
|
},
|
|
|
|
'ffv1': {'library': 'libgstffv1'},
|
|
|
|
'flavors': {'library': 'libgstrsflv'},
|
|
|
|
'gif': {
|
|
|
|
'library': 'libgstgif',
|
2022-12-27 18:27:11 +00:00
|
|
|
'examples': ['testvideosrc2gif'],
|
2022-12-27 18:25:16 +00:00
|
|
|
},
|
2022-12-28 22:20:34 +00:00
|
|
|
# gtk4 is added below
|
2022-12-27 18:25:16 +00:00
|
|
|
'hsv': {'library': 'libgsthsv'},
|
|
|
|
'png': {
|
|
|
|
'library': 'libgstrspng',
|
2022-12-27 18:27:11 +00:00
|
|
|
'examples': ['pngenc'],
|
2022-12-27 18:25:16 +00:00
|
|
|
},
|
|
|
|
'rav1e': {'library': 'libgstrav1e'},
|
|
|
|
'videofx': {
|
|
|
|
'library': 'libgstrsvideofx',
|
2024-02-05 18:57:20 +00:00
|
|
|
'extra-deps': {'cairo-gobject': []},
|
2022-12-27 18:25:16 +00:00
|
|
|
},
|
2022-12-19 11:01:35 +00:00
|
|
|
}
|
2022-10-23 08:51:02 +00:00
|
|
|
|
2022-12-19 11:01:35 +00:00
|
|
|
# Won't build on platforms where it bundles the sources because of:
|
|
|
|
# https://github.com/qnighy/libwebp-sys2-rs/issues/12
|
2022-12-27 18:25:16 +00:00
|
|
|
# the fix is:
|
2022-12-19 11:01:35 +00:00
|
|
|
# https://github.com/qnighy/libwebp-sys2-rs/pull/13
|
|
|
|
if host_system not in ['windows', 'darwin']
|
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
|
2022-12-27 18:25:16 +00:00
|
|
|
plugins += {'webp': {
|
|
|
|
'library': 'libgstrswebp',
|
2024-02-05 18:57:20 +00:00
|
|
|
'extra-deps': {'libwebpdemux': []},
|
2022-12-27 18:25:16 +00:00
|
|
|
}}
|
2022-12-19 11:01:35 +00:00
|
|
|
endif
|
2019-11-19 08:56:01 +00:00
|
|
|
|
2022-12-27 18:25:16 +00:00
|
|
|
sodium_opt = get_option('sodium')
|
|
|
|
if sodium_opt.allowed()
|
|
|
|
sodium_plugin = {'sodium': {
|
|
|
|
'library': 'libgstsodium',
|
2022-12-27 18:27:11 +00:00
|
|
|
'examples': ['generate-keys', 'encrypt-example', 'decrypt-example'],
|
|
|
|
'features': ['serde', 'serde_json', 'clap'],
|
2022-12-27 18:25:16 +00:00
|
|
|
}}
|
|
|
|
if get_option('sodium-source') == 'system'
|
|
|
|
sodium_dep = dependency('libsodium', required: sodium_opt.enabled())
|
|
|
|
extra_env += {'SODIUM_USE_PKG_CONFIG': '1'}
|
|
|
|
if sodium_dep.found()
|
|
|
|
plugins += sodium_plugin
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
plugins += sodium_plugin
|
|
|
|
endif
|
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')
|
2022-12-27 18:25:16 +00:00
|
|
|
if csound_option.allowed()
|
2021-05-26 09:07:27 +00:00
|
|
|
# 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()
|
2022-12-27 18:25:16 +00:00
|
|
|
plugins += {'csound': {
|
|
|
|
'library': 'libgstcsound',
|
2022-12-27 18:27:11 +00:00
|
|
|
'examples': ['csound-effect'],
|
2022-12-27 18:25:16 +00:00
|
|
|
}}
|
2021-05-26 09:07:27 +00:00
|
|
|
extra_env += {'CSOUND_LIB_DIR': csound_libdir}
|
2022-12-27 18:25:16 +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
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2022-12-28 22:20:34 +00:00
|
|
|
if get_option('gtk4').allowed()
|
|
|
|
gtk4_features = []
|
2024-06-06 09:43:10 +00:00
|
|
|
gl_winsys = gstgl_dep.get_variable('gl_winsys').split()
|
|
|
|
gl_platforms = gstgl_dep.get_variable('gl_platforms').split()
|
2023-04-22 12:36:06 +00:00
|
|
|
if 'wayland' in gl_winsys
|
|
|
|
gtk4_features += 'wayland'
|
|
|
|
endif
|
|
|
|
if 'x11' in gl_winsys
|
|
|
|
if 'egl' in gl_platforms
|
|
|
|
gtk4_features += 'x11egl'
|
2022-12-28 22:20:34 +00:00
|
|
|
endif
|
2023-04-22 12:36:06 +00:00
|
|
|
if 'glx' in gl_platforms
|
|
|
|
gtk4_features += 'x11glx'
|
2022-12-28 22:20:34 +00:00
|
|
|
endif
|
2022-12-23 19:23:42 +00:00
|
|
|
elif host_system == 'windows'
|
|
|
|
if 'egl' in gl_platforms
|
|
|
|
gtk4_features += 'winegl'
|
|
|
|
endif
|
2022-12-27 18:27:11 +00:00
|
|
|
endif
|
2024-04-24 13:59:11 +00:00
|
|
|
|
|
|
|
gst_allocators_dep = dependency('gstreamer-allocators-1.0', version: '>=1.24', required: false)
|
|
|
|
gtk_dep = dependency('gtk4', version: '>=4.6', required: get_option('gtk4'))
|
|
|
|
if gtk_dep.found()
|
2024-06-06 11:05:18 +00:00
|
|
|
if host_system == 'linux' and gtk_dep.version().version_compare('>=4.14') and \
|
|
|
|
gst_allocators_dep.found() and 'wayland' in gtk4_features
|
2024-04-24 13:59:11 +00:00
|
|
|
gtk4_features += 'dmabuf'
|
|
|
|
endif
|
|
|
|
|
|
|
|
if gtk_dep.version().version_compare('>=4.14')
|
|
|
|
gtk4_features += 'gtk_v4_14'
|
|
|
|
elif gtk_dep.version().version_compare('>=4.12')
|
|
|
|
gtk4_features += 'gtk_v4_12'
|
|
|
|
elif gtk_dep.version().version_compare('>=4.10')
|
|
|
|
gtk4_features += 'gtk_v4_10'
|
|
|
|
endif
|
|
|
|
|
2024-06-06 09:45:06 +00:00
|
|
|
plugins += {
|
|
|
|
'gtk4': {
|
|
|
|
'library': 'libgstgtk4',
|
|
|
|
'examples': ['gtksink'],
|
|
|
|
'extra-deps': {'gtk4': ['>=4.6']},
|
|
|
|
'features': gtk4_features,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
endif
|
2022-12-28 22:20:34 +00:00
|
|
|
endif
|
2022-12-27 18:27:11 +00:00
|
|
|
|
2024-06-06 11:10:32 +00:00
|
|
|
examples_opt = get_option('examples')
|
|
|
|
if examples_opt.allowed() and 'gtk4' in plugins
|
|
|
|
plugins += {
|
|
|
|
'fallbackswitch': {
|
|
|
|
'library': 'libgstfallbackswitch',
|
|
|
|
'examples_features': {
|
|
|
|
'gtk-fallbackswitch': ['gtk', 'gio', 'gst-plugin-gtk4'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'livesync': {
|
|
|
|
'library': 'libgstlivesync',
|
|
|
|
'examples_features': {
|
|
|
|
'gtk-livesync': ['gtk', 'gio', 'gst-plugin-gtk4'],
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'togglerecord': {
|
|
|
|
'library': 'libgsttogglerecord',
|
|
|
|
'examples_features': {
|
|
|
|
'gtk-recording': ['gtk', 'gio', 'gst-plugin-gtk4'],
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
else
|
|
|
|
plugins += {
|
|
|
|
'fallbackswitch': { 'library': 'libgstfallbackswitch'},
|
|
|
|
'livesync': { 'library': 'libgstlivesync'},
|
|
|
|
'togglerecord': { 'library': 'libgsttogglerecord'},
|
|
|
|
}
|
|
|
|
endif
|
|
|
|
|
2022-12-27 18:25:16 +00:00
|
|
|
# Process plugins list
|
|
|
|
|
|
|
|
default_library = get_option('default_library')
|
2020-01-10 01:52:31 +00:00
|
|
|
|
2022-12-27 18:25:16 +00:00
|
|
|
library_suffixes = []
|
|
|
|
if default_library in ['shared', 'both']
|
|
|
|
library_suffixes += [ext_dynamic]
|
|
|
|
endif
|
|
|
|
if default_library in ['static', 'both']
|
|
|
|
library_suffixes += [ext_static]
|
2021-04-09 12:38:02 +00:00
|
|
|
endif
|
|
|
|
|
2022-12-27 18:25:16 +00:00
|
|
|
# cargo packages (plugins) to build
|
|
|
|
packages = []
|
2022-12-27 18:27:11 +00:00
|
|
|
# cargo features
|
|
|
|
features = []
|
|
|
|
# examples to build
|
|
|
|
examples = []
|
2022-12-27 18:25:16 +00:00
|
|
|
# Add the plugin library files as output
|
2019-11-19 08:56:01 +00:00
|
|
|
output = []
|
2022-12-27 18:27:11 +00:00
|
|
|
|
2023-01-11 14:07:15 +00:00
|
|
|
if get_option('gtk4').allowed()
|
|
|
|
if glib_dep.version().version_compare('>=2.74')
|
|
|
|
features += ['glib/v2_74', 'gio/v2_74']
|
|
|
|
elif glib_dep.version().version_compare('>=2.72')
|
|
|
|
features += ['glib/v2_72', 'gio/v2_72']
|
|
|
|
elif glib_dep.version().version_compare('>=2.70')
|
|
|
|
features += ['glib/v2_70', 'gio/v2_70']
|
|
|
|
elif glib_dep.version().version_compare('>=2.68')
|
|
|
|
features += ['glib/v2_68', 'gio/v2_68']
|
|
|
|
elif glib_dep.version().version_compare('>=2.66')
|
|
|
|
features += ['glib/v2_66', 'gio/v2_66']
|
|
|
|
elif glib_dep.version().version_compare('>=2.64')
|
|
|
|
features += ['glib/v2_64', 'gio/v2_64']
|
|
|
|
elif glib_dep.version().version_compare('>=2.62')
|
|
|
|
features += ['glib/v2_62', 'gio/v2_62']
|
|
|
|
elif glib_dep.version().version_compare('>=2.60')
|
|
|
|
features += ['glib/v2_60', 'gio/v2_60']
|
|
|
|
elif glib_dep.version().version_compare('>=2.58')
|
|
|
|
features += ['glib/v2_58', 'gio/v2_58']
|
|
|
|
endif
|
2022-12-27 18:27:11 +00:00
|
|
|
endif
|
|
|
|
|
2024-01-26 17:33:16 +00:00
|
|
|
if get_option('rav1e').allowed()
|
|
|
|
nasm = find_program('nasm', required: false)
|
|
|
|
if nasm.found()
|
|
|
|
features += 'gst-plugin-rav1e/asm'
|
|
|
|
extra_env += {'NASM': nasm.full_path()}
|
|
|
|
endif
|
2022-12-27 18:27:11 +00:00
|
|
|
endif
|
2019-11-19 08:56:01 +00:00
|
|
|
|
2023-08-22 00:41:07 +00:00
|
|
|
if get_option('default_library') == 'static'
|
|
|
|
extra_env += {
|
|
|
|
# Tell the pkg-config crate to think of all libraries as static
|
|
|
|
'PKG_CONFIG_ALL_STATIC': '1',
|
|
|
|
# Tell the system-deps crate to process linker flag for static deps
|
|
|
|
'SYSTEM_DEPS_LINK': 'static'
|
|
|
|
}
|
|
|
|
endif
|
|
|
|
|
2022-12-27 18:25:16 +00:00
|
|
|
foreach plugin_name, details: plugins
|
2023-10-18 09:03:22 +00:00
|
|
|
plugin_opt = get_variable(f'@plugin_name@_option', get_option(plugin_name))
|
2024-06-06 09:22:41 +00:00
|
|
|
if not plugin_opt.allowed()
|
|
|
|
debug(f'@plugin_name@ is disabled')
|
|
|
|
continue
|
|
|
|
endif
|
|
|
|
plugin_deps_found = true
|
|
|
|
|
|
|
|
# Check whether we have all needed deps
|
|
|
|
foreach dep_name, dep_ver: details.get('extra-deps', {})
|
|
|
|
if dep_ver.length() != 0
|
|
|
|
dep = dependency(dep_name, version: dep_ver, required: plugin_opt)
|
|
|
|
else
|
|
|
|
dep = dependency(dep_name, required: plugin_opt)
|
2023-08-18 01:09:10 +00:00
|
|
|
endif
|
2024-06-06 09:22:41 +00:00
|
|
|
deps_cache += {dep_name: dep}
|
|
|
|
if not dep.found()
|
2024-06-20 09:24:11 +00:00
|
|
|
if dep_ver.length() != 0
|
|
|
|
dep_ver_msg = ' '.join(dep_ver)
|
|
|
|
debug(f'@plugin_name@ dependency @dep_name@ @dep_ver_msg@ not found, skipping')
|
|
|
|
else
|
|
|
|
debug(f'@plugin_name@ dependency @dep_name@ not found, skipping')
|
|
|
|
endif
|
2024-06-06 09:22:41 +00:00
|
|
|
plugin_deps_found = false
|
|
|
|
break
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
if not plugin_deps_found
|
|
|
|
continue
|
|
|
|
endif
|
2023-03-10 21:41:50 +00:00
|
|
|
|
2024-06-06 09:22:41 +00:00
|
|
|
# Validate gst-plugin features
|
|
|
|
plugin_features = details.get('features', [])
|
|
|
|
foreach feature: plugin_features
|
|
|
|
if feature.startswith('gst-plugin') and not packages.contains(feature)
|
|
|
|
msg = f'@plugin_name@ required feature @feature@ not found'
|
|
|
|
if plugin_opt.enabled()
|
|
|
|
error(msg)
|
2022-12-27 18:25:16 +00:00
|
|
|
endif
|
2024-06-06 09:22:41 +00:00
|
|
|
message(msg + ', skipping')
|
|
|
|
plugin_deps_found = false
|
|
|
|
break
|
2022-12-27 18:25:16 +00:00
|
|
|
endif
|
2024-06-06 09:22:41 +00:00
|
|
|
endforeach
|
|
|
|
if not plugin_deps_found
|
|
|
|
continue
|
|
|
|
endif
|
|
|
|
|
2024-06-06 11:06:47 +00:00
|
|
|
# Parse and enable examples
|
|
|
|
plugin_examples = details.get('examples', [])
|
|
|
|
foreach example: plugin_examples
|
|
|
|
examples += example
|
|
|
|
endforeach
|
|
|
|
|
2024-06-06 11:10:32 +00:00
|
|
|
plugin_examples_features = details.get('examples_features', {})
|
|
|
|
foreach example, examples_features: plugin_examples_features
|
|
|
|
example_deps_found = true
|
|
|
|
foreach feature: examples_features
|
|
|
|
if feature.startswith('gst-plugin') and not packages.contains(feature)
|
|
|
|
msg = f'@plugin_name@ example @example@ required feature @feature@ not found'
|
|
|
|
if plugin_opt.enabled() and examples_opt.enabled()
|
|
|
|
error(msg)
|
|
|
|
endif
|
|
|
|
message(msg + ', skipping')
|
|
|
|
example_deps_found = false
|
|
|
|
break
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
features += examples_features
|
|
|
|
if example_deps_found
|
|
|
|
examples += example
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
2024-06-06 09:22:41 +00:00
|
|
|
packages += f'gst-plugin-@plugin_name@'
|
|
|
|
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 != ''
|
|
|
|
features += extra_features.split(',')
|
|
|
|
endif
|
|
|
|
|
|
|
|
lib = details.get('library')
|
|
|
|
# No 'lib' suffix with MSVC
|
|
|
|
if cc.get_argument_syntax() == 'msvc'
|
|
|
|
lib = lib.substring(3)
|
|
|
|
endif
|
|
|
|
if default_library in ['shared', 'both']
|
|
|
|
output += [lib + '.' + ext_dynamic]
|
|
|
|
endif
|
|
|
|
if default_library in ['static', 'both']
|
|
|
|
output += [lib + '.' + ext_static]
|
2022-12-27 18:25:16 +00:00
|
|
|
endif
|
|
|
|
endforeach
|
2020-11-16 14:23:51 +00:00
|
|
|
|
2023-04-18 20:26:11 +00:00
|
|
|
feature_args = []
|
|
|
|
if features.length() > 0
|
|
|
|
feature_args += ['--features', features]
|
|
|
|
endif
|
2020-11-16 14:23:51 +00:00
|
|
|
|
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-12-27 18:27:11 +00:00
|
|
|
extra_args = []
|
2022-08-25 22:30:08 +00:00
|
|
|
if get_option('doc').disabled()
|
2023-04-21 14:50:22 +00:00
|
|
|
extra_args += ['--disable-doc']
|
2022-08-25 22:30:08 +00:00
|
|
|
endif
|
2022-01-11 18:36:41 +00:00
|
|
|
|
2022-12-16 23:14:50 +00:00
|
|
|
# 'pkgconfig' is the entry in the machine file, if specified
|
2024-01-26 17:32:57 +00:00
|
|
|
pkg_config = find_program('pkgconfig', 'pkg-config')
|
2022-12-16 23:14:50 +00:00
|
|
|
if pkg_config.found()
|
|
|
|
extra_env += {'PKG_CONFIG': pkg_config.full_path()}
|
|
|
|
endif
|
|
|
|
|
|
|
|
pkg_config_path = get_option('pkg_config_path')
|
|
|
|
if pkg_config_path.length() > 0
|
2022-12-19 11:01:10 +00:00
|
|
|
pathsep = ':'
|
|
|
|
if host_system == 'windows'
|
|
|
|
pathsep = ';'
|
|
|
|
endif
|
|
|
|
extra_env += {'PKG_CONFIG_PATH': pathsep.join(pkg_config_path)}
|
2022-12-16 23:14:50 +00:00
|
|
|
endif
|
|
|
|
|
2023-06-08 12:03:47 +00:00
|
|
|
# get cmdline for rust
|
|
|
|
extra_env += {'RUSTC': ' '.join(rustc.cmd_array())}
|
2023-04-21 14:50:22 +00:00
|
|
|
|
2023-08-18 01:09:10 +00:00
|
|
|
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
|
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
|
2024-01-16 13:54:39 +00:00
|
|
|
plugin_name = fs.stem(plugin.full_path())
|
|
|
|
# skip the 'lib' prefix from plugin path when not building with MSVC
|
|
|
|
if cc.get_argument_syntax() != 'msvc'
|
|
|
|
plugin_name = plugin_name.substring(3)
|
|
|
|
endif
|
2022-08-30 19:59:17 +00:00
|
|
|
|
2024-02-22 17:31:23 +00:00
|
|
|
plugin_display_name = plugin_name
|
|
|
|
if plugin_name.startswith('gst')
|
|
|
|
plugin_display_name = plugin_name.substring(3)
|
|
|
|
endif
|
|
|
|
if plugin_display_name in plugin_names
|
|
|
|
# When default_library=both plugins are duplicated.
|
|
|
|
continue
|
|
|
|
endif
|
|
|
|
plugin_names += plugin_display_name
|
|
|
|
|
2022-12-27 18:25:16 +00:00
|
|
|
option_name = plugin_name.substring(3)
|
|
|
|
if option_name.startswith('rs')
|
|
|
|
option_name = option_name.substring(2)
|
|
|
|
endif
|
|
|
|
if option_name == 'flv'
|
|
|
|
option_name = 'flavors'
|
|
|
|
endif
|
|
|
|
if not get_option(option_name).allowed()
|
|
|
|
continue
|
|
|
|
endif
|
|
|
|
|
2022-08-30 19:59:17 +00:00
|
|
|
# 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('|')
|
2022-12-27 18:25:16 +00:00
|
|
|
dep_name = dep_name_version.get(0).strip()
|
2022-08-16 14:44:41 +00:00
|
|
|
if dep_name_version.length() > 1
|
2022-12-27 18:25:16 +00:00
|
|
|
extras = {'version': dep_name_version.get(1).strip()}
|
2022-08-16 14:44:41 +00:00
|
|
|
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
|
|
|
|
2022-12-27 18:25:16 +00:00
|
|
|
if default_library == 'static' and plugin_name in ['gstcsound', 'gstthreadshare', 'gstgtk4']
|
2022-09-02 14:10:26 +00:00
|
|
|
warning('Static plugin @0@ is known to fail. It will not be included in libgstreamer-full.'.format(plugin_name))
|
|
|
|
else
|
|
|
|
gst_plugins += dep
|
2022-11-29 16:48:03 +00:00
|
|
|
pc_files += [plugin_name + '.pc']
|
2022-10-20 14:00:37 +00:00
|
|
|
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
|
2023-08-18 01:09:10 +00:00
|
|
|
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
|
2020-11-26 15:50:04 +00:00
|
|
|
|
2022-12-27 18:25:16 +00:00
|
|
|
if get_option('webrtc').allowed()
|
|
|
|
custom_target('gst-webrtc-signalling-server',
|
|
|
|
build_by_default: true,
|
2024-01-16 13:54:39 +00:00
|
|
|
output: 'gst-webrtc-signalling-server' + exe_suffix,
|
2022-12-27 18:25:16 +00:00
|
|
|
console: true,
|
|
|
|
install: true,
|
|
|
|
install_dir: get_option('bindir'),
|
|
|
|
depfile: 'gst-webrtc-signalling-server.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'),
|
|
|
|
'--depfile', '@DEPFILE@',
|
|
|
|
'--bin', 'gst-webrtc-signalling-server',
|
|
|
|
'--exe-suffix', exe_suffix,
|
|
|
|
])
|
|
|
|
endif
|
2022-10-20 17:10:43 +00:00
|
|
|
|
2022-12-27 18:27:11 +00:00
|
|
|
if get_option('examples').allowed() and examples.length() > 0
|
2024-01-16 13:54:39 +00:00
|
|
|
outputs = []
|
|
|
|
foreach example: examples
|
|
|
|
outputs += [example + exe_suffix]
|
|
|
|
endforeach
|
2022-12-27 18:27:11 +00:00
|
|
|
custom_target('gst-plugins-rs-examples',
|
|
|
|
build_by_default: true,
|
2024-01-16 13:54:39 +00:00
|
|
|
output: outputs,
|
2022-12-27 18:27:11 +00:00
|
|
|
console: true,
|
|
|
|
install: false,
|
|
|
|
depfile: 'gst-plugins-rs-examples.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'),
|
|
|
|
'--depfile', '@DEPFILE@',
|
|
|
|
'--packages', packages,
|
|
|
|
'--examples', examples,
|
|
|
|
'--exe-suffix', exe_suffix,
|
2023-04-18 20:26:11 +00:00
|
|
|
] + feature_args)
|
2022-12-27 18:27:11 +00:00
|
|
|
endif
|
|
|
|
|
2023-08-20 17:02:24 +00:00
|
|
|
if get_option('tests').allowed()
|
|
|
|
test('tests',
|
|
|
|
cargo_wrapper,
|
|
|
|
env: extra_env,
|
|
|
|
args: ['test',
|
|
|
|
meson.current_build_dir(),
|
|
|
|
meson.current_source_dir(),
|
|
|
|
meson.global_build_root(),
|
|
|
|
target,
|
|
|
|
get_option('prefix'),
|
|
|
|
get_option('libdir'),
|
|
|
|
'--packages', packages],
|
|
|
|
timeout: 600)
|
|
|
|
endif
|
2022-10-20 14:00:37 +00:00
|
|
|
|
|
|
|
summary({
|
|
|
|
'Plugins': plugin_names,
|
|
|
|
}, list_sep: ', ')
|