2017-11-29 14:03:12 +00:00
|
|
|
project(
|
|
|
|
'sway',
|
|
|
|
'c',
|
2021-12-23 13:58:51 +00:00
|
|
|
version: '1.8-dev',
|
2017-11-29 14:03:12 +00:00
|
|
|
license: 'MIT',
|
2021-10-24 19:34:36 +00:00
|
|
|
meson_version: '>=0.60.0',
|
2017-11-29 14:03:12 +00:00
|
|
|
default_options: [
|
|
|
|
'c_std=c11',
|
|
|
|
'warning_level=2',
|
|
|
|
'werror=true',
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2018-11-12 21:23:06 +00:00
|
|
|
add_project_arguments(
|
|
|
|
[
|
|
|
|
'-DWLR_USE_UNSTABLE',
|
|
|
|
|
|
|
|
'-Wno-unused-parameter',
|
|
|
|
'-Wno-unused-result',
|
2019-11-17 16:16:13 +00:00
|
|
|
'-Wno-missing-braces',
|
2018-11-12 21:23:06 +00:00
|
|
|
'-Wundef',
|
2019-01-16 01:57:53 +00:00
|
|
|
'-Wvla',
|
2018-11-12 21:23:06 +00:00
|
|
|
],
|
|
|
|
language: 'c',
|
|
|
|
)
|
2017-12-01 10:42:12 +00:00
|
|
|
|
2017-11-29 14:03:12 +00:00
|
|
|
cc = meson.get_compiler('c')
|
|
|
|
|
2017-11-30 13:31:13 +00:00
|
|
|
is_freebsd = host_machine.system().startswith('freebsd')
|
|
|
|
datadir = get_option('datadir')
|
|
|
|
sysconfdir = get_option('sysconfdir')
|
|
|
|
prefix = get_option('prefix')
|
|
|
|
|
2018-09-26 18:05:45 +00:00
|
|
|
if is_freebsd
|
|
|
|
add_project_arguments('-D_C11_SOURCE', language: 'c')
|
|
|
|
endif
|
|
|
|
|
2022-01-18 12:41:01 +00:00
|
|
|
# Execute the wlroots subproject, if any
|
2022-11-11 19:59:20 +00:00
|
|
|
wlroots_version = ['>=0.17.0', '<0.18.0']
|
2022-01-18 12:41:01 +00:00
|
|
|
subproject(
|
|
|
|
'wlroots',
|
|
|
|
default_options: ['examples=false'],
|
|
|
|
required: false,
|
|
|
|
version: wlroots_version,
|
|
|
|
)
|
|
|
|
|
2021-02-23 19:32:11 +00:00
|
|
|
jsonc = dependency('json-c', version: '>=0.13')
|
2022-03-12 13:02:32 +00:00
|
|
|
pcre2 = dependency('libpcre2-8')
|
2022-11-10 13:35:14 +00:00
|
|
|
wayland_server = dependency('wayland-server', version: '>=1.21.0')
|
2017-11-29 14:03:12 +00:00
|
|
|
wayland_client = dependency('wayland-client')
|
2018-03-31 01:38:28 +00:00
|
|
|
wayland_cursor = dependency('wayland-cursor')
|
2021-02-23 19:32:11 +00:00
|
|
|
wayland_egl = dependency('wayland-egl')
|
2021-12-14 06:28:35 +00:00
|
|
|
wayland_protos = dependency('wayland-protocols', version: '>=1.24')
|
2022-01-18 12:41:01 +00:00
|
|
|
wlroots = dependency('wlroots', version: wlroots_version)
|
2021-02-23 19:32:11 +00:00
|
|
|
xkbcommon = dependency('xkbcommon')
|
|
|
|
cairo = dependency('cairo')
|
|
|
|
pango = dependency('pango')
|
|
|
|
pangocairo = dependency('pangocairo')
|
|
|
|
gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf'))
|
|
|
|
pixman = dependency('pixman-1')
|
|
|
|
glesv2 = dependency('glesv2')
|
|
|
|
libevdev = dependency('libevdev')
|
2022-08-23 23:13:12 +00:00
|
|
|
libinput = dependency('libinput', version: '>=1.21.0')
|
2021-02-23 19:32:11 +00:00
|
|
|
xcb = dependency('xcb', required: get_option('xwayland'))
|
|
|
|
drm_full = dependency('libdrm') # only needed for drm_fourcc.h
|
|
|
|
drm = drm_full.partial_dependency(compile_args: true, includes: true)
|
2021-02-08 18:24:20 +00:00
|
|
|
libudev = dependency('libudev')
|
2021-02-23 19:32:11 +00:00
|
|
|
bash_comp = dependency('bash-completion', required: false)
|
|
|
|
fish_comp = dependency('fish', required: false)
|
|
|
|
math = cc.find_library('m')
|
|
|
|
rt = cc.find_library('rt')
|
2022-04-17 18:16:35 +00:00
|
|
|
xcb_icccm = dependency('xcb-icccm', required: get_option('xwayland'))
|
2022-05-30 16:25:01 +00:00
|
|
|
threads = dependency('threads') # for pthread_setschedparam
|
2017-11-30 16:34:44 +00:00
|
|
|
|
2020-12-02 22:43:43 +00:00
|
|
|
wlroots_features = {
|
|
|
|
'xwayland': false,
|
|
|
|
}
|
2021-02-15 23:01:32 +00:00
|
|
|
foreach name, _ : wlroots_features
|
|
|
|
var_name = 'have_' + name.underscorify()
|
|
|
|
have = wlroots.get_variable(pkgconfig: var_name, internal: var_name) == 'true'
|
|
|
|
wlroots_features += { name: have }
|
|
|
|
endforeach
|
2019-01-18 22:32:10 +00:00
|
|
|
|
2020-12-02 22:43:43 +00:00
|
|
|
if get_option('xwayland').enabled() and not wlroots_features['xwayland']
|
2019-01-18 22:32:10 +00:00
|
|
|
error('Cannot enable Xwayland in sway: wlroots has been built without Xwayland support')
|
|
|
|
endif
|
2020-12-02 22:43:43 +00:00
|
|
|
have_xwayland = xcb.found() and wlroots_features['xwayland']
|
2018-03-28 16:21:50 +00:00
|
|
|
|
2020-12-02 22:46:49 +00:00
|
|
|
if get_option('sd-bus-provider') == 'auto'
|
|
|
|
if not get_option('tray').disabled()
|
|
|
|
assert(get_option('auto_features').auto(), 'sd-bus-provider must not be set to auto since auto_features != auto')
|
|
|
|
endif
|
2022-01-10 14:54:24 +00:00
|
|
|
sdbus = dependency(['libsystemd', 'libelogind'],
|
|
|
|
required: false,
|
2020-12-02 22:46:49 +00:00
|
|
|
version: '>=239',
|
|
|
|
)
|
2022-01-10 14:54:24 +00:00
|
|
|
if not sdbus.found()
|
|
|
|
sdbus = dependency('basu', required: false)
|
|
|
|
endif
|
2020-12-02 22:46:49 +00:00
|
|
|
else
|
|
|
|
sdbus = dependency(get_option('sd-bus-provider'), required: get_option('tray'))
|
|
|
|
endif
|
|
|
|
|
2022-01-10 14:54:24 +00:00
|
|
|
tray_deps_found = sdbus.found()
|
|
|
|
if get_option('tray').enabled() and not tray_deps_found
|
|
|
|
error('Building with -Dtray=enabled, but sd-bus has not been not found')
|
|
|
|
endif
|
|
|
|
have_tray = (not get_option('tray').disabled()) and tray_deps_found
|
2019-01-17 17:02:25 +00:00
|
|
|
|
|
|
|
conf_data = configuration_data()
|
2018-07-24 20:16:06 +00:00
|
|
|
|
2019-01-17 17:02:25 +00:00
|
|
|
conf_data.set10('HAVE_XWAYLAND', have_xwayland)
|
2018-11-17 23:33:06 +00:00
|
|
|
conf_data.set10('HAVE_GDK_PIXBUF', gdk_pixbuf.found())
|
2020-12-02 22:46:49 +00:00
|
|
|
conf_data.set10('HAVE_LIBSYSTEMD', sdbus.found() and sdbus.name() == 'libsystemd')
|
|
|
|
conf_data.set10('HAVE_LIBELOGIND', sdbus.found() and sdbus.name() == 'libelogind')
|
2020-12-02 22:48:11 +00:00
|
|
|
conf_data.set10('HAVE_BASU', sdbus.found() and sdbus.name() == 'basu')
|
2019-01-17 17:02:25 +00:00
|
|
|
conf_data.set10('HAVE_TRAY', have_tray)
|
2018-04-17 07:54:02 +00:00
|
|
|
|
2019-03-04 15:25:34 +00:00
|
|
|
scdoc = dependency('scdoc', version: '>=1.9.2', native: true, required: get_option('man-pages'))
|
2018-05-11 12:39:46 +00:00
|
|
|
if scdoc.found()
|
2021-06-25 14:24:22 +00:00
|
|
|
scdoc_prog = find_program(scdoc.get_variable(pkgconfig: 'scdoc'), native: true)
|
2017-11-30 16:34:44 +00:00
|
|
|
mandir = get_option('mandir')
|
|
|
|
man_files = [
|
2018-05-11 12:39:46 +00:00
|
|
|
'sway/sway.1.scd',
|
2018-05-12 00:58:34 +00:00
|
|
|
'sway/sway.5.scd',
|
2018-05-12 01:13:43 +00:00
|
|
|
'sway/sway-bar.5.scd',
|
2018-05-12 01:25:05 +00:00
|
|
|
'sway/sway-input.5.scd',
|
2019-02-27 18:23:10 +00:00
|
|
|
'sway/sway-ipc.7.scd',
|
2018-10-14 14:48:51 +00:00
|
|
|
'sway/sway-output.5.scd',
|
2019-05-30 06:58:46 +00:00
|
|
|
'swaybar/swaybar-protocol.7.scd',
|
2018-05-12 01:39:47 +00:00
|
|
|
'swaymsg/swaymsg.1.scd',
|
2017-11-30 16:34:44 +00:00
|
|
|
]
|
2021-07-13 12:19:42 +00:00
|
|
|
|
|
|
|
if get_option('swaynag')
|
|
|
|
man_files += [
|
|
|
|
'swaynag/swaynag.1.scd',
|
|
|
|
'swaynag/swaynag.5.scd',
|
|
|
|
]
|
|
|
|
endif
|
|
|
|
|
2017-11-30 16:34:44 +00:00
|
|
|
foreach filename : man_files
|
|
|
|
topic = filename.split('.')[-3].split('/')[-1]
|
|
|
|
section = filename.split('.')[-2]
|
2018-05-11 12:39:46 +00:00
|
|
|
output = '@0@.@1@'.format(topic, section)
|
2017-11-30 16:34:44 +00:00
|
|
|
|
|
|
|
custom_target(
|
2018-05-11 12:39:46 +00:00
|
|
|
output,
|
2017-11-30 16:34:44 +00:00
|
|
|
input: filename,
|
2018-05-11 12:39:46 +00:00
|
|
|
output: output,
|
2021-07-05 20:00:00 +00:00
|
|
|
command: scdoc_prog,
|
2017-11-30 16:34:44 +00:00
|
|
|
install: true,
|
2021-07-05 20:00:00 +00:00
|
|
|
feed: true,
|
|
|
|
capture: true,
|
2017-11-30 16:34:44 +00:00
|
|
|
install_dir: '@0@/man@1@'.format(mandir, section)
|
|
|
|
)
|
|
|
|
endforeach
|
|
|
|
endif
|
2017-11-29 14:03:12 +00:00
|
|
|
|
2018-11-23 22:14:59 +00:00
|
|
|
add_project_arguments('-DSYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir)), language : 'c')
|
2017-12-05 09:40:55 +00:00
|
|
|
|
2019-02-12 22:13:24 +00:00
|
|
|
version = '"@0@"'.format(meson.project_version())
|
2019-10-14 12:03:28 +00:00
|
|
|
git = find_program('git', native: true, required: false)
|
2019-02-05 13:32:05 +00:00
|
|
|
if git.found()
|
2022-01-11 10:35:44 +00:00
|
|
|
git_commit = run_command([git, 'rev-parse', '--short', 'HEAD'], check: false)
|
|
|
|
git_branch = run_command([git, 'rev-parse', '--abbrev-ref', 'HEAD'], check: false)
|
2019-10-14 12:03:28 +00:00
|
|
|
if git_commit.returncode() == 0 and git_branch.returncode() == 0
|
|
|
|
version = '"@0@-@1@ (" __DATE__ ", branch \'@2@\')"'.format(
|
|
|
|
meson.project_version(),
|
|
|
|
git_commit.stdout().strip(),
|
|
|
|
git_branch.stdout().strip(),
|
|
|
|
)
|
2019-02-12 22:13:24 +00:00
|
|
|
endif
|
2017-11-30 09:48:08 +00:00
|
|
|
endif
|
2017-11-30 09:29:32 +00:00
|
|
|
add_project_arguments('-DSWAY_VERSION=@0@'.format(version), language: 'c')
|
2017-11-29 14:03:12 +00:00
|
|
|
|
2019-06-23 03:13:19 +00:00
|
|
|
# Compute the relative path used by compiler invocations.
|
|
|
|
source_root = meson.current_source_dir().split('/')
|
2021-06-25 14:22:28 +00:00
|
|
|
build_root = meson.global_build_root().split('/')
|
2019-06-23 03:13:19 +00:00
|
|
|
relative_dir_parts = []
|
|
|
|
i = 0
|
|
|
|
in_prefix = true
|
|
|
|
foreach p : build_root
|
|
|
|
if i >= source_root.length() or not in_prefix or p != source_root[i]
|
|
|
|
in_prefix = false
|
|
|
|
relative_dir_parts += '..'
|
|
|
|
endif
|
|
|
|
i += 1
|
|
|
|
endforeach
|
|
|
|
i = 0
|
|
|
|
in_prefix = true
|
|
|
|
foreach p : source_root
|
|
|
|
if i >= build_root.length() or not in_prefix or build_root[i] != p
|
|
|
|
in_prefix = false
|
|
|
|
relative_dir_parts += p
|
|
|
|
endif
|
|
|
|
i += 1
|
|
|
|
endforeach
|
|
|
|
relative_dir = join_paths(relative_dir_parts) + '/'
|
|
|
|
|
|
|
|
# Strip relative path prefixes from the code if possible, otherwise hide them.
|
|
|
|
if cc.has_argument('-fmacro-prefix-map=/prefix/to/hide=')
|
|
|
|
add_project_arguments(
|
|
|
|
'-fmacro-prefix-map=@0@='.format(relative_dir),
|
|
|
|
language: 'c',
|
|
|
|
)
|
|
|
|
else
|
|
|
|
add_project_arguments(
|
|
|
|
'-DSWAY_REL_SRC_DIR="@0@"'.format(relative_dir),
|
|
|
|
language: 'c',
|
|
|
|
)
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2017-11-29 14:03:12 +00:00
|
|
|
sway_inc = include_directories('include')
|
|
|
|
|
2018-03-28 16:21:50 +00:00
|
|
|
subdir('include')
|
2018-03-27 17:35:34 +00:00
|
|
|
subdir('protocols')
|
2017-11-30 08:39:27 +00:00
|
|
|
subdir('common')
|
|
|
|
subdir('sway')
|
2017-11-30 16:40:49 +00:00
|
|
|
subdir('swaymsg')
|
2018-03-29 03:04:20 +00:00
|
|
|
|
2021-07-13 12:19:42 +00:00
|
|
|
if get_option('swaybar') or get_option('swaynag')
|
|
|
|
subdir('client')
|
|
|
|
endif
|
|
|
|
if get_option('swaybar')
|
|
|
|
subdir('swaybar')
|
|
|
|
endif
|
|
|
|
if get_option('swaynag')
|
|
|
|
subdir('swaynag')
|
|
|
|
endif
|
2018-09-20 23:31:09 +00:00
|
|
|
|
2017-11-30 13:31:13 +00:00
|
|
|
config = configuration_data()
|
|
|
|
config.set('datadir', join_paths(prefix, datadir))
|
|
|
|
config.set('prefix', prefix)
|
2018-11-23 22:14:59 +00:00
|
|
|
config.set('sysconfdir', join_paths(prefix, sysconfdir))
|
2018-10-17 13:06:55 +00:00
|
|
|
|
2017-11-30 13:31:13 +00:00
|
|
|
configure_file(
|
|
|
|
configuration: config,
|
|
|
|
input: 'config.in',
|
|
|
|
output: '@BASENAME@',
|
2020-01-22 16:30:57 +00:00
|
|
|
install_dir: join_paths(sysconfdir, 'sway')
|
2017-11-30 13:31:13 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
install_data(
|
|
|
|
'sway.desktop',
|
2020-01-22 16:30:57 +00:00
|
|
|
install_dir: join_paths(datadir, 'wayland-sessions')
|
2017-11-30 13:31:13 +00:00
|
|
|
)
|
|
|
|
|
2019-01-18 07:44:02 +00:00
|
|
|
if get_option('default-wallpaper')
|
2017-11-30 13:31:13 +00:00
|
|
|
wallpaper_files = files(
|
|
|
|
'assets/Sway_Wallpaper_Blue_768x1024.png',
|
|
|
|
'assets/Sway_Wallpaper_Blue_768x1024_Portrait.png',
|
|
|
|
'assets/Sway_Wallpaper_Blue_1136x640.png',
|
|
|
|
'assets/Sway_Wallpaper_Blue_1136x640_Portrait.png',
|
|
|
|
'assets/Sway_Wallpaper_Blue_1366x768.png',
|
|
|
|
'assets/Sway_Wallpaper_Blue_1920x1080.png',
|
|
|
|
'assets/Sway_Wallpaper_Blue_2048x1536.png',
|
|
|
|
'assets/Sway_Wallpaper_Blue_2048x1536_Portrait.png',
|
|
|
|
)
|
2020-01-22 16:30:57 +00:00
|
|
|
wallpaper_install_dir = join_paths(datadir, 'backgrounds', 'sway')
|
2017-11-30 13:31:13 +00:00
|
|
|
|
|
|
|
install_data(wallpaper_files, install_dir: wallpaper_install_dir)
|
|
|
|
endif
|
2017-11-30 16:51:58 +00:00
|
|
|
|
2019-01-18 07:44:02 +00:00
|
|
|
if get_option('zsh-completions')
|
2017-11-30 16:51:58 +00:00
|
|
|
zsh_files = files(
|
|
|
|
'completions/zsh/_sway',
|
|
|
|
'completions/zsh/_swaymsg',
|
|
|
|
)
|
2020-01-22 16:30:57 +00:00
|
|
|
zsh_install_dir = join_paths(datadir, 'zsh', 'site-functions')
|
2017-11-30 16:51:58 +00:00
|
|
|
|
|
|
|
install_data(zsh_files, install_dir: zsh_install_dir)
|
|
|
|
endif
|
2018-07-27 16:50:33 +00:00
|
|
|
|
2019-01-18 07:44:02 +00:00
|
|
|
if get_option('bash-completions')
|
2018-07-27 16:50:33 +00:00
|
|
|
bash_files = files(
|
|
|
|
'completions/bash/sway',
|
|
|
|
'completions/bash/swaymsg',
|
|
|
|
)
|
2021-07-13 12:19:42 +00:00
|
|
|
|
|
|
|
if get_option('swaybar')
|
|
|
|
bash_files += files('completions/bash/swaybar')
|
|
|
|
endif
|
|
|
|
|
2020-01-22 04:03:58 +00:00
|
|
|
if bash_comp.found()
|
2021-06-25 14:24:22 +00:00
|
|
|
bash_install_dir = bash_comp.get_variable(
|
|
|
|
pkgconfig: 'completionsdir',
|
|
|
|
pkgconfig_define: ['datadir', datadir]
|
2020-03-29 08:06:48 +00:00
|
|
|
)
|
2020-01-22 04:03:58 +00:00
|
|
|
else
|
|
|
|
bash_install_dir = join_paths(datadir, 'bash-completion', 'completions')
|
|
|
|
endif
|
2018-07-27 16:50:33 +00:00
|
|
|
|
|
|
|
install_data(bash_files, install_dir: bash_install_dir)
|
|
|
|
endif
|
2018-08-26 16:27:18 +00:00
|
|
|
|
2019-01-18 07:44:02 +00:00
|
|
|
if get_option('fish-completions')
|
2018-08-26 16:27:18 +00:00
|
|
|
fish_files = files(
|
|
|
|
'completions/fish/sway.fish',
|
|
|
|
'completions/fish/swaymsg.fish',
|
|
|
|
)
|
2021-07-13 12:19:42 +00:00
|
|
|
|
|
|
|
if get_option('swaynag')
|
|
|
|
fish_files += files('completions/fish/swaynag.fish')
|
|
|
|
endif
|
|
|
|
|
2020-01-22 04:03:58 +00:00
|
|
|
if fish_comp.found()
|
2021-06-25 14:24:22 +00:00
|
|
|
fish_install_dir = fish_comp.get_variable(
|
|
|
|
pkgconfig: 'completionsdir',
|
|
|
|
pkgconfig_define: ['datadir', datadir]
|
2020-03-29 08:06:48 +00:00
|
|
|
)
|
2020-01-22 04:03:58 +00:00
|
|
|
else
|
2020-01-22 04:05:43 +00:00
|
|
|
fish_install_dir = join_paths(datadir, 'fish', 'vendor_completions.d')
|
2020-01-22 04:03:58 +00:00
|
|
|
endif
|
2018-08-26 16:27:18 +00:00
|
|
|
|
|
|
|
install_data(fish_files, install_dir: fish_install_dir)
|
|
|
|
endif
|
2019-02-27 20:26:50 +00:00
|
|
|
|
2020-04-30 15:12:28 +00:00
|
|
|
summary({
|
|
|
|
'xwayland': have_xwayland,
|
|
|
|
'gdk-pixbuf': gdk_pixbuf.found(),
|
|
|
|
'tray': have_tray,
|
|
|
|
'man-pages': scdoc.found(),
|
|
|
|
}, bool_yn: true)
|
2019-02-27 20:26:50 +00:00
|
|
|
|