diff options
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 129 |
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 @@ | |||
1 | project( | 1 | project( |
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') |
36 | endif | 36 | endif |
37 | 37 | ||
38 | jsonc = dependency('json-c', version: '>=0.13') | 38 | jsonc = dependency('json-c', version: '>=0.13') |
39 | pcre = dependency('libpcre') | 39 | pcre = dependency('libpcre') |
40 | wayland_server = dependency('wayland-server') | 40 | wayland_server = dependency('wayland-server') |
41 | wayland_client = dependency('wayland-client') | 41 | wayland_client = dependency('wayland-client') |
42 | wayland_cursor = dependency('wayland-cursor') | 42 | wayland_cursor = dependency('wayland-cursor') |
43 | wayland_egl = dependency('wayland-egl') | 43 | wayland_egl = dependency('wayland-egl') |
44 | wayland_protos = dependency('wayland-protocols', version: '>=1.14') | 44 | wayland_protos = dependency('wayland-protocols', version: '>=1.14') |
45 | xkbcommon = dependency('xkbcommon') | 45 | xkbcommon = dependency('xkbcommon') |
46 | cairo = dependency('cairo') | 46 | cairo = dependency('cairo') |
47 | pango = dependency('pango') | 47 | pango = dependency('pango') |
48 | pangocairo = dependency('pangocairo') | 48 | pangocairo = dependency('pangocairo') |
49 | gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf')) | 49 | gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf')) |
50 | pixman = dependency('pixman-1') | 50 | pixman = dependency('pixman-1') |
51 | glesv2 = dependency('glesv2') | 51 | glesv2 = dependency('glesv2') |
52 | libevdev = dependency('libevdev') | 52 | libevdev = dependency('libevdev') |
53 | libinput = dependency('libinput', version: '>=1.6.0') | 53 | libinput = dependency('libinput', version: '>=1.6.0') |
54 | xcb = dependency('xcb', required: get_option('xwayland')) | 54 | xcb = dependency('xcb', required: get_option('xwayland')) |
55 | bash_comp = dependency('bash-completion', required: false) | 55 | drm_full = dependency('libdrm') # only needed for drm_fourcc.h |
56 | fish_comp = dependency('fish', required: false) | 56 | drm = drm_full.partial_dependency(compile_args: true, includes: true) |
57 | math = cc.find_library('m') | 57 | libudev = dependency('libudev') |
58 | rt = cc.find_library('rt') | 58 | bash_comp = dependency('bash-completion', required: false) |
59 | fish_comp = dependency('fish', required: false) | ||
60 | math = cc.find_library('m') | ||
61 | rt = 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 |
61 | wlroots_version = ['>=0.12.0', '<0.13.0'] | 64 | wlroots_version = ['>=0.15.0', '<0.16.0'] |
62 | wlroots_proj = subproject( | 65 | wlroots_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 | ) |
68 | wlroots_features = { | ||
69 | 'xwayland': false, | ||
70 | 'systemd': false, | ||
71 | 'elogind': false, | ||
72 | 'libseat': false, | ||
73 | } | ||
74 | if wlroots_proj.found() | 71 | if 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 | ||
81 | else | 73 | else |
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 | ||
87 | endif | 75 | endif |
88 | 76 | ||
77 | wlroots_features = { | ||
78 | 'xwayland': false, | ||
79 | } | ||
80 | foreach 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 } | ||
84 | endforeach | ||
85 | |||
89 | if get_option('xwayland').enabled() and not wlroots_features['xwayland'] | 86 | if 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') |
91 | endif | 88 | endif |
@@ -131,8 +128,7 @@ conf_data.set10('HAVE_TRAY', have_tray) | |||
131 | 128 | ||
132 | scdoc = dependency('scdoc', version: '>=1.9.2', native: true, required: get_option('man-pages')) | 129 | scdoc = dependency('scdoc', version: '>=1.9.2', native: true, required: get_option('man-pages')) |
133 | if scdoc.found() | 130 | if 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. |
185 | source_root = meson.current_source_dir().split('/') | 187 | source_root = meson.current_source_dir().split('/') |
186 | build_root = meson.build_root().split('/') | 188 | build_root = meson.global_build_root().split('/') |
187 | relative_dir_parts = [] | 189 | relative_dir_parts = [] |
188 | i = 0 | 190 | i = 0 |
189 | in_prefix = true | 191 | in_prefix = true |
@@ -227,9 +229,15 @@ subdir('common') | |||
227 | subdir('sway') | 229 | subdir('sway') |
228 | subdir('swaymsg') | 230 | subdir('swaymsg') |
229 | 231 | ||
230 | subdir('client') | 232 | if get_option('swaybar') or get_option('swaynag') |
231 | subdir('swaybar') | 233 | subdir('client') |
232 | subdir('swaynag') | 234 | endif |
235 | if get_option('swaybar') | ||
236 | subdir('swaybar') | ||
237 | endif | ||
238 | if get_option('swaynag') | ||
239 | subdir('swaynag') | ||
240 | endif | ||
233 | 241 | ||
234 | config = configuration_data() | 242 | config = configuration_data() |
235 | config.set('datadir', join_paths(prefix, datadir)) | 243 | config.set('datadir', join_paths(prefix, datadir)) |
@@ -277,13 +285,17 @@ endif | |||
277 | if get_option('bash-completions') | 285 | if 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 | |||
313 | summary({ | 329 | summary({ |
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 | ||
321 | if 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') | ||
324 | endif | ||