ptp-helper: Add a feature option for the PTP support

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4410>
This commit is contained in:
Sebastian Dröge 2023-04-13 15:38:54 +03:00 committed by GStreamer Marge Bot
parent 2e84603b02
commit 6378ebbdcd
2 changed files with 102 additions and 97 deletions

View file

@ -1,20 +1,25 @@
# Check PTP support
have_ptp = true
ptp_helper_option = get_option('ptp-helper')
if ptp_helper_option.disabled()
subdir_done()
endif
if host_system not in ['linux', 'freebsd', 'openbsd', 'netbsd', 'dragonfly', 'darwin', 'sunos', 'solaris', 'illumos', 'windows']
have_ptp = false
message('PTP not supported on this OS')
if ptp_helper_option.enabled()
error('PTP not supported on this OS')
endif
subdir_done()
endif
if have_ptp
have_rust = add_languages('rust', native : false, required : false)
if not have_rust
have_ptp = false
warning('PTP not supported without Rust compiler')
if ptp_helper_option.enabled()
error('PTP not supported without Rust compiler')
endif
subdir_done()
endif
if have_ptp
rustc = meson.get_compiler('rust')
if rustc.get_id() not in ['rustc', 'clippy-driver rustc']
@ -30,12 +35,12 @@ if have_ptp
endif
if rustc.get_id() in ['rustc', 'clippy-driver rustc'] and not rustc.version().version_compare('>=' + rust_req)
have_ptp = false
warning('PTP support requires at least Rust @0@ on this platform, found @1@'.format(rust_req, rustc.version()))
if ptp_helper_option.enabled()
error('PTP support requires at least Rust @0@ on this platform, found @1@'.format(rust_req, rustc.version()))
endif
subdir_done()
endif
if have_ptp
cdata.set('HAVE_PTP', 1, description : 'PTP support available')
ptp_helper_conf_data = configuration_data()
@ -111,4 +116,3 @@ if have_ptp
endif
meson.add_devenv({'GST_PTP_HELPER': exe.full_path()})
endif

View file

@ -3,6 +3,7 @@ option('gst_parse', type : 'boolean', value : true,
description: 'Enable pipeline string parser')
option('registry', type : 'boolean', value : true)
option('tracer_hooks', type : 'boolean', value : true, description: 'Enable tracer usage')
option('ptp-helper', type: 'feature', description: 'Build gst-ptp-helper')
option('ptp-helper-setuid-user', type : 'string',
description : 'User to switch to when installing gst-ptp-helper setuid root')
option('ptp-helper-setuid-group', type : 'string',