1bb3a541cSmrgproject('xkeyboard-config',
2caa6d561Smrg        version: '2.38',
3bb3a541cSmrg        license: 'MIT/Expat',
4bb3a541cSmrg        meson_version: '>= 0.54.0')
5bb3a541cSmrg
6bb3a541cSmrgdir_data        = join_paths(get_option('prefix'), get_option('datadir'))
7bb3a541cSmrgdir_xkb_base    = join_paths(dir_data, 'X11', 'xkb')
8bb3a541cSmrgdir_xkb_rules   = join_paths(dir_xkb_base, 'rules')
9bb3a541cSmrgdir_man7        = join_paths(get_option('prefix'), get_option('mandir'), 'man7')
10bb3a541cSmrgdir_pkgconfig   = join_paths(dir_data, 'pkgconfig')
11bb3a541cSmrg
12bb3a541cSmrgi18n = import('i18n')
13bb3a541cSmrg
14bb3a541cSmrgpkgconfig = import('pkgconfig')
15bb3a541cSmrgpkgconfig.generate(
16bb3a541cSmrg    filebase: 'xkeyboard-config',
17bb3a541cSmrg    name: 'XKeyboardConfig',
18bb3a541cSmrg    description: 'X Keyboard configuration data',
19bb3a541cSmrg    version: meson.project_version(),
20bb3a541cSmrg    variables: [
21bb3a541cSmrg        'datadir=@0@'.format(dir_data),
22bb3a541cSmrg        'xkb_base=@0@'.format(dir_xkb_base),
23bb3a541cSmrg    ],
24bb3a541cSmrg    install_dir: dir_pkgconfig,
25bb3a541cSmrg    dataonly: true,
26bb3a541cSmrg)
27bb3a541cSmrg
28bb3a541cSmrg# KcGST only need to be installed as-is
29bb3a541cSmrgforeach dir: ['compat', 'geometry', 'keycodes', 'symbols', 'types']
30bb3a541cSmrg    install_subdir(dir,
31bb3a541cSmrg                   exclude_files: ['Makefile.am'],
32bb3a541cSmrg                   install_dir: dir_xkb_base)
33bb3a541cSmrgendforeach
34bb3a541cSmrg
35bb3a541cSmrg# Rules are a bit more complicated
36bb3a541cSmrgsubdir('rules')
37bb3a541cSmrg
38bb3a541cSmrg# man page
39bb3a541cSmrgxsltproc = find_program('xsltproc', required: false)
40bb3a541cSmrgif xsltproc.found()
41bb3a541cSmrg  man_substs = configuration_data()
42bb3a541cSmrg  man_substs.set('xkb_base', dir_xkb_base)
43bb3a541cSmrg  # emulating what the macros do for vendorversion, hardcoding the man
44bb3a541cSmrg  # suffixes
45bb3a541cSmrg  man_substs.set('vendorversion', '"@0@ @1@" "X Version 11"'.format(meson.project_name(), meson.project_version()))
46bb3a541cSmrg  xsl = configure_file(input: 'man/man.xsl',
47bb3a541cSmrg                       output: 'man.xsl',
48bb3a541cSmrg                       configuration: man_substs,
49bb3a541cSmrg                       install: false)
50bb3a541cSmrg  # evdev_ruleset is set by rules/meson.build
51bb3a541cSmrg  manpage = custom_target('man page',
52bb3a541cSmrg                          output: 'xkeyboard-config.7',
53bb3a541cSmrg                          build_by_default: true,
54bb3a541cSmrg                          command: [xsltproc, '-nonet', xsl, evdev_ruleset],
55bb3a541cSmrg                          capture: true,
56bb3a541cSmrg                          install:true,
57bb3a541cSmrg                          install_dir: dir_man7)
58bb3a541cSmrg
59bb3a541cSmrgendif
60bb3a541cSmrg
61bb3a541cSmrgsubdir('po')
62