2017-11-29 14:03:12 +00:00
|
|
|
project(
|
|
|
|
'sway',
|
|
|
|
'c',
|
|
|
|
license: 'MIT',
|
|
|
|
default_options: [
|
|
|
|
'c_std=c11',
|
|
|
|
'warning_level=2',
|
|
|
|
'werror=true',
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2018-11-12 21:23:06 +00:00
|
|
|
add_project_arguments(
|
|
|
|
[
|
|
|
|
'-DWL_HIDE_DEPRECATED',
|
|
|
|
'-DWLR_USE_UNSTABLE',
|
|
|
|
|
|
|
|
'-Wno-unused-parameter',
|
|
|
|
'-Wno-unused-result',
|
|
|
|
'-Wundef',
|
|
|
|
],
|
|
|
|
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
|
|
|
|
|
2018-04-17 07:54:02 +00:00
|
|
|
swayidle_deps = []
|
|
|
|
|
2018-01-04 15:43:40 +00:00
|
|
|
jsonc = dependency('json-c', version: '>=0.13')
|
2017-11-30 08:41:51 +00:00
|
|
|
pcre = dependency('libpcre')
|
2018-03-12 11:21:46 +00:00
|
|
|
wlroots = dependency('wlroots', fallback: ['wlroots', 'wlroots'])
|
2017-11-29 14:03:12 +00:00
|
|
|
wayland_server = dependency('wayland-server')
|
|
|
|
wayland_client = dependency('wayland-client')
|
2018-03-31 01:38:28 +00:00
|
|
|
wayland_cursor = dependency('wayland-cursor')
|
2017-11-29 14:03:12 +00:00
|
|
|
wayland_egl = dependency('wayland-egl')
|
2018-05-18 22:47:47 +00:00
|
|
|
wayland_protos = dependency('wayland-protocols', version: '>=1.14')
|
2017-11-29 14:03:12 +00:00
|
|
|
xkbcommon = dependency('xkbcommon')
|
2018-03-27 19:25:25 +00:00
|
|
|
cairo = dependency('cairo')
|
2017-11-30 08:41:51 +00:00
|
|
|
pango = dependency('pango')
|
2018-03-27 19:25:25 +00:00
|
|
|
pangocairo = dependency('pangocairo')
|
|
|
|
gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: false)
|
2017-11-30 08:41:51 +00:00
|
|
|
pixman = dependency('pixman-1')
|
2018-04-07 23:34:12 +00:00
|
|
|
libinput = dependency('libinput', version: '>=1.6.0')
|
2018-09-20 23:31:09 +00:00
|
|
|
libpam = cc.find_library('pam', required: false)
|
2018-10-06 16:17:36 +00:00
|
|
|
crypt = cc.find_library('crypt', required: false)
|
2018-04-17 07:54:02 +00:00
|
|
|
systemd = dependency('libsystemd', required: false)
|
|
|
|
elogind = dependency('libelogind', required: false)
|
2017-11-29 14:03:12 +00:00
|
|
|
math = cc.find_library('m')
|
2018-03-29 03:04:20 +00:00
|
|
|
rt = cc.find_library('rt')
|
2018-06-18 21:49:28 +00:00
|
|
|
git = find_program('git', required: false)
|
2017-11-30 16:34:44 +00:00
|
|
|
|
2018-03-28 16:21:50 +00:00
|
|
|
conf_data = configuration_data()
|
|
|
|
|
2018-11-17 23:33:06 +00:00
|
|
|
conf_data.set10('HAVE_XWAYLAND', get_option('enable-xwayland'))
|
2018-07-24 20:16:06 +00:00
|
|
|
if get_option('enable-xwayland')
|
2018-08-02 07:36:47 +00:00
|
|
|
xcb = dependency('xcb')
|
2018-07-24 20:16:06 +00:00
|
|
|
endif
|
|
|
|
|
2018-11-17 23:33:06 +00:00
|
|
|
conf_data.set10('HAVE_GDK_PIXBUF', gdk_pixbuf.found())
|
|
|
|
conf_data.set10('HAVE_SYSTEMD', systemd.found())
|
|
|
|
conf_data.set10('HAVE_ELOGIND', elogind.found())
|
2018-04-17 07:54:02 +00:00
|
|
|
|
2018-09-28 10:18:54 +00:00
|
|
|
if not systemd.found() and not elogind.found()
|
2018-11-17 23:33:06 +00:00
|
|
|
warning('The sway binary must be setuid when compiled without (e)logind')
|
|
|
|
warning('You must do this manually post-install: chmod a+s /path/to/sway')
|
2018-09-28 10:18:54 +00:00
|
|
|
endif
|
|
|
|
|
2018-05-11 12:39:46 +00:00
|
|
|
scdoc = find_program('scdoc', required: false)
|
|
|
|
|
|
|
|
if scdoc.found()
|
|
|
|
sh = find_program('sh')
|
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',
|
2018-10-14 14:48:51 +00:00
|
|
|
'sway/sway-output.5.scd',
|
2018-05-12 01:39:47 +00:00
|
|
|
'swaylock/swaylock.1.scd',
|
|
|
|
'swaymsg/swaymsg.1.scd',
|
2018-04-17 07:54:02 +00:00
|
|
|
'swayidle/swayidle.1.scd',
|
2018-07-27 15:19:42 +00:00
|
|
|
'swaynag/swaynag.1.scd',
|
2018-07-28 13:34:25 +00:00
|
|
|
'swaynag/swaynag.5.scd',
|
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,
|
2017-11-30 16:34:44 +00:00
|
|
|
command: [
|
2018-05-11 12:39:46 +00:00
|
|
|
sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc.path(), output)
|
2017-11-30 16:34:44 +00:00
|
|
|
],
|
|
|
|
install: true,
|
|
|
|
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
|
|
|
|
2018-09-02 12:58:15 +00:00
|
|
|
version = get_option('sway-version')
|
2017-11-30 09:48:08 +00:00
|
|
|
if version != ''
|
|
|
|
version = '"@0@"'.format(version)
|
|
|
|
else
|
|
|
|
if not git.found()
|
|
|
|
error('git is required to make the version string')
|
|
|
|
endif
|
|
|
|
|
|
|
|
git_commit_hash = run_command([git.path(), 'describe', '--always', '--tags']).stdout().strip()
|
|
|
|
git_branch = run_command([git.path(), 'rev-parse', '--abbrev-ref', 'HEAD']).stdout().strip()
|
|
|
|
version = '"@0@ (" __DATE__ ", branch \'@1@\')"'.format(git_commit_hash, git_branch)
|
|
|
|
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
|
|
|
|
2018-09-30 12:11:24 +00:00
|
|
|
if get_option('use_rpath')
|
|
|
|
if get_option('custom_rpath') == ''
|
|
|
|
# default to platform specific libdir, one level up from the binary
|
|
|
|
rpathdir = join_paths('$ORIGIN', '..', '$LIB')
|
|
|
|
else
|
|
|
|
rpathdir = get_option('custom_rpath')
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
rpathdir = ''
|
|
|
|
endif
|
2018-09-02 13:07:47 +00:00
|
|
|
|
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
|
|
|
|
2018-03-27 19:25:25 +00:00
|
|
|
subdir('client')
|
2018-03-27 17:35:34 +00:00
|
|
|
subdir('swaybg')
|
2018-03-29 03:04:20 +00:00
|
|
|
subdir('swaybar')
|
2018-04-17 07:54:02 +00:00
|
|
|
subdir('swayidle')
|
2018-07-27 15:19:42 +00:00
|
|
|
subdir('swaynag')
|
2018-09-28 10:18:54 +00:00
|
|
|
subdir('swaylock')
|
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@',
|
|
|
|
install_dir: sysconfdir + '/sway'
|
|
|
|
)
|
|
|
|
|
|
|
|
if is_freebsd
|
|
|
|
configure_file(
|
|
|
|
configuration: config,
|
|
|
|
input: 'security.d/10-freebsd.in',
|
|
|
|
output: '@BASENAME@',
|
|
|
|
install_dir: sysconfdir + '/sway/security.d'
|
|
|
|
)
|
|
|
|
else
|
|
|
|
configure_file(
|
|
|
|
configuration: config,
|
|
|
|
input: 'security.d/00-defaults.in',
|
|
|
|
output: '@BASENAME@',
|
|
|
|
install_dir: sysconfdir + '/sway/security.d'
|
|
|
|
)
|
|
|
|
endif
|
|
|
|
|
|
|
|
install_data(
|
|
|
|
'sway.desktop',
|
|
|
|
install_dir: datadir + '/wayland-sessions'
|
|
|
|
)
|
|
|
|
|
2018-09-02 12:58:15 +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',
|
|
|
|
)
|
|
|
|
wallpaper_install_dir = datadir + '/backgrounds/sway'
|
|
|
|
|
|
|
|
install_data(wallpaper_files, install_dir: wallpaper_install_dir)
|
|
|
|
endif
|
2017-11-30 16:51:58 +00:00
|
|
|
|
2018-09-02 12:58:15 +00:00
|
|
|
if (get_option('zsh-completions'))
|
2017-11-30 16:51:58 +00:00
|
|
|
zsh_files = files(
|
|
|
|
'completions/zsh/_sway',
|
|
|
|
'completions/zsh/_swaylock',
|
|
|
|
'completions/zsh/_swaymsg',
|
|
|
|
)
|
|
|
|
zsh_install_dir = datadir + '/zsh/site-functions'
|
|
|
|
|
|
|
|
install_data(zsh_files, install_dir: zsh_install_dir)
|
|
|
|
endif
|
2018-07-27 16:50:33 +00:00
|
|
|
|
2018-09-02 12:58:15 +00:00
|
|
|
if (get_option('bash-completions'))
|
2018-07-27 16:50:33 +00:00
|
|
|
bash_files = files(
|
|
|
|
'completions/bash/sway',
|
|
|
|
'completions/bash/swayidle',
|
|
|
|
'completions/bash/swaylock',
|
|
|
|
'completions/bash/swaymsg',
|
|
|
|
)
|
|
|
|
bash_install_dir = datadir + '/bash-completion/completions'
|
|
|
|
|
|
|
|
install_data(bash_files, install_dir: bash_install_dir)
|
|
|
|
endif
|
2018-08-26 16:27:18 +00:00
|
|
|
|
2018-09-02 12:58:15 +00:00
|
|
|
if (get_option('fish-completions'))
|
2018-08-26 16:27:18 +00:00
|
|
|
fish_files = files(
|
|
|
|
'completions/fish/sway.fish',
|
2018-10-27 14:54:20 +00:00
|
|
|
'completions/fish/swayidle.fish',
|
2018-08-26 16:27:18 +00:00
|
|
|
'completions/fish/swaylock.fish',
|
|
|
|
'completions/fish/swaymsg.fish',
|
2018-10-27 14:54:32 +00:00
|
|
|
'completions/fish/swaynag.fish',
|
2018-08-26 16:27:18 +00:00
|
|
|
)
|
|
|
|
fish_install_dir = datadir + '/fish/completions'
|
|
|
|
|
|
|
|
install_data(fish_files, install_dir: fish_install_dir)
|
|
|
|
endif
|