[glib-networking/wip/inigomartinez/meson: 3/4] build: Make PKCS#11 support required



commit 9b065cf299e94279677bf62ef7daa87644a0cc75
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Wed Oct 18 20:56:12 2017 +0200

    build: Make PKCS#11 support required
    
    This patch removes the build option for PKCS#11 support and makes
    it necessary for a successfull build.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=786639

 meson.build            |   25 +++++++------------------
 meson_options.txt      |    1 -
 tls/gnutls/meson.build |   23 +++++++++--------------
 tls/tests/meson.build  |   41 ++++++++++++++++++++---------------------
 4 files changed, 36 insertions(+), 54 deletions(-)
---
diff --git a/meson.build b/meson.build
index f491a6e..87b4efa 100644
--- a/meson.build
+++ b/meson.build
@@ -105,20 +105,12 @@ if enable_tls_support
   message(msg + ca_certificates_path)
 
   # *** Checks for pkcs11    ***
-  have_pkcs11 = false
-
-  enable_pkcs11_support = get_option('pkcs11_support')
-  if enable_pkcs11_support != 'no'
-    pkcs11_dep = dependency('p11-kit-1', version: '>= 0.8', required: (enable_pkcs11_support == 'yes'))
-    have_pkcs11 = pkcs11_dep.found()
-    if have_pkcs11
-      tls_support += ['gnutls-pkcs11']
-      pkcs_support += ['p11-kit']
-    endif
+  pkcs11_dep = dependency('p11-kit-1', version: '>= 0.8')
+  tls_support += ['gnutls-pkcs11']
+  pkcs_support += ['p11-kit']
 
-    config_h.set('HAVE_PKCS11', have_pkcs11,
-                 description: 'Building with PKCS#11 support')
-  endif
+  config_h.set('HAVE_PKCS11', true,
+               description: 'Building with PKCS#11 support')
 endif
 
 config_h.set('HAVE_GNUTLS', enable_tls_support)
@@ -156,12 +148,9 @@ if have_libproxy or have_gnome_proxy
 endif
 
 if enable_tls_support
-  if have_pkcs11
-    tls_inc = include_directories('tls')
-
-    subdir('tls/pkcs11')
-  endif
+  tls_inc = include_directories('tls')
 
+  subdir('tls/pkcs11')
   subdir('tls/gnutls')
   subdir('tls/tests')
 endif
diff --git a/meson_options.txt b/meson_options.txt
index e59f50f..db4a67c 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -2,5 +2,4 @@ option('libproxy_backend', type: 'combo', choices: ['yes', 'no', 'auto'], value:
 option('gnome_proxy_backend', type: 'combo', choices: ['yes', 'no', 'auto'], value: 'auto', description: 
'support for GNOME proxy configuration')
 option('tls_support', type: 'boolean', value: true, description: 'support for GNUTLS')
 option('ca_certificates_path', type: 'string', value: '', description: 'path to system Certificate Authority 
list')
-option('pkcs11_support', type: 'combo', choices: ['yes', 'no', 'auto'], value: 'auto', description: 'support 
for pkcs11')
 option('installed-tests', type: 'boolean', value: false, description: 'enable installed unit tests')
diff --git a/tls/gnutls/meson.build b/tls/gnutls/meson.build
index f6eeb1a..5891cc2 100644
--- a/tls/gnutls/meson.build
+++ b/tls/gnutls/meson.build
@@ -1,36 +1,31 @@
 sources = files(
   'gnutls-module.c',
   'gtlsbackend-gnutls.c',
+  'gtlsbackend-gnutls-pkcs11.c',
   'gtlscertificate-gnutls.c',
+  'gtlscertificate-gnutls-pkcs11.c',
   'gtlsclientconnection-gnutls.c',
   'gtlsconnection-gnutls.c',
   'gtlsdatabase-gnutls.c',
+  'gtlsdatabase-gnutls-pkcs11.c',
   'gtlsfiledatabase-gnutls.c',
   'gtlsinputstream-gnutls.c',
   'gtlsoutputstream-gnutls.c',
   'gtlsserverconnection-gnutls.c'
 )
 
-incs = [top_inc]
+incs = [
+  top_inc,
+  tls_inc
+]
 
 deps = [
   gio_dep,
   glib_dep,
-  gnutls_dep
+  gnutls_dep,
+  libgiopkcs11_dep
 ]
 
-if have_pkcs11
-  sources += files(
-    'gtlsbackend-gnutls-pkcs11.c',
-    'gtlscertificate-gnutls-pkcs11.c',
-    'gtlsdatabase-gnutls-pkcs11.c'
-  )
-
-  incs += tls_inc
-
-  deps += libgiopkcs11_dep
-endif
-
 shared_module(
   'giognutls',
   sources: sources,
diff --git a/tls/tests/meson.build b/tls/tests/meson.build
index 4f3494b..3ae29de 100644
--- a/tls/tests/meson.build
+++ b/tls/tests/meson.build
@@ -1,9 +1,6 @@
-incs = [top_inc]
-
-deps = [
-  gio_dep,
-  glib_dep,
-  gnutls_dep
+incs = [
+  top_inc,
+  tls_inc
 ]
 
 cflags = [
@@ -11,27 +8,29 @@ cflags = [
   '-DTOP_BUILDDIR="@0@"'.format(meson.build_root())
 ]
 
+deps = [
+  gio_dep,
+  glib_dep,
+  gnutls_dep
+]
+
 test_programs = [
   ['certificate', [], deps],
   ['file-database', [], deps],
   ['connection', ['mock-interaction.c'], deps]
 ]
 
-if have_pkcs11
-  incs += tls_inc
-
-  pkcs11_deps = deps + [
-    libgiopkcs11_dep,
-    pkcs11_dep
-  ]
+deps += [
+  libgiopkcs11_dep,
+  pkcs11_dep
+]
 
-  test_programs += [
-    ['pkcs11-util', [], pkcs11_deps],
-    ['pkcs11-array', [], pkcs11_deps],
-    ['pkcs11-pin', [], pkcs11_deps],
-    ['pkcs11-slot', ['mock-interaction.c', 'mock-pkcs11.c'], pkcs11_deps]
-  ]
-endif
+test_programs += [
+  ['pkcs11-util', [], deps],
+  ['pkcs11-array', [], deps],
+  ['pkcs11-pin', [], deps],
+  ['pkcs11-slot', ['mock-interaction.c', 'mock-pkcs11.c'], deps]
+]
 
 foreach program: test_programs
   test_conf = configuration_data()


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