-
Notifications
You must be signed in to change notification settings - Fork 158
/
Copy pathmeson.build
93 lines (78 loc) · 2.34 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
project('jo', 'c',
version: '1.9',
license: 'GPL-2.0-or-later',
meson_version: '>=0.57.0',
default_options: ['warning_level=3', 'optimization=2'])
PACKAGE_VERSION = meson.project_version()
cc = meson.get_compiler('c')
headers = [
'stddef.h',
'stdint.h',
'stdlib.h',
'string.h',
'unistd.h',
'stdbool.h'
]
functions = [
'strchr',
'strrchr',
'strlcpy',
'strlcat',
'snprintf',
'pledge',
'err',
'errx'
]
foreach h: headers
cc.has_header(h, required: true)
endforeach
foreach f: functions
add_project_arguments(
'-DHAVE_@0@='.format(f.to_upper()) +
cc.has_function(f).to_int().to_string(),
language: 'c')
endforeach
add_project_arguments('-DPACKAGE_VERSION="@0@"'.format(PACKAGE_VERSION),
language: 'c')
pandoc = find_program('pandoc', required: false)
if not pandoc.found()
warning('pandoc not found, man pages rebuild will not be possible')
jo1 = 'jo.1'
else
pandoc_commands = [pandoc, '-s', '-w', 'man', '-f', 'markdown', '-o']
jo1 = custom_target('jo.1',
output: 'jo.1',
input: 'jo.pandoc',
build_always_stale: true,
command: [pandoc_commands, '@OUTPUT@', '@INPUT@']).full_path()
run_command(pandoc_commands,
join_paths(meson.current_build_dir(), 'jo.1'),
join_paths(meson.current_source_dir(), 'jo.pandoc'),
check: false)
custom_target('jo.md',
output: 'jo.md',
input: 'jo.pandoc',
build_always_stale: true,
command: [pandoc, '-s', '-w', 'gfm', '-f', 'markdown-smart', '-o', '@OUTPUT@', '@INPUT@'])
endif
install_man(jo1)
bashcomp = dependency('bash-completion', required: false)
if bashcomp.found()
bashcompdir = bashcomp.get_variable(pkgconfig: 'completionsdir')
else
bashcompdir = join_paths(get_option('sysconfdir'), 'bash_completion.d')
endif
install_data('jo.bash', install_dir: bashcompdir)
m_dep = cc.find_library('m', required : false)
executable('jo',
'jo.c',
'base64.c',
'base64.h',
'json.c',
dependencies: m_dep,
install: true)
summary({'Prefix': get_option('prefix'),
'C compiler': cc.get_id(),
'Pandoc': pandoc,
'Bash completion': join_paths(bashcompdir, 'jo.bash'),
})