From dcba5bcb9f20c7d5d75f700693e031737567289a Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 5 Dec 2022 10:57:52 +0100 Subject: [PATCH] build: move completions to separate file --- completions/meson.build | 39 +++++++++++++++++++++++++++++++++++++++ meson.build | 39 +-------------------------------------- 2 files changed, 40 insertions(+), 38 deletions(-) create mode 100644 completions/meson.build diff --git a/completions/meson.build b/completions/meson.build new file mode 100644 index 0000000..e2e913a --- /dev/null +++ b/completions/meson.build @@ -0,0 +1,39 @@ +bash_comp = dependency('bash-completion', required: false) +fish_comp = dependency('fish', required: false) + +datadir = get_option('datadir') + +if get_option('zsh-completions') + zsh_files = files( + 'zsh/_swaylock', + ) + zsh_install_dir = datadir + '/zsh/site-functions' + + install_data(zsh_files, install_dir: zsh_install_dir) +endif + +if get_option('bash-completions') + bash_files = files( + 'bash/swaylock', + ) + if bash_comp.found() + bash_install_dir = bash_comp.get_variable('completionsdir') + else + bash_install_dir = datadir + '/bash-completion/completions' + endif + + install_data(bash_files, install_dir: bash_install_dir) +endif + +if get_option('fish-completions') + fish_files = files( + 'fish/swaylock.fish', + ) + if fish_comp.found() + fish_install_dir = fish_comp.get_variable('completionsdir') + else + fish_install_dir = datadir + '/fish/vendor_completions.d' + endif + + install_data(fish_files, install_dir: fish_install_dir) +endif diff --git a/meson.build b/meson.build index 13548b7..260e55f 100644 --- a/meson.build +++ b/meson.build @@ -42,8 +42,6 @@ wayland_scanner = dependency('wayland-scanner', version: '>=1.15.0', native: tru xkbcommon = dependency('xkbcommon') cairo = dependency('cairo') gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf')) -bash_comp = dependency('bash-completion', required: false) -fish_comp = dependency('fish', required: false) libpam = cc.find_library('pam', required: get_option('pam')) crypt = cc.find_library('crypt', required: not libpam.found()) math = cc.find_library('m') @@ -180,39 +178,4 @@ if scdoc.found() endforeach endif -datadir = get_option('datadir') - -if get_option('zsh-completions') - zsh_files = files( - 'completions/zsh/_swaylock', - ) - zsh_install_dir = datadir + '/zsh/site-functions' - - install_data(zsh_files, install_dir: zsh_install_dir) -endif - -if get_option('bash-completions') - bash_files = files( - 'completions/bash/swaylock', - ) - if bash_comp.found() - bash_install_dir = bash_comp.get_variable('completionsdir') - else - bash_install_dir = datadir + '/bash-completion/completions' - endif - - install_data(bash_files, install_dir: bash_install_dir) -endif - -if get_option('fish-completions') - fish_files = files( - 'completions/fish/swaylock.fish', - ) - if fish_comp.found() - fish_install_dir = fish_comp.get_variable('completionsdir') - else - fish_install_dir = datadir + '/fish/vendor_completions.d' - endif - - install_data(fish_files, install_dir: fish_install_dir) -endif +subdir('completions')