meson.build: registry list is dependent on getopt_long
[platform/upstream/libxkbcommon.git] / meson.build
1 project(
2     'libxkbcommon',
3     'c',
4     version: '0.10.0',
5     default_options: [
6         'c_std=c99',
7         'warning_level=2',
8         'b_lundef=true',
9     ],
10     meson_version : '>= 0.49.0',
11 )
12 pkgconfig = import('pkgconfig')
13 cc = meson.get_compiler('c')
14
15
16 # Compiler flags.
17 foreach cflag: [
18     '-fvisibility=hidden',
19     '-fno-strict-aliasing',
20     '-fsanitize-undefined-trap-on-error',
21     '-Wextra',
22     '-Wno-unused-parameter',
23     '-Wno-missing-field-initializers',
24     '-Wpointer-arith',
25     '-Wmissing-declarations',
26     '-Wformat=2',
27     '-Wstrict-prototypes',
28     '-Wmissing-prototypes',
29     '-Wnested-externs',
30     '-Wbad-function-cast',
31     '-Wshadow',
32     '-Wlogical-op',
33     '-Wdate-time',
34     '-Wwrite-strings',
35     '-Wno-documentation-deprecated-sync',
36 ]
37     if cc.has_argument(cflag)
38         add_project_arguments(cflag, language: 'c')
39     endif
40 endforeach
41
42
43 # The XKB config root.
44 XKBCONFIGROOT = get_option('xkb-config-root')
45 if XKBCONFIGROOT == ''
46     xkeyboard_config_dep = dependency('xkeyboard-config', required: false)
47     if xkeyboard_config_dep.found()
48         XKBCONFIGROOT = xkeyboard_config_dep.get_pkgconfig_variable('xkb_base')
49     else
50         XKBCONFIGROOT = join_paths(get_option('prefix'), get_option('datadir'), 'X11', 'xkb')
51   endif
52 endif
53
54
55 # The X locale directory for compose.
56 XLOCALEDIR = get_option('x-locale-root')
57 if XLOCALEDIR == ''
58     XLOCALEDIR = join_paths(get_option('prefix'), get_option('datadir'), 'X11', 'locale')
59 endif
60
61
62 # config.h.
63 configh_data = configuration_data()
64 # Like AC_USE_SYSTEM_EXTENSIONS, what #define to use to get extensions
65 # beyond the base POSIX function set.
66 if host_machine.system() == 'sunos'
67   system_extensions = '__EXTENSIONS__'
68 else
69   system_extensions = '_GNU_SOURCE'
70 endif
71 configh_data.set(system_extensions, 1)
72 system_ext_define = '#define ' + system_extensions
73 configh_data.set_quoted('DFLT_XKB_CONFIG_ROOT', XKBCONFIGROOT)
74 configh_data.set_quoted('XLOCALEDIR', XLOCALEDIR)
75 configh_data.set_quoted('DEFAULT_XKB_RULES', get_option('default-rules'))
76 configh_data.set_quoted('DEFAULT_XKB_MODEL', get_option('default-model'))
77 configh_data.set_quoted('DEFAULT_XKB_LAYOUT', get_option('default-layout'))
78 if get_option('default-variant') != ''
79     configh_data.set_quoted('DEFAULT_XKB_VARIANT', get_option('default-variant'))
80 else
81     configh_data.set('DEFAULT_XKB_VARIANT', 'NULL')
82 endif
83 if get_option('default-options') != ''
84     configh_data.set_quoted('DEFAULT_XKB_OPTIONS', get_option('default-options'))
85 else
86     configh_data.set('DEFAULT_XKB_OPTIONS', 'NULL')
87 endif
88 if cc.links('int main(){if(__builtin_expect(1<0,0)){}}', name: '__builtin_expect')
89     configh_data.set('HAVE___BUILTIN_EXPECT', 1)
90 endif
91 if cc.has_header_symbol('unistd.h', 'eaccess', prefix: system_ext_define)
92     configh_data.set('HAVE_EACCESS', 1)
93 endif
94 if cc.has_header_symbol('unistd.h', 'euidaccess', prefix: system_ext_define)
95     configh_data.set('HAVE_EUIDACCESS', 1)
96 endif
97 if cc.has_header_symbol('sys/mman.h', 'mmap')
98     configh_data.set('HAVE_MMAP', 1)
99 endif
100 if cc.has_header_symbol('stdlib.h', 'mkostemp', prefix: system_ext_define)
101     configh_data.set('HAVE_MKOSTEMP', 1)
102 endif
103 if cc.has_header_symbol('fcntl.h', 'posix_fallocate', prefix: system_ext_define)
104     configh_data.set('HAVE_POSIX_FALLOCATE', 1)
105 endif
106 if cc.has_header_symbol('string.h', 'strndup', prefix: system_ext_define)
107     configh_data.set('HAVE_STRNDUP', 1)
108 endif
109 if cc.has_header_symbol('stdio.h', 'asprintf', prefix: system_ext_define)
110     configh_data.set('HAVE_ASPRINTF', 1)
111 elif cc.has_header_symbol('stdio.h', 'vasprintf', prefix: system_ext_define)
112     configh_data.set('HAVE_VASPRINTF', 1)
113 endif
114 if cc.has_header_symbol('stdlib.h', 'secure_getenv', prefix: system_ext_define)
115     configh_data.set('HAVE_SECURE_GETENV', 1)
116 elif cc.has_header_symbol('stdlib.h', '__secure_getenv', prefix: system_ext_define)
117     configh_data.set('HAVE___SECURE_GETENV', 1)
118 else
119     message('C library does not support secure_getenv, using getenv instead')
120 endif
121 have_getopt_long = cc.has_header_symbol('getopt.h', 'getopt_long',
122                                         prefix: '#define _GNU_SOURCE')
123
124 # Silence some security & deprecation warnings on MSVC
125 # for some unix/C functions we use.
126 # https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4996?view=vs-2019
127 configh_data.set('_CRT_SECURE_NO_WARNINGS', 1)
128 configh_data.set('_CRT_NONSTDC_NO_WARNINGS', 1)
129 configh_data.set('_CRT_NONSTDC_NO_DEPRECATE', 1)
130 # Reduce unnecessary includes on MSVC.
131 configh_data.set('WIN32_LEAN_AND_MEAN', 1)
132 configure_file(output: 'config.h', configuration: configh_data)
133
134
135 # Supports -Wl,--version-script?
136 have_version_script = cc.links(
137     'int main(){}',
138     args: '-Wl,--version-script=' + join_paths(meson.source_root(), 'xkbcommon.map'),
139     name: '-Wl,--version-script',
140 )
141
142
143 # libxkbcommon.
144 # Note: we use some yacc extensions, which work with either GNU bison
145 # (preferred) or byacc (with backtracking enabled).
146 bison = find_program('bison', 'win_bison', required: false)
147 if bison.found()
148     yacc_gen = generator(
149         bison,
150         output: ['@BASENAME@.c', '@BASENAME@.h'],
151         arguments: ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@', '-p _xkbcommon_'],
152     )
153 else
154     byacc = find_program('byacc', required: false)
155     if byacc.found()
156         yacc_gen = generator(
157             byacc,
158             output: ['@BASENAME@.c', '@BASENAME@.h'],
159             arguments: ['@INPUT@', '-H', '@OUTPUT1@', '-o', '@OUTPUT0@', '-p _xkbcommon_'],
160         )
161     else
162         error('Could not find a compatible YACC program (bison or byacc)')
163     endif
164 endif
165 libxkbcommon_sources = [
166     'src/compose/parser.c',
167     'src/compose/parser.h',
168     'src/compose/paths.c',
169     'src/compose/paths.h',
170     'src/compose/state.c',
171     'src/compose/table.c',
172     'src/compose/table.h',
173     'src/xkbcomp/action.c',
174     'src/xkbcomp/action.h',
175     'src/xkbcomp/ast.h',
176     'src/xkbcomp/ast-build.c',
177     'src/xkbcomp/ast-build.h',
178     'src/xkbcomp/compat.c',
179     'src/xkbcomp/expr.c',
180     'src/xkbcomp/expr.h',
181     'src/xkbcomp/include.c',
182     'src/xkbcomp/include.h',
183     'src/xkbcomp/keycodes.c',
184     'src/xkbcomp/keymap.c',
185     'src/xkbcomp/keymap-dump.c',
186     'src/xkbcomp/keywords.c',
187     yacc_gen.process('src/xkbcomp/parser.y'),
188     'src/xkbcomp/parser-priv.h',
189     'src/xkbcomp/rules.c',
190     'src/xkbcomp/rules.h',
191     'src/xkbcomp/scanner.c',
192     'src/xkbcomp/symbols.c',
193     'src/xkbcomp/types.c',
194     'src/xkbcomp/vmod.c',
195     'src/xkbcomp/vmod.h',
196     'src/xkbcomp/xkbcomp.c',
197     'src/xkbcomp/xkbcomp-priv.h',
198     'src/atom.c',
199     'src/atom.h',
200     'src/context.c',
201     'src/context.h',
202     'src/context-priv.c',
203     'src/darray.h',
204     'src/keysym.c',
205     'src/keysym.h',
206     'src/keysym-utf.c',
207     'src/ks_tables.h',
208     'src/keymap.c',
209     'src/keymap.h',
210     'src/keymap-priv.c',
211     'src/scanner-utils.h',
212     'src/state.c',
213     'src/text.c',
214     'src/text.h',
215     'src/utf8.c',
216     'src/utf8.h',
217     'src/utils.c',
218     'src/utils.h',
219 ]
220 libxkbcommon_link_args = []
221 if have_version_script
222     libxkbcommon_link_args += '-Wl,--version-script=' + join_paths(meson.source_root(), 'xkbcommon.map')
223 endif
224 libxkbcommon = library(
225     'xkbcommon',
226     'xkbcommon/xkbcommon.h',
227     libxkbcommon_sources,
228     link_args: libxkbcommon_link_args,
229     link_depends: 'xkbcommon.map',
230     version: '0.0.0',
231     install: true,
232     include_directories: include_directories('src'),
233 )
234 install_headers(
235     'xkbcommon/xkbcommon.h',
236     'xkbcommon/xkbcommon-compat.h',
237     'xkbcommon/xkbcommon-compose.h',
238     'xkbcommon/xkbcommon-keysyms.h',
239     'xkbcommon/xkbcommon-names.h',
240     subdir: 'xkbcommon',
241 )
242 pkgconfig.generate(
243     libxkbcommon,
244     name: 'xkbcommon',
245     filebase: 'xkbcommon',
246     version: meson.project_version(),
247     description: 'XKB API common to servers and clients',
248 )
249
250
251 # libxkbcommon-x11.
252 if get_option('enable-x11')
253     xcb_dep = dependency('xcb', version: '>=1.10', required: false)
254     xcb_xkb_dep = dependency('xcb-xkb', version: '>=1.10', required: false)
255     if not xcb_dep.found() or not xcb_xkb_dep.found()
256         error('''X11 support requires xcb-xkb >= 1.10 which was not found.
257 You can disable X11 support with -Denable-x11=false.''')
258     endif
259
260     libxkbcommon_x11_sources = [
261         'src/x11/keymap.c',
262         'src/x11/state.c',
263         'src/x11/util.c',
264         'src/x11/x11-priv.h',
265         'src/context.h',
266         'src/context-priv.c',
267         'src/keymap.h',
268         'src/keymap-priv.c',
269         'src/atom.h',
270         'src/atom.c',
271     ]
272     libxkbcommon_x11_link_args = []
273     if have_version_script
274         libxkbcommon_x11_link_args += '-Wl,--version-script=' + join_paths(meson.source_root(), 'xkbcommon-x11.map')
275     endif
276     libxkbcommon_x11 = library(
277         'xkbcommon-x11',
278         'xkbcommon/xkbcommon-x11.h',
279         libxkbcommon_x11_sources,
280         link_args: libxkbcommon_x11_link_args,
281         link_depends: 'xkbcommon-x11.map',
282         version: '0.0.0',
283         install: true,
284         include_directories: include_directories('src'),
285         link_with: libxkbcommon,
286         dependencies: [
287             xcb_dep,
288             xcb_xkb_dep,
289         ],
290     )
291     install_headers(
292         'xkbcommon/xkbcommon-x11.h',
293         subdir: 'xkbcommon',
294     )
295     pkgconfig.generate(
296         libxkbcommon_x11,
297         name: 'xkbcommon-x11',
298         filebase: 'xkbcommon-x11',
299         version: meson.project_version(),
300         description: 'XKB API common to servers and clients - X11 support',
301         requires: ['xkbcommon'],
302         requires_private: ['xcb>=1.10', 'xcb-xkb>=1.10'],
303     )
304 endif
305
306 # libxkbregistry
307 if get_option('enable-xkbregistry')
308     dep_libxml = dependency('libxml-2.0')
309     deps_libxkbregistry = [dep_libxml]
310     libxkbregistry_sources = [
311         'src/registry.c',
312         'src/utils.h',
313         'src/utils.c',
314         'src/util-list.h',
315         'src/util-list.c',
316     ]
317     libxkbregistry_link_args = []
318     if have_version_script
319         libxkbregistry_link_args += '-Wl,--version-script=' + join_paths(meson.source_root(), 'xkbregistry.map')
320     endif
321     libxkbregistry = library(
322         'xkbregistry',
323         'xkbcommon/xkbregistry.h',
324         libxkbregistry_sources,
325         link_args: libxkbregistry_link_args,
326         link_depends: 'xkbregistry.map',
327         dependencies: deps_libxkbregistry,
328         version: '0.0.0',
329         install: true,
330         include_directories: include_directories('src'),
331     )
332     install_headers(
333         'xkbcommon/xkbregistry.h',
334         subdir: 'xkbcommon',
335     )
336     pkgconfig.generate(
337         libxkbregistry,
338         name: 'xkbregistry',
339         filebase: 'xkbregistry',
340         version: meson.project_version(),
341         description: 'XKB API to query available rules, models, layouts, variants and options',
342     )
343
344     dep_libxkbregistry = declare_dependency(
345                                 include_directories: include_directories('xkbcommon'),
346                                 link_with: libxkbregistry
347                                 )
348     if have_getopt_long
349         executable('xkbcommon-registry-list',
350                    'tools/registry-list.c',
351                    dependencies: dep_libxkbregistry,
352                    install: false)
353     endif
354 endif
355
356 # Tests
357 test_env = environment()
358 test_env.set('XKB_LOG_LEVEL', 'debug')
359 test_env.set('XKB_LOG_VERBOSITY', '10')
360 test_env.set('top_srcdir', meson.source_root())
361 test_env.set('top_builddir', meson.build_root())
362
363 test_configh_data = configuration_data()
364 test_configh_data.set_quoted('TEST_XKB_CONFIG_ROOT', join_paths(meson.source_root(), 'test', 'data'))
365 configure_file(output: 'test-config.h', configuration: test_configh_data)
366
367 # Some tests need to use unexported symbols, so we link them against
368 # an internal copy of libxkbcommon with all symbols exposed.
369 libxkbcommon_test_internal = static_library(
370     'xkbcommon-test-internal',
371     'test/common.c',
372     'test/test.h',
373     'test/evdev-scancodes.h',
374     libxkbcommon_sources,
375     include_directories: include_directories('src'),
376 )
377 test_dep = declare_dependency(
378     include_directories: include_directories('src'),
379     link_with: libxkbcommon_test_internal,
380 )
381 if get_option('enable-x11')
382     libxkbcommon_x11_internal = static_library(
383         'xkbcommon-x11-internal',
384         libxkbcommon_x11_sources,
385         include_directories: include_directories('src'),
386         link_with: libxkbcommon_test_internal,
387         dependencies: [
388             xcb_dep,
389             xcb_xkb_dep,
390         ],
391     )
392     x11_test_dep = declare_dependency(
393         link_with: libxkbcommon_x11_internal,
394         dependencies: [
395             test_dep,
396             xcb_dep,
397             xcb_xkb_dep,
398         ],
399     )
400 endif
401 test(
402     'keysym',
403     executable('test-keysym', 'test/keysym.c', dependencies: test_dep),
404     env: test_env,
405 )
406 test(
407     'keymap',
408     executable('test-keymap', 'test/keymap.c', dependencies: test_dep),
409     env: test_env,
410 )
411 test(
412     'filecomp',
413     executable('test-filecomp', 'test/filecomp.c', dependencies: test_dep),
414     env: test_env,
415 )
416 # TODO: This test currently uses some functions that don't exist on Windows.
417 if cc.get_id() != 'msvc'
418   test(
419       'context',
420       executable('test-context', 'test/context.c', dependencies: test_dep),
421       env: test_env,
422   )
423 endif
424 test(
425     'rules-file',
426     executable('test-rules-file', 'test/rules-file.c', dependencies: test_dep),
427     env: test_env,
428 )
429 test(
430     'rules-file-includes',
431     executable('test-rules-file-includes', 'test/rules-file-includes.c', dependencies: test_dep),
432     env: test_env,
433 )
434 test(
435     'stringcomp',
436     executable('test-stringcomp', 'test/stringcomp.c', dependencies: test_dep),
437     env: test_env,
438 )
439 test(
440     'buffercomp',
441     executable('test-buffercomp', 'test/buffercomp.c', dependencies: test_dep),
442     env: test_env,
443 )
444 test(
445     'log',
446     executable('test-log', 'test/log.c', dependencies: test_dep),
447     env: test_env,
448 )
449 test(
450     'atom',
451     executable('test-atom', 'test/atom.c', dependencies: test_dep),
452     env: test_env,
453 )
454 test(
455     'utf8',
456     executable('test-utf8', 'test/utf8.c', dependencies: test_dep),
457     env: test_env,
458 )
459 test(
460     'state',
461     executable('test-state', 'test/state.c', dependencies: test_dep),
462     env: test_env,
463 )
464 test(
465     'keyseq',
466     executable('test-keyseq', 'test/keyseq.c', dependencies: test_dep),
467     env: test_env,
468 )
469 test(
470     'rulescomp',
471     executable('test-rulescomp', 'test/rulescomp.c', dependencies: test_dep),
472     env: test_env,
473 )
474 test(
475     'compose',
476     executable('test-compose', 'test/compose.c', dependencies: test_dep),
477     env: test_env,
478 )
479 test(
480     'utils',
481     executable('test-utils', 'test/utils.c', dependencies: test_dep),
482     env: test_env,
483 )
484 test(
485     'symbols-leak-test',
486     find_program('test/symbols-leak-test.py'),
487     env: test_env,
488     suite: ['python-tests'],
489 )
490 if get_option('enable-x11')
491     test(
492         'x11',
493         executable('test-x11', 'test/x11.c', dependencies: x11_test_dep),
494         env: test_env,
495     )
496     # test/x11comp is meant to be run, but it is (temporarily?) disabled.
497     # See: https://github.com/xkbcommon/libxkbcommon/issues/30
498     executable('test-x11comp', 'test/x11comp.c', dependencies: x11_test_dep)
499 endif
500 if get_option('enable-xkbregistry')
501     test(
502         'registry',
503         executable('test-registry', 'test/registry.c',
504                    include_directories: include_directories('src'),
505                    dependencies: dep_libxkbregistry),
506         env: test_env,
507     )
508 endif
509
510 valgrind = find_program('valgrind', required: false)
511 if valgrind.found()
512     add_test_setup('valgrind',
513         exe_wrapper: [valgrind,
514                        '--leak-check=full',
515                        '--track-origins=yes',
516                        '--gen-suppressions=all',
517                        '--error-exitcode=99'],
518         timeout_multiplier : 10)
519 else
520     message('valgrind not found, disabling valgrind test setup')
521 endif
522
523
524 # Fuzzing target programs.
525 executable('fuzz-keymap', 'fuzz/keymap/target.c', dependencies: test_dep)
526 executable('fuzz-compose', 'fuzz/compose/target.c', dependencies: test_dep)
527
528
529 # Demo programs.
530 libxkbcommon_tools_internal = static_library(
531     'tools-internal',
532     'tools/tools-common.h',
533     'tools/tools-common.c',
534     libxkbcommon_sources,
535     include_directories: include_directories('src'),
536 )
537 tools_dep = declare_dependency(
538     include_directories: [include_directories('src'), include_directories('tools')],
539     link_with: libxkbcommon_tools_internal,
540 )
541
542 if have_getopt_long
543     executable('xkbcommon-rmlvo-to-keymap', 'tools/rmlvo-to-keymap.c', dependencies: tools_dep)
544     executable('xkbcommon-how-to-type', 'tools/how-to-type.c', dependencies: tools_dep)
545 endif
546 if cc.has_header('linux/input.h')
547     executable('xkbcommon-interactive-evdev', 'tools/interactive-evdev.c', dependencies: tools_dep)
548 endif
549 if get_option('enable-x11')
550     x11_tools_dep = declare_dependency(
551         link_with: libxkbcommon_x11_internal,
552         dependencies: [
553             tools_dep,
554             xcb_dep,
555             xcb_xkb_dep,
556         ],
557     )
558     executable('xkbcommon-interactive-x11', 'tools/interactive-x11.c', dependencies: x11_tools_dep)
559 endif
560 if get_option('enable-wayland')
561     wayland_client_dep = dependency('wayland-client', version: '>=1.2.0', required: false)
562     wayland_protocols_dep = dependency('wayland-protocols', version: '>=1.12', required: false)
563     wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true)
564     if not wayland_client_dep.found() or not wayland_protocols_dep.found() or not wayland_scanner_dep.found()
565         error('''The Wayland demo programs require wayland-client >= 1.2.0, wayland-protocols >= 1.7 which were not found.
566 You can disable the Wayland demo programs with -Denable-wayland=false.''')
567     endif
568
569     wayland_scanner = find_program(wayland_scanner_dep.get_pkgconfig_variable('wayland_scanner'))
570     wayland_scanner_code_gen = generator(
571         wayland_scanner,
572         output: '@BASENAME@-protocol.c',
573         arguments: ['code', '@INPUT@', '@OUTPUT@'],
574     )
575     wayland_scanner_client_header_gen = generator(
576         wayland_scanner,
577         output: '@BASENAME@-client-protocol.h',
578         arguments: ['client-header', '@INPUT@', '@OUTPUT@'],
579     )
580     wayland_protocols_datadir = wayland_protocols_dep.get_pkgconfig_variable('pkgdatadir')
581     xdg_shell_xml = join_paths(wayland_protocols_datadir, 'stable/xdg-shell/xdg-shell.xml')
582     xdg_shell_sources = [
583         wayland_scanner_code_gen.process(xdg_shell_xml),
584         wayland_scanner_client_header_gen.process(xdg_shell_xml),
585     ]
586     executable('xkbcommon-interactive-wayland',
587                'tools/interactive-wayland.c',
588                xdg_shell_sources,
589                dependencies: [tools_dep, wayland_client_dep])
590 endif
591
592 # xkeyboard-config "verifier"
593 xkct_config = configuration_data()
594 xkct_config.set('MESON_BUILD_ROOT', meson.build_root())
595 xkct_config.set('XKB_CONFIG_ROOT', XKBCONFIGROOT)
596 configure_file(input: 'test/xkeyboard-config-test.py.in',
597                output: 'xkeyboard-config-test',
598                configuration: xkct_config)
599
600
601 # Benchmarks.
602 libxkbcommon_bench_internal = static_library(
603     'xkbcommon-bench-internal',
604     'bench/bench.c',
605     'bench/bench.h',
606     link_with: libxkbcommon_test_internal,
607 )
608 bench_dep = declare_dependency(
609     include_directories: include_directories('src'),
610     link_with: libxkbcommon_bench_internal,
611 )
612 bench_env = environment()
613 bench_env.set('top_srcdir', meson.source_root())
614 benchmark(
615     'key-proc',
616     executable('bench-key-proc', 'bench/key-proc.c', dependencies: bench_dep),
617     env: bench_env,
618 )
619 benchmark(
620     'rules',
621     executable('bench-rules', 'bench/rules.c', dependencies: bench_dep),
622     env: bench_env,
623 )
624 benchmark(
625     'rulescomp',
626     executable('bench-rulescomp', 'bench/rulescomp.c', dependencies: bench_dep),
627     env: bench_env,
628 )
629 benchmark(
630     'compose',
631     executable('bench-compose', 'bench/compose.c', dependencies: bench_dep),
632     env: bench_env,
633 )
634
635
636 # Documentation.
637 if get_option('enable-docs')
638     doxygen = find_program('doxygen', required: false)
639     if not doxygen.found()
640         error('''Documentation requires doxygen which was not found.
641 You can disable the documentation with -Denable-docs=false.''')
642     endif
643     doxygen_wrapper = find_program('scripts/doxygen-wrapper')
644
645     doxygen_input = [
646         'README.md',
647         'doc/doxygen-extra.css',
648         'doc/quick-guide.md',
649         'doc/compat.md',
650         'doc/user-configuration.md',
651         'doc/rules-format.md',
652         'xkbcommon/xkbcommon.h',
653         'xkbcommon/xkbcommon-names.h',
654         'xkbcommon/xkbcommon-x11.h',
655         'xkbcommon/xkbcommon-compose.h',
656         'xkbcommon/xkbregistry.h',
657     ]
658     doxygen_data = configuration_data()
659     doxygen_data.set('PACKAGE_NAME', meson.project_name())
660     doxygen_data.set('PACKAGE_VERSION', meson.project_version())
661     doxygen_data.set('INPUT', ' '.join(doxygen_input))
662     doxygen_data.set('OUTPUT_DIRECTORY', meson.build_root())
663     doxyfile = configure_file(
664         input: 'doc/Doxyfile.in',
665         output: 'Doxyfile',
666         configuration: doxygen_data,
667     )
668     # TODO: Meson should provide this.
669     docdir = join_paths(get_option('datadir'), 'doc', meson.project_name())
670     custom_target(
671         'doc',
672         input: [doxyfile] + doxygen_input,
673         output: 'html',
674         command: [doxygen_wrapper, doxygen.path(), join_paths(meson.build_root(), 'Doxyfile'), meson.source_root()],
675         install: true,
676         install_dir: docdir,
677         build_by_default: true,
678     )
679 endif