diff --git a/etc/meson.build b/etc/meson.build index a1a0bd8538..93ec8ce9e2 100644 --- a/etc/meson.build +++ b/etc/meson.build @@ -21,20 +21,13 @@ install_data( ) # Bash completion -have_bash = find_program('bash', required : false).found() # For completion scripts -bash_comp_dep = dependency('bash-completion', version: '>=2.0', required: false) -if have_bash - +bash = find_program('bash', required : get_option('bash-completion')) +bash_completion = dependency('bash-completion', version: '>=2.0', required: get_option('bash-completion')) +if bash_completion.found() bash_comp_inst_dir = '' - if bash_comp_dep.found() - bash_comp_dir_override = bash_comp_dep.version().version_compare('>= 2.10') ? ['datadir', get_option('datadir')] : ['prefix', get_option('prefix')] - bash_comp_inst_dir = bash_comp_dep.get_variable('completionsdir', pkgconfig_define: bash_comp_dir_override) - endif - - if bash_comp_inst_dir == '' - message('Found bash-completion but the .pc file did not set \'completionsdir\', fallback to a predefined path') - bash_comp_inst_dir = get_option('datadir') / 'bash-completion' / 'completions' - endif + bash_comp_dir_override = bash_completion.version().version_compare('>= 2.10') ? ['datadir', get_option('datadir')] : ['prefix', get_option('prefix')] + bash_comp_inst_dir = bash_completion.get_variable('completionsdir', pkgconfig_define: bash_comp_dir_override, + default_value: get_option('datadir') / 'bash-completion' / 'completions') bash_completion_conf = configuration_data() bash_completion_conf.set('GIMP_MAIN_EXE', gimpmain_exe_name) @@ -50,4 +43,13 @@ if have_bash configuration: bash_completion_conf, install: true, install_dir: bash_comp_inst_dir) + have_bash_completion = 'true (@0@)'.format(bash_comp_inst_dir) +elif get_option('bash-completion').disabled() + have_bash_completion = 'disabled' +else + if not bash.found() + have_bash_completion = 'false (bash not found)' + elif not bash_completion.found() + have_bash_completion = 'false (bash-completion not found)' + endif endif diff --git a/meson.build b/meson.build index a04dfebaef..3919d07655 100644 --- a/meson.build +++ b/meson.build @@ -2164,6 +2164,7 @@ final_message = [ ''' Debug symbols format: @0@'''.format(debugging_format), ''' Binary symlinks: @0@'''.format(enable_default_bin), ''' OpenMP: @0@'''.format(have_openmp), +''' Bash Completion: @0@'''.format(have_bash_completion), '', '''Optional Plug-Ins:''', ''' Ascii Art: @0@'''.format(libaa.found()), diff --git a/meson_options.txt b/meson_options.txt index c68081bef5..d995b83eaf 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -34,6 +34,7 @@ option('win-debugging', type: 'combo', value: 'native', description: 'Buil # Features option('enable-default-bin',type: 'feature', value: 'auto', description: 'Install unversioned symlinks pointing to versioned executables (on UNIX) or unversioned duplicates (on Windows)') +option('bash-completion', type: 'feature', value: 'auto', description: 'Install a bash completion script') option('aa', type: 'feature', value: 'auto', description: 'AA plugin') option('alsa', type: 'feature', value: 'auto', description: 'Alsa support in midi input controller') option('appdata-test', type: 'feature', value: 'auto', description: 'Validate the appdata file')