From 08a5b304e4334020f46752697ad0e7cde54229f4 Mon Sep 17 00:00:00 2001 From: emersion Date: Thu, 17 Jan 2019 18:02:25 +0100 Subject: [PATCH 1/5] Use Meson feature options --- meson.build | 16 +++++++++++----- meson_options.txt | 4 ++-- sway/meson.build | 2 +- swaybar/meson.build | 4 ++-- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/meson.build b/meson.build index 2285cbdf..8acf0f2c 100644 --- a/meson.build +++ b/meson.build @@ -2,6 +2,7 @@ project( 'sway', 'c', license: 'MIT', + meson_version: '>=0.48.0', default_options: [ 'c_std=c11', 'warning_level=2', @@ -53,21 +54,26 @@ libpam = cc.find_library('pam', required: false) crypt = cc.find_library('crypt', required: false) systemd = dependency('libsystemd', required: false) elogind = dependency('libelogind', required: false) +xcb = dependency('xcb', required: get_option('xwayland')) math = cc.find_library('m') rt = cc.find_library('rt') git = find_program('git', required: false) -conf_data = configuration_data() +have_xwayland = xcb.found() -conf_data.set10('HAVE_XWAYLAND', get_option('enable-xwayland')) -if get_option('enable-xwayland') - xcb = dependency('xcb') +tray_deps_found = systemd.found() or elogind.found() +if get_option('tray').enabled() and not tray_deps_found + error('Building with -Dtray=enabled, but libsystemd and libelogind have not been not found') endif +have_tray = (not get_option('tray').disabled()) and tray_deps_found + +conf_data = configuration_data() +conf_data.set10('HAVE_XWAYLAND', have_xwayland) conf_data.set10('HAVE_GDK_PIXBUF', gdk_pixbuf.found()) conf_data.set10('HAVE_SYSTEMD', systemd.found()) conf_data.set10('HAVE_ELOGIND', elogind.found()) -conf_data.set10('HAVE_TRAY', get_option('enable-tray') and (systemd.found() or elogind.found())) +conf_data.set10('HAVE_TRAY', have_tray) if not systemd.found() and not elogind.found() warning('The sway binary must be setuid when compiled without (e)logind') diff --git a/meson_options.txt b/meson_options.txt index 4640618e..81eee66f 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -5,5 +5,5 @@ option('default-wallpaper', type: 'boolean', value: true, description: 'Install option('zsh-completions', type: 'boolean', value: true, description: 'Install zsh shell completions.') option('bash-completions', type: 'boolean', value: true, description: 'Install bash shell completions.') option('fish-completions', type: 'boolean', value: true, description: 'Install fish shell completions.') -option('enable-xwayland', type: 'boolean', value: true, description: 'Enable support for X11 applications') -option('enable-tray', type: 'boolean', value: false, description: 'Enable support for swaybar tray') +option('xwayland', type: 'feature', value: 'auto', description: 'Enable support for X11 applications') +option('tray', type: 'feature', value: 'auto', description: 'Enable support for swaybar tray') diff --git a/sway/meson.build b/sway/meson.build index 0a08ee74..2388a66d 100644 --- a/sway/meson.build +++ b/sway/meson.build @@ -194,7 +194,7 @@ sway_deps = [ xkbcommon, ] -if get_option('enable-xwayland') +if have_xwayland sway_sources += 'desktop/xwayland.c' sway_deps += xcb endif diff --git a/swaybar/meson.build b/swaybar/meson.build index 312ca97b..a44c0061 100644 --- a/swaybar/meson.build +++ b/swaybar/meson.build @@ -1,4 +1,4 @@ -tray_files = get_option('enable-tray') ? [ +tray_files = have_tray ? [ 'tray/host.c', 'tray/icon.c', 'tray/item.c', @@ -19,7 +19,7 @@ swaybar_deps = [ wayland_cursor, wlroots, ] -if get_option('enable-tray') +if have_tray if systemd.found() swaybar_deps += systemd elif elogind.found() From ba16f16e4d5ac01690f9c2140c1f6682affd27cb Mon Sep 17 00:00:00 2001 From: emersion Date: Fri, 18 Jan 2019 08:21:43 +0100 Subject: [PATCH 2/5] meson: add gdk-pixbuf and man-pages options --- meson.build | 5 ++--- meson_options.txt | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 8acf0f2c..1318ce8f 100644 --- a/meson.build +++ b/meson.build @@ -46,7 +46,7 @@ xkbcommon = dependency('xkbcommon') cairo = dependency('cairo') pango = dependency('pango') pangocairo = dependency('pangocairo') -gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: false) +gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf')) pixman = dependency('pixman-1') libevdev = dependency('libevdev') libinput = dependency('libinput', version: '>=1.6.0') @@ -80,8 +80,7 @@ if not systemd.found() and not elogind.found() warning('You must do this manually post-install: chmod a+s /path/to/sway') endif -scdoc = find_program('scdoc', required: false) - +scdoc = find_program('scdoc', required: get_option('man-pages')) if scdoc.found() sh = find_program('sh') mandir = get_option('mandir') diff --git a/meson_options.txt b/meson_options.txt index 81eee66f..836d171a 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -7,3 +7,5 @@ option('bash-completions', type: 'boolean', value: true, description: 'Install b option('fish-completions', type: 'boolean', value: true, description: 'Install fish shell completions.') option('xwayland', type: 'feature', value: 'auto', description: 'Enable support for X11 applications') option('tray', type: 'feature', value: 'auto', description: 'Enable support for swaybar tray') +option('gdk-pixbuf', type: 'feature', value: 'auto', description: 'Enable support for more image formats in swaybg') +option('man-pages', type: 'feature', value: 'auto', description: 'Generate and install man pages') From ab35e0383f562b6d586e1f27a139fe3ff9f38130 Mon Sep 17 00:00:00 2001 From: emersion Date: Fri, 18 Jan 2019 08:22:59 +0100 Subject: [PATCH 3/5] meson: remove unused dependencies --- meson.build | 2 -- 1 file changed, 2 deletions(-) diff --git a/meson.build b/meson.build index 1318ce8f..85d58a35 100644 --- a/meson.build +++ b/meson.build @@ -50,8 +50,6 @@ gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf') pixman = dependency('pixman-1') libevdev = dependency('libevdev') libinput = dependency('libinput', version: '>=1.6.0') -libpam = cc.find_library('pam', required: false) -crypt = cc.find_library('crypt', required: false) systemd = dependency('libsystemd', required: false) elogind = dependency('libelogind', required: false) xcb = dependency('xcb', required: get_option('xwayland')) From bb2f007ad3c6be5b03eb60b524b36ee4d7ad9742 Mon Sep 17 00:00:00 2001 From: emersion Date: Fri, 18 Jan 2019 08:26:44 +0100 Subject: [PATCH 4/5] meson: remove rpath options --- meson.build | 11 ----------- meson_options.txt | 2 -- sway/meson.build | 1 - swaybar/meson.build | 1 - swaybg/meson.build | 1 - swaymsg/meson.build | 13 ++++++------- swaynag/meson.build | 1 - 7 files changed, 6 insertions(+), 24 deletions(-) diff --git a/meson.build b/meson.build index 85d58a35..8f522a3b 100644 --- a/meson.build +++ b/meson.build @@ -126,17 +126,6 @@ else endif add_project_arguments('-DSWAY_VERSION=@0@'.format(version), language: 'c') -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 - sway_inc = include_directories('include') subdir('include') diff --git a/meson_options.txt b/meson_options.txt index 836d171a..04b29e17 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,6 +1,4 @@ option('sway-version', type : 'string', description: 'The version string reported in `sway --version`.') -option('use_rpath', type: 'boolean', value: false, description: 'install binaries with rpath set') -option('custom_rpath', type: 'string', value: '', description: 'override rpath with a custom one') option('default-wallpaper', type: 'boolean', value: true, description: 'Install the default wallpaper.') option('zsh-completions', type: 'boolean', value: true, description: 'Install zsh shell completions.') option('bash-completions', type: 'boolean', value: true, description: 'Install bash shell completions.') diff --git a/sway/meson.build b/sway/meson.build index 2388a66d..94d5abdb 100644 --- a/sway/meson.build +++ b/sway/meson.build @@ -205,6 +205,5 @@ executable( include_directories: [sway_inc], dependencies: sway_deps, link_with: [lib_sway_common], - install_rpath : rpathdir, install: true ) diff --git a/swaybar/meson.build b/swaybar/meson.build index a44c0061..b35f8169 100644 --- a/swaybar/meson.build +++ b/swaybar/meson.build @@ -42,6 +42,5 @@ executable( include_directories: [sway_inc], dependencies: swaybar_deps, link_with: [lib_sway_common, lib_sway_client], - install_rpath : rpathdir, install: true ) diff --git a/swaybg/meson.build b/swaybg/meson.build index 095c5488..8704de6d 100644 --- a/swaybg/meson.build +++ b/swaybg/meson.build @@ -14,6 +14,5 @@ executable( wlroots, ], link_with: [lib_sway_common, lib_sway_client], - install_rpath : rpathdir, install: true ) diff --git a/swaymsg/meson.build b/swaymsg/meson.build index 7318349d..b78e6cb0 100644 --- a/swaymsg/meson.build +++ b/swaymsg/meson.build @@ -1,9 +1,8 @@ executable( - 'swaymsg', - 'main.c', - include_directories: [sway_inc], - dependencies: [jsonc, wlroots], - link_with: [lib_sway_common], - install_rpath : rpathdir, - install: true + 'swaymsg', + 'main.c', + include_directories: [sway_inc], + dependencies: [jsonc, wlroots], + link_with: [lib_sway_common], + install: true ) diff --git a/swaynag/meson.build b/swaynag/meson.build index 223a0bc7..2ba3ed95 100644 --- a/swaynag/meson.build +++ b/swaynag/meson.build @@ -19,6 +19,5 @@ executable( wlroots, ], link_with: [lib_sway_common, lib_sway_client], - install_rpath : rpathdir, install: true ) From 765d7bc94f1b02f0b1135b6412dab8654ec2ac31 Mon Sep 17 00:00:00 2001 From: emersion Date: Fri, 18 Jan 2019 08:44:02 +0100 Subject: [PATCH 5/5] meson: remove extraneous parentheses --- meson.build | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index 8f522a3b..bb1c4ddf 100644 --- a/meson.build +++ b/meson.build @@ -172,7 +172,7 @@ install_data( install_dir: datadir + '/wayland-sessions' ) -if (get_option('default-wallpaper')) +if get_option('default-wallpaper') wallpaper_files = files( 'assets/Sway_Wallpaper_Blue_768x1024.png', 'assets/Sway_Wallpaper_Blue_768x1024_Portrait.png', @@ -188,7 +188,7 @@ if (get_option('default-wallpaper')) install_data(wallpaper_files, install_dir: wallpaper_install_dir) endif -if (get_option('zsh-completions')) +if get_option('zsh-completions') zsh_files = files( 'completions/zsh/_sway', 'completions/zsh/_swaymsg', @@ -198,7 +198,7 @@ if (get_option('zsh-completions')) install_data(zsh_files, install_dir: zsh_install_dir) endif -if (get_option('bash-completions')) +if get_option('bash-completions') bash_files = files( 'completions/bash/sway', 'completions/bash/swaybar', @@ -209,7 +209,7 @@ if (get_option('bash-completions')) install_data(bash_files, install_dir: bash_install_dir) endif -if (get_option('fish-completions')) +if get_option('fish-completions') fish_files = files( 'completions/fish/sway.fish', 'completions/fish/swaymsg.fish',