xref: /aosp_15_r20/external/wayland-protocols/freedesktop.org/meson.build (revision 6c119a463dd5c45dd05bbe67429293292dde15ee)
1*6c119a46SAndroid Build Coastguard Workerproject('wayland-protocols',
2*6c119a46SAndroid Build Coastguard Worker	version: '1.22',
3*6c119a46SAndroid Build Coastguard Worker	meson_version: '>= 0.54.0',
4*6c119a46SAndroid Build Coastguard Worker	license: 'MIT/Expat',
5*6c119a46SAndroid Build Coastguard Worker)
6*6c119a46SAndroid Build Coastguard Worker
7*6c119a46SAndroid Build Coastguard Workerwayland_protocols_version = meson.project_version()
8*6c119a46SAndroid Build Coastguard Worker
9*6c119a46SAndroid Build Coastguard Workerfs = import('fs')
10*6c119a46SAndroid Build Coastguard Worker
11*6c119a46SAndroid Build Coastguard Workerdep_scanner = dependency('wayland-scanner', native: true)
12*6c119a46SAndroid Build Coastguard Worker
13*6c119a46SAndroid Build Coastguard Workerstable_protocols = [
14*6c119a46SAndroid Build Coastguard Worker	'presentation-time',
15*6c119a46SAndroid Build Coastguard Worker	'viewporter',
16*6c119a46SAndroid Build Coastguard Worker	'xdg-shell',
17*6c119a46SAndroid Build Coastguard Worker]
18*6c119a46SAndroid Build Coastguard Worker
19*6c119a46SAndroid Build Coastguard Workerunstable_protocols = {
20*6c119a46SAndroid Build Coastguard Worker	'fullscreen-shell': ['v1'],
21*6c119a46SAndroid Build Coastguard Worker	'idle-inhibit': ['v1'],
22*6c119a46SAndroid Build Coastguard Worker	'input-method': ['v1'],
23*6c119a46SAndroid Build Coastguard Worker	'input-timestamps': ['v1'],
24*6c119a46SAndroid Build Coastguard Worker	'keyboard-shortcuts-inhibit': ['v1'],
25*6c119a46SAndroid Build Coastguard Worker	'linux-dmabuf': ['v1'],
26*6c119a46SAndroid Build Coastguard Worker	'linux-explicit-synchronization': ['v1'],
27*6c119a46SAndroid Build Coastguard Worker	'pointer-constraints': ['v1'],
28*6c119a46SAndroid Build Coastguard Worker	'pointer-gestures': ['v1'],
29*6c119a46SAndroid Build Coastguard Worker	'primary-selection': ['v1'],
30*6c119a46SAndroid Build Coastguard Worker	'relative-pointer': ['v1'],
31*6c119a46SAndroid Build Coastguard Worker	'tablet': ['v1', 'v2'],
32*6c119a46SAndroid Build Coastguard Worker	'text-input': ['v1', 'v3'],
33*6c119a46SAndroid Build Coastguard Worker	'xdg-decoration': ['v1'],
34*6c119a46SAndroid Build Coastguard Worker	'xdg-foreign': ['v1', 'v2'],
35*6c119a46SAndroid Build Coastguard Worker	'xdg-output': ['v1'],
36*6c119a46SAndroid Build Coastguard Worker	'xdg-shell': ['v5', 'v6'],
37*6c119a46SAndroid Build Coastguard Worker	'xwayland-keyboard-grab': ['v1'],
38*6c119a46SAndroid Build Coastguard Worker}
39*6c119a46SAndroid Build Coastguard Worker
40*6c119a46SAndroid Build Coastguard Workerstaging_protocols = {
41*6c119a46SAndroid Build Coastguard Worker	'xdg-activation': ['v1'],
42*6c119a46SAndroid Build Coastguard Worker	'drm-lease': ['v1'],
43*6c119a46SAndroid Build Coastguard Worker}
44*6c119a46SAndroid Build Coastguard Worker
45*6c119a46SAndroid Build Coastguard Workerprotocol_files = []
46*6c119a46SAndroid Build Coastguard Worker
47*6c119a46SAndroid Build Coastguard Workerforeach name : stable_protocols
48*6c119a46SAndroid Build Coastguard Worker	protocol_files += ['stable/@0@/@[email protected]'.format(name)]
49*6c119a46SAndroid Build Coastguard Workerendforeach
50*6c119a46SAndroid Build Coastguard Worker
51*6c119a46SAndroid Build Coastguard Workerforeach name : staging_protocols.keys()
52*6c119a46SAndroid Build Coastguard Worker	foreach version : staging_protocols.get(name)
53*6c119a46SAndroid Build Coastguard Worker		protocol_files += [
54*6c119a46SAndroid Build Coastguard Worker			'staging/@0@/@0@-@[email protected]'.format(name, version)
55*6c119a46SAndroid Build Coastguard Worker		]
56*6c119a46SAndroid Build Coastguard Worker	endforeach
57*6c119a46SAndroid Build Coastguard Workerendforeach
58*6c119a46SAndroid Build Coastguard Worker
59*6c119a46SAndroid Build Coastguard Workerforeach name : unstable_protocols.keys()
60*6c119a46SAndroid Build Coastguard Worker	foreach version : unstable_protocols.get(name)
61*6c119a46SAndroid Build Coastguard Worker		protocol_files += [
62*6c119a46SAndroid Build Coastguard Worker			'unstable/@0@/@0@-unstable-@[email protected]'.format(name, version)
63*6c119a46SAndroid Build Coastguard Worker		]
64*6c119a46SAndroid Build Coastguard Worker	endforeach
65*6c119a46SAndroid Build Coastguard Workerendforeach
66*6c119a46SAndroid Build Coastguard Worker
67*6c119a46SAndroid Build Coastguard Worker# Check that each protocol has a README
68*6c119a46SAndroid Build Coastguard Workerforeach protocol_file : protocol_files
69*6c119a46SAndroid Build Coastguard Worker	dir = fs.parent(protocol_file)
70*6c119a46SAndroid Build Coastguard Worker	if not fs.is_file(dir + '/README')
71*6c119a46SAndroid Build Coastguard Worker		error('Missing README in @0@'.format(protocol_file))
72*6c119a46SAndroid Build Coastguard Worker	endif
73*6c119a46SAndroid Build Coastguard Workerendforeach
74*6c119a46SAndroid Build Coastguard Worker
75*6c119a46SAndroid Build Coastguard Workerforeach protocol_file : protocol_files
76*6c119a46SAndroid Build Coastguard Worker	protocol_install_dir = fs.parent(join_paths(
77*6c119a46SAndroid Build Coastguard Worker		get_option('datadir'),
78*6c119a46SAndroid Build Coastguard Worker		'wayland-protocols',
79*6c119a46SAndroid Build Coastguard Worker		protocol_file,
80*6c119a46SAndroid Build Coastguard Worker	))
81*6c119a46SAndroid Build Coastguard Worker	install_data(
82*6c119a46SAndroid Build Coastguard Worker		protocol_file,
83*6c119a46SAndroid Build Coastguard Worker		install_dir: protocol_install_dir,
84*6c119a46SAndroid Build Coastguard Worker	)
85*6c119a46SAndroid Build Coastguard Workerendforeach
86*6c119a46SAndroid Build Coastguard Worker
87*6c119a46SAndroid Build Coastguard Workerwayland_protocols_srcdir = meson.current_source_dir()
88*6c119a46SAndroid Build Coastguard Worker
89*6c119a46SAndroid Build Coastguard Workerpkgconfig_configuration = configuration_data()
90*6c119a46SAndroid Build Coastguard Workerpkgconfig_configuration.set('prefix', get_option('prefix'))
91*6c119a46SAndroid Build Coastguard Workerpkgconfig_configuration.set('datarootdir', '${prefix}/@0@'.format(get_option('datadir')))
92*6c119a46SAndroid Build Coastguard Workerpkgconfig_configuration.set('abs_top_srcdir', wayland_protocols_srcdir)
93*6c119a46SAndroid Build Coastguard Workerpkgconfig_configuration.set('PACKAGE', 'wayland-protocols')
94*6c119a46SAndroid Build Coastguard Workerpkgconfig_configuration.set('WAYLAND_PROTOCOLS_VERSION', wayland_protocols_version)
95*6c119a46SAndroid Build Coastguard Worker
96*6c119a46SAndroid Build Coastguard Workerpkg_install_dir = join_paths(get_option('datadir'), 'pkgconfig')
97*6c119a46SAndroid Build Coastguard Workerconfigure_file(
98*6c119a46SAndroid Build Coastguard Worker	input: 'wayland-protocols.pc.in',
99*6c119a46SAndroid Build Coastguard Worker	output: 'wayland-protocols.pc',
100*6c119a46SAndroid Build Coastguard Worker	configuration: pkgconfig_configuration,
101*6c119a46SAndroid Build Coastguard Worker	install_dir: pkg_install_dir,
102*6c119a46SAndroid Build Coastguard Worker)
103*6c119a46SAndroid Build Coastguard Worker
104*6c119a46SAndroid Build Coastguard Workerconfigure_file(
105*6c119a46SAndroid Build Coastguard Worker	input: 'wayland-protocols-uninstalled.pc.in',
106*6c119a46SAndroid Build Coastguard Worker	output: 'wayland-protocols-uninstalled.pc',
107*6c119a46SAndroid Build Coastguard Worker	configuration: pkgconfig_configuration,
108*6c119a46SAndroid Build Coastguard Worker)
109*6c119a46SAndroid Build Coastguard Worker
110*6c119a46SAndroid Build Coastguard Workerwayland_protocols = declare_dependency(
111*6c119a46SAndroid Build Coastguard Worker	variables: {
112*6c119a46SAndroid Build Coastguard Worker		'pkgdatadir': wayland_protocols_srcdir,
113*6c119a46SAndroid Build Coastguard Worker	},
114*6c119a46SAndroid Build Coastguard Worker)
115*6c119a46SAndroid Build Coastguard Worker
116*6c119a46SAndroid Build Coastguard Workermeson.override_dependency('wayland-protocols', wayland_protocols)
117*6c119a46SAndroid Build Coastguard Worker
118*6c119a46SAndroid Build Coastguard Workerif get_option('tests')
119*6c119a46SAndroid Build Coastguard Worker	subdir('tests')
120*6c119a46SAndroid Build Coastguard Workerendif
121