| 1 |
wl_req = '>= 1.15' |
| 2 |
wl_client_dep = dependency('wayland-client', version: wl_req, required: get_option('wayland')) |
| 3 |
libdrm_dep = dependency('libdrm', version: '>= 2.4.98', required: get_option('wayland')) |
| 4 |
wl_proto_req = '>= 1.44' |
| 5 |
wl_protocol_dep = dependency('wayland-protocols', version: wl_proto_req, required: get_option('wayland')) |
| 6 |
wl_scanner = find_program('wayland-scanner', required: get_option('wayland')) |
| 7 |
# Also used in ext/wayland |
| 8 |
use_wayland = wl_protocol_dep.found() and wl_client_dep.found() and wl_scanner.found() and libdrm_dep.found() |
| 9 |
|
| 10 |
if use_wayland |
| 11 |
wl_sources = files([ |
| 12 |
'gstwlbuffer.c', |
| 13 |
'gstwlcontext.c', |
| 14 |
'gstwldisplay.c', |
| 15 |
'gstwllinuxdmabuf.c', |
| 16 |
'gstwloutput.c', |
| 17 |
'gstwlshmallocator.c', |
| 18 |
'gstwlvideobufferpool.c', |
| 19 |
'gstwlvideoformat.c', |
| 20 |
'gstwlwindow.c', |
| 21 |
]) |
| 22 |
|
| 23 |
wl_headers = files([ |
| 24 |
'gstwl_fwd.h', |
| 25 |
'gstwlbuffer.h', |
| 26 |
'gstwlcontext.h', |
| 27 |
'gstwldisplay.h', |
| 28 |
'gstwllinuxdmabuf.h', |
| 29 |
'gstwloutput.h', |
| 30 |
'gstwlshmallocator.h', |
| 31 |
'gstwlvideobufferpool.h', |
| 32 |
'gstwlvideoformat.h', |
| 33 |
'gstwlwindow.h', |
| 34 |
'wayland.h', |
| 35 |
'wayland-prelude.h', |
| 36 |
]) |
| 37 |
|
| 38 |
protocols_datadir = wl_protocol_dep.get_variable('pkgdatadir') |
| 39 |
|
| 40 |
protocol_defs = [ |
| 41 |
['color-management', 'staging', 'v1' ], |
| 42 |
['color-representation', 'staging', 'v1' ], |
| 43 |
['viewporter', 'stable', ], |
| 44 |
['linux-dmabuf', 'unstable', 'v1', ], |
| 45 |
['fullscreen-shell', 'unstable', 'v1', ], |
| 46 |
['xdg-shell', 'stable', ], |
| 47 |
['single-pixel-buffer', 'staging', 'v1' ], |
| 48 |
] |
| 49 |
protocols_files = [] |
| 50 |
|
| 51 |
foreach protodef: protocol_defs |
| 52 |
proto_name = protodef[0] |
| 53 |
proto_stability = protodef[1] |
| 54 |
|
| 55 |
if proto_stability == 'internal' |
| 56 |
base_file = proto_name |
| 57 |
xml_path = 'protocols' / proto_name + '.xml' |
| 58 |
elif proto_stability == 'stable' |
| 59 |
base_file = proto_name |
| 60 |
xml_path = protocols_datadir / 'stable' / proto_name / (base_file + '.xml') |
| 61 |
elif proto_stability == 'unstable' |
| 62 |
base_file = '@0@-unstable-@1@'.format(proto_name, protodef[2]) |
| 63 |
xml_path = protocols_datadir / 'unstable' / proto_name / (base_file + '.xml') |
| 64 |
elif proto_stability == 'staging' |
| 65 |
base_file = '@0@-@1@'.format(proto_name, protodef[2]) |
| 66 |
xml_path = protocols_datadir / 'staging' / proto_name / (base_file + '.xml') |
| 67 |
else |
| 68 |
error('Unsupported protocol stability') |
| 69 |
endif |
| 70 |
|
| 71 |
protocols_files += [custom_target(f'@base_file@ client header', |
| 72 |
input: xml_path, |
| 73 |
output: f'@[email protected]', |
| 74 |
command: [ |
| 75 |
wl_scanner, |
| 76 |
'client-header', |
| 77 |
'@INPUT@', '@OUTPUT@', |
| 78 |
], |
| 79 |
)] |
| 80 |
|
| 81 |
protocols_files += [custom_target(f'@base_file@ source', |
| 82 |
input: xml_path, |
| 83 |
output: f'@[email protected]', |
| 84 |
command: [ |
| 85 |
wl_scanner, |
| 86 |
'private-code', |
| 87 |
'@INPUT@', '@OUTPUT@', |
| 88 |
], |
| 89 |
)] |
| 90 |
endforeach |
| 91 |
|
| 92 |
extra_c_args = [ |
| 93 |
'-DGST_USE_UNSTABLE_API', |
| 94 |
'-DBUILDING_GST_WL', |
| 95 |
'-DG_LOG_DOMAIN="GStreamer-Wayland"', |
| 96 |
'-D_GNU_SOURCE' |
| 97 |
] |
| 98 |
|
| 99 |
if wl_client_dep.version().version_compare('>= 1.22.91') |
| 100 |
extra_c_args += [ '-DHAVE_WL_EVENT_QUEUE_NAME' ] |
| 101 |
endif |
| 102 |
|
| 103 |
gstwayland = library('gstwayland-' + api_version, |
| 104 |
wl_sources + protocols_files, |
| 105 |
c_args : gst_plugins_bad_args + extra_c_args, |
| 106 |
include_directories : [configinc, libsinc], |
| 107 |
version : libversion, |
| 108 |
soversion : soversion, |
| 109 |
darwin_versions : osxversion, |
| 110 |
install : true, |
| 111 |
dependencies : [gst_dep, gstallocators_dep, gstvideo_dep, libdrm_dep, |
| 112 |
wl_client_dep] |
| 113 |
) |
| 114 |
|
| 115 |
pkg_name = 'gstreamer-wayland-1.0' |
| 116 |
gst_libraries += [[pkg_name, {'lib': gstwayland}]] |
| 117 |
pkgconfig.generate(gstwayland, |
| 118 |
libraries : [gst_dep, gstvideo_dep], |
| 119 |
variables : pkgconfig_variables, |
| 120 |
subdirs : pkgconfig_subdirs, |
| 121 |
name : pkg_name, |
| 122 |
description : 'GStreamer Wayland support', |
| 123 |
) |
| 124 |
|
| 125 |
gstwayland_dep = declare_dependency(link_with : gstwayland, |
| 126 |
include_directories : [libsinc], |
| 127 |
dependencies : [gst_dep, gstallocators_dep, gstvideo_dep, libdrm_dep, |
| 128 |
wl_client_dep]) |
| 129 |
|
| 130 |
install_headers(wl_headers, subdir: 'gstreamer-1.0/gst/wayland') |
| 131 |
meson.override_dependency(pkg_name, gstwayland_dep) |
| 132 |
endif |