Make wayland bits in meson.build conditional on wayland use

Otherwise the build won't configure due to its inability to find
wayland-scanner program on systems where no such program is availble.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
This commit is contained in:
Руслан Ижбулатов 2018-03-03 21:55:15 +00:00 committed by Chun-wei Fan
parent b1b05bee53
commit b7d7602750

View File

@ -596,8 +596,10 @@ proto_sources = [
] ]
im_wayland_sources = files('gtkimcontextwayland.c') im_wayland_sources = files('gtkimcontextwayland.c')
wayland_scanner = find_program('wayland-scanner') if wayland_enabled
genprotocols = find_program('../gdk/wayland/genprotocolfiles.py') wayland_scanner = find_program('wayland-scanner')
genprotocols = find_program('../gdk/wayland/genprotocolfiles.py')
endif
foreach p: proto_sources foreach p: proto_sources
proto_name = p.get(0) proto_name = p.get(0)
@ -612,25 +614,27 @@ foreach p: proto_sources
input = join_paths(proto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base)) input = join_paths(proto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base))
endif endif
im_wayland_sources += custom_target('@0@ client header'.format(output_base), if wayland_enabled
input: input, im_wayland_sources += custom_target('@0@ client header'.format(output_base),
output: '@0@-client-protocol.h'.format(output_base), input: input,
command: [ output: '@0@-client-protocol.h'.format(output_base),
genprotocols, command: [
wayland_scanner, genprotocols,
'@INPUT@', '@OUTPUT@', wayland_scanner,
'client-header', '@INPUT@', '@OUTPUT@',
]) 'client-header',
])
im_wayland_sources += custom_target('@0@ source'.format(output_base), im_wayland_sources += custom_target('@0@ source'.format(output_base),
input: input, input: input,
output: '@0@-protocol.c'.format(output_base), output: '@0@-protocol.c'.format(output_base),
command: [ command: [
genprotocols, genprotocols,
wayland_scanner, wayland_scanner,
'@INPUT@', '@OUTPUT@', '@INPUT@', '@OUTPUT@',
'code', 'code',
]) ])
endif
endforeach endforeach
if os_unix if os_unix