diff options
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 154 |
1 files changed, 48 insertions, 106 deletions
diff --git a/meson.build b/meson.build index 756857b7..1043e4ba 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.6', | 4 | version: '1.10-dev', |
5 | license: 'MIT', | 5 | license: 'MIT', |
6 | meson_version: '>=0.58.1', | 6 | meson_version: '>=0.60.0', |
7 | default_options: [ | 7 | default_options: [ |
8 | 'c_std=c11', | 8 | 'c_std=c11', |
9 | 'warning_level=2', | 9 | 'warning_level=2', |
@@ -14,10 +14,12 @@ project( | |||
14 | add_project_arguments( | 14 | add_project_arguments( |
15 | [ | 15 | [ |
16 | '-DWLR_USE_UNSTABLE', | 16 | '-DWLR_USE_UNSTABLE', |
17 | '-D_POSIX_C_SOURCE=200809L', | ||
17 | 18 | ||
18 | '-Wno-unused-parameter', | 19 | '-Wno-unused-parameter', |
19 | '-Wno-unused-result', | 20 | '-Wno-unused-result', |
20 | '-Wno-missing-braces', | 21 | '-Wno-missing-braces', |
22 | '-Wno-format-zero-length', | ||
21 | '-Wundef', | 23 | '-Wundef', |
22 | '-Wvla', | 24 | '-Wvla', |
23 | ], | 25 | ], |
@@ -35,47 +37,19 @@ if is_freebsd | |||
35 | add_project_arguments('-D_C11_SOURCE', language: 'c') | 37 | add_project_arguments('-D_C11_SOURCE', language: 'c') |
36 | endif | 38 | endif |
37 | 39 | ||
38 | jsonc = dependency('json-c', version: '>=0.13') | 40 | # Execute the wlroots subproject, if any |
39 | pcre = dependency('libpcre') | 41 | wlroots_version = ['>=0.18.0', '<0.19.0'] |
40 | wayland_server = dependency('wayland-server') | 42 | subproject( |
41 | wayland_client = dependency('wayland-client') | ||
42 | wayland_cursor = dependency('wayland-cursor') | ||
43 | wayland_egl = dependency('wayland-egl') | ||
44 | wayland_protos = dependency('wayland-protocols', version: '>=1.14') | ||
45 | xkbcommon = dependency('xkbcommon') | ||
46 | cairo = dependency('cairo') | ||
47 | pango = dependency('pango') | ||
48 | pangocairo = dependency('pangocairo') | ||
49 | gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf')) | ||
50 | pixman = dependency('pixman-1') | ||
51 | glesv2 = dependency('glesv2') | ||
52 | libevdev = dependency('libevdev') | ||
53 | libinput = dependency('libinput', version: '>=1.6.0') | ||
54 | xcb = dependency('xcb', required: get_option('xwayland')) | ||
55 | drm_full = dependency('libdrm') # only needed for drm_fourcc.h | ||
56 | drm = drm_full.partial_dependency(compile_args: true, includes: true) | ||
57 | libudev = dependency('libudev') | ||
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') | ||
62 | |||
63 | # Try first to find wlroots as a subproject, then as a system dependency | ||
64 | wlroots_version = ['>=0.15.0', '<0.16.0'] | ||
65 | wlroots_proj = subproject( | ||
66 | 'wlroots', | 43 | 'wlroots', |
67 | default_options: ['examples=false'], | 44 | default_options: ['examples=false'], |
68 | required: false, | 45 | required: false, |
69 | version: wlroots_version, | 46 | version: wlroots_version, |
70 | ) | 47 | ) |
71 | if wlroots_proj.found() | 48 | wlroots = dependency('wlroots', version: wlroots_version) |
72 | wlroots = wlroots_proj.get_variable('wlroots') | ||
73 | else | ||
74 | wlroots = dependency('wlroots', version: wlroots_version) | ||
75 | endif | ||
76 | |||
77 | wlroots_features = { | 49 | wlroots_features = { |
78 | 'xwayland': false, | 50 | 'xwayland': false, |
51 | 'libinput_backend': false, | ||
52 | 'session': false, | ||
79 | } | 53 | } |
80 | foreach name, _ : wlroots_features | 54 | foreach name, _ : wlroots_features |
81 | var_name = 'have_' + name.underscorify() | 55 | var_name = 'have_' + name.underscorify() |
@@ -86,25 +60,42 @@ endforeach | |||
86 | if get_option('xwayland').enabled() and not wlroots_features['xwayland'] | 60 | if get_option('xwayland').enabled() and not wlroots_features['xwayland'] |
87 | error('Cannot enable Xwayland in sway: wlroots has been built without Xwayland support') | 61 | error('Cannot enable Xwayland in sway: wlroots has been built without Xwayland support') |
88 | endif | 62 | endif |
89 | have_xwayland = xcb.found() and wlroots_features['xwayland'] | 63 | |
64 | null_dep = dependency('', required: false) | ||
65 | |||
66 | jsonc = dependency('json-c', version: '>=0.13') | ||
67 | pcre2 = dependency('libpcre2-8') | ||
68 | wayland_server = dependency('wayland-server', version: '>=1.21.0') | ||
69 | wayland_client = dependency('wayland-client') | ||
70 | wayland_cursor = dependency('wayland-cursor') | ||
71 | wayland_protos = dependency('wayland-protocols', version: '>=1.24') | ||
72 | xkbcommon = dependency('xkbcommon', version: '>=1.5.0') | ||
73 | cairo = dependency('cairo') | ||
74 | pango = dependency('pango') | ||
75 | pangocairo = dependency('pangocairo') | ||
76 | gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf')) | ||
77 | pixman = dependency('pixman-1') | ||
78 | libevdev = dependency('libevdev') | ||
79 | libinput = wlroots_features['libinput_backend'] ? dependency('libinput', version: '>=1.21.0') : null_dep | ||
80 | xcb = dependency('xcb', required: get_option('xwayland')) | ||
81 | drm = dependency('libdrm') | ||
82 | libudev = wlroots_features['libinput_backend'] ? dependency('libudev') : null_dep | ||
83 | math = cc.find_library('m') | ||
84 | rt = cc.find_library('rt') | ||
85 | xcb_icccm = dependency('xcb-icccm', required: get_option('xwayland')) | ||
86 | threads = dependency('threads') # for pthread_setschedparam | ||
87 | |||
88 | have_xwayland = xcb.found() and xcb_icccm.found() and wlroots_features['xwayland'] | ||
90 | 89 | ||
91 | if get_option('sd-bus-provider') == 'auto' | 90 | if get_option('sd-bus-provider') == 'auto' |
92 | if not get_option('tray').disabled() | 91 | if not get_option('tray').disabled() |
93 | assert(get_option('auto_features').auto(), 'sd-bus-provider must not be set to auto since auto_features != auto') | 92 | assert(get_option('auto_features').auto(), 'sd-bus-provider must not be set to auto since auto_features != auto') |
94 | endif | 93 | endif |
95 | sdbus = dependency('libsystemd', | 94 | sdbus = dependency(['libsystemd', 'libelogind'], |
96 | required: false, | 95 | required: false, |
97 | version: '>=239', | 96 | version: '>=239', |
98 | not_found_message: 'libsystemd not found, trying libelogind', | ||
99 | ) | 97 | ) |
100 | if not sdbus.found() | 98 | if not sdbus.found() |
101 | sdbus = dependency('libelogind', | ||
102 | required: false, | ||
103 | version: '>=239', | ||
104 | not_found_message: 'libelogind not found, trying basu', | ||
105 | ) | ||
106 | endif | ||
107 | if not sdbus.found() | ||
108 | sdbus = dependency('basu', required: false) | 99 | sdbus = dependency('basu', required: false) |
109 | endif | 100 | endif |
110 | else | 101 | else |
@@ -125,11 +116,15 @@ conf_data.set10('HAVE_LIBSYSTEMD', sdbus.found() and sdbus.name() == 'libsystemd | |||
125 | conf_data.set10('HAVE_LIBELOGIND', sdbus.found() and sdbus.name() == 'libelogind') | 116 | conf_data.set10('HAVE_LIBELOGIND', sdbus.found() and sdbus.name() == 'libelogind') |
126 | conf_data.set10('HAVE_BASU', sdbus.found() and sdbus.name() == 'basu') | 117 | conf_data.set10('HAVE_BASU', sdbus.found() and sdbus.name() == 'basu') |
127 | conf_data.set10('HAVE_TRAY', have_tray) | 118 | conf_data.set10('HAVE_TRAY', have_tray) |
119 | conf_data.set10('HAVE_LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM', cc.has_header_symbol( | ||
120 | 'libinput.h', | ||
121 | 'LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM', | ||
122 | dependencies: libinput, | ||
123 | )) | ||
128 | 124 | ||
129 | scdoc = dependency('scdoc', version: '>=1.9.2', native: true, required: get_option('man-pages')) | 125 | scdoc = dependency('scdoc', version: '>=1.9.2', native: true, required: get_option('man-pages')) |
130 | if scdoc.found() | 126 | if scdoc.found() |
131 | scdoc_prog = find_program(scdoc.get_variable(pkgconfig: 'scdoc'), native: true) | 127 | scdoc_prog = find_program(scdoc.get_variable(pkgconfig: 'scdoc'), native: true) |
132 | sh = find_program('sh', native: true) | ||
133 | mandir = get_option('mandir') | 128 | mandir = get_option('mandir') |
134 | man_files = [ | 129 | man_files = [ |
135 | 'sway/sway.1.scd', | 130 | 'sway/sway.1.scd', |
@@ -158,10 +153,10 @@ if scdoc.found() | |||
158 | output, | 153 | output, |
159 | input: filename, | 154 | input: filename, |
160 | output: output, | 155 | output: output, |
161 | command: [ | 156 | command: scdoc_prog, |
162 | sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc_prog.full_path(), output) | ||
163 | ], | ||
164 | install: true, | 157 | install: true, |
158 | feed: true, | ||
159 | capture: true, | ||
165 | install_dir: '@0@/man@1@'.format(mandir, section) | 160 | install_dir: '@0@/man@1@'.format(mandir, section) |
166 | ) | 161 | ) |
167 | endforeach | 162 | endforeach |
@@ -172,8 +167,8 @@ add_project_arguments('-DSYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir | |||
172 | version = '"@0@"'.format(meson.project_version()) | 167 | version = '"@0@"'.format(meson.project_version()) |
173 | git = find_program('git', native: true, required: false) | 168 | git = find_program('git', native: true, required: false) |
174 | if git.found() | 169 | if git.found() |
175 | git_commit = run_command([git, 'rev-parse', '--short', 'HEAD']) | 170 | git_commit = run_command([git, 'rev-parse', '--short', 'HEAD'], check: false) |
176 | git_branch = run_command([git, 'rev-parse', '--abbrev-ref', 'HEAD']) | 171 | git_branch = run_command([git, 'rev-parse', '--abbrev-ref', 'HEAD'], check: false) |
177 | if git_commit.returncode() == 0 and git_branch.returncode() == 0 | 172 | if git_commit.returncode() == 0 and git_branch.returncode() == 0 |
178 | version = '"@0@-@1@ (" __DATE__ ", branch \'@2@\')"'.format( | 173 | version = '"@0@-@1@ (" __DATE__ ", branch \'@2@\')"'.format( |
179 | meson.project_version(), | 174 | meson.project_version(), |
@@ -273,59 +268,7 @@ if get_option('default-wallpaper') | |||
273 | install_data(wallpaper_files, install_dir: wallpaper_install_dir) | 268 | install_data(wallpaper_files, install_dir: wallpaper_install_dir) |
274 | endif | 269 | endif |
275 | 270 | ||
276 | if get_option('zsh-completions') | 271 | subdir('completions') |
277 | zsh_files = files( | ||
278 | 'completions/zsh/_sway', | ||
279 | 'completions/zsh/_swaymsg', | ||
280 | ) | ||
281 | zsh_install_dir = join_paths(datadir, 'zsh', 'site-functions') | ||
282 | |||
283 | install_data(zsh_files, install_dir: zsh_install_dir) | ||
284 | endif | ||
285 | |||
286 | if get_option('bash-completions') | ||
287 | bash_files = files( | ||
288 | 'completions/bash/sway', | ||
289 | 'completions/bash/swaymsg', | ||
290 | ) | ||
291 | |||
292 | if get_option('swaybar') | ||
293 | bash_files += files('completions/bash/swaybar') | ||
294 | endif | ||
295 | |||
296 | if bash_comp.found() | ||
297 | bash_install_dir = bash_comp.get_variable( | ||
298 | pkgconfig: 'completionsdir', | ||
299 | pkgconfig_define: ['datadir', datadir] | ||
300 | ) | ||
301 | else | ||
302 | bash_install_dir = join_paths(datadir, 'bash-completion', 'completions') | ||
303 | endif | ||
304 | |||
305 | install_data(bash_files, install_dir: bash_install_dir) | ||
306 | endif | ||
307 | |||
308 | if get_option('fish-completions') | ||
309 | fish_files = files( | ||
310 | 'completions/fish/sway.fish', | ||
311 | 'completions/fish/swaymsg.fish', | ||
312 | ) | ||
313 | |||
314 | if get_option('swaynag') | ||
315 | fish_files += files('completions/fish/swaynag.fish') | ||
316 | endif | ||
317 | |||
318 | if fish_comp.found() | ||
319 | fish_install_dir = fish_comp.get_variable( | ||
320 | pkgconfig: 'completionsdir', | ||
321 | pkgconfig_define: ['datadir', datadir] | ||
322 | ) | ||
323 | else | ||
324 | fish_install_dir = join_paths(datadir, 'fish', 'vendor_completions.d') | ||
325 | endif | ||
326 | |||
327 | install_data(fish_files, install_dir: fish_install_dir) | ||
328 | endif | ||
329 | 272 | ||
330 | summary({ | 273 | summary({ |
331 | 'xwayland': have_xwayland, | 274 | 'xwayland': have_xwayland, |
@@ -333,4 +276,3 @@ summary({ | |||
333 | 'tray': have_tray, | 276 | 'tray': have_tray, |
334 | 'man-pages': scdoc.found(), | 277 | 'man-pages': scdoc.found(), |
335 | }, bool_yn: true) | 278 | }, bool_yn: true) |
336 | |||