forked from swaywm/swayidle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.build
152 lines (128 loc) · 3.43 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
project(
'swayidle',
'c',
version: '1.7',
license: 'MIT',
meson_version: '>=0.48.0',
default_options: [
'c_std=c11',
'warning_level=2',
'werror=true',
],
)
add_project_arguments(
[
'-Wno-unused-parameter',
'-Wno-unused-result',
'-Wundef',
'-Wvla',
],
language: 'c',
)
wayland_client = dependency('wayland-client')
wayland_protos = dependency('wayland-protocols', version: '>=1.14')
wayland_server = dependency('wayland-server')
bash_comp = dependency('bash-completion', required: false)
fish_comp = dependency('fish', required: false)
logind = dependency('lib' + get_option('logind-provider'), required: get_option('logind'))
scdoc = find_program('scdoc', required: get_option('man-pages'))
wayland_scanner = find_program('wayland-scanner')
wl_protocol_dir = wayland_protos.get_pkgconfig_variable('pkgdatadir')
if wayland_server.version().version_compare('>=1.14.91')
code_type = 'private-code'
else
code_type = 'code'
endif
wayland_scanner_code = generator(
wayland_scanner,
output: '@[email protected]',
arguments: [code_type, '@INPUT@', '@OUTPUT@'],
)
wayland_scanner_client = generator(
wayland_scanner,
output: '@[email protected]',
arguments: ['client-header', '@INPUT@', '@OUTPUT@'],
)
client_protos_src = wayland_scanner_code.process('idle.xml')
client_protos_headers = wayland_scanner_client.process('idle.xml')
lib_client_protos = static_library(
'client_protos',
[client_protos_src, client_protos_headers],
dependencies: [wayland_client]
) # for the include directory
client_protos = declare_dependency(
link_with: lib_client_protos,
sources: client_protos_headers,
)
swayidle_deps = [
client_protos,
wayland_client,
wayland_server,
]
conf_data = configuration_data()
conf_data.set10('HAVE_SYSTEMD', false)
conf_data.set10('HAVE_ELOGIND', false)
if logind.found()
swayidle_deps += logind
conf_data.set10('HAVE_' + get_option('logind-provider').to_upper(), true)
endif
configure_file(output: 'config.h', configuration: conf_data)
executable(
'swayidle', [
'main.c',
],
dependencies: swayidle_deps,
install: true,
)
if scdoc.found()
sh = find_program('sh')
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: [
sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc.path(), output)
],
install: true,
install_dir: '@0@/man@1@'.format(mandir, section)
)
endforeach
endif
datadir = get_option('datadir')
if get_option('zsh-completions')
zsh_files = files(
'completions/zsh/_swayidle',
)
zsh_install_dir = datadir + '/zsh/site-functions'
install_data(zsh_files, install_dir: zsh_install_dir)
endif
if get_option('bash-completions')
bash_files = files(
'completions/bash/swayidle',
)
if bash_comp.found()
bash_install_dir = bash_comp.get_pkgconfig_variable('completionsdir')
else
bash_install_dir = datadir + '/bash-completion/completions'
endif
install_data(bash_files, install_dir: bash_install_dir)
endif
if get_option('fish-completions')
fish_files = files(
'completions/fish/swayidle.fish',
)
if fish_comp.found()
fish_install_dir = fish_comp.get_pkgconfig_variable('completionsdir')
else
fish_install_dir = datadir + '/fish/vendor_completions.d'
endif
install_data(fish_files, install_dir: fish_install_dir)
endif