xkeyboard-config
/
meson.build
134 строки · 4.9 Кб
1project('xkeyboard-config',
2version: '2.43',
3license: 'MIT/Expat',
4meson_version: '>= 0.56.0')
5
6dir_data = join_paths(get_option('prefix'), get_option('datadir'))
7dir_xkb_base = join_paths(dir_data, 'X11', 'xkb')
8dir_xkb_rules = join_paths(dir_xkb_base, 'rules')
9dir_man7 = join_paths(get_option('prefix'), get_option('mandir'), 'man7')
10dir_pkgconfig = join_paths(dir_data, 'pkgconfig')
11
12i18n = import('i18n')
13
14pkgconfig = import('pkgconfig')
15pkgconfig.generate(
16filebase: 'xkeyboard-config',
17name: 'XKeyboardConfig',
18description: 'X Keyboard configuration data',
19version: meson.project_version(),
20variables: [
21'datadir=@0@'.format(dir_data),
22'xkb_base=@0@'.format(dir_xkb_base),
23],
24install_dir: dir_pkgconfig,
25dataonly: true,
26)
27
28# KcG.T only need to be installed as-is
29foreach dir: ['compat', 'geometry', 'keycodes', 'types']
30install_subdir(dir,
31exclude_files: ['custom'],
32install_dir: dir_xkb_base)
33endforeach
34
35# Rules and symbols are a bit more complicated
36subdir('rules')
37subdir('symbols')
38
39# man page
40xsltproc = find_program('xsltproc', required: false)
41if xsltproc.found()
42man_substs = configuration_data()
43man_substs.set('xkb_base', dir_xkb_base)
44# emulating what the macros do for vendorversion, hardcoding the man
45# suffixes
46man_substs.set('vendorversion', '"@0@ @1@" "X Version 11"'.format(meson.project_name(), meson.project_version()))
47xsl = configure_file(input: 'man/man.xsl',
48output: 'man.xsl',
49configuration: man_substs,
50install: false)
51# evdev_ruleset is set by rules/meson.build
52manpage = custom_target('man page',
53output: 'xkeyboard-config.7',
54build_by_default: true,
55command: [xsltproc, '-nonet', xsl, evdev_ruleset],
56capture: true,
57install:true,
58install_dir: dir_man7)
59
60verify_group_names = find_program('tests/verify-group-names.sh')
61test('verify group names', verify_group_names)
62endif
63
64# If needed, copy our data files over to the build directory
65# so we can use the builddir as XKB_CONFIG_ROOT
66pymod = import('python')
67python = pymod.find_installation('python3',
68modules: ['pytest'],
69required: false)
70pytest = find_program('pytest-3', 'pytest', required: false)
71enable_pytest = python.found() and pytest.found()
72if get_option('non-latin-layouts-list') or enable_pytest
73foreach dir: ['compat', 'geometry', 'keycodes', 'symbols', 'types']
74# Copy directory but exclude some symbols files that are generated
75# to include compatibility sections
76run_command(
77'tests/copydir.py',
78dir,
79dir == 'symbols' ? compat_symbols : [],
80check: true
81)
82endforeach
83endif
84
85# Latin layout list
86# Needed e.g. for a distribution installer, in order to check if user can
87# input required Latin characters and if not add automatically a US layout.
88if get_option('non-latin-layouts-list')
89python = pymod.find_installation('python3',
90modules: ['yaml'],
91required: true)
92xkbcli = find_program('xkbcli', required: true)
93pyregistry = find_program('scripts/registry.py', required: true)
94
95# Both rules sets are expected to provide the same results, but are
96# nevertheless generated for completeness.
97foreach ruleset: ['base', 'evdev']
98custom_target('non-latin-layouts-list-@0@'.format(ruleset),
99build_by_default: true,
100command: [pyregistry,
101'--xkb-root', meson.project_build_root(),
102'--rules', ruleset,
103'layouts',
104'--non-latin',
105'--csv', '@OUTPUT@'],
106output: 'non-latin-layouts-@0@.csv'.format(ruleset),
107install: false)
108endforeach
109endif
110
111# pytest suite
112if enable_pytest
113pytest_args = ['--verbose', '--log-level=DEBUG']
114if get_option('compat-rules')
115pytest_args += [
116'tests',
117'--layout-compat-config', layout_mappings,
118'--layout-compat-config', variant_mappings,
119]
120endif
121# use pytest xdist if available, it really speeds up the tests cases
122optional_python_modules = ['xdist']
123if pymod.find_installation('python3', modules: optional_python_modules, required: false).found()
124pytest_args += ['-n', 'auto']
125endif
126
127test('pytest', pytest,
128args: pytest_args,
129env: ['XKB_CONFIG_ROOT=@0@'.format(meson.project_build_root())],
130workdir: meson.project_source_root(),
131timeout: 60)
132endif
133
134subdir('po')
135