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