mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
meson: prevent sandbox violation if GStreamer and wayland-protocols are subprojects
Suppose you have a project where GStreamer and wayland-protocols are pulled in as dependencies via .wrap files. In that case, Meson's setup step will fail for gst-plugins-bad with the message "Sandbox violation: Tried to grab file viewporter.xml outside current (sub)project." To avoid this exception, one should use Meson's `files` and `join_paths` functions. The suggested solution is identical to how GTK 4 processes Wayland files. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5593>
This commit is contained in:
parent
6f8b9574f2
commit
c48e96fd76
1 changed files with 35 additions and 19 deletions
|
@ -7,7 +7,7 @@ wl_scanner = find_program('wayland-scanner', required: get_option('wayland'))
|
||||||
use_wayland = wl_protocol_dep.found() and wl_client_dep.found() and wl_scanner.found() and libdrm_dep.found()
|
use_wayland = wl_protocol_dep.found() and wl_client_dep.found() and wl_scanner.found() and libdrm_dep.found()
|
||||||
|
|
||||||
if use_wayland
|
if use_wayland
|
||||||
wl_sources = [
|
wl_sources = files([
|
||||||
'gstwlbuffer.c',
|
'gstwlbuffer.c',
|
||||||
'gstwlcontext.c',
|
'gstwlcontext.c',
|
||||||
'gstwldisplay.c',
|
'gstwldisplay.c',
|
||||||
|
@ -16,9 +16,9 @@ if use_wayland
|
||||||
'gstwlvideobufferpool.c',
|
'gstwlvideobufferpool.c',
|
||||||
'gstwlvideoformat.c',
|
'gstwlvideoformat.c',
|
||||||
'gstwlwindow.c',
|
'gstwlwindow.c',
|
||||||
]
|
])
|
||||||
|
|
||||||
wl_headers = [
|
wl_headers = files([
|
||||||
'gstwl_fwd.h',
|
'gstwl_fwd.h',
|
||||||
'gstwlbuffer.h',
|
'gstwlbuffer.h',
|
||||||
'gstwlcontext.h',
|
'gstwlcontext.h',
|
||||||
|
@ -30,32 +30,48 @@ if use_wayland
|
||||||
'gstwlwindow.h',
|
'gstwlwindow.h',
|
||||||
'wayland.h',
|
'wayland.h',
|
||||||
'wayland-prelude.h',
|
'wayland-prelude.h',
|
||||||
]
|
])
|
||||||
|
|
||||||
protocols_datadir = wl_protocol_dep.get_variable('pkgdatadir')
|
protocols_datadir = wl_protocol_dep.get_variable('pkgdatadir')
|
||||||
|
|
||||||
protocol_defs = [
|
protocol_defs = [
|
||||||
['/stable/viewporter/viewporter.xml', 'viewporter-protocol.c', 'viewporter-client-protocol.h'],
|
['viewporter', 'stable', ],
|
||||||
['/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml',
|
['linux-dmabuf', 'unstable', 'v1', ],
|
||||||
'linux-dmabuf-unstable-v1-protocol.c', 'linux-dmabuf-unstable-v1-client-protocol.h'],
|
['fullscreen-shell', 'unstable', 'v1', ],
|
||||||
['/unstable/fullscreen-shell/fullscreen-shell-unstable-v1.xml',
|
['xdg-shell', 'stable', ]
|
||||||
'fullscreen-shell-unstable-v1-protocol.c', 'fullscreen-shell-unstable-v1-client-protocol.h'],
|
|
||||||
['/stable/xdg-shell/xdg-shell.xml', 'xdg-shell-protocol.c', 'xdg-shell-client-protocol.h'],
|
|
||||||
]
|
]
|
||||||
protocols_files = []
|
protocols_files = []
|
||||||
|
|
||||||
foreach protodef: protocol_defs
|
foreach protodef: protocol_defs
|
||||||
xmlfile = protocols_datadir + protodef.get(0)
|
proto_name = protodef.get(0)
|
||||||
|
proto_stability = protodef.get(1)
|
||||||
|
if proto_stability == 'stable'
|
||||||
|
output_base = proto_name
|
||||||
|
else
|
||||||
|
proto_version = protodef.get(2)
|
||||||
|
output_base = f'@proto_name@-@proto_stability@-@proto_version@'
|
||||||
|
endif
|
||||||
|
input = protocols_datadir / proto_stability / proto_name / f'@output_base@.xml'
|
||||||
|
|
||||||
protocols_files += [custom_target(protodef.get(1),
|
protocols_files += [custom_target(f'@output_base@ client header',
|
||||||
output : protodef.get(1),
|
input: input,
|
||||||
input : xmlfile,
|
output: f'@output_base@-client-protocol.h',
|
||||||
command : [wl_scanner, 'code', '@INPUT@', '@OUTPUT@'])]
|
command: [
|
||||||
|
wl_scanner,
|
||||||
|
'client-header',
|
||||||
|
'@INPUT@', '@OUTPUT@',
|
||||||
|
],
|
||||||
|
)]
|
||||||
|
|
||||||
protocols_files += [custom_target(protodef.get(2),
|
protocols_files += [custom_target(f'@output_base@ source',
|
||||||
output : protodef.get(2),
|
input: input,
|
||||||
input : xmlfile,
|
output: f'@output_base@-protocol.c',
|
||||||
command : [wl_scanner, 'client-header', '@INPUT@', '@OUTPUT@'])]
|
command: [
|
||||||
|
wl_scanner,
|
||||||
|
'code',
|
||||||
|
'@INPUT@', '@OUTPUT@',
|
||||||
|
],
|
||||||
|
)]
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
extra_c_args = [
|
extra_c_args = [
|
||||||
|
|
Loading…
Reference in a new issue