-
Notifications
You must be signed in to change notification settings - Fork 63
/
meson.build
175 lines (148 loc) · 4.75 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
project('sway-notificaton-center', ['c', 'vala'],
version: '0.10.1',
meson_version: '>= 0.59.0',
default_options: [ 'warning_level=2' ],
)
add_project_arguments(['-Wno-error=int-conversion'], language: 'c')
add_project_arguments(['--enable-gobject-tracing'], language: 'vala')
add_project_arguments(['--enable-checking'], language: 'vala')
cc = meson.get_compiler('c')
vala = meson.get_compiler('vala')
gnome = import('gnome')
app_resources = []
config_path = join_paths(get_option('sysconfdir'), 'xdg', 'swaync')
# Wayland protocols
protocol_dep = []
subdir('protocols')
subdir('data')
subdir('src')
datadir = get_option('datadir')
libdir = get_option('libdir')
conf_data = configuration_data()
conf_data.set('bindir', join_paths(get_option('prefix'), get_option('bindir')))
# Dbus service
configure_file(
configuration: conf_data,
input: 'services/dbus/org.erikreider.swaync.service.in',
output: '@BASENAME@',
install_dir: datadir + '/dbus-1/services'
)
# Systemd service unit
systemd = dependency('systemd', required: false)
if get_option('systemd-service')
if systemd.found()
systemd_service_install_dir = systemd.get_variable(pkgconfig :'systemduserunitdir')
else
systemd_service_install_dir = join_paths(libdir, 'systemd', 'user')
endif
configure_file(
configuration: conf_data,
input: 'services/systemd/swaync.service.in',
output: '@BASENAME@',
install_dir: systemd_service_install_dir
)
endif
# Zsh completion
if get_option('zsh-completions')
zsh_files = files(
'completions/zsh/_swaync',
'completions/zsh/_swaync-client',
)
zsh_install_dir = join_paths(datadir, 'zsh', 'site-functions')
install_data(zsh_files, install_dir: zsh_install_dir)
endif
# Bash completion
bash_comp = dependency('bash-completion', required: false)
if get_option('bash-completions')
bash_files = files(
'completions/bash/swaync',
'completions/bash/swaync-client',
)
if bash_comp.found()
bash_install_dir = bash_comp.get_variable(
pkgconfig: 'completionsdir',
pkgconfig_define: ['datadir', datadir]
)
else
bash_install_dir = join_paths(datadir, 'bash-completion', 'completions')
endif
install_data(bash_files, install_dir: bash_install_dir)
endif
# Fish completion
fish_comp = dependency('fish', required: false)
if get_option('fish-completions')
fish_files = files(
'completions/fish/swaync.fish',
'completions/fish/swaync-client.fish',
)
if fish_comp.found()
fish_install_dir = fish_comp.get_variable(
pkgconfig: 'completionsdir',
pkgconfig_define: ['datadir', datadir]
)
else
fish_install_dir = join_paths(datadir, 'fish', 'vendor_completions.d')
endif
install_data(fish_files, install_dir: fish_install_dir)
endif
# Man pages
if get_option('man-pages')
scdoc = dependency('scdoc', version: '>=1.9.2', native: true, required: true)
sed = find_program(['sed', '/usr/bin/sed'], required : true)
if scdoc.found() and sed.found()
scdoc_prog = find_program(scdoc.get_variable(pkgconfig :'scdoc'), native: true)
# Remove parts of man page if necessary
sed_command = []
foreach option : ['pulse-audio', 'scripting']
if get_option(option) == false
# Removes all lines between the #START and #END lines (inclusive)
sed_command += ['-e', '/#START @0@/,/#END @0@/d'.format(option)]
else
# Removes the #START and #END lines
sed_command += ['-e', '/#START @0@/d;/#END @0@/d'.format(option)]
endif
endforeach
mandir = get_option('mandir')
man_files = [
'swaync.1.scd',
'swaync.5.scd',
'swaync-client.1.scd',
]
foreach filename : man_files
topic = filename.split('.')[-3].split('/')[-1]
section = filename.split('.')[-2]
input = join_paths('man', filename)
output = '@0@.@1@'.format(topic, section)
message(mandir, section, '@0@/man@1@'.format(mandir, section))
# Remove parts of man page if necessary
if sed_command.length() > 0
output_stripped = '.stripped-@0@.@1@'.format(topic, section)
input = custom_target(
output_stripped,
input: input,
output: output_stripped,
command: [sed, sed_command],
install: false,
feed: true,
capture: true,
build_by_default: true,
build_always_stale: true
)
endif
custom_target(
output,
input: input,
output: output,
command: scdoc_prog,
install: true,
feed: true,
capture: true,
build_by_default: true,
build_always_stale: true,
install_dir: '@0@/man@1@'.format(mandir, section)
)
endforeach
endif
endif
# Run the postinstall script when installing
meson.add_install_script('build-aux/meson/postinstall.py')