build: move completions to separate file

This commit is contained in:
Simon Ser 2022-12-05 10:57:52 +01:00
parent d9e71c87c7
commit dcba5bcb9f
2 changed files with 40 additions and 38 deletions

39
completions/meson.build Normal file
View File

@ -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

View File

@ -42,8 +42,6 @@ wayland_scanner = dependency('wayland-scanner', version: '>=1.15.0', native: tru
xkbcommon = dependency('xkbcommon') xkbcommon = dependency('xkbcommon')
cairo = dependency('cairo') cairo = dependency('cairo')
gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf')) 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')) libpam = cc.find_library('pam', required: get_option('pam'))
crypt = cc.find_library('crypt', required: not libpam.found()) crypt = cc.find_library('crypt', required: not libpam.found())
math = cc.find_library('m') math = cc.find_library('m')
@ -180,39 +178,4 @@ if scdoc.found()
endforeach endforeach
endif endif
datadir = get_option('datadir') subdir('completions')
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