[PATCH wayland-protocols 1/3] Add meson build system support

Philipp Zabel p.zabel at pengutronix.de
Tue Dec 5 09:50:11 UTC 2017


<On Wed, 2017-10-11 at 17:00 +0800, Jonas Ådahl wrote:
> Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
> ---
>  meson.build             | 81 +++++++++++++++++++++++++++++++++++++++++++++++++
>  meson_options.txt       |  4 +++
>  tests/meson.build       | 13 ++++++++
>  wayland-protocols.pc.in |  2 +-
>  4 files changed, 99 insertions(+), 1 deletion(-)
>  create mode 100644 meson.build
>  create mode 100644 meson_options.txt
>  create mode 100644 tests/meson.build
> 
> diff --git a/meson.build b/meson.build
> new file mode 100644
> index 0000000..b7f2a5b
> --- /dev/null
> +++ b/meson.build
> @@ -0,0 +1,81 @@
> +project('wayland-protocols',
> +        version: '1.11',
> +        meson_version: '>= 0.36.0')
> +wayland_protocols_version = meson.project_version()
> +
> +stable_protocols = [
> +  'stable/presentation-time/presentation-time.xml',
> +  'stable/viewporter/viewporter.xml',
> +]
> +
> +unstable_protocols = [
> +  'unstable/pointer-gestures/pointer-gestures-unstable-v1.xml',
> +  'unstable/fullscreen-shell/fullscreen-shell-unstable-v1.xml',
> +  'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml',
> +  'unstable/text-input/text-input-unstable-v1.xml',
> +  'unstable/input-method/input-method-unstable-v1.xml',
> +  'unstable/xdg-shell/xdg-shell-unstable-v5.xml',
> +  'unstable/xdg-shell/xdg-shell-unstable-v6.xml',
> +  'unstable/relative-pointer/relative-pointer-unstable-v1.xml',
> +  'unstable/pointer-constraints/pointer-constraints-unstable-v1.xml',
> +  'unstable/tablet/tablet-unstable-v1.xml',
> +  'unstable/tablet/tablet-unstable-v2.xml',
> +  'unstable/xdg-foreign/xdg-foreign-unstable-v1.xml',
> +  'unstable/xdg-foreign/xdg-foreign-unstable-v2.xml',
> +  'unstable/idle-inhibit/idle-inhibit-unstable-v1.xml',
> +  'unstable/xwayland-keyboard-grab/xwayland-keyboard-grab-unstable-v1.xml',
> +  'unstable/keyboard-shortcuts-inhibit/keyboard-shortcuts-inhibit-unstable-v1.xml',
> +  'unstable/xdg-output/xdg-output-unstable-v1.xml',
> +]
> +
> +protocols = stable_protocols + unstable_protocols
> +
> +# Check that each protocol has a README
> +foreach protocol : protocols
> +  protocol_components = protocol.split('/')
> +  stability = protocol_components[0]
> +  protocol_name = protocol_components[1]
> +  readme_path = join_paths(meson.source_root(),
> +                           stability,
> +                           protocol_name,
> +                           'README')
> +  if run_command('[', '-f', readme_path, ']').returncode() != 0
> +    error('Missing README in @0@'.format(protocol))
> +  endif
> +endforeach
> +
> +wayland_scanner = find_program('wayland-scanner')
> +
> +foreach protocol : stable_protocols + unstable_protocols

There is a "protocols" shorthand defined above, it could be reused here.

Not sure if it would be beneficial to merge this loop and the README
loop above to reduce the path splitting boilerplate?

> +  protocol_components = protocol.split('/')
> +  stability = protocol_components[0]
> +  protocol_name = protocol_components[1]
> +  xml_file = protocol_components[2]

xml_file is unused.

> +  protocol_install_dir = join_paths(get_option('datadir'),
> +                                    'wayland-protocols',
> +                                    stability,
> +                                    protocol_name)
> +  install_data(protocol,
> +               install_dir: protocol_install_dir)
> +endforeach

regards
Philipp


More information about the wayland-devel mailing list