-
Notifications
You must be signed in to change notification settings - Fork 51
/
meson.build
103 lines (88 loc) · 2.37 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
94
95
96
97
98
99
100
101
102
103
project(
'swayidle',
'c',
version: '1.8.0',
license: 'MIT',
meson_version: '>=0.59.0',
default_options: [
'c_std=c11',
'warning_level=2',
'werror=true',
],
)
add_project_arguments([
'-D_POSIX_C_SOURCE=200809L',
'-Wno-unused-parameter',
'-Wno-unused-result',
'-Wundef',
'-Wvla',
], language: 'c')
wayland_client = dependency('wayland-client')
wayland_protos = dependency('wayland-protocols', version: '>=1.27')
wayland_server = dependency('wayland-server')
logind = dependency('lib' + get_option('logind-provider'), required: get_option('logind'))
scdoc = find_program('scdoc', required: get_option('man-pages'))
wayland_scanner = dependency('wayland-scanner', native: true, version: '>=1.14.91')
wayland_scanner_prog = find_program(wayland_scanner.get_variable('wayland_scanner'), native: true)
wl_protocol_dir = wayland_protos.get_variable('pkgdatadir')
wayland_scanner_code = generator(
wayland_scanner_prog,
output: '@BASENAME@-protocol.c',
arguments: ['private-code', '@INPUT@', '@OUTPUT@'],
)
wayland_scanner_client = generator(
wayland_scanner_prog,
output: '@BASENAME@-client-protocol.h',
arguments: ['client-header', '@INPUT@', '@OUTPUT@'],
)
protos = [
wl_protocol_dir / 'staging/ext-idle-notify/ext-idle-notify-v1.xml',
]
protos_src = []
foreach xml : protos
protos_src += wayland_scanner_code.process(xml)
protos_src += wayland_scanner_client.process(xml)
endforeach
conf_data = configuration_data()
conf_data.set_quoted('SYSCONFDIR', get_option('prefix') / get_option('sysconfdir'))
conf_data.set10('HAVE_SYSTEMD', false)
conf_data.set10('HAVE_ELOGIND', false)
if logind.found()
conf_data.set10('HAVE_' + get_option('logind-provider').to_upper(), true)
endif
config_header = configure_file(output: 'config.h', configuration: conf_data)
executable(
'swayidle', [
'main.c',
protos_src,
config_header,
],
dependencies: [
wayland_client,
wayland_server,
logind,
],
install: true,
)
if scdoc.found()
mandir = get_option('mandir')
man_files = [
'swayidle.1.scd',
]
foreach filename : man_files
topic = filename.split('.')[-3].split('/')[-1]
section = filename.split('.')[-2]
output = '@0@.@1@'.format(topic, section)
custom_target(
output,
input: filename,
output: output,
command: scdoc,
feed: true,
capture: true,
install: true,
install_dir: '@0@/man@1@'.format(mandir, section)
)
endforeach
endif
subdir('completions')