[dconf/wip/inigomartinez/meson: 14/14] build: Use completions dir from pkg-config file



commit 5a1f2156ed8a64eaa26362e223326e96538f6821
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Wed Apr 11 09:50:21 2018 +0200

    build: Use completions dir from pkg-config file
    
    The `bash-completions` pkg-config file provides a variable with the
    location of the completion files.
    
    This variable is checked to set the installation directory of the
    completion file provided by dconf.
    
    As a side note, the variable in the `bash-completions` pkg-config
    file is not totally correct, because it provides a directory
    that is relative to prefix while it should be relative to datadir.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=790236

 bin/meson.build   |   10 ++++++----
 meson.build       |    6 ++++++
 meson_options.txt |    1 +
 3 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/bin/meson.build b/bin/meson.build
index 8c41cb0..dc220cc 100644
--- a/bin/meson.build
+++ b/bin/meson.build
@@ -19,7 +19,9 @@ executable(
   install: true
 )
 
-install_data(
-  'completion/dconf',
-  install_dir: join_paths(dconf_datadir, 'bash-completion', 'completions')
-)
+if enable_bash_completion
+  install_data(
+    'completion/dconf',
+    install_dir: completions_dir
+  )
+endif
diff --git a/meson.build b/meson.build
index f9a245e..4a309c4 100644
--- a/meson.build
+++ b/meson.build
@@ -45,6 +45,12 @@ glib_dep = dependency('glib-2.0', version: '>= 2.44.0')
 gio_module_dir = gio_dep.get_pkgconfig_variable('giomoduledir', define_variable: ['libdir', dconf_libdir])
 dbus_session_service_dir = dependency('dbus-1').get_pkgconfig_variable('session_bus_services_dir', 
define_variable: ['datadir', dconf_datadir])
 
+enable_bash_completion = get_option('bash_completion')
+if enable_bash_completion
+  # FIXME: the `.pc` file is wrong because `completionsdir` should be relative to `datadir`, not `prefix`
+  completions_dir = dependency('bash-completion').get_pkgconfig_variable('completionsdir', define_variable: 
['prefix', dconf_prefix])
+endif
+
 configure_file(
   output: 'config.h',
   configuration: configuration_data()
diff --git a/meson_options.txt b/meson_options.txt
index 76e88ea..9c8e3e6 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,2 +1,3 @@
+option('bash_completion', type: 'boolean', value: true, description: 'install bash completion files')
 option('man', type: 'boolean', value: true, description: 'generate man pages')
 option('gtk_doc', type: 'boolean', value: false, description: 'use gtk-doc to build documentation')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]