[gvfs] build: Make SFTP backend optional



commit 44d45dca5d1ab2369fa7e5c2789b31c51e44f985
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Tue Apr 3 20:10:23 2018 +0200

    build: Make SFTP backend optional
    
    One of the requirements for SFTP is the existence of a ssh client.
    
    A new option has been added to make SFTP backend optional, so a
    ssh client is not a hard requirement anymore.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=786149

 daemon/meson.build |   36 +++++++++++++++++++-----------------
 meson.build        |    8 ++++++++
 meson_options.txt  |    1 +
 3 files changed, 28 insertions(+), 17 deletions(-)
---
diff --git a/daemon/meson.build b/daemon/meson.build
index 1ecb303..1744f74 100644
--- a/daemon/meson.build
+++ b/daemon/meson.build
@@ -251,26 +251,28 @@ cflags = [
 programs += [['gvfsd-burn', sources, [gio_unix_dep], cflags]]
 mounts += ['burn']
 
-sources = files(
-  'gvfsbackendsftp.c',
-  'pty_open.c'
-)
+if enable_sftp
+  sources = files(
+    'gvfsbackendsftp.c',
+    'pty_open.c'
+  )
 
-deps = socket_deps + [
-  gio_unix_dep,
-  util_dep
-]
+  deps = socket_deps + [
+    gio_unix_dep,
+    util_dep
+  ]
 
-cflags = [
-  '-DBACKEND_HEADER=gvfsbackendsftp.h',
-  '-DDEFAULT_BACKEND_TYPE=sftp',
-  '-DBACKEND_TYPES="sftp", G_VFS_TYPE_BACKEND_SFTP,',
-  '-DMAX_JOB_THREADS=1',
-  '-DSSH_PROGRAM="@0@"'.format(find_program('ssh').path())
-]
+  cflags = [
+    '-DBACKEND_HEADER=gvfsbackendsftp.h',
+    '-DDEFAULT_BACKEND_TYPE=sftp',
+    '-DBACKEND_TYPES="sftp", G_VFS_TYPE_BACKEND_SFTP,',
+    '-DMAX_JOB_THREADS=1',
+    '-DSSH_PROGRAM="@0@"'.format(ssh.path())
+  ]
 
-programs += [['gvfsd-sftp', sources, deps, cflags]]
-mounts += ['sftp']
+  programs += [['gvfsd-sftp', sources, deps, cflags]]
+  mounts += ['sftp']
+endif
 
 if enable_samba
   sources = files('gvfsbackendsmb.c')
diff --git a/meson.build b/meson.build
index 15a78e4..665d284 100644
--- a/meson.build
+++ b/meson.build
@@ -453,6 +453,13 @@ if enable_nfs
   libnfs_dep = dependency('libnfs', version: '>= 1.9.8')
 endif
 
+# *** SFTP backend ***
+enable_sftp = get_option('sftp')
+if enable_sftp
+  ssh = find_program('ssh', required: false)
+  assert(ssh.found(), 'SFTP backend requested but a ssh client is required')
+endif
+
 # *** Enable development utils ***
 enable_devel_utils = get_option('devel_utils')
 enable_installed_tests = get_option('installed_tests')
@@ -523,6 +530,7 @@ output += '  gphoto2: ' + enable_gphoto2.to_string() + '\n'
 output += '  http: ' + enable_http.to_string() + '\n'
 output += '  mtp: ' + enable_mtp.to_string() + '\n'
 output += '  nfs: ' + enable_nfs.to_string() + '\n'
+output += '  sftp: ' + enable_sftp.to_string() + '\n'
 output += '  smb: ' + enable_samba.to_string() + '\n'
 output += '  udisks2: ' + enable_udisks2.to_string() + '\n'
 output += '\n'
diff --git a/meson_options.txt b/meson_options.txt
index 2c116a5..66e2ade 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -14,6 +14,7 @@ option('gphoto2', type: 'boolean', value: true, description: 'build with gphoto2
 option('http', type: 'boolean', value: true, description: 'build with http/dav backends')
 option('mtp', type: 'boolean', value: true, description: 'build with mtp backend and volume monitor')
 option('nfs', type: 'boolean', value: true, description: 'build with nfs backend')
+option('sftp', type: 'boolean', value: true, description: 'build with sftp backend')
 option('smb', type: 'boolean', value: true, description: 'build with smb backends')
 option('udisks2', type: 'boolean', value: true, description: 'build with udisks2 volume monitor')
 


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