xref: /aosp_15_r20/external/libxkbcommon/meson.build (revision 2b949d0487e80d67f1fda82db69e101e761f8064)
1*2b949d04SAndroid Build Coastguard Workerproject(
2*2b949d04SAndroid Build Coastguard Worker    'libxkbcommon',
3*2b949d04SAndroid Build Coastguard Worker    'c',
4*2b949d04SAndroid Build Coastguard Worker    version: '1.4.0',
5*2b949d04SAndroid Build Coastguard Worker    default_options: [
6*2b949d04SAndroid Build Coastguard Worker        'c_std=c11',
7*2b949d04SAndroid Build Coastguard Worker        'warning_level=2',
8*2b949d04SAndroid Build Coastguard Worker        'b_lundef=true',
9*2b949d04SAndroid Build Coastguard Worker    ],
10*2b949d04SAndroid Build Coastguard Worker    meson_version : '>= 0.49.0',
11*2b949d04SAndroid Build Coastguard Worker)
12*2b949d04SAndroid Build Coastguard Workerpkgconfig = import('pkgconfig')
13*2b949d04SAndroid Build Coastguard Workercc = meson.get_compiler('c')
14*2b949d04SAndroid Build Coastguard Worker
15*2b949d04SAndroid Build Coastguard Workerdir_libexec = get_option('prefix')/get_option('libexecdir')/'xkbcommon'
16*2b949d04SAndroid Build Coastguard Worker
17*2b949d04SAndroid Build Coastguard Worker# Compiler flags.
18*2b949d04SAndroid Build Coastguard Workercflags = [
19*2b949d04SAndroid Build Coastguard Worker    '-fno-strict-aliasing',
20*2b949d04SAndroid Build Coastguard Worker    '-fsanitize-undefined-trap-on-error',
21*2b949d04SAndroid Build Coastguard Worker    '-Wno-unused-parameter',
22*2b949d04SAndroid Build Coastguard Worker    '-Wno-missing-field-initializers',
23*2b949d04SAndroid Build Coastguard Worker    '-Wpointer-arith',
24*2b949d04SAndroid Build Coastguard Worker    '-Wmissing-declarations',
25*2b949d04SAndroid Build Coastguard Worker    '-Wformat=2',
26*2b949d04SAndroid Build Coastguard Worker    '-Wstrict-prototypes',
27*2b949d04SAndroid Build Coastguard Worker    '-Wmissing-prototypes',
28*2b949d04SAndroid Build Coastguard Worker    '-Wnested-externs',
29*2b949d04SAndroid Build Coastguard Worker    '-Wbad-function-cast',
30*2b949d04SAndroid Build Coastguard Worker    '-Wshadow',
31*2b949d04SAndroid Build Coastguard Worker    '-Wlogical-op',
32*2b949d04SAndroid Build Coastguard Worker    '-Wdate-time',
33*2b949d04SAndroid Build Coastguard Worker    '-Wwrite-strings',
34*2b949d04SAndroid Build Coastguard Worker    '-Wno-documentation-deprecated-sync',
35*2b949d04SAndroid Build Coastguard Worker]
36*2b949d04SAndroid Build Coastguard Workeradd_project_arguments(cc.get_supported_arguments(cflags), language: 'c')
37*2b949d04SAndroid Build Coastguard Worker
38*2b949d04SAndroid Build Coastguard Worker
39*2b949d04SAndroid Build Coastguard Worker# The XKB config root.
40*2b949d04SAndroid Build Coastguard WorkerXKBCONFIGROOT = get_option('xkb-config-root')
41*2b949d04SAndroid Build Coastguard Workerif XKBCONFIGROOT == ''
42*2b949d04SAndroid Build Coastguard Worker    xkeyboard_config_dep = dependency('xkeyboard-config', required: false)
43*2b949d04SAndroid Build Coastguard Worker    if xkeyboard_config_dep.found()
44*2b949d04SAndroid Build Coastguard Worker        XKBCONFIGROOT = xkeyboard_config_dep.get_pkgconfig_variable('xkb_base')
45*2b949d04SAndroid Build Coastguard Worker    else
46*2b949d04SAndroid Build Coastguard Worker        XKBCONFIGROOT = get_option('prefix')/get_option('datadir')/'X11'/'xkb'
47*2b949d04SAndroid Build Coastguard Worker  endif
48*2b949d04SAndroid Build Coastguard Workerendif
49*2b949d04SAndroid Build Coastguard Worker
50*2b949d04SAndroid Build Coastguard WorkerXKBCONFIGEXTRAPATH = get_option('xkb-config-extra-path')
51*2b949d04SAndroid Build Coastguard Workerif XKBCONFIGEXTRAPATH == ''
52*2b949d04SAndroid Build Coastguard Worker    XKBCONFIGEXTRAPATH = get_option('prefix')/get_option('sysconfdir')/'xkb'
53*2b949d04SAndroid Build Coastguard Workerendif
54*2b949d04SAndroid Build Coastguard Worker
55*2b949d04SAndroid Build Coastguard Worker# The X locale directory for compose.
56*2b949d04SAndroid Build Coastguard WorkerXLOCALEDIR = get_option('x-locale-root')
57*2b949d04SAndroid Build Coastguard Workerif XLOCALEDIR == ''
58*2b949d04SAndroid Build Coastguard Worker    XLOCALEDIR = get_option('prefix')/get_option('datadir')/'X11'/'locale'
59*2b949d04SAndroid Build Coastguard Workerendif
60*2b949d04SAndroid Build Coastguard Worker
61*2b949d04SAndroid Build Coastguard Worker
62*2b949d04SAndroid Build Coastguard Worker# config.h.
63*2b949d04SAndroid Build Coastguard Workerconfigh_data = configuration_data()
64*2b949d04SAndroid Build Coastguard Workerconfigh_data.set('EXIT_INVALID_USAGE', '2')
65*2b949d04SAndroid Build Coastguard Workerconfigh_data.set_quoted('LIBXKBCOMMON_VERSION', meson.project_version())
66*2b949d04SAndroid Build Coastguard Workerconfigh_data.set_quoted('LIBXKBCOMMON_TOOL_PATH', dir_libexec)
67*2b949d04SAndroid Build Coastguard Worker# Like AC_USE_SYSTEM_EXTENSIONS, what #define to use to get extensions
68*2b949d04SAndroid Build Coastguard Worker# beyond the base POSIX function set.
69*2b949d04SAndroid Build Coastguard Workerif host_machine.system() == 'sunos'
70*2b949d04SAndroid Build Coastguard Worker  system_extensions = '__EXTENSIONS__'
71*2b949d04SAndroid Build Coastguard Workerelse
72*2b949d04SAndroid Build Coastguard Worker  system_extensions = '_GNU_SOURCE'
73*2b949d04SAndroid Build Coastguard Workerendif
74*2b949d04SAndroid Build Coastguard Workerconfigh_data.set(system_extensions, 1)
75*2b949d04SAndroid Build Coastguard Workersystem_ext_define = '#define ' + system_extensions
76*2b949d04SAndroid Build Coastguard Workerconfigh_data.set_quoted('DFLT_XKB_CONFIG_ROOT', XKBCONFIGROOT)
77*2b949d04SAndroid Build Coastguard Workerconfigh_data.set_quoted('DFLT_XKB_CONFIG_EXTRA_PATH', XKBCONFIGEXTRAPATH)
78*2b949d04SAndroid Build Coastguard Workerconfigh_data.set_quoted('XLOCALEDIR', XLOCALEDIR)
79*2b949d04SAndroid Build Coastguard Workerconfigh_data.set_quoted('DEFAULT_XKB_RULES', get_option('default-rules'))
80*2b949d04SAndroid Build Coastguard Workerconfigh_data.set_quoted('DEFAULT_XKB_MODEL', get_option('default-model'))
81*2b949d04SAndroid Build Coastguard Workerconfigh_data.set_quoted('DEFAULT_XKB_LAYOUT', get_option('default-layout'))
82*2b949d04SAndroid Build Coastguard Workerif get_option('default-variant') != ''
83*2b949d04SAndroid Build Coastguard Worker    configh_data.set_quoted('DEFAULT_XKB_VARIANT', get_option('default-variant'))
84*2b949d04SAndroid Build Coastguard Workerelse
85*2b949d04SAndroid Build Coastguard Worker    configh_data.set('DEFAULT_XKB_VARIANT', 'NULL')
86*2b949d04SAndroid Build Coastguard Workerendif
87*2b949d04SAndroid Build Coastguard Workerif get_option('default-options') != ''
88*2b949d04SAndroid Build Coastguard Worker    configh_data.set_quoted('DEFAULT_XKB_OPTIONS', get_option('default-options'))
89*2b949d04SAndroid Build Coastguard Workerelse
90*2b949d04SAndroid Build Coastguard Worker    configh_data.set('DEFAULT_XKB_OPTIONS', 'NULL')
91*2b949d04SAndroid Build Coastguard Workerendif
92*2b949d04SAndroid Build Coastguard Workerif cc.has_header('unistd.h')
93*2b949d04SAndroid Build Coastguard Worker    configh_data.set('HAVE_UNISTD_H', 1)
94*2b949d04SAndroid Build Coastguard Workerendif
95*2b949d04SAndroid Build Coastguard Workerif cc.links('int main(){if(__builtin_expect(1<0,0)){}}', name: '__builtin_expect')
96*2b949d04SAndroid Build Coastguard Worker    configh_data.set('HAVE___BUILTIN_EXPECT', 1)
97*2b949d04SAndroid Build Coastguard Workerendif
98*2b949d04SAndroid Build Coastguard Workerif cc.has_header_symbol('unistd.h', 'eaccess', prefix: system_ext_define)
99*2b949d04SAndroid Build Coastguard Worker    configh_data.set('HAVE_EACCESS', 1)
100*2b949d04SAndroid Build Coastguard Workerendif
101*2b949d04SAndroid Build Coastguard Workerif cc.has_header_symbol('unistd.h', 'euidaccess', prefix: system_ext_define)
102*2b949d04SAndroid Build Coastguard Worker    configh_data.set('HAVE_EUIDACCESS', 1)
103*2b949d04SAndroid Build Coastguard Workerendif
104*2b949d04SAndroid Build Coastguard Workerif cc.has_header_symbol('sys/mman.h', 'mmap')
105*2b949d04SAndroid Build Coastguard Worker    configh_data.set('HAVE_MMAP', 1)
106*2b949d04SAndroid Build Coastguard Workerendif
107*2b949d04SAndroid Build Coastguard Workerif cc.has_header_symbol('stdlib.h', 'mkostemp', prefix: system_ext_define)
108*2b949d04SAndroid Build Coastguard Worker    configh_data.set('HAVE_MKOSTEMP', 1)
109*2b949d04SAndroid Build Coastguard Workerendif
110*2b949d04SAndroid Build Coastguard Workerif cc.has_header_symbol('fcntl.h', 'posix_fallocate', prefix: system_ext_define)
111*2b949d04SAndroid Build Coastguard Worker    configh_data.set('HAVE_POSIX_FALLOCATE', 1)
112*2b949d04SAndroid Build Coastguard Workerendif
113*2b949d04SAndroid Build Coastguard Workerif cc.has_header_symbol('string.h', 'strndup', prefix: system_ext_define)
114*2b949d04SAndroid Build Coastguard Worker    configh_data.set('HAVE_STRNDUP', 1)
115*2b949d04SAndroid Build Coastguard Workerendif
116*2b949d04SAndroid Build Coastguard Workerif cc.has_header_symbol('stdio.h', 'asprintf', prefix: system_ext_define)
117*2b949d04SAndroid Build Coastguard Worker    configh_data.set('HAVE_ASPRINTF', 1)
118*2b949d04SAndroid Build Coastguard Workerelif cc.has_header_symbol('stdio.h', 'vasprintf', prefix: system_ext_define)
119*2b949d04SAndroid Build Coastguard Worker    configh_data.set('HAVE_VASPRINTF', 1)
120*2b949d04SAndroid Build Coastguard Workerendif
121*2b949d04SAndroid Build Coastguard Workerif cc.has_header_symbol('stdlib.h', 'secure_getenv', prefix: system_ext_define)
122*2b949d04SAndroid Build Coastguard Worker    configh_data.set('HAVE_SECURE_GETENV', 1)
123*2b949d04SAndroid Build Coastguard Workerelif cc.has_header_symbol('stdlib.h', '__secure_getenv', prefix: system_ext_define)
124*2b949d04SAndroid Build Coastguard Worker    configh_data.set('HAVE___SECURE_GETENV', 1)
125*2b949d04SAndroid Build Coastguard Workerelse
126*2b949d04SAndroid Build Coastguard Worker    message('C library does not support secure_getenv, using getenv instead')
127*2b949d04SAndroid Build Coastguard Workerendif
128*2b949d04SAndroid Build Coastguard Workerif not cc.has_header_symbol('limits.h', 'PATH_MAX', prefix: system_ext_define)
129*2b949d04SAndroid Build Coastguard Worker    if host_machine.system() == 'windows'
130*2b949d04SAndroid Build Coastguard Worker        # see https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation
131*2b949d04SAndroid Build Coastguard Worker        configh_data.set('PATH_MAX', 260)
132*2b949d04SAndroid Build Coastguard Worker    else
133*2b949d04SAndroid Build Coastguard Worker        configh_data.set('PATH_MAX', 4096)
134*2b949d04SAndroid Build Coastguard Worker    endif
135*2b949d04SAndroid Build Coastguard Workerendif
136*2b949d04SAndroid Build Coastguard Worker
137*2b949d04SAndroid Build Coastguard Worker# Silence some security & deprecation warnings on MSVC
138*2b949d04SAndroid Build Coastguard Worker# for some unix/C functions we use.
139*2b949d04SAndroid Build Coastguard Worker# https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4996?view=vs-2019
140*2b949d04SAndroid Build Coastguard Workerconfigh_data.set('_CRT_SECURE_NO_WARNINGS', 1)
141*2b949d04SAndroid Build Coastguard Workerconfigh_data.set('_CRT_NONSTDC_NO_WARNINGS', 1)
142*2b949d04SAndroid Build Coastguard Workerconfigh_data.set('_CRT_NONSTDC_NO_DEPRECATE', 1)
143*2b949d04SAndroid Build Coastguard Worker# Reduce unnecessary includes on MSVC.
144*2b949d04SAndroid Build Coastguard Workerconfigh_data.set('WIN32_LEAN_AND_MEAN', 1)
145*2b949d04SAndroid Build Coastguard Worker
146*2b949d04SAndroid Build Coastguard Worker# Supports -Wl,--version-script?
147*2b949d04SAndroid Build Coastguard Workerhave_version_script = cc.links(
148*2b949d04SAndroid Build Coastguard Worker    'int main(){}',
149*2b949d04SAndroid Build Coastguard Worker    args: '-Wl,--version-script=' + meson.source_root()/'xkbcommon.map',
150*2b949d04SAndroid Build Coastguard Worker    name: '-Wl,--version-script',
151*2b949d04SAndroid Build Coastguard Worker)
152*2b949d04SAndroid Build Coastguard Worker
153*2b949d04SAndroid Build Coastguard Workermap_to_def = find_program('scripts/map-to-def')
154*2b949d04SAndroid Build Coastguard Worker
155*2b949d04SAndroid Build Coastguard Worker# libxkbcommon.
156*2b949d04SAndroid Build Coastguard Worker# Note: we use some yacc extensions, which work with either GNU bison
157*2b949d04SAndroid Build Coastguard Worker# (preferred) or byacc (with backtracking enabled).
158*2b949d04SAndroid Build Coastguard Workerbison = find_program('bison', 'win_bison', required: false)
159*2b949d04SAndroid Build Coastguard Workerif bison.found()
160*2b949d04SAndroid Build Coastguard Worker    yacc_gen = generator(
161*2b949d04SAndroid Build Coastguard Worker        bison,
162*2b949d04SAndroid Build Coastguard Worker        output: ['@[email protected]', '@[email protected]'],
163*2b949d04SAndroid Build Coastguard Worker        arguments: ['--defines=@OUTPUT1@', '-o', '@OUTPUT0@', '-p', '_xkbcommon_', '@INPUT@'],
164*2b949d04SAndroid Build Coastguard Worker    )
165*2b949d04SAndroid Build Coastguard Workerelse
166*2b949d04SAndroid Build Coastguard Worker    byacc = find_program('byacc', required: false)
167*2b949d04SAndroid Build Coastguard Worker    if byacc.found()
168*2b949d04SAndroid Build Coastguard Worker        yacc_gen = generator(
169*2b949d04SAndroid Build Coastguard Worker            byacc,
170*2b949d04SAndroid Build Coastguard Worker            output: ['@[email protected]', '@[email protected]'],
171*2b949d04SAndroid Build Coastguard Worker            arguments: ['-H', '@OUTPUT1@', '-o', '@OUTPUT0@', '-p', '_xkbcommon_', '@INPUT@'],
172*2b949d04SAndroid Build Coastguard Worker        )
173*2b949d04SAndroid Build Coastguard Worker    else
174*2b949d04SAndroid Build Coastguard Worker        error('Could not find a compatible YACC program (bison or byacc)')
175*2b949d04SAndroid Build Coastguard Worker    endif
176*2b949d04SAndroid Build Coastguard Workerendif
177*2b949d04SAndroid Build Coastguard Workerlibxkbcommon_sources = [
178*2b949d04SAndroid Build Coastguard Worker    'src/compose/parser.c',
179*2b949d04SAndroid Build Coastguard Worker    'src/compose/parser.h',
180*2b949d04SAndroid Build Coastguard Worker    'src/compose/paths.c',
181*2b949d04SAndroid Build Coastguard Worker    'src/compose/paths.h',
182*2b949d04SAndroid Build Coastguard Worker    'src/compose/state.c',
183*2b949d04SAndroid Build Coastguard Worker    'src/compose/table.c',
184*2b949d04SAndroid Build Coastguard Worker    'src/compose/table.h',
185*2b949d04SAndroid Build Coastguard Worker    'src/xkbcomp/action.c',
186*2b949d04SAndroid Build Coastguard Worker    'src/xkbcomp/action.h',
187*2b949d04SAndroid Build Coastguard Worker    'src/xkbcomp/ast.h',
188*2b949d04SAndroid Build Coastguard Worker    'src/xkbcomp/ast-build.c',
189*2b949d04SAndroid Build Coastguard Worker    'src/xkbcomp/ast-build.h',
190*2b949d04SAndroid Build Coastguard Worker    'src/xkbcomp/compat.c',
191*2b949d04SAndroid Build Coastguard Worker    'src/xkbcomp/expr.c',
192*2b949d04SAndroid Build Coastguard Worker    'src/xkbcomp/expr.h',
193*2b949d04SAndroid Build Coastguard Worker    'src/xkbcomp/include.c',
194*2b949d04SAndroid Build Coastguard Worker    'src/xkbcomp/include.h',
195*2b949d04SAndroid Build Coastguard Worker    'src/xkbcomp/keycodes.c',
196*2b949d04SAndroid Build Coastguard Worker    'src/xkbcomp/keymap.c',
197*2b949d04SAndroid Build Coastguard Worker    'src/xkbcomp/keymap-dump.c',
198*2b949d04SAndroid Build Coastguard Worker    'src/xkbcomp/keywords.c',
199*2b949d04SAndroid Build Coastguard Worker    yacc_gen.process('src/xkbcomp/parser.y'),
200*2b949d04SAndroid Build Coastguard Worker    'src/xkbcomp/parser-priv.h',
201*2b949d04SAndroid Build Coastguard Worker    'src/xkbcomp/rules.c',
202*2b949d04SAndroid Build Coastguard Worker    'src/xkbcomp/rules.h',
203*2b949d04SAndroid Build Coastguard Worker    'src/xkbcomp/scanner.c',
204*2b949d04SAndroid Build Coastguard Worker    'src/xkbcomp/symbols.c',
205*2b949d04SAndroid Build Coastguard Worker    'src/xkbcomp/types.c',
206*2b949d04SAndroid Build Coastguard Worker    'src/xkbcomp/vmod.c',
207*2b949d04SAndroid Build Coastguard Worker    'src/xkbcomp/vmod.h',
208*2b949d04SAndroid Build Coastguard Worker    'src/xkbcomp/xkbcomp.c',
209*2b949d04SAndroid Build Coastguard Worker    'src/xkbcomp/xkbcomp-priv.h',
210*2b949d04SAndroid Build Coastguard Worker    'src/atom.c',
211*2b949d04SAndroid Build Coastguard Worker    'src/atom.h',
212*2b949d04SAndroid Build Coastguard Worker    'src/context.c',
213*2b949d04SAndroid Build Coastguard Worker    'src/context.h',
214*2b949d04SAndroid Build Coastguard Worker    'src/context-priv.c',
215*2b949d04SAndroid Build Coastguard Worker    'src/darray.h',
216*2b949d04SAndroid Build Coastguard Worker    'src/keysym.c',
217*2b949d04SAndroid Build Coastguard Worker    'src/keysym.h',
218*2b949d04SAndroid Build Coastguard Worker    'src/keysym-utf.c',
219*2b949d04SAndroid Build Coastguard Worker    'src/ks_tables.h',
220*2b949d04SAndroid Build Coastguard Worker    'src/keymap.c',
221*2b949d04SAndroid Build Coastguard Worker    'src/keymap.h',
222*2b949d04SAndroid Build Coastguard Worker    'src/keymap-priv.c',
223*2b949d04SAndroid Build Coastguard Worker    'src/scanner-utils.h',
224*2b949d04SAndroid Build Coastguard Worker    'src/state.c',
225*2b949d04SAndroid Build Coastguard Worker    'src/text.c',
226*2b949d04SAndroid Build Coastguard Worker    'src/text.h',
227*2b949d04SAndroid Build Coastguard Worker    'src/utf8.c',
228*2b949d04SAndroid Build Coastguard Worker    'src/utf8.h',
229*2b949d04SAndroid Build Coastguard Worker    'src/utils.c',
230*2b949d04SAndroid Build Coastguard Worker    'src/utils.h',
231*2b949d04SAndroid Build Coastguard Worker]
232*2b949d04SAndroid Build Coastguard Workerlibxkbcommon_link_args = []
233*2b949d04SAndroid Build Coastguard Workerlibxkbcommon_link_deps = []
234*2b949d04SAndroid Build Coastguard Workerif have_version_script
235*2b949d04SAndroid Build Coastguard Worker    libxkbcommon_link_args += '-Wl,--version-script=' + meson.source_root()/'xkbcommon.map'
236*2b949d04SAndroid Build Coastguard Worker    libxkbcommon_link_deps += 'xkbcommon.map'
237*2b949d04SAndroid Build Coastguard Workerelif cc.get_argument_syntax() == 'msvc'
238*2b949d04SAndroid Build Coastguard Worker    libxkbcommon_def = custom_target('xkbcommon.def',
239*2b949d04SAndroid Build Coastguard Worker        command: [map_to_def, '@INPUT@', '@OUTPUT@'],
240*2b949d04SAndroid Build Coastguard Worker        input: 'xkbcommon.map',
241*2b949d04SAndroid Build Coastguard Worker        output: 'kxbcommon.def',
242*2b949d04SAndroid Build Coastguard Worker    )
243*2b949d04SAndroid Build Coastguard Worker    libxkbcommon_link_deps += libxkbcommon_def
244*2b949d04SAndroid Build Coastguard Worker    libxkbcommon_link_args += '/DEF:' + libxkbcommon_def.full_path()
245*2b949d04SAndroid Build Coastguard Workerendif
246*2b949d04SAndroid Build Coastguard Workerlibxkbcommon = library(
247*2b949d04SAndroid Build Coastguard Worker    'xkbcommon',
248*2b949d04SAndroid Build Coastguard Worker    'include/xkbcommon/xkbcommon.h',
249*2b949d04SAndroid Build Coastguard Worker    libxkbcommon_sources,
250*2b949d04SAndroid Build Coastguard Worker    link_args: libxkbcommon_link_args,
251*2b949d04SAndroid Build Coastguard Worker    link_depends: libxkbcommon_link_deps,
252*2b949d04SAndroid Build Coastguard Worker    gnu_symbol_visibility: 'hidden',
253*2b949d04SAndroid Build Coastguard Worker    version: '0.0.0',
254*2b949d04SAndroid Build Coastguard Worker    install: true,
255*2b949d04SAndroid Build Coastguard Worker    include_directories: include_directories('src', 'include'),
256*2b949d04SAndroid Build Coastguard Worker)
257*2b949d04SAndroid Build Coastguard Workerinstall_headers(
258*2b949d04SAndroid Build Coastguard Worker    'include/xkbcommon/xkbcommon.h',
259*2b949d04SAndroid Build Coastguard Worker    'include/xkbcommon/xkbcommon-compat.h',
260*2b949d04SAndroid Build Coastguard Worker    'include/xkbcommon/xkbcommon-compose.h',
261*2b949d04SAndroid Build Coastguard Worker    'include/xkbcommon/xkbcommon-keysyms.h',
262*2b949d04SAndroid Build Coastguard Worker    'include/xkbcommon/xkbcommon-names.h',
263*2b949d04SAndroid Build Coastguard Worker    subdir: 'xkbcommon',
264*2b949d04SAndroid Build Coastguard Worker)
265*2b949d04SAndroid Build Coastguard Worker
266*2b949d04SAndroid Build Coastguard Workerdep_libxkbcommon = declare_dependency(
267*2b949d04SAndroid Build Coastguard Worker    link_with: libxkbcommon,
268*2b949d04SAndroid Build Coastguard Worker    include_directories: include_directories('include'),
269*2b949d04SAndroid Build Coastguard Worker)
270*2b949d04SAndroid Build Coastguard Workerpkgconfig.generate(
271*2b949d04SAndroid Build Coastguard Worker    libxkbcommon,
272*2b949d04SAndroid Build Coastguard Worker    name: 'xkbcommon',
273*2b949d04SAndroid Build Coastguard Worker    filebase: 'xkbcommon',
274*2b949d04SAndroid Build Coastguard Worker    version: meson.project_version(),
275*2b949d04SAndroid Build Coastguard Worker    description: 'XKB API common to servers and clients',
276*2b949d04SAndroid Build Coastguard Worker)
277*2b949d04SAndroid Build Coastguard Worker
278*2b949d04SAndroid Build Coastguard Worker
279*2b949d04SAndroid Build Coastguard Worker# libxkbcommon-x11.
280*2b949d04SAndroid Build Coastguard Workerif get_option('enable-x11')
281*2b949d04SAndroid Build Coastguard Worker    xcb_dep = dependency('xcb', version: '>=1.10', required: false)
282*2b949d04SAndroid Build Coastguard Worker    xcb_xkb_dep = dependency('xcb-xkb', version: '>=1.10', required: false)
283*2b949d04SAndroid Build Coastguard Worker    if not xcb_dep.found() or not xcb_xkb_dep.found()
284*2b949d04SAndroid Build Coastguard Worker        error('''X11 support requires xcb-xkb >= 1.10 which was not found.
285*2b949d04SAndroid Build Coastguard WorkerYou can disable X11 support with -Denable-x11=false.''')
286*2b949d04SAndroid Build Coastguard Worker    endif
287*2b949d04SAndroid Build Coastguard Worker
288*2b949d04SAndroid Build Coastguard Worker    libxkbcommon_x11_sources = [
289*2b949d04SAndroid Build Coastguard Worker        'src/x11/keymap.c',
290*2b949d04SAndroid Build Coastguard Worker        'src/x11/state.c',
291*2b949d04SAndroid Build Coastguard Worker        'src/x11/util.c',
292*2b949d04SAndroid Build Coastguard Worker        'src/x11/x11-priv.h',
293*2b949d04SAndroid Build Coastguard Worker        'src/context.h',
294*2b949d04SAndroid Build Coastguard Worker        'src/context-priv.c',
295*2b949d04SAndroid Build Coastguard Worker        'src/keymap.h',
296*2b949d04SAndroid Build Coastguard Worker        'src/keymap-priv.c',
297*2b949d04SAndroid Build Coastguard Worker        'src/atom.h',
298*2b949d04SAndroid Build Coastguard Worker        'src/atom.c',
299*2b949d04SAndroid Build Coastguard Worker    ]
300*2b949d04SAndroid Build Coastguard Worker    libxkbcommon_x11_link_args = []
301*2b949d04SAndroid Build Coastguard Worker    libxkbcommon_x11_link_deps = []
302*2b949d04SAndroid Build Coastguard Worker    if have_version_script
303*2b949d04SAndroid Build Coastguard Worker        libxkbcommon_x11_link_args += '-Wl,--version-script=' + meson.source_root()/'xkbcommon-x11.map'
304*2b949d04SAndroid Build Coastguard Worker        libxkbcommon_x11_link_deps += 'xkbcommon-x11.map'
305*2b949d04SAndroid Build Coastguard Worker    elif cc.get_argument_syntax() == 'msvc'
306*2b949d04SAndroid Build Coastguard Worker        libxkbcommon_x11_def = custom_target('xkbcommon-x11.def',
307*2b949d04SAndroid Build Coastguard Worker            command: [map_to_def, '@INPUT@', '@OUTPUT@'],
308*2b949d04SAndroid Build Coastguard Worker            input: 'xkbcommon-x11.map',
309*2b949d04SAndroid Build Coastguard Worker            output: 'xkbcommon-x11.def',
310*2b949d04SAndroid Build Coastguard Worker        )
311*2b949d04SAndroid Build Coastguard Worker        libxkbcommon_x11_link_deps += libxkbcommon_x11_def
312*2b949d04SAndroid Build Coastguard Worker        libxkbcommon_x11_link_args += '/DEF:' + libxkbcommon_x11_def.full_path()
313*2b949d04SAndroid Build Coastguard Worker    endif
314*2b949d04SAndroid Build Coastguard Worker    libxkbcommon_x11 = library(
315*2b949d04SAndroid Build Coastguard Worker        'xkbcommon-x11',
316*2b949d04SAndroid Build Coastguard Worker        'include/xkbcommon/xkbcommon-x11.h',
317*2b949d04SAndroid Build Coastguard Worker        libxkbcommon_x11_sources,
318*2b949d04SAndroid Build Coastguard Worker        link_args: libxkbcommon_x11_link_args,
319*2b949d04SAndroid Build Coastguard Worker        link_depends: libxkbcommon_x11_link_deps,
320*2b949d04SAndroid Build Coastguard Worker        gnu_symbol_visibility: 'hidden',
321*2b949d04SAndroid Build Coastguard Worker        version: '0.0.0',
322*2b949d04SAndroid Build Coastguard Worker        install: true,
323*2b949d04SAndroid Build Coastguard Worker        include_directories: include_directories('src', 'include'),
324*2b949d04SAndroid Build Coastguard Worker        link_with: libxkbcommon,
325*2b949d04SAndroid Build Coastguard Worker        dependencies: [
326*2b949d04SAndroid Build Coastguard Worker            xcb_dep,
327*2b949d04SAndroid Build Coastguard Worker            xcb_xkb_dep,
328*2b949d04SAndroid Build Coastguard Worker        ],
329*2b949d04SAndroid Build Coastguard Worker    )
330*2b949d04SAndroid Build Coastguard Worker    install_headers(
331*2b949d04SAndroid Build Coastguard Worker        'include/xkbcommon/xkbcommon-x11.h',
332*2b949d04SAndroid Build Coastguard Worker        subdir: 'xkbcommon',
333*2b949d04SAndroid Build Coastguard Worker    )
334*2b949d04SAndroid Build Coastguard Worker    dep_libxkbcommon_x11 = declare_dependency(
335*2b949d04SAndroid Build Coastguard Worker        link_with: libxkbcommon_x11,
336*2b949d04SAndroid Build Coastguard Worker        include_directories: include_directories('include'),
337*2b949d04SAndroid Build Coastguard Worker    )
338*2b949d04SAndroid Build Coastguard Worker    pkgconfig.generate(
339*2b949d04SAndroid Build Coastguard Worker        libxkbcommon_x11,
340*2b949d04SAndroid Build Coastguard Worker        name: 'xkbcommon-x11',
341*2b949d04SAndroid Build Coastguard Worker        filebase: 'xkbcommon-x11',
342*2b949d04SAndroid Build Coastguard Worker        version: meson.project_version(),
343*2b949d04SAndroid Build Coastguard Worker        description: 'XKB API common to servers and clients - X11 support',
344*2b949d04SAndroid Build Coastguard Worker        requires: ['xkbcommon'],
345*2b949d04SAndroid Build Coastguard Worker        requires_private: ['xcb>=1.10', 'xcb-xkb>=1.10'],
346*2b949d04SAndroid Build Coastguard Worker    )
347*2b949d04SAndroid Build Coastguard Workerendif
348*2b949d04SAndroid Build Coastguard Worker
349*2b949d04SAndroid Build Coastguard Worker# libxkbregistry
350*2b949d04SAndroid Build Coastguard Workerif get_option('enable-xkbregistry')
351*2b949d04SAndroid Build Coastguard Worker    dep_libxml = dependency('libxml-2.0')
352*2b949d04SAndroid Build Coastguard Worker    deps_libxkbregistry = [dep_libxml]
353*2b949d04SAndroid Build Coastguard Worker    libxkbregistry_sources = [
354*2b949d04SAndroid Build Coastguard Worker        'src/registry.c',
355*2b949d04SAndroid Build Coastguard Worker        'src/utils.h',
356*2b949d04SAndroid Build Coastguard Worker        'src/utils.c',
357*2b949d04SAndroid Build Coastguard Worker        'src/util-list.h',
358*2b949d04SAndroid Build Coastguard Worker        'src/util-list.c',
359*2b949d04SAndroid Build Coastguard Worker    ]
360*2b949d04SAndroid Build Coastguard Worker    libxkbregistry_link_args = []
361*2b949d04SAndroid Build Coastguard Worker    libxkbregistry_link_deps = []
362*2b949d04SAndroid Build Coastguard Worker    if have_version_script
363*2b949d04SAndroid Build Coastguard Worker        libxkbregistry_link_args += '-Wl,--version-script=' + meson.source_root()/'xkbregistry.map'
364*2b949d04SAndroid Build Coastguard Worker        libxkbregistry_link_deps += 'xkbregistry.map'
365*2b949d04SAndroid Build Coastguard Worker    elif cc.get_argument_syntax() == 'msvc'
366*2b949d04SAndroid Build Coastguard Worker        libxkbregistry_def = custom_target('xkbregistry.def',
367*2b949d04SAndroid Build Coastguard Worker            command: [map_to_def, '@INPUT@', '@OUTPUT@'],
368*2b949d04SAndroid Build Coastguard Worker            input: 'xkbregistry.map',
369*2b949d04SAndroid Build Coastguard Worker            output: 'xkbregistry.def',
370*2b949d04SAndroid Build Coastguard Worker        )
371*2b949d04SAndroid Build Coastguard Worker        libxkbregistry_link_deps += libxkbregistry_def
372*2b949d04SAndroid Build Coastguard Worker        libxkbregistry_link_args += '/DEF:' + libxkbregistry_def.full_path()
373*2b949d04SAndroid Build Coastguard Worker    endif
374*2b949d04SAndroid Build Coastguard Worker    libxkbregistry = library(
375*2b949d04SAndroid Build Coastguard Worker        'xkbregistry',
376*2b949d04SAndroid Build Coastguard Worker        'include/xkbcommon/xkbregistry.h',
377*2b949d04SAndroid Build Coastguard Worker        libxkbregistry_sources,
378*2b949d04SAndroid Build Coastguard Worker        link_args: libxkbregistry_link_args,
379*2b949d04SAndroid Build Coastguard Worker        link_depends: libxkbregistry_link_deps,
380*2b949d04SAndroid Build Coastguard Worker        gnu_symbol_visibility: 'hidden',
381*2b949d04SAndroid Build Coastguard Worker        dependencies: deps_libxkbregistry,
382*2b949d04SAndroid Build Coastguard Worker        version: '0.0.0',
383*2b949d04SAndroid Build Coastguard Worker        install: true,
384*2b949d04SAndroid Build Coastguard Worker        include_directories: include_directories('src', 'include'),
385*2b949d04SAndroid Build Coastguard Worker    )
386*2b949d04SAndroid Build Coastguard Worker    install_headers(
387*2b949d04SAndroid Build Coastguard Worker        'include/xkbcommon/xkbregistry.h',
388*2b949d04SAndroid Build Coastguard Worker        subdir: 'xkbcommon',
389*2b949d04SAndroid Build Coastguard Worker    )
390*2b949d04SAndroid Build Coastguard Worker    pkgconfig.generate(
391*2b949d04SAndroid Build Coastguard Worker        libxkbregistry,
392*2b949d04SAndroid Build Coastguard Worker        name: 'xkbregistry',
393*2b949d04SAndroid Build Coastguard Worker        filebase: 'xkbregistry',
394*2b949d04SAndroid Build Coastguard Worker        version: meson.project_version(),
395*2b949d04SAndroid Build Coastguard Worker        description: 'XKB API to query available rules, models, layouts, variants and options',
396*2b949d04SAndroid Build Coastguard Worker    )
397*2b949d04SAndroid Build Coastguard Worker
398*2b949d04SAndroid Build Coastguard Worker    dep_libxkbregistry = declare_dependency(
399*2b949d04SAndroid Build Coastguard Worker        link_with: libxkbregistry,
400*2b949d04SAndroid Build Coastguard Worker        include_directories: include_directories('include'),
401*2b949d04SAndroid Build Coastguard Worker    )
402*2b949d04SAndroid Build Coastguard Workerendif
403*2b949d04SAndroid Build Coastguard Worker
404*2b949d04SAndroid Build Coastguard Workerman_pages = []
405*2b949d04SAndroid Build Coastguard Worker
406*2b949d04SAndroid Build Coastguard Worker# Tools
407*2b949d04SAndroid Build Coastguard Workerbuild_tools = get_option('enable-tools') and cc.has_header_symbol('getopt.h', 'getopt_long', prefix: '#define _GNU_SOURCE')
408*2b949d04SAndroid Build Coastguard Workerif build_tools
409*2b949d04SAndroid Build Coastguard Worker    libxkbcommon_tools_internal = static_library(
410*2b949d04SAndroid Build Coastguard Worker        'tools-internal',
411*2b949d04SAndroid Build Coastguard Worker        'tools/tools-common.h',
412*2b949d04SAndroid Build Coastguard Worker        'tools/tools-common.c',
413*2b949d04SAndroid Build Coastguard Worker        dependencies: dep_libxkbcommon,
414*2b949d04SAndroid Build Coastguard Worker    )
415*2b949d04SAndroid Build Coastguard Worker    tools_dep = declare_dependency(
416*2b949d04SAndroid Build Coastguard Worker        include_directories: [include_directories('tools', 'include')],
417*2b949d04SAndroid Build Coastguard Worker        link_with: libxkbcommon_tools_internal,
418*2b949d04SAndroid Build Coastguard Worker    )
419*2b949d04SAndroid Build Coastguard Worker
420*2b949d04SAndroid Build Coastguard Worker    executable('xkbcli', 'tools/xkbcli.c',
421*2b949d04SAndroid Build Coastguard Worker               dependencies: tools_dep, install: true)
422*2b949d04SAndroid Build Coastguard Worker    install_man('tools/xkbcli.1')
423*2b949d04SAndroid Build Coastguard Worker
424*2b949d04SAndroid Build Coastguard Worker    xkbcli_compile_keymap = executable('xkbcli-compile-keymap',
425*2b949d04SAndroid Build Coastguard Worker                                       'tools/compile-keymap.c',
426*2b949d04SAndroid Build Coastguard Worker                                       dependencies: tools_dep,
427*2b949d04SAndroid Build Coastguard Worker                                       install: true,
428*2b949d04SAndroid Build Coastguard Worker                                       install_dir: dir_libexec)
429*2b949d04SAndroid Build Coastguard Worker    install_man('tools/xkbcli-compile-keymap.1')
430*2b949d04SAndroid Build Coastguard Worker    # The same tool again, but with access to some private APIs.
431*2b949d04SAndroid Build Coastguard Worker    executable('compile-keymap',
432*2b949d04SAndroid Build Coastguard Worker               'tools/compile-keymap.c',
433*2b949d04SAndroid Build Coastguard Worker               libxkbcommon_sources,
434*2b949d04SAndroid Build Coastguard Worker               dependencies: [tools_dep],
435*2b949d04SAndroid Build Coastguard Worker               c_args: ['-DENABLE_PRIVATE_APIS'],
436*2b949d04SAndroid Build Coastguard Worker               include_directories: [include_directories('src', 'include')],
437*2b949d04SAndroid Build Coastguard Worker               install: false)
438*2b949d04SAndroid Build Coastguard Worker    executable('compose',
439*2b949d04SAndroid Build Coastguard Worker               'tools/compose.c',
440*2b949d04SAndroid Build Coastguard Worker               dependencies: tools_dep,
441*2b949d04SAndroid Build Coastguard Worker               include_directories: [include_directories('src', 'include')],
442*2b949d04SAndroid Build Coastguard Worker               install: false)
443*2b949d04SAndroid Build Coastguard Worker    configh_data.set10('HAVE_XKBCLI_COMPILE_KEYMAP', true)
444*2b949d04SAndroid Build Coastguard Worker    executable('xkbcli-how-to-type',
445*2b949d04SAndroid Build Coastguard Worker               'tools/how-to-type.c',
446*2b949d04SAndroid Build Coastguard Worker               dependencies: tools_dep,
447*2b949d04SAndroid Build Coastguard Worker               install: true,
448*2b949d04SAndroid Build Coastguard Worker               install_dir: dir_libexec)
449*2b949d04SAndroid Build Coastguard Worker    install_man('tools/xkbcli-how-to-type.1')
450*2b949d04SAndroid Build Coastguard Worker    configh_data.set10('HAVE_XKBCLI_HOW_TO_TYPE', true)
451*2b949d04SAndroid Build Coastguard Worker    if cc.has_header('linux/input.h')
452*2b949d04SAndroid Build Coastguard Worker        executable('xkbcli-interactive-evdev',
453*2b949d04SAndroid Build Coastguard Worker                   'tools/interactive-evdev.c',
454*2b949d04SAndroid Build Coastguard Worker                   dependencies: tools_dep,
455*2b949d04SAndroid Build Coastguard Worker                   install: true,
456*2b949d04SAndroid Build Coastguard Worker                   install_dir: dir_libexec)
457*2b949d04SAndroid Build Coastguard Worker        configh_data.set10('HAVE_XKBCLI_INTERACTIVE_EVDEV', true)
458*2b949d04SAndroid Build Coastguard Worker        install_man('tools/xkbcli-interactive-evdev.1')
459*2b949d04SAndroid Build Coastguard Worker    endif
460*2b949d04SAndroid Build Coastguard Worker    if get_option('enable-x11')
461*2b949d04SAndroid Build Coastguard Worker        x11_tools_dep = declare_dependency(
462*2b949d04SAndroid Build Coastguard Worker            link_with: libxkbcommon_x11,
463*2b949d04SAndroid Build Coastguard Worker            dependencies: [
464*2b949d04SAndroid Build Coastguard Worker                tools_dep,
465*2b949d04SAndroid Build Coastguard Worker                xcb_dep,
466*2b949d04SAndroid Build Coastguard Worker                xcb_xkb_dep,
467*2b949d04SAndroid Build Coastguard Worker            ],
468*2b949d04SAndroid Build Coastguard Worker        )
469*2b949d04SAndroid Build Coastguard Worker        executable('xkbcli-interactive-x11',
470*2b949d04SAndroid Build Coastguard Worker                   'tools/interactive-x11.c',
471*2b949d04SAndroid Build Coastguard Worker                   dependencies: x11_tools_dep,
472*2b949d04SAndroid Build Coastguard Worker                   install: true,
473*2b949d04SAndroid Build Coastguard Worker                   install_dir: dir_libexec)
474*2b949d04SAndroid Build Coastguard Worker        install_man('tools/xkbcli-interactive-x11.1')
475*2b949d04SAndroid Build Coastguard Worker        configh_data.set10('HAVE_XKBCLI_INTERACTIVE_X11', true)
476*2b949d04SAndroid Build Coastguard Worker    endif
477*2b949d04SAndroid Build Coastguard Worker    if get_option('enable-wayland')
478*2b949d04SAndroid Build Coastguard Worker        wayland_client_dep = dependency('wayland-client', version: '>=1.2.0', required: false)
479*2b949d04SAndroid Build Coastguard Worker        wayland_protocols_dep = dependency('wayland-protocols', version: '>=1.12', required: false)
480*2b949d04SAndroid Build Coastguard Worker        wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true)
481*2b949d04SAndroid Build Coastguard Worker        if not wayland_client_dep.found() or not wayland_protocols_dep.found() or not wayland_scanner_dep.found()
482*2b949d04SAndroid Build Coastguard Worker            error('''The Wayland xkbcli programs require wayland-client >= 1.2.0, wayland-protocols >= 1.7 which were not found.
483*2b949d04SAndroid Build Coastguard WorkerYou can disable the Wayland xkbcli programs with -Denable-wayland=false.''')
484*2b949d04SAndroid Build Coastguard Worker        endif
485*2b949d04SAndroid Build Coastguard Worker
486*2b949d04SAndroid Build Coastguard Worker        wayland_scanner = find_program(wayland_scanner_dep.get_pkgconfig_variable('wayland_scanner'))
487*2b949d04SAndroid Build Coastguard Worker        wayland_scanner_code_gen = generator(
488*2b949d04SAndroid Build Coastguard Worker            wayland_scanner,
489*2b949d04SAndroid Build Coastguard Worker            output: '@[email protected]',
490*2b949d04SAndroid Build Coastguard Worker            arguments: ['code', '@INPUT@', '@OUTPUT@'],
491*2b949d04SAndroid Build Coastguard Worker        )
492*2b949d04SAndroid Build Coastguard Worker        wayland_scanner_client_header_gen = generator(
493*2b949d04SAndroid Build Coastguard Worker            wayland_scanner,
494*2b949d04SAndroid Build Coastguard Worker            output: '@[email protected]',
495*2b949d04SAndroid Build Coastguard Worker            arguments: ['client-header', '@INPUT@', '@OUTPUT@'],
496*2b949d04SAndroid Build Coastguard Worker        )
497*2b949d04SAndroid Build Coastguard Worker        wayland_protocols_datadir = wayland_protocols_dep.get_pkgconfig_variable('pkgdatadir')
498*2b949d04SAndroid Build Coastguard Worker        xdg_shell_xml = wayland_protocols_datadir/'stable/xdg-shell/xdg-shell.xml'
499*2b949d04SAndroid Build Coastguard Worker        xdg_shell_sources = [
500*2b949d04SAndroid Build Coastguard Worker            wayland_scanner_code_gen.process(xdg_shell_xml),
501*2b949d04SAndroid Build Coastguard Worker            wayland_scanner_client_header_gen.process(xdg_shell_xml),
502*2b949d04SAndroid Build Coastguard Worker        ]
503*2b949d04SAndroid Build Coastguard Worker        executable('xkbcli-interactive-wayland',
504*2b949d04SAndroid Build Coastguard Worker                   'tools/interactive-wayland.c',
505*2b949d04SAndroid Build Coastguard Worker                   xdg_shell_sources,
506*2b949d04SAndroid Build Coastguard Worker                   dependencies: [tools_dep, wayland_client_dep],
507*2b949d04SAndroid Build Coastguard Worker                   install: true,
508*2b949d04SAndroid Build Coastguard Worker                   install_dir: dir_libexec)
509*2b949d04SAndroid Build Coastguard Worker        install_man('tools/xkbcli-interactive-wayland.1')
510*2b949d04SAndroid Build Coastguard Worker        configh_data.set10('HAVE_XKBCLI_INTERACTIVE_WAYLAND', true)
511*2b949d04SAndroid Build Coastguard Worker    endif
512*2b949d04SAndroid Build Coastguard Worker
513*2b949d04SAndroid Build Coastguard Worker    if get_option('enable-xkbregistry')
514*2b949d04SAndroid Build Coastguard Worker        configh_data.set10('HAVE_XKBCLI_LIST', true)
515*2b949d04SAndroid Build Coastguard Worker        executable('xkbcli-list',
516*2b949d04SAndroid Build Coastguard Worker                   'tools/registry-list.c',
517*2b949d04SAndroid Build Coastguard Worker                   dependencies: dep_libxkbregistry,
518*2b949d04SAndroid Build Coastguard Worker                   install: true,
519*2b949d04SAndroid Build Coastguard Worker                   install_dir: dir_libexec)
520*2b949d04SAndroid Build Coastguard Worker        install_man('tools/xkbcli-list.1')
521*2b949d04SAndroid Build Coastguard Worker    endif
522*2b949d04SAndroid Build Coastguard Workerendif
523*2b949d04SAndroid Build Coastguard Worker
524*2b949d04SAndroid Build Coastguard Worker
525*2b949d04SAndroid Build Coastguard Worker# xkeyboard-config "verifier"
526*2b949d04SAndroid Build Coastguard Workerxkct_config = configuration_data()
527*2b949d04SAndroid Build Coastguard Workerxkct_config.set('MESON_BUILD_ROOT', meson.build_root())
528*2b949d04SAndroid Build Coastguard Workerxkct_config.set('XKB_CONFIG_ROOT', XKBCONFIGROOT)
529*2b949d04SAndroid Build Coastguard Workerconfigure_file(input: 'test/xkeyboard-config-test.py.in',
530*2b949d04SAndroid Build Coastguard Worker               output: 'xkeyboard-config-test',
531*2b949d04SAndroid Build Coastguard Worker               configuration: xkct_config)
532*2b949d04SAndroid Build Coastguard Worker
533*2b949d04SAndroid Build Coastguard Worker# Tests
534*2b949d04SAndroid Build Coastguard Workertest_env = environment()
535*2b949d04SAndroid Build Coastguard Workertest_env.set('XKB_LOG_LEVEL', 'debug')
536*2b949d04SAndroid Build Coastguard Workertest_env.set('XKB_LOG_VERBOSITY', '10')
537*2b949d04SAndroid Build Coastguard Workertest_env.set('top_srcdir', meson.source_root())
538*2b949d04SAndroid Build Coastguard Workertest_env.set('top_builddir', meson.build_root())
539*2b949d04SAndroid Build Coastguard Workertest_env.set('HAVE_XKBCLI_INTERACTIVE_EVDEV', configh_data.get('HAVE_XKBCLI_INTERACTIVE_EVDEV', 0).to_string())
540*2b949d04SAndroid Build Coastguard Workertest_env.set('HAVE_XKBCLI_INTERACTIVE_WAYLAND', configh_data.get('HAVE_XKBCLI_INTERACTIVE_WAYLAND', 0).to_string())
541*2b949d04SAndroid Build Coastguard Workertest_env.set('HAVE_XKBCLI_INTERACTIVE_X11', configh_data.get('HAVE_XKBCLI_INTERACTIVE_X11', 0).to_string())
542*2b949d04SAndroid Build Coastguard Workertest_env.set('HAVE_XKBCLI_LIST', configh_data.get('HAVE_XKBCLI_LIST', 0).to_string())
543*2b949d04SAndroid Build Coastguard Worker
544*2b949d04SAndroid Build Coastguard Workertest_configh_data = configuration_data()
545*2b949d04SAndroid Build Coastguard Workertest_configh_data.set_quoted('TEST_XKB_CONFIG_ROOT', meson.source_root()/'test'/'data')
546*2b949d04SAndroid Build Coastguard Workerconfigure_file(output: 'test-config.h', configuration: test_configh_data)
547*2b949d04SAndroid Build Coastguard Worker
548*2b949d04SAndroid Build Coastguard Worker# Some tests need to use unexported symbols, so we link them against
549*2b949d04SAndroid Build Coastguard Worker# an internal copy of libxkbcommon with all symbols exposed.
550*2b949d04SAndroid Build Coastguard Workerlibxkbcommon_test_internal = static_library(
551*2b949d04SAndroid Build Coastguard Worker    'xkbcommon-test-internal',
552*2b949d04SAndroid Build Coastguard Worker    'test/common.c',
553*2b949d04SAndroid Build Coastguard Worker    'test/test.h',
554*2b949d04SAndroid Build Coastguard Worker    'test/evdev-scancodes.h',
555*2b949d04SAndroid Build Coastguard Worker    'bench/bench.c',
556*2b949d04SAndroid Build Coastguard Worker    'bench/bench.h',
557*2b949d04SAndroid Build Coastguard Worker    libxkbcommon_sources,
558*2b949d04SAndroid Build Coastguard Worker    include_directories: include_directories('src', 'include'),
559*2b949d04SAndroid Build Coastguard Worker)
560*2b949d04SAndroid Build Coastguard Workertest_dep = declare_dependency(
561*2b949d04SAndroid Build Coastguard Worker    include_directories: include_directories('src', 'include'),
562*2b949d04SAndroid Build Coastguard Worker    link_with: libxkbcommon_test_internal,
563*2b949d04SAndroid Build Coastguard Worker)
564*2b949d04SAndroid Build Coastguard Workerif get_option('enable-x11')
565*2b949d04SAndroid Build Coastguard Worker    libxkbcommon_x11_internal = static_library(
566*2b949d04SAndroid Build Coastguard Worker        'xkbcommon-x11-internal',
567*2b949d04SAndroid Build Coastguard Worker        libxkbcommon_x11_sources,
568*2b949d04SAndroid Build Coastguard Worker        include_directories: include_directories('src', 'include'),
569*2b949d04SAndroid Build Coastguard Worker        link_with: libxkbcommon_test_internal,
570*2b949d04SAndroid Build Coastguard Worker        dependencies: [
571*2b949d04SAndroid Build Coastguard Worker            xcb_dep,
572*2b949d04SAndroid Build Coastguard Worker            xcb_xkb_dep,
573*2b949d04SAndroid Build Coastguard Worker        ],
574*2b949d04SAndroid Build Coastguard Worker    )
575*2b949d04SAndroid Build Coastguard Worker    x11_test_dep = declare_dependency(
576*2b949d04SAndroid Build Coastguard Worker        link_with: libxkbcommon_x11_internal,
577*2b949d04SAndroid Build Coastguard Worker        dependencies: [
578*2b949d04SAndroid Build Coastguard Worker            test_dep,
579*2b949d04SAndroid Build Coastguard Worker            xcb_dep,
580*2b949d04SAndroid Build Coastguard Worker            xcb_xkb_dep,
581*2b949d04SAndroid Build Coastguard Worker        ],
582*2b949d04SAndroid Build Coastguard Worker    )
583*2b949d04SAndroid Build Coastguard Workerendif
584*2b949d04SAndroid Build Coastguard Workertest(
585*2b949d04SAndroid Build Coastguard Worker    'keysym',
586*2b949d04SAndroid Build Coastguard Worker    executable('test-keysym', 'test/keysym.c', dependencies: test_dep),
587*2b949d04SAndroid Build Coastguard Worker    env: test_env,
588*2b949d04SAndroid Build Coastguard Worker)
589*2b949d04SAndroid Build Coastguard Workertest(
590*2b949d04SAndroid Build Coastguard Worker    'keymap',
591*2b949d04SAndroid Build Coastguard Worker    executable('test-keymap', 'test/keymap.c', dependencies: test_dep),
592*2b949d04SAndroid Build Coastguard Worker    env: test_env,
593*2b949d04SAndroid Build Coastguard Worker)
594*2b949d04SAndroid Build Coastguard Workertest(
595*2b949d04SAndroid Build Coastguard Worker    'filecomp',
596*2b949d04SAndroid Build Coastguard Worker    executable('test-filecomp', 'test/filecomp.c', dependencies: test_dep),
597*2b949d04SAndroid Build Coastguard Worker    env: test_env,
598*2b949d04SAndroid Build Coastguard Worker)
599*2b949d04SAndroid Build Coastguard Worker# TODO: This test currently uses some functions that don't exist on Windows.
600*2b949d04SAndroid Build Coastguard Workerif cc.get_id() != 'msvc'
601*2b949d04SAndroid Build Coastguard Worker  test(
602*2b949d04SAndroid Build Coastguard Worker      'context',
603*2b949d04SAndroid Build Coastguard Worker      executable('test-context', 'test/context.c', dependencies: test_dep),
604*2b949d04SAndroid Build Coastguard Worker      env: test_env,
605*2b949d04SAndroid Build Coastguard Worker  )
606*2b949d04SAndroid Build Coastguard Workerendif
607*2b949d04SAndroid Build Coastguard Workertest(
608*2b949d04SAndroid Build Coastguard Worker    'rules-file',
609*2b949d04SAndroid Build Coastguard Worker    executable('test-rules-file', 'test/rules-file.c', dependencies: test_dep),
610*2b949d04SAndroid Build Coastguard Worker    env: test_env,
611*2b949d04SAndroid Build Coastguard Worker)
612*2b949d04SAndroid Build Coastguard Workertest(
613*2b949d04SAndroid Build Coastguard Worker    'rules-file-includes',
614*2b949d04SAndroid Build Coastguard Worker    executable('test-rules-file-includes', 'test/rules-file-includes.c', dependencies: test_dep),
615*2b949d04SAndroid Build Coastguard Worker    env: test_env,
616*2b949d04SAndroid Build Coastguard Worker)
617*2b949d04SAndroid Build Coastguard Workertest(
618*2b949d04SAndroid Build Coastguard Worker    'stringcomp',
619*2b949d04SAndroid Build Coastguard Worker    executable('test-stringcomp', 'test/stringcomp.c', dependencies: test_dep),
620*2b949d04SAndroid Build Coastguard Worker    env: test_env,
621*2b949d04SAndroid Build Coastguard Worker)
622*2b949d04SAndroid Build Coastguard Workertest(
623*2b949d04SAndroid Build Coastguard Worker    'buffercomp',
624*2b949d04SAndroid Build Coastguard Worker    executable('test-buffercomp', 'test/buffercomp.c', dependencies: test_dep),
625*2b949d04SAndroid Build Coastguard Worker    env: test_env,
626*2b949d04SAndroid Build Coastguard Worker)
627*2b949d04SAndroid Build Coastguard Workertest(
628*2b949d04SAndroid Build Coastguard Worker    'log',
629*2b949d04SAndroid Build Coastguard Worker    executable('test-log', 'test/log.c', dependencies: test_dep),
630*2b949d04SAndroid Build Coastguard Worker    env: test_env,
631*2b949d04SAndroid Build Coastguard Worker)
632*2b949d04SAndroid Build Coastguard Workertest(
633*2b949d04SAndroid Build Coastguard Worker    'atom',
634*2b949d04SAndroid Build Coastguard Worker    executable('test-atom', 'test/atom.c', dependencies: test_dep),
635*2b949d04SAndroid Build Coastguard Worker    env: test_env,
636*2b949d04SAndroid Build Coastguard Worker)
637*2b949d04SAndroid Build Coastguard Workertest(
638*2b949d04SAndroid Build Coastguard Worker    'utf8',
639*2b949d04SAndroid Build Coastguard Worker    executable('test-utf8', 'test/utf8.c', dependencies: test_dep),
640*2b949d04SAndroid Build Coastguard Worker    env: test_env,
641*2b949d04SAndroid Build Coastguard Worker)
642*2b949d04SAndroid Build Coastguard Workertest(
643*2b949d04SAndroid Build Coastguard Worker    'state',
644*2b949d04SAndroid Build Coastguard Worker    executable('test-state', 'test/state.c', dependencies: test_dep),
645*2b949d04SAndroid Build Coastguard Worker    env: test_env,
646*2b949d04SAndroid Build Coastguard Worker)
647*2b949d04SAndroid Build Coastguard Workertest(
648*2b949d04SAndroid Build Coastguard Worker    'keyseq',
649*2b949d04SAndroid Build Coastguard Worker    executable('test-keyseq', 'test/keyseq.c', dependencies: test_dep),
650*2b949d04SAndroid Build Coastguard Worker    env: test_env,
651*2b949d04SAndroid Build Coastguard Worker)
652*2b949d04SAndroid Build Coastguard Workertest(
653*2b949d04SAndroid Build Coastguard Worker    'rulescomp',
654*2b949d04SAndroid Build Coastguard Worker    executable('test-rulescomp', 'test/rulescomp.c', dependencies: test_dep),
655*2b949d04SAndroid Build Coastguard Worker    env: test_env,
656*2b949d04SAndroid Build Coastguard Worker)
657*2b949d04SAndroid Build Coastguard Workertest(
658*2b949d04SAndroid Build Coastguard Worker    'compose',
659*2b949d04SAndroid Build Coastguard Worker    executable('test-compose', 'test/compose.c', dependencies: test_dep),
660*2b949d04SAndroid Build Coastguard Worker    env: test_env,
661*2b949d04SAndroid Build Coastguard Worker)
662*2b949d04SAndroid Build Coastguard Workertest(
663*2b949d04SAndroid Build Coastguard Worker    'utils',
664*2b949d04SAndroid Build Coastguard Worker    executable('test-utils', 'test/utils.c', dependencies: test_dep),
665*2b949d04SAndroid Build Coastguard Worker    env: test_env,
666*2b949d04SAndroid Build Coastguard Worker)
667*2b949d04SAndroid Build Coastguard Workertest(
668*2b949d04SAndroid Build Coastguard Worker    'symbols-leak-test',
669*2b949d04SAndroid Build Coastguard Worker    find_program('test/symbols-leak-test.py'),
670*2b949d04SAndroid Build Coastguard Worker    env: test_env,
671*2b949d04SAndroid Build Coastguard Worker    suite: ['python-tests'],
672*2b949d04SAndroid Build Coastguard Worker)
673*2b949d04SAndroid Build Coastguard Workerif get_option('enable-x11')
674*2b949d04SAndroid Build Coastguard Worker    test(
675*2b949d04SAndroid Build Coastguard Worker        'x11',
676*2b949d04SAndroid Build Coastguard Worker        executable('test-x11', 'test/x11.c', dependencies: x11_test_dep),
677*2b949d04SAndroid Build Coastguard Worker        env: test_env,
678*2b949d04SAndroid Build Coastguard Worker    )
679*2b949d04SAndroid Build Coastguard Worker    # test/x11comp is meant to be run, but it is (temporarily?) disabled.
680*2b949d04SAndroid Build Coastguard Worker    # See: https://github.com/xkbcommon/libxkbcommon/issues/30
681*2b949d04SAndroid Build Coastguard Worker    executable('test-x11comp', 'test/x11comp.c', dependencies: x11_test_dep)
682*2b949d04SAndroid Build Coastguard Workerendif
683*2b949d04SAndroid Build Coastguard Workerif get_option('enable-xkbregistry')
684*2b949d04SAndroid Build Coastguard Worker    test(
685*2b949d04SAndroid Build Coastguard Worker        'registry',
686*2b949d04SAndroid Build Coastguard Worker        executable('test-registry', 'test/registry.c',
687*2b949d04SAndroid Build Coastguard Worker                   include_directories: include_directories('src'),
688*2b949d04SAndroid Build Coastguard Worker                   dependencies: dep_libxkbregistry),
689*2b949d04SAndroid Build Coastguard Worker        env: test_env,
690*2b949d04SAndroid Build Coastguard Worker    )
691*2b949d04SAndroid Build Coastguard Workerendif
692*2b949d04SAndroid Build Coastguard Workerif build_tools
693*2b949d04SAndroid Build Coastguard Worker    test('tool-option-parsing',
694*2b949d04SAndroid Build Coastguard Worker         find_program('test/tool-option-parsing.py'),
695*2b949d04SAndroid Build Coastguard Worker         env: test_env,
696*2b949d04SAndroid Build Coastguard Worker         suite: ['python-tests'])
697*2b949d04SAndroid Build Coastguard Worker
698*2b949d04SAndroid Build Coastguard Worker    # A set of keysyms to test for. Add one or two symbols to this array
699*2b949d04SAndroid Build Coastguard Worker    # whenever the xorgproto gets updated to make sure we resolve them.
700*2b949d04SAndroid Build Coastguard Worker    keysyms_to_test = [
701*2b949d04SAndroid Build Coastguard Worker        'XF86Macro23',
702*2b949d04SAndroid Build Coastguard Worker    ]
703*2b949d04SAndroid Build Coastguard Worker
704*2b949d04SAndroid Build Coastguard Worker    env = environment()
705*2b949d04SAndroid Build Coastguard Worker    env.set('XKB_CONFIG_ROOT', meson.source_root()/'test'/'data')
706*2b949d04SAndroid Build Coastguard Worker    foreach keysym: keysyms_to_test
707*2b949d04SAndroid Build Coastguard Worker        test('keysym-test-@0@'.format(keysym),
708*2b949d04SAndroid Build Coastguard Worker             find_program('test/test-keysym.py'),
709*2b949d04SAndroid Build Coastguard Worker             env: env,
710*2b949d04SAndroid Build Coastguard Worker             args: [keysym, '--tool', xkbcli_compile_keymap],
711*2b949d04SAndroid Build Coastguard Worker             suite: ['python-tests'])
712*2b949d04SAndroid Build Coastguard Worker    endforeach
713*2b949d04SAndroid Build Coastguard Workerendif
714*2b949d04SAndroid Build Coastguard Worker
715*2b949d04SAndroid Build Coastguard Workervalgrind = find_program('valgrind', required: false)
716*2b949d04SAndroid Build Coastguard Workerif valgrind.found()
717*2b949d04SAndroid Build Coastguard Worker    add_test_setup('valgrind',
718*2b949d04SAndroid Build Coastguard Worker        exe_wrapper: [valgrind,
719*2b949d04SAndroid Build Coastguard Worker                       '--leak-check=full',
720*2b949d04SAndroid Build Coastguard Worker                       '--track-origins=yes',
721*2b949d04SAndroid Build Coastguard Worker                       '--gen-suppressions=all',
722*2b949d04SAndroid Build Coastguard Worker                       '--error-exitcode=99'],
723*2b949d04SAndroid Build Coastguard Worker        timeout_multiplier : 10)
724*2b949d04SAndroid Build Coastguard Workerelse
725*2b949d04SAndroid Build Coastguard Worker    message('valgrind not found, disabling valgrind test setup')
726*2b949d04SAndroid Build Coastguard Workerendif
727*2b949d04SAndroid Build Coastguard Worker
728*2b949d04SAndroid Build Coastguard Worker
729*2b949d04SAndroid Build Coastguard Worker# Fuzzing target programs.
730*2b949d04SAndroid Build Coastguard Workerexecutable('fuzz-keymap', 'fuzz/keymap/target.c', dependencies: test_dep)
731*2b949d04SAndroid Build Coastguard Workerexecutable('fuzz-compose', 'fuzz/compose/target.c', dependencies: test_dep)
732*2b949d04SAndroid Build Coastguard Worker
733*2b949d04SAndroid Build Coastguard Worker
734*2b949d04SAndroid Build Coastguard Worker# Benchmarks.
735*2b949d04SAndroid Build Coastguard Workerbench_env = environment()
736*2b949d04SAndroid Build Coastguard Workerbench_env.set('top_srcdir', meson.source_root())
737*2b949d04SAndroid Build Coastguard Workerbenchmark(
738*2b949d04SAndroid Build Coastguard Worker    'key-proc',
739*2b949d04SAndroid Build Coastguard Worker    executable('bench-key-proc', 'bench/key-proc.c', dependencies: test_dep),
740*2b949d04SAndroid Build Coastguard Worker    env: bench_env,
741*2b949d04SAndroid Build Coastguard Worker)
742*2b949d04SAndroid Build Coastguard Workerbenchmark(
743*2b949d04SAndroid Build Coastguard Worker    'rules',
744*2b949d04SAndroid Build Coastguard Worker    executable('bench-rules', 'bench/rules.c', dependencies: test_dep),
745*2b949d04SAndroid Build Coastguard Worker    env: bench_env,
746*2b949d04SAndroid Build Coastguard Worker)
747*2b949d04SAndroid Build Coastguard Workerbenchmark(
748*2b949d04SAndroid Build Coastguard Worker    'rulescomp',
749*2b949d04SAndroid Build Coastguard Worker    executable('bench-rulescomp', 'bench/rulescomp.c', dependencies: test_dep),
750*2b949d04SAndroid Build Coastguard Worker    env: bench_env,
751*2b949d04SAndroid Build Coastguard Worker)
752*2b949d04SAndroid Build Coastguard Workerbenchmark(
753*2b949d04SAndroid Build Coastguard Worker    'compose',
754*2b949d04SAndroid Build Coastguard Worker    executable('bench-compose', 'bench/compose.c', dependencies: test_dep),
755*2b949d04SAndroid Build Coastguard Worker    env: bench_env,
756*2b949d04SAndroid Build Coastguard Worker)
757*2b949d04SAndroid Build Coastguard Workerbenchmark(
758*2b949d04SAndroid Build Coastguard Worker    'atom',
759*2b949d04SAndroid Build Coastguard Worker    executable('bench-atom', 'bench/atom.c', dependencies: test_dep),
760*2b949d04SAndroid Build Coastguard Worker    env: bench_env,
761*2b949d04SAndroid Build Coastguard Worker)
762*2b949d04SAndroid Build Coastguard Workerif get_option('enable-x11')
763*2b949d04SAndroid Build Coastguard Worker  benchmark(
764*2b949d04SAndroid Build Coastguard Worker      'x11',
765*2b949d04SAndroid Build Coastguard Worker      executable('bench-x11', 'bench/x11.c', dependencies: x11_test_dep),
766*2b949d04SAndroid Build Coastguard Worker      env: bench_env,
767*2b949d04SAndroid Build Coastguard Worker  )
768*2b949d04SAndroid Build Coastguard Workerendif
769*2b949d04SAndroid Build Coastguard Worker
770*2b949d04SAndroid Build Coastguard Worker
771*2b949d04SAndroid Build Coastguard Worker# Documentation.
772*2b949d04SAndroid Build Coastguard Workerif get_option('enable-docs')
773*2b949d04SAndroid Build Coastguard Worker    doxygen = find_program('doxygen', required: false)
774*2b949d04SAndroid Build Coastguard Worker    if not doxygen.found()
775*2b949d04SAndroid Build Coastguard Worker        error('''Documentation requires doxygen which was not found.
776*2b949d04SAndroid Build Coastguard WorkerYou can disable the documentation with -Denable-docs=false.''')
777*2b949d04SAndroid Build Coastguard Worker    endif
778*2b949d04SAndroid Build Coastguard Worker    doxygen_wrapper = find_program('scripts/doxygen-wrapper')
779*2b949d04SAndroid Build Coastguard Worker
780*2b949d04SAndroid Build Coastguard Worker    doxygen_input = [
781*2b949d04SAndroid Build Coastguard Worker        'README.md',
782*2b949d04SAndroid Build Coastguard Worker        'doc/doxygen-extra.css',
783*2b949d04SAndroid Build Coastguard Worker        'doc/quick-guide.md',
784*2b949d04SAndroid Build Coastguard Worker        'doc/compat.md',
785*2b949d04SAndroid Build Coastguard Worker        'doc/user-configuration.md',
786*2b949d04SAndroid Build Coastguard Worker        'doc/rules-format.md',
787*2b949d04SAndroid Build Coastguard Worker        'doc/keymap-format-text-v1.md',
788*2b949d04SAndroid Build Coastguard Worker        'include/xkbcommon/xkbcommon.h',
789*2b949d04SAndroid Build Coastguard Worker        'include/xkbcommon/xkbcommon-names.h',
790*2b949d04SAndroid Build Coastguard Worker        'include/xkbcommon/xkbcommon-x11.h',
791*2b949d04SAndroid Build Coastguard Worker        'include/xkbcommon/xkbcommon-compose.h',
792*2b949d04SAndroid Build Coastguard Worker        'include/xkbcommon/xkbregistry.h',
793*2b949d04SAndroid Build Coastguard Worker    ]
794*2b949d04SAndroid Build Coastguard Worker    doxygen_data = configuration_data()
795*2b949d04SAndroid Build Coastguard Worker    doxygen_data.set('PACKAGE_NAME', meson.project_name())
796*2b949d04SAndroid Build Coastguard Worker    doxygen_data.set('PACKAGE_VERSION', meson.project_version())
797*2b949d04SAndroid Build Coastguard Worker    doxygen_data.set('INPUT', ' '.join(doxygen_input))
798*2b949d04SAndroid Build Coastguard Worker    doxygen_data.set('OUTPUT_DIRECTORY', meson.build_root())
799*2b949d04SAndroid Build Coastguard Worker    doxyfile = configure_file(
800*2b949d04SAndroid Build Coastguard Worker        input: 'doc/Doxyfile.in',
801*2b949d04SAndroid Build Coastguard Worker        output: 'Doxyfile',
802*2b949d04SAndroid Build Coastguard Worker        configuration: doxygen_data,
803*2b949d04SAndroid Build Coastguard Worker    )
804*2b949d04SAndroid Build Coastguard Worker    # TODO: Meson should provide this.
805*2b949d04SAndroid Build Coastguard Worker    docdir = get_option('datadir')/'doc'/meson.project_name()
806*2b949d04SAndroid Build Coastguard Worker    custom_target(
807*2b949d04SAndroid Build Coastguard Worker        'doc',
808*2b949d04SAndroid Build Coastguard Worker        input: [doxyfile] + doxygen_input,
809*2b949d04SAndroid Build Coastguard Worker        output: 'html',
810*2b949d04SAndroid Build Coastguard Worker        command: [doxygen_wrapper, doxygen.path(), meson.build_root()/'Doxyfile', meson.source_root()],
811*2b949d04SAndroid Build Coastguard Worker        install: true,
812*2b949d04SAndroid Build Coastguard Worker        install_dir: docdir,
813*2b949d04SAndroid Build Coastguard Worker        build_by_default: true,
814*2b949d04SAndroid Build Coastguard Worker    )
815*2b949d04SAndroid Build Coastguard Workerendif
816*2b949d04SAndroid Build Coastguard Worker
817*2b949d04SAndroid Build Coastguard Workerconfigure_file(output: 'config.h', configuration: configh_data)
818*2b949d04SAndroid Build Coastguard Worker
819*2b949d04SAndroid Build Coastguard Worker
820*2b949d04SAndroid Build Coastguard Worker# Stable variables for projects using xkbcommon as a subproject.
821*2b949d04SAndroid Build Coastguard Worker# These variables should not be renamed.
822*2b949d04SAndroid Build Coastguard Workerlibxkbcommon_dep = dep_libxkbcommon
823*2b949d04SAndroid Build Coastguard Workerif get_option('enable-x11')
824*2b949d04SAndroid Build Coastguard Worker  libxkbcommon_x11_dep = dep_libxkbcommon_x11
825*2b949d04SAndroid Build Coastguard Workerendif
826*2b949d04SAndroid Build Coastguard Workerif get_option('enable-xkbregistry')
827*2b949d04SAndroid Build Coastguard Worker  libxkbregistry_dep = dep_libxkbregistry
828*2b949d04SAndroid Build Coastguard Workerendif
829