[gvfs] build: Add an option for gcrypt



commit d1189c1bede6a6cd2b6e89dfe50d66fead49a47e
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Mon Nov 6 19:52:34 2017 +0100

    build: Add an option for gcrypt
    
    Add an option to make gcrypt conditional allowing to disable it if
    desired. This patch also makes the existence of libgcrypt-config
    program mandatory if the gcrypt option is enabled.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=786149

 daemon/meson.build |    2 +-
 meson.build        |   27 ++++++++++++++++-----------
 meson_options.txt  |    1 +
 3 files changed, 18 insertions(+), 12 deletions(-)
---
diff --git a/daemon/meson.build b/daemon/meson.build
index 606d83f..a31f5f6 100644
--- a/daemon/meson.build
+++ b/daemon/meson.build
@@ -525,7 +525,7 @@ if enable_afp
   sources = common_sources + files('gvfsbackendafp.c')
 
   deps = []
-  if have_gcrypt
+  if enable_gcrypt
     deps += libgcrypt_dep
   endif
 
diff --git a/meson.build b/meson.build
index 913355d..07eff01 100644
--- a/meson.build
+++ b/meson.build
@@ -249,20 +249,25 @@ libxml_dep = dependency('libxml-2.0', required: false)
 have_libxml = libxml_dep.found()
 
 # *** Check for libgcrypt ***
-libgcrypt_config = find_program('libgcrypt-config')
-libgcrypt_version = run_command(libgcrypt_config, '--version').stdout().strip()
+enable_gcrypt = get_option('enable-gcrypt')
+if enable_gcrypt
+  libgcrypt_req_version = '>= 1.2.2'
 
-libgcrypt_cflags = run_command(libgcrypt_config, '--cflags').stdout().strip().split()
-libgcrypt_libs = run_command(libgcrypt_config, '--libs').stdout().strip().split()
+  libgcrypt_config = find_program('libgcrypt-config')
+  libgcrypt_version = run_command(libgcrypt_config, '--version').stdout().strip()
 
-libgcrypt_dep = declare_dependency(
-  compile_args: libgcrypt_cflags,
-  link_args: libgcrypt_libs,
-  version: libgcrypt_version
-)
+  assert(libgcrypt_version.version_compare(libgcrypt_req_version), 'gcrypt required but libgcrypt ' + 
libgcrypt_req_version + ' not found')
+
+  libgcrypt_cflags = run_command(libgcrypt_config, '--cflags').stdout().strip().split()
+  libgcrypt_libs = run_command(libgcrypt_config, '--libs').stdout().strip().split()
 
-have_gcrypt = libgcrypt_version.version_compare('>= 1.2.2')
-config_h.set('HAVE_GCRYPT', have_gcrypt)
+  libgcrypt_dep = declare_dependency(
+    compile_args: libgcrypt_cflags,
+    link_args: libgcrypt_libs,
+    version: libgcrypt_version
+  )
+endif
+config_h.set('HAVE_GCRYPT', enable_gcrypt)
 
 # *** Check for dbus service dir ***
 dbus_service_dir = get_option('with-dbus-service-dir')
diff --git a/meson_options.txt b/meson_options.txt
index 833b7d7..205bb61 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -22,6 +22,7 @@ option('enable-udisks2', type: 'boolean', value: true, description: 'build with
 option('enable-bluray', type: 'boolean', value: true, description: 'build with bluray metadata support')
 option('enable-fuse', type: 'boolean', value: true, description: 'build with fuse support')
 option('enable-gcr', type: 'boolean', value: true, description: 'build with gcr certificate support')
+option('enable-gcrypt', type: 'boolean', value: true, description: 'build with gcrypt support')
 option('enable-gudev', type: 'boolean', value: true, description: 'build with gudev device support')
 option('enable-keyring', type: 'boolean', value: true, description: 'build with keyring support')
 option('enable-logind', type: 'boolean', value: true, description: 'build with logind support')


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