Форк
0
/
meson.build 
134 строки · 4.9 Кб
1
project('xkeyboard-config',
2
        version: '2.43',
3
        license: 'MIT/Expat',
4
        meson_version: '>= 0.56.0')
5

6
dir_data        = join_paths(get_option('prefix'), get_option('datadir'))
7
dir_xkb_base    = join_paths(dir_data, 'X11', 'xkb')
8
dir_xkb_rules   = join_paths(dir_xkb_base, 'rules')
9
dir_man7        = join_paths(get_option('prefix'), get_option('mandir'), 'man7')
10
dir_pkgconfig   = join_paths(dir_data, 'pkgconfig')
11

12
i18n = import('i18n')
13

14
pkgconfig = import('pkgconfig')
15
pkgconfig.generate(
16
    filebase: 'xkeyboard-config',
17
    name: 'XKeyboardConfig',
18
    description: 'X Keyboard configuration data',
19
    version: meson.project_version(),
20
    variables: [
21
        'datadir=@0@'.format(dir_data),
22
        'xkb_base=@0@'.format(dir_xkb_base),
23
    ],
24
    install_dir: dir_pkgconfig,
25
    dataonly: true,
26
)
27

28
# KcG.T only need to be installed as-is
29
foreach dir: ['compat', 'geometry', 'keycodes', 'types']
30
    install_subdir(dir,
31
                   exclude_files: ['custom'],
32
                   install_dir: dir_xkb_base)
33
endforeach
34

35
# Rules and symbols are a bit more complicated
36
subdir('rules')
37
subdir('symbols')
38

39
# man page
40
xsltproc = find_program('xsltproc', required: false)
41
if xsltproc.found()
42
  man_substs = configuration_data()
43
  man_substs.set('xkb_base', dir_xkb_base)
44
  # emulating what the macros do for vendorversion, hardcoding the man
45
  # suffixes
46
  man_substs.set('vendorversion', '"@0@ @1@" "X Version 11"'.format(meson.project_name(), meson.project_version()))
47
  xsl = configure_file(input: 'man/man.xsl',
48
                       output: 'man.xsl',
49
                       configuration: man_substs,
50
                       install: false)
51
  # evdev_ruleset is set by rules/meson.build
52
  manpage = custom_target('man page',
53
                          output: 'xkeyboard-config.7',
54
                          build_by_default: true,
55
                          command: [xsltproc, '-nonet', xsl, evdev_ruleset],
56
                          capture: true,
57
                          install:true,
58
                          install_dir: dir_man7)
59

60
  verify_group_names = find_program('tests/verify-group-names.sh')
61
  test('verify group names', verify_group_names)
62
endif
63

64
# If needed, copy our data files over to the build directory
65
# so we can use the builddir as XKB_CONFIG_ROOT
66
pymod = import('python')
67
python = pymod.find_installation('python3',
68
                                 modules: ['pytest'],
69
                                 required: false)
70
pytest = find_program('pytest-3', 'pytest', required: false)
71
enable_pytest = python.found() and pytest.found()
72
if get_option('non-latin-layouts-list') or enable_pytest
73
    foreach dir: ['compat', 'geometry', 'keycodes', 'symbols', 'types']
74
        # Copy directory but exclude some symbols files that are generated
75
        # to include compatibility sections
76
        run_command(
77
            'tests/copydir.py',
78
            dir,
79
            dir == 'symbols' ? compat_symbols : [],
80
            check: true
81
        )
82
    endforeach
83
endif
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.
88
if get_option('non-latin-layouts-list')
89
    python = pymod.find_installation('python3',
90
                                     modules: ['yaml'],
91
                                     required: true)
92
    xkbcli = find_program('xkbcli', required: true)
93
    pyregistry = 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.
97
    foreach ruleset: ['base', 'evdev']
98
        custom_target('non-latin-layouts-list-@0@'.format(ruleset),
99
                      build_by_default: true,
100
                      command: [pyregistry,
101
                                '--xkb-root', meson.project_build_root(),
102
                                '--rules', ruleset,
103
                                'layouts',
104
                                '--non-latin',
105
                                '--csv', '@OUTPUT@'],
106
                      output: 'non-latin-layouts-@0@.csv'.format(ruleset),
107
                      install: false)
108
    endforeach
109
endif
110

111
# pytest suite
112
if enable_pytest
113
    pytest_args = ['--verbose', '--log-level=DEBUG']
114
    if get_option('compat-rules')
115
        pytest_args += [
116
            'tests',
117
            '--layout-compat-config', layout_mappings,
118
            '--layout-compat-config', variant_mappings,
119
        ]
120
    endif
121
    # use pytest xdist if available, it really speeds up the tests cases
122
    optional_python_modules = ['xdist']
123
    if pymod.find_installation('python3', modules: optional_python_modules, required: false).found()
124
        pytest_args += ['-n', 'auto']
125
    endif
126

127
    test('pytest', pytest,
128
         args: pytest_args,
129
         env: ['XKB_CONFIG_ROOT=@0@'.format(meson.project_build_root())],
130
         workdir: meson.project_source_root(),
131
         timeout: 60)
132
endif
133

134
subdir('po')
135

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.