diff options
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 158 |
1 files changed, 79 insertions, 79 deletions
diff --git a/meson.build b/meson.build index 38a55678..46352da5 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.8-dev', |
5 | license: 'MIT', | 5 | license: 'MIT', |
6 | meson_version: '>=0.53.0', | 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', |
@@ -35,56 +35,50 @@ 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 | # Execute the wlroots subproject, if any |
39 | pcre = dependency('libpcre') | 39 | wlroots_version = ['>=0.16.0', '<0.17.0'] |
40 | wayland_server = dependency('wayland-server') | 40 | 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 | bash_comp = dependency('bash-completion', required: false) | ||
56 | fish_comp = dependency('fish', required: false) | ||
57 | math = cc.find_library('m') | ||
58 | rt = cc.find_library('rt') | ||
59 | |||
60 | # Try first to find wlroots as a subproject, then as a system dependency | ||
61 | wlroots_version = ['>=0.12.0', '<0.13.0'] | ||
62 | wlroots_proj = subproject( | ||
63 | 'wlroots', | 41 | 'wlroots', |
64 | default_options: ['examples=false'], | 42 | default_options: ['examples=false'], |
65 | required: false, | 43 | required: false, |
66 | version: wlroots_version, | 44 | version: wlroots_version, |
67 | ) | 45 | ) |
46 | |||
47 | jsonc = dependency('json-c', version: '>=0.13') | ||
48 | pcre2 = dependency('libpcre2-8') | ||
49 | wayland_server = dependency('wayland-server', version: '>=1.20.0') | ||
50 | wayland_client = dependency('wayland-client') | ||
51 | wayland_cursor = dependency('wayland-cursor') | ||
52 | wayland_egl = dependency('wayland-egl') | ||
53 | wayland_protos = dependency('wayland-protocols', version: '>=1.24') | ||
54 | wlroots = dependency('wlroots', version: wlroots_version) | ||
55 | xkbcommon = dependency('xkbcommon') | ||
56 | cairo = dependency('cairo') | ||
57 | pango = dependency('pango') | ||
58 | pangocairo = dependency('pangocairo') | ||
59 | gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf')) | ||
60 | pixman = dependency('pixman-1') | ||
61 | glesv2 = dependency('glesv2') | ||
62 | libevdev = dependency('libevdev') | ||
63 | libinput = dependency('libinput', version: '>=1.6.0') | ||
64 | xcb = dependency('xcb', required: get_option('xwayland')) | ||
65 | drm_full = dependency('libdrm') # only needed for drm_fourcc.h | ||
66 | drm = drm_full.partial_dependency(compile_args: true, includes: true) | ||
67 | libudev = dependency('libudev') | ||
68 | bash_comp = dependency('bash-completion', required: false) | ||
69 | fish_comp = dependency('fish', required: false) | ||
70 | math = cc.find_library('m') | ||
71 | rt = cc.find_library('rt') | ||
72 | xcb_icccm = dependency('xcb-icccm', required: get_option('xwayland')) | ||
73 | |||
68 | wlroots_features = { | 74 | wlroots_features = { |
69 | 'xwayland': false, | 75 | 'xwayland': false, |
70 | 'systemd': false, | ||
71 | 'elogind': false, | ||
72 | 'libseat': false, | ||
73 | } | 76 | } |
74 | if wlroots_proj.found() | 77 | foreach name, _ : wlroots_features |
75 | wlroots = wlroots_proj.get_variable('wlroots') | 78 | var_name = 'have_' + name.underscorify() |
76 | wlroots_conf = wlroots_proj.get_variable('conf_data') | 79 | have = wlroots.get_variable(pkgconfig: var_name, internal: var_name) == 'true' |
77 | foreach name, _ : wlroots_features | 80 | wlroots_features += { name: have } |
78 | has = wlroots_conf.get('WLR_HAS_' + name.to_upper()) == 1 | 81 | endforeach |
79 | wlroots_features += { name: has } | ||
80 | endforeach | ||
81 | else | ||
82 | 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 | ||
88 | 82 | ||
89 | if get_option('xwayland').enabled() and not wlroots_features['xwayland'] | 83 | if get_option('xwayland').enabled() and not wlroots_features['xwayland'] |
90 | error('Cannot enable Xwayland in sway: wlroots has been built without Xwayland support') | 84 | error('Cannot enable Xwayland in sway: wlroots has been built without Xwayland support') |
@@ -95,19 +89,11 @@ if get_option('sd-bus-provider') == 'auto' | |||
95 | if not get_option('tray').disabled() | 89 | if not get_option('tray').disabled() |
96 | assert(get_option('auto_features').auto(), 'sd-bus-provider must not be set to auto since auto_features != auto') | 90 | assert(get_option('auto_features').auto(), 'sd-bus-provider must not be set to auto since auto_features != auto') |
97 | endif | 91 | endif |
98 | sdbus = dependency('libsystemd', | 92 | sdbus = dependency(['libsystemd', 'libelogind'], |
99 | required: false, | 93 | required: false, |
100 | version: '>=239', | 94 | version: '>=239', |
101 | not_found_message: 'libsystemd not found, trying libelogind', | ||
102 | ) | 95 | ) |
103 | if not sdbus.found() | 96 | if not sdbus.found() |
104 | sdbus = dependency('libelogind', | ||
105 | required: false, | ||
106 | version: '>=239', | ||
107 | not_found_message: 'libelogind not found, trying basu', | ||
108 | ) | ||
109 | endif | ||
110 | if not sdbus.found() | ||
111 | sdbus = dependency('basu', required: false) | 97 | sdbus = dependency('basu', required: false) |
112 | endif | 98 | endif |
113 | else | 99 | else |
@@ -131,8 +117,7 @@ conf_data.set10('HAVE_TRAY', have_tray) | |||
131 | 117 | ||
132 | scdoc = dependency('scdoc', version: '>=1.9.2', native: true, required: get_option('man-pages')) | 118 | scdoc = dependency('scdoc', version: '>=1.9.2', native: true, required: get_option('man-pages')) |
133 | if scdoc.found() | 119 | if scdoc.found() |
134 | scdoc_prog = find_program(scdoc.get_pkgconfig_variable('scdoc'), native: true) | 120 | scdoc_prog = find_program(scdoc.get_variable(pkgconfig: 'scdoc'), native: true) |
135 | sh = find_program('sh', native: true) | ||
136 | mandir = get_option('mandir') | 121 | mandir = get_option('mandir') |
137 | man_files = [ | 122 | man_files = [ |
138 | 'sway/sway.1.scd', | 123 | 'sway/sway.1.scd', |
@@ -143,9 +128,15 @@ if scdoc.found() | |||
143 | 'sway/sway-output.5.scd', | 128 | 'sway/sway-output.5.scd', |
144 | 'swaybar/swaybar-protocol.7.scd', | 129 | 'swaybar/swaybar-protocol.7.scd', |
145 | 'swaymsg/swaymsg.1.scd', | 130 | 'swaymsg/swaymsg.1.scd', |
146 | 'swaynag/swaynag.1.scd', | ||
147 | 'swaynag/swaynag.5.scd', | ||
148 | ] | 131 | ] |
132 | |||
133 | if get_option('swaynag') | ||
134 | man_files += [ | ||
135 | 'swaynag/swaynag.1.scd', | ||
136 | 'swaynag/swaynag.5.scd', | ||
137 | ] | ||
138 | endif | ||
139 | |||
149 | foreach filename : man_files | 140 | foreach filename : man_files |
150 | topic = filename.split('.')[-3].split('/')[-1] | 141 | topic = filename.split('.')[-3].split('/')[-1] |
151 | section = filename.split('.')[-2] | 142 | section = filename.split('.')[-2] |
@@ -155,10 +146,10 @@ if scdoc.found() | |||
155 | output, | 146 | output, |
156 | input: filename, | 147 | input: filename, |
157 | output: output, | 148 | output: output, |
158 | command: [ | 149 | command: scdoc_prog, |
159 | sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc_prog.path(), output) | ||
160 | ], | ||
161 | install: true, | 150 | install: true, |
151 | feed: true, | ||
152 | capture: true, | ||
162 | install_dir: '@0@/man@1@'.format(mandir, section) | 153 | install_dir: '@0@/man@1@'.format(mandir, section) |
163 | ) | 154 | ) |
164 | endforeach | 155 | endforeach |
@@ -169,8 +160,8 @@ add_project_arguments('-DSYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir | |||
169 | version = '"@0@"'.format(meson.project_version()) | 160 | version = '"@0@"'.format(meson.project_version()) |
170 | git = find_program('git', native: true, required: false) | 161 | git = find_program('git', native: true, required: false) |
171 | if git.found() | 162 | if git.found() |
172 | git_commit = run_command([git, 'rev-parse', '--short', 'HEAD']) | 163 | git_commit = run_command([git, 'rev-parse', '--short', 'HEAD'], check: false) |
173 | git_branch = run_command([git, 'rev-parse', '--abbrev-ref', 'HEAD']) | 164 | git_branch = run_command([git, 'rev-parse', '--abbrev-ref', 'HEAD'], check: false) |
174 | if git_commit.returncode() == 0 and git_branch.returncode() == 0 | 165 | if git_commit.returncode() == 0 and git_branch.returncode() == 0 |
175 | version = '"@0@-@1@ (" __DATE__ ", branch \'@2@\')"'.format( | 166 | version = '"@0@-@1@ (" __DATE__ ", branch \'@2@\')"'.format( |
176 | meson.project_version(), | 167 | meson.project_version(), |
@@ -183,7 +174,7 @@ add_project_arguments('-DSWAY_VERSION=@0@'.format(version), language: 'c') | |||
183 | 174 | ||
184 | # Compute the relative path used by compiler invocations. | 175 | # Compute the relative path used by compiler invocations. |
185 | source_root = meson.current_source_dir().split('/') | 176 | source_root = meson.current_source_dir().split('/') |
186 | build_root = meson.build_root().split('/') | 177 | build_root = meson.global_build_root().split('/') |
187 | relative_dir_parts = [] | 178 | relative_dir_parts = [] |
188 | i = 0 | 179 | i = 0 |
189 | in_prefix = true | 180 | in_prefix = true |
@@ -227,9 +218,15 @@ subdir('common') | |||
227 | subdir('sway') | 218 | subdir('sway') |
228 | subdir('swaymsg') | 219 | subdir('swaymsg') |
229 | 220 | ||
230 | subdir('client') | 221 | if get_option('swaybar') or get_option('swaynag') |
231 | subdir('swaybar') | 222 | subdir('client') |
232 | subdir('swaynag') | 223 | endif |
224 | if get_option('swaybar') | ||
225 | subdir('swaybar') | ||
226 | endif | ||
227 | if get_option('swaynag') | ||
228 | subdir('swaynag') | ||
229 | endif | ||
233 | 230 | ||
234 | config = configuration_data() | 231 | config = configuration_data() |
235 | config.set('datadir', join_paths(prefix, datadir)) | 232 | config.set('datadir', join_paths(prefix, datadir)) |
@@ -277,13 +274,17 @@ endif | |||
277 | if get_option('bash-completions') | 274 | if get_option('bash-completions') |
278 | bash_files = files( | 275 | bash_files = files( |
279 | 'completions/bash/sway', | 276 | 'completions/bash/sway', |
280 | 'completions/bash/swaybar', | ||
281 | 'completions/bash/swaymsg', | 277 | 'completions/bash/swaymsg', |
282 | ) | 278 | ) |
279 | |||
280 | if get_option('swaybar') | ||
281 | bash_files += files('completions/bash/swaybar') | ||
282 | endif | ||
283 | |||
283 | if bash_comp.found() | 284 | if bash_comp.found() |
284 | bash_install_dir = bash_comp.get_pkgconfig_variable( | 285 | bash_install_dir = bash_comp.get_variable( |
285 | 'completionsdir', | 286 | pkgconfig: 'completionsdir', |
286 | define_variable: ['datadir', datadir] | 287 | pkgconfig_define: ['datadir', datadir] |
287 | ) | 288 | ) |
288 | else | 289 | else |
289 | bash_install_dir = join_paths(datadir, 'bash-completion', 'completions') | 290 | bash_install_dir = join_paths(datadir, 'bash-completion', 'completions') |
@@ -296,12 +297,16 @@ if get_option('fish-completions') | |||
296 | fish_files = files( | 297 | fish_files = files( |
297 | 'completions/fish/sway.fish', | 298 | 'completions/fish/sway.fish', |
298 | 'completions/fish/swaymsg.fish', | 299 | 'completions/fish/swaymsg.fish', |
299 | 'completions/fish/swaynag.fish', | ||
300 | ) | 300 | ) |
301 | |||
302 | if get_option('swaynag') | ||
303 | fish_files += files('completions/fish/swaynag.fish') | ||
304 | endif | ||
305 | |||
301 | if fish_comp.found() | 306 | if fish_comp.found() |
302 | fish_install_dir = fish_comp.get_pkgconfig_variable( | 307 | fish_install_dir = fish_comp.get_variable( |
303 | 'completionsdir', | 308 | pkgconfig: 'completionsdir', |
304 | define_variable: ['datadir', datadir] | 309 | pkgconfig_define: ['datadir', datadir] |
305 | ) | 310 | ) |
306 | else | 311 | else |
307 | fish_install_dir = join_paths(datadir, 'fish', 'vendor_completions.d') | 312 | fish_install_dir = join_paths(datadir, 'fish', 'vendor_completions.d') |
@@ -313,12 +318,7 @@ endif | |||
313 | summary({ | 318 | summary({ |
314 | 'xwayland': have_xwayland, | 319 | 'xwayland': have_xwayland, |
315 | 'gdk-pixbuf': gdk_pixbuf.found(), | 320 | 'gdk-pixbuf': gdk_pixbuf.found(), |
316 | 'sd-bus': sdbus.found(), | ||
317 | 'tray': have_tray, | 321 | 'tray': have_tray, |
318 | 'man-pages': scdoc.found(), | 322 | 'man-pages': scdoc.found(), |
319 | }, bool_yn: true) | 323 | }, bool_yn: true) |
320 | 324 | ||
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 | ||