summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2017-10-11 16:15:57 +0800
committerJonas Ådahl <jadahl@gmail.com>2021-03-26 15:50:36 +0100
commit79b9a42514963939b4c2283f9ab1a081d1bc36dc (patch)
tree74fad0b6b0ae6f6e522745783ed9eeea37ad0ea6
parentf899eff0a7da3db1e47b95c648848a50e38cc29c (diff)
downloadwayland-protocols-79b9a42514963939b4c2283f9ab1a081d1bc36dc.tar.gz
Add meson build system support
Signed-off-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Simon Ser <contact@emersion.fr>
-rw-r--r--meson.build99
-rw-r--r--meson_options.txt4
-rw-r--r--tests/meson.build14
-rw-r--r--wayland-protocols.pc.in4
4 files changed, 119 insertions, 2 deletions
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..e5802dc
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,99 @@
+project('wayland-protocols',
+ version: '1.20',
+ meson_version: '>= 0.53.0',
+ license: 'MIT/Expat',
+)
+
+wayland_protocols_version = meson.project_version()
+
+fs = import('fs')
+
+dep_scanner = dependency('wayland-scanner', native: true)
+
+stable_protocols = [
+ 'presentation-time',
+ 'viewporter',
+ 'xdg-shell',
+]
+
+unstable_protocols = {
+ 'fullscreen-shell': ['v1'],
+ 'idle-inhibit': ['v1'],
+ 'input-method': ['v1'],
+ 'input-timestamps': ['v1'],
+ 'keyboard-shortcuts-inhibit': ['v1'],
+ 'linux-dmabuf': ['v1'],
+ 'linux-explicit-synchronization': ['v1'],
+ 'pointer-constraints': ['v1'],
+ 'pointer-gestures': ['v1'],
+ 'primary-selection': ['v1'],
+ 'relative-pointer': ['v1'],
+ 'tablet': ['v1', 'v2'],
+ 'text-input': ['v1', 'v3'],
+ 'xdg-decoration': ['v1'],
+ 'xdg-foreign': ['v1', 'v2'],
+ 'xdg-output': ['v1'],
+ 'xdg-shell': ['v5', 'v6'],
+ 'xwayland-keyboard-grab': ['v1'],
+}
+
+protocol_files = []
+
+foreach name : stable_protocols
+ protocol_files += ['stable/@0@/@0@.xml'.format(name)]
+endforeach
+
+foreach name : unstable_protocols.keys()
+ foreach version : unstable_protocols.get(name)
+ protocol_files += [
+ 'unstable/@0@/@0@-unstable-@1@.xml'.format(name, version)
+ ]
+ endforeach
+endforeach
+
+# Check that each protocol has a README
+foreach protocol_file : protocol_files
+ dir = fs.parent(protocol_file)
+ if not fs.is_file(dir + '/README')
+ error('Missing README in @0@'.format(protocol_file))
+ endif
+endforeach
+
+foreach protocol_file : protocol_files
+ protocol_install_dir = fs.parent(join_paths(
+ get_option('datadir'),
+ 'wayland-protocols',
+ protocol_file,
+ ))
+ install_data(
+ protocol_file,
+ install_dir: protocol_install_dir,
+ )
+endforeach
+
+wayland_protocols_srcdir = meson.current_source_dir()
+
+pkgconfig_configuration = configuration_data()
+pkgconfig_configuration.set('prefix', get_option('prefix'))
+pkgconfig_configuration.set('datadir', get_option('datadir'))
+pkgconfig_configuration.set('abs_top_srcdir', wayland_protocols_srcdir)
+pkgconfig_configuration.set('PACKAGE', 'wayland-protocols')
+pkgconfig_configuration.set('WAYLAND_PROTOCOLS_VERSION', wayland_protocols_version)
+
+pkg_install_dir = join_paths(get_option('datadir'), 'pkgconfig')
+configure_file(
+ input: 'wayland-protocols.pc.in',
+ output: 'wayland-protocols.pc',
+ configuration: pkgconfig_configuration,
+ install_dir: pkg_install_dir,
+)
+
+configure_file(
+ input: 'wayland-protocols-uninstalled.pc.in',
+ output: 'wayland-protocols-uninstalled.pc',
+ configuration: pkgconfig_configuration,
+)
+
+if get_option('tests')
+ subdir('tests')
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..f361d3b
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,4 @@
+option('tests',
+ type: 'boolean',
+ value: true,
+ description: 'Build the tests')
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..3a6b150
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,14 @@
+prog_scan_sh = find_program('scan.sh')
+prog_scanner = find_program(dep_scanner.get_pkgconfig_variable('wayland_scanner'))
+
+# Check that each protocol passes through the scanner
+foreach protocol_file : protocol_files
+ protocol_path = join_paths(wayland_protocols_srcdir, protocol_file)
+ test_name = 'scan-@0@'.format(protocol_file.underscorify())
+ test(test_name, prog_scan_sh,
+ args: protocol_path,
+ env: [
+ 'SCANNER=@0@'.format(prog_scanner.path()),
+ ]
+ )
+endforeach
diff --git a/wayland-protocols.pc.in b/wayland-protocols.pc.in
index 379be06..d2dd276 100644
--- a/wayland-protocols.pc.in
+++ b/wayland-protocols.pc.in
@@ -1,6 +1,6 @@
prefix=@prefix@
-datarootdir=@datarootdir@
-pkgdatadir=${pc_sysrootdir}@datadir@/@PACKAGE@
+datarootdir=${prefix}/@datadir@
+pkgdatadir=${pc_sysrootdir}${datarootdir}/@PACKAGE@
Name: Wayland Protocols
Description: Wayland protocol files