build: Merge 'completion' into 'src'

Ever since commit bafbbe81c9, the shell completions are generated
using the Toolbx binary, and the 'completion' sub-directory no longer
has any source code, but only the build scripts to invoke the Toolbx
binary to generate them.  This is a good opportunity to simplify the
layout of this Git repository by reducing the number of sub-directories.

The file containing the Bash completions had to be renamed to avoid
colliding with the name of the Toolbx binary, since they are both
generated in the same sub-directory.

https://github.com/containers/toolbox/pull/1216
This commit is contained in:
Debarshi Ray 2023-01-27 00:43:46 +01:00
parent fbf0135a99
commit ea62fecefd
4 changed files with 47 additions and 36 deletions

View file

@ -1,35 +0,0 @@
meson_generate_completions_program = find_program('meson_generate_completions.py')
if bashcompletionsdir != ''
custom_target(
'bash-completion',
capture: true,
command: [meson_generate_completions_program, meson.global_source_root() / 'src', 'bash'],
depends: [toolbox_go],
install: true,
install_dir: bashcompletionsdir,
output: 'toolbox',
)
endif
if fishcompletionsdir != ''
custom_target(
'fish-completion',
capture: true,
command: [meson_generate_completions_program, meson.global_source_root() / 'src', 'fish'],
depends: [toolbox_go],
install: true,
install_dir: fishcompletionsdir,
output: 'toolbox.fish',
)
endif
custom_target(
'zsh-completion',
capture: true,
command: [meson_generate_completions_program, meson.global_source_root() / 'src', 'zsh'],
depends: [toolbox_go],
install: true,
install_dir: zshcompletionsdir,
output: '_toolbox',
)

View file

@ -112,6 +112,5 @@ subdir('data')
subdir('doc')
subdir('profile.d')
subdir('src')
subdir('completion')
meson.add_install_script('meson_post_install.py')

View file

@ -1,6 +1,7 @@
go_build_wrapper_file = files('go-build-wrapper')
go_build_wrapper_program = find_program('go-build-wrapper')
meson_generate_completions_program = find_program('meson_generate_completions.py')
meson_go_fmt_program = find_program('meson_go_fmt.py')
sources = files(
@ -66,6 +67,52 @@ toolbox_go = custom_target(
output: 'toolbox',
)
if bashcompletionsdir != ''
custom_target(
'bash-completion',
capture: true,
command: [
meson_generate_completions_program,
meson.current_source_dir(),
'bash',
],
depends: [toolbox_go],
install: true,
install_dir: bashcompletionsdir,
output: 'toolbox.bash',
)
endif
if fishcompletionsdir != ''
custom_target(
'fish-completion',
capture: true,
command: [
meson_generate_completions_program,
meson.current_source_dir(),
'fish',
],
depends: [toolbox_go],
install: true,
install_dir: fishcompletionsdir,
output: 'toolbox.fish',
)
endif
custom_target(
'zsh-completion',
capture: true,
command: [
meson_generate_completions_program,
meson.current_source_dir(),
'zsh',
],
depends: [toolbox_go],
install: true,
install_dir: zshcompletionsdir,
output: '_toolbox',
)
if shellcheck.found()
test('shellcheck src/go-build-wrapper', shellcheck, args: [go_build_wrapper_file])
endif