aboutsummaryrefslogtreecommitdiffstats
path: root/meson.build
diff options
context:
space:
mode:
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build129
1 files changed, 70 insertions, 59 deletions
diff --git a/meson.build b/meson.build
index 38a55678..436b84d1 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.59.0',
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,8 +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)
136 mandir = get_option('mandir') 132 mandir = get_option('mandir')
137 man_files = [ 133 man_files = [
138 'sway/sway.1.scd', 134 'sway/sway.1.scd',
@@ -143,9 +139,15 @@ if scdoc.found()
143 'sway/sway-output.5.scd', 139 'sway/sway-output.5.scd',
144 'swaybar/swaybar-protocol.7.scd', 140 'swaybar/swaybar-protocol.7.scd',
145 'swaymsg/swaymsg.1.scd', 141 'swaymsg/swaymsg.1.scd',
146 'swaynag/swaynag.1.scd',
147 'swaynag/swaynag.5.scd',
148 ] 142 ]
143
144 if get_option('swaynag')
145 man_files += [
146 'swaynag/swaynag.1.scd',
147 'swaynag/swaynag.5.scd',
148 ]
149 endif
150
149 foreach filename : man_files 151 foreach filename : man_files
150 topic = filename.split('.')[-3].split('/')[-1] 152 topic = filename.split('.')[-3].split('/')[-1]
151 section = filename.split('.')[-2] 153 section = filename.split('.')[-2]
@@ -155,10 +157,10 @@ if scdoc.found()
155 output, 157 output,
156 input: filename, 158 input: filename,
157 output: output, 159 output: output,
158 command: [ 160 command: scdoc_prog,
159 sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc_prog.path(), output)
160 ],
161 install: true, 161 install: true,
162 feed: true,
163 capture: true,
162 install_dir: '@0@/man@1@'.format(mandir, section) 164 install_dir: '@0@/man@1@'.format(mandir, section)
163 ) 165 )
164 endforeach 166 endforeach
@@ -183,7 +185,7 @@ add_project_arguments('-DSWAY_VERSION=@0@'.format(version), language: 'c')
183 185
184# Compute the relative path used by compiler invocations. 186# Compute the relative path used by compiler invocations.
185source_root = meson.current_source_dir().split('/') 187source_root = meson.current_source_dir().split('/')
186build_root = meson.build_root().split('/') 188build_root = meson.global_build_root().split('/')
187relative_dir_parts = [] 189relative_dir_parts = []
188i = 0 190i = 0
189in_prefix = true 191in_prefix = true
@@ -227,9 +229,15 @@ subdir('common')
227subdir('sway') 229subdir('sway')
228subdir('swaymsg') 230subdir('swaymsg')
229 231
230subdir('client') 232if get_option('swaybar') or get_option('swaynag')
231subdir('swaybar') 233 subdir('client')
232subdir('swaynag') 234endif
235if get_option('swaybar')
236 subdir('swaybar')
237endif
238if get_option('swaynag')
239 subdir('swaynag')
240endif
233 241
234config = configuration_data() 242config = configuration_data()
235config.set('datadir', join_paths(prefix, datadir)) 243config.set('datadir', join_paths(prefix, datadir))
@@ -277,13 +285,17 @@ endif
277if get_option('bash-completions') 285if get_option('bash-completions')
278 bash_files = files( 286 bash_files = files(
279 'completions/bash/sway', 287 'completions/bash/sway',
280 'completions/bash/swaybar',
281 'completions/bash/swaymsg', 288 'completions/bash/swaymsg',
282 ) 289 )
290
291 if get_option('swaybar')
292 bash_files += files('completions/bash/swaybar')
293 endif
294
283 if bash_comp.found() 295 if bash_comp.found()
284 bash_install_dir = bash_comp.get_pkgconfig_variable( 296 bash_install_dir = bash_comp.get_variable(
285 'completionsdir', 297 pkgconfig: 'completionsdir',
286 define_variable: ['datadir', datadir] 298 pkgconfig_define: ['datadir', datadir]
287 ) 299 )
288 else 300 else
289 bash_install_dir = join_paths(datadir, 'bash-completion', 'completions') 301 bash_install_dir = join_paths(datadir, 'bash-completion', 'completions')
@@ -296,12 +308,16 @@ if get_option('fish-completions')
296 fish_files = files( 308 fish_files = files(
297 'completions/fish/sway.fish', 309 'completions/fish/sway.fish',
298 'completions/fish/swaymsg.fish', 310 'completions/fish/swaymsg.fish',
299 'completions/fish/swaynag.fish',
300 ) 311 )
312
313 if get_option('swaynag')
314 fish_files += files('completions/fish/swaynag.fish')
315 endif
316
301 if fish_comp.found() 317 if fish_comp.found()
302 fish_install_dir = fish_comp.get_pkgconfig_variable( 318 fish_install_dir = fish_comp.get_variable(
303 'completionsdir', 319 pkgconfig: 'completionsdir',
304 define_variable: ['datadir', datadir] 320 pkgconfig_define: ['datadir', datadir]
305 ) 321 )
306 else 322 else
307 fish_install_dir = join_paths(datadir, 'fish', 'vendor_completions.d') 323 fish_install_dir = join_paths(datadir, 'fish', 'vendor_completions.d')
@@ -313,12 +329,7 @@ endif
313summary({ 329summary({
314 'xwayland': have_xwayland, 330 'xwayland': have_xwayland,
315 'gdk-pixbuf': gdk_pixbuf.found(), 331 'gdk-pixbuf': gdk_pixbuf.found(),
316 'sd-bus': sdbus.found(),
317 'tray': have_tray, 332 'tray': have_tray,
318 'man-pages': scdoc.found(), 333 'man-pages': scdoc.found(),
319}, bool_yn: true) 334}, bool_yn: true)
320 335
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