-
Notifications
You must be signed in to change notification settings - Fork 71
/
meson.build
75 lines (64 loc) · 2.14 KB
/
meson.build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
enabled_completions = get_option('enabled-shell-completions')
if enabled_completions == []
summary(
'generated shell completions',
false,
section: 'Optional build components',
bool_yn: true,
)
subdir_done()
endif
crazy_complete_min_version = '0.3.0'
crazy_complete_exe = find_program(
'crazy-complete',
native: true,
version: '>=' + crazy_complete_min_version,
disabler: true,
required: get_option('generate-shell-completions'),
)
if crazy_complete_exe.found() and crazy_complete_exe.version() != 'unknown'
crazy_complete_version = crazy_complete_exe.version()
if crazy_complete_version.version_compare('!=' + crazy_complete_min_version)
warning(
f'Version of crazy-complete @crazy_complete_version@ doesn\'t match the',
f'expected version @crazy_complete_min_version@. Build will proceed, but',
f'consider using version @crazy_complete_min_version@ if you have',
'problems with your version.'
)
endif
endif
summary(
'generated shell completions',
crazy_complete_exe.found(),
section: 'Optional build components',
bool_yn: true,
)
shells = {
'bash': ['@0@', get_option('datadir') / 'bash-completion/completions'],
'fish': ['@[email protected]', get_option('datadir') / 'fish/vendor_completions.d'],
'zsh' : ['_@0@', get_option('datadir') / 'zsh/site-functions'],
}
completion_targets = []
foreach shell, out_file_data : shells
out_file = out_file_data[0]
install_dir = out_file_data[1]
if shell in enabled_completions
completion_targets += custom_target(
command: [crazy_complete_exe, shell, '@INPUT@', '--output', '@OUTPUT@'],
input: 'j4-dmenu-desktop.yaml',
output: out_file.format('j4-dmenu-desktop'),
install: true,
install_dir: install_dir,
)
if get_option('generate-tests-shell-completion')
completion_targets += custom_target(
command: [crazy_complete_exe, shell, '@INPUT@', '--output', '@OUTPUT@'],
input: 'j4-dmenu-tests.yaml',
output: out_file.format('j4-dmenu-tests'),
install: true,
install_dir: install_dir,
)
endif
endif
endforeach
alias_target('shell-completions', completion_targets)