aboutsummaryrefslogtreecommitdiffstats
path: root/meson.build
diff options
context:
space:
mode:
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build124
1 files changed, 68 insertions, 56 deletions
diff --git a/meson.build b/meson.build
index 38a55678..756857b7 100644
--- a/meson.build
+++ b/meson.build
@@ -1,9 +1,9 @@
1project( 1project(
2 'sway', 2 'sway',
3 'c', 3 'c',
4 version: '1.5', #release_version 4 version: '1.6',
5 license: 'MIT', 5 license: 'MIT',
6 meson_version: '>=0.53.0', 6 meson_version: '>=0.58.1',
7 default_options: [ 7 default_options: [
8 'c_std=c11', 8 'c_std=c11',
9 'warning_level=2', 9 'warning_level=2',
@@ -35,57 +35,54 @@ if is_freebsd
35 add_project_arguments('-D_C11_SOURCE', language: 'c') 35 add_project_arguments('-D_C11_SOURCE', language: 'c')
36endif 36endif
37 37
38jsonc = dependency('json-c', version: '>=0.13') 38jsonc = dependency('json-c', version: '>=0.13')
39pcre = dependency('libpcre') 39pcre = dependency('libpcre')
40wayland_server = dependency('wayland-server') 40wayland_server = dependency('wayland-server')
41wayland_client = dependency('wayland-client') 41wayland_client = dependency('wayland-client')
42wayland_cursor = dependency('wayland-cursor') 42wayland_cursor = dependency('wayland-cursor')
43wayland_egl = dependency('wayland-egl') 43wayland_egl = dependency('wayland-egl')
44wayland_protos = dependency('wayland-protocols', version: '>=1.14') 44wayland_protos = dependency('wayland-protocols', version: '>=1.14')
45xkbcommon = dependency('xkbcommon') 45xkbcommon = dependency('xkbcommon')
46cairo = dependency('cairo') 46cairo = dependency('cairo')
47pango = dependency('pango') 47pango = dependency('pango')
48pangocairo = dependency('pangocairo') 48pangocairo = dependency('pangocairo')
49gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf')) 49gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf'))
50pixman = dependency('pixman-1') 50pixman = dependency('pixman-1')
51glesv2 = dependency('glesv2') 51glesv2 = dependency('glesv2')
52libevdev = dependency('libevdev') 52libevdev = dependency('libevdev')
53libinput = dependency('libinput', version: '>=1.6.0') 53libinput = dependency('libinput', version: '>=1.6.0')
54xcb = dependency('xcb', required: get_option('xwayland')) 54xcb = dependency('xcb', required: get_option('xwayland'))
55bash_comp = dependency('bash-completion', required: false) 55drm_full = dependency('libdrm') # only needed for drm_fourcc.h
56fish_comp = dependency('fish', required: false) 56drm = drm_full.partial_dependency(compile_args: true, includes: true)
57math = cc.find_library('m') 57libudev = dependency('libudev')
58rt = cc.find_library('rt') 58bash_comp = dependency('bash-completion', required: false)
59fish_comp = dependency('fish', required: false)
60math = cc.find_library('m')
61rt = cc.find_library('rt')
59 62
60# Try first to find wlroots as a subproject, then as a system dependency 63# Try first to find wlroots as a subproject, then as a system dependency
61wlroots_version = ['>=0.12.0', '<0.13.0'] 64wlroots_version = ['>=0.15.0', '<0.16.0']
62wlroots_proj = subproject( 65wlroots_proj = subproject(
63 'wlroots', 66 'wlroots',
64 default_options: ['examples=false'], 67 default_options: ['examples=false'],
65 required: false, 68 required: false,
66 version: wlroots_version, 69 version: wlroots_version,
67) 70)
68wlroots_features = {
69 'xwayland': false,
70 'systemd': false,
71 'elogind': false,
72 'libseat': false,
73}
74if wlroots_proj.found() 71if wlroots_proj.found()
75 wlroots = wlroots_proj.get_variable('wlroots') 72 wlroots = wlroots_proj.get_variable('wlroots')
76 wlroots_conf = wlroots_proj.get_variable('conf_data')
77 foreach name, _ : wlroots_features
78 has = wlroots_conf.get('WLR_HAS_' + name.to_upper()) == 1
79 wlroots_features += { name: has }
80 endforeach
81else 73else
82 wlroots = dependency('wlroots', version: wlroots_version) 74 wlroots = dependency('wlroots', version: wlroots_version)
83 foreach name, _ : wlroots_features
84 has = cc.get_define('WLR_HAS_' + name.to_upper(), prefix: '#include <wlr/config.h>', dependencies: wlroots) == '1'
85 wlroots_features += { name: has }
86 endforeach
87endif 75endif
88 76
77wlroots_features = {
78 'xwayland': false,
79}
80foreach name, _ : wlroots_features
81 var_name = 'have_' + name.underscorify()
82 have = wlroots.get_variable(pkgconfig: var_name, internal: var_name) == 'true'
83 wlroots_features += { name: have }
84endforeach
85
89if get_option('xwayland').enabled() and not wlroots_features['xwayland'] 86if get_option('xwayland').enabled() and not wlroots_features['xwayland']
90 error('Cannot enable Xwayland in sway: wlroots has been built without Xwayland support') 87 error('Cannot enable Xwayland in sway: wlroots has been built without Xwayland support')
91endif 88endif
@@ -131,7 +128,7 @@ conf_data.set10('HAVE_TRAY', have_tray)
131 128
132scdoc = dependency('scdoc', version: '>=1.9.2', native: true, required: get_option('man-pages')) 129scdoc = dependency('scdoc', version: '>=1.9.2', native: true, required: get_option('man-pages'))
133if scdoc.found() 130if scdoc.found()
134 scdoc_prog = find_program(scdoc.get_pkgconfig_variable('scdoc'), native: true) 131 scdoc_prog = find_program(scdoc.get_variable(pkgconfig: 'scdoc'), native: true)
135 sh = find_program('sh', native: true) 132 sh = find_program('sh', native: true)
136 mandir = get_option('mandir') 133 mandir = get_option('mandir')
137 man_files = [ 134 man_files = [
@@ -143,9 +140,15 @@ if scdoc.found()
143 'sway/sway-output.5.scd', 140 'sway/sway-output.5.scd',
144 'swaybar/swaybar-protocol.7.scd', 141 'swaybar/swaybar-protocol.7.scd',
145 'swaymsg/swaymsg.1.scd', 142 'swaymsg/swaymsg.1.scd',
146 'swaynag/swaynag.1.scd',
147 'swaynag/swaynag.5.scd',
148 ] 143 ]
144
145 if get_option('swaynag')
146 man_files += [
147 'swaynag/swaynag.1.scd',
148 'swaynag/swaynag.5.scd',
149 ]
150 endif
151
149 foreach filename : man_files 152 foreach filename : man_files
150 topic = filename.split('.')[-3].split('/')[-1] 153 topic = filename.split('.')[-3].split('/')[-1]
151 section = filename.split('.')[-2] 154 section = filename.split('.')[-2]
@@ -156,7 +159,7 @@ if scdoc.found()
156 input: filename, 159 input: filename,
157 output: output, 160 output: output,
158 command: [ 161 command: [
159 sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc_prog.path(), output) 162 sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc_prog.full_path(), output)
160 ], 163 ],
161 install: true, 164 install: true,
162 install_dir: '@0@/man@1@'.format(mandir, section) 165 install_dir: '@0@/man@1@'.format(mandir, section)
@@ -183,7 +186,7 @@ add_project_arguments('-DSWAY_VERSION=@0@'.format(version), language: 'c')
183 186
184# Compute the relative path used by compiler invocations. 187# Compute the relative path used by compiler invocations.
185source_root = meson.current_source_dir().split('/') 188source_root = meson.current_source_dir().split('/')
186build_root = meson.build_root().split('/') 189build_root = meson.global_build_root().split('/')
187relative_dir_parts = [] 190relative_dir_parts = []
188i = 0 191i = 0
189in_prefix = true 192in_prefix = true
@@ -227,9 +230,15 @@ subdir('common')
227subdir('sway') 230subdir('sway')
228subdir('swaymsg') 231subdir('swaymsg')
229 232
230subdir('client') 233if get_option('swaybar') or get_option('swaynag')
231subdir('swaybar') 234 subdir('client')
232subdir('swaynag') 235endif
236if get_option('swaybar')
237 subdir('swaybar')
238endif
239if get_option('swaynag')
240 subdir('swaynag')
241endif
233 242
234config = configuration_data() 243config = configuration_data()
235config.set('datadir', join_paths(prefix, datadir)) 244config.set('datadir', join_paths(prefix, datadir))
@@ -277,13 +286,17 @@ endif
277if get_option('bash-completions') 286if get_option('bash-completions')
278 bash_files = files( 287 bash_files = files(
279 'completions/bash/sway', 288 'completions/bash/sway',
280 'completions/bash/swaybar',
281 'completions/bash/swaymsg', 289 'completions/bash/swaymsg',
282 ) 290 )
291
292 if get_option('swaybar')
293 bash_files += files('completions/bash/swaybar')
294 endif
295
283 if bash_comp.found() 296 if bash_comp.found()
284 bash_install_dir = bash_comp.get_pkgconfig_variable( 297 bash_install_dir = bash_comp.get_variable(
285 'completionsdir', 298 pkgconfig: 'completionsdir',
286 define_variable: ['datadir', datadir] 299 pkgconfig_define: ['datadir', datadir]
287 ) 300 )
288 else 301 else
289 bash_install_dir = join_paths(datadir, 'bash-completion', 'completions') 302 bash_install_dir = join_paths(datadir, 'bash-completion', 'completions')
@@ -296,12 +309,16 @@ if get_option('fish-completions')
296 fish_files = files( 309 fish_files = files(
297 'completions/fish/sway.fish', 310 'completions/fish/sway.fish',
298 'completions/fish/swaymsg.fish', 311 'completions/fish/swaymsg.fish',
299 'completions/fish/swaynag.fish',
300 ) 312 )
313
314 if get_option('swaynag')
315 fish_files += files('completions/fish/swaynag.fish')
316 endif
317
301 if fish_comp.found() 318 if fish_comp.found()
302 fish_install_dir = fish_comp.get_pkgconfig_variable( 319 fish_install_dir = fish_comp.get_variable(
303 'completionsdir', 320 pkgconfig: 'completionsdir',
304 define_variable: ['datadir', datadir] 321 pkgconfig_define: ['datadir', datadir]
305 ) 322 )
306 else 323 else
307 fish_install_dir = join_paths(datadir, 'fish', 'vendor_completions.d') 324 fish_install_dir = join_paths(datadir, 'fish', 'vendor_completions.d')
@@ -313,12 +330,7 @@ endif
313summary({ 330summary({
314 'xwayland': have_xwayland, 331 'xwayland': have_xwayland,
315 'gdk-pixbuf': gdk_pixbuf.found(), 332 'gdk-pixbuf': gdk_pixbuf.found(),
316 'sd-bus': sdbus.found(),
317 'tray': have_tray, 333 'tray': have_tray,
318 'man-pages': scdoc.found(), 334 'man-pages': scdoc.found(),
319}, bool_yn: true) 335}, bool_yn: true)
320 336
321if not wlroots_features['systemd'] and not wlroots_features['elogind'] and not wlroots_features['libseat']
322 warning('The sway binary must be setuid when compiled without (e)logind or libseat')
323 warning('You must do this manually post-install: chmod a+s /path/to/sway')
324endif