[glib-networking/wip/nacho/gnutls-optional: 1/2] Make gnutls optional
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib-networking/wip/nacho/gnutls-optional: 1/2] Make gnutls optional
- Date: Wed, 12 Sep 2018 11:55:20 +0000 (UTC)
commit 03d04456fa8b508e4780197a4128af3944e895ad
Author: Ignacio Casal Quinteiro <qignacio amazon com>
Date: Mon Sep 10 13:01:37 2018 +0200
Make gnutls optional
We allow to pass -Dgnutls_support=false now. This is
in preparation to support different backends.
GNUTLS will continue to be the default enabled backend.
meson.build | 16 ++++++++--
meson_options.txt | 1 +
tls/tests/certificate.c | 3 +-
tls/tests/connection.c | 3 +-
tls/tests/dtls-connection.c | 3 +-
tls/tests/file-database.c | 3 +-
tls/tests/meson.build | 74 +++++++++++++++++++++++++++------------------
7 files changed, 67 insertions(+), 36 deletions(-)
---
diff --git a/meson.build b/meson.build
index c3b69ae..c3ec364 100644
--- a/meson.build
+++ b/meson.build
@@ -74,8 +74,14 @@ if enable_gnome_proxy_support
gsettings_desktop_schemas_dep = dependency('gsettings-desktop-schemas')
endif
+backends = []
+
# *** Checks for GnuTLS ***
-gnutls_dep = dependency('gnutls', version: '>= 3.4.4')
+enable_gnutls_support = get_option('gnutls_support')
+if enable_gnutls_support
+ gnutls_dep = dependency('gnutls', version: '>= 3.4.4')
+ backends += ['gnutls']
+endif
# *** Checks for p11-kit ***
enable_pkcs11_support = get_option('pkcs11_support')
@@ -130,7 +136,10 @@ if enable_pkcs11_support
subdir('tls/pkcs11')
endif
-subdir('tls/gnutls')
+if enable_gnutls_support
+ subdir('tls/gnutls')
+endif
+
subdir('tls/tests')
# Will automatically pick it up from the cross file if defined
@@ -139,7 +148,8 @@ if gio_querymodules.found()
meson.add_install_script('meson_post_install.py', gio_querymodules.path(), gio_module_dir)
endif
-output = '\n\n libproxy support: ' + enable_libproxy_support.to_string() + '\n'
+output = '\n\n gnutls support: ' + enable_gnutls_support.to_string() + '\n'
+output += ' libproxy support: ' + enable_libproxy_support.to_string() + '\n'
output += ' GNOME proxy support: ' + enable_gnome_proxy_support.to_string() + '\n'
output += ' PKCS#11 support: ' + enable_pkcs11_support.to_string() + '\n'
message(output)
diff --git a/meson_options.txt b/meson_options.txt
index 93b34c0..71e7749 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,3 +1,4 @@
+option('gnutls_support', type: 'boolean', value: true, description: 'support for GNUTLS networking
configration')
option('libproxy_support', type: 'boolean', value: true, description: 'support for libproxy proxy
configration')
option('gnome_proxy_support', type: 'boolean', value: true, description: 'support for GNOME desktop proxy
configuration')
option('pkcs11_support', type: 'boolean', value: false, description: 'support for PKCS#11 using p11-kit')
diff --git a/tls/tests/certificate.c b/tls/tests/certificate.c
index cfd5176..3310269 100644
--- a/tls/tests/certificate.c
+++ b/tls/tests/certificate.c
@@ -559,7 +559,8 @@ main (int argc,
g_test_init (&argc, &argv, NULL);
g_setenv ("GSETTINGS_BACKEND", "memory", TRUE);
- g_setenv ("GIO_USE_TLS", "gnutls", TRUE);
+ g_setenv ("GIO_USE_TLS", BACKEND, TRUE);
+ g_assert (g_ascii_strcasecmp (G_OBJECT_TYPE_NAME (g_tls_backend_get_default ()), "GTlsBackend" BACKEND) ==
0);
g_test_add ("/tls/certificate/create-pem", TestCertificate, NULL,
setup_certificate, test_create_pem, teardown_certificate);
diff --git a/tls/tests/connection.c b/tls/tests/connection.c
index 6087efc..78feadf 100644
--- a/tls/tests/connection.c
+++ b/tls/tests/connection.c
@@ -1995,7 +1995,8 @@ main (int argc,
g_test_bug_base ("http://bugzilla.gnome.org/");
g_setenv ("GSETTINGS_BACKEND", "memory", TRUE);
- g_setenv ("GIO_USE_TLS", "gnutls", TRUE);
+ g_setenv ("GIO_USE_TLS", BACKEND, TRUE);
+ g_assert (g_ascii_strcasecmp (G_OBJECT_TYPE_NAME (g_tls_backend_get_default ()), "GTlsBackend" BACKEND) ==
0);
g_test_add ("/tls/connection/basic", TestConnection, NULL,
setup_connection, test_basic_connection, teardown_connection);
diff --git a/tls/tests/dtls-connection.c b/tls/tests/dtls-connection.c
index b9a691c..105b879 100644
--- a/tls/tests/dtls-connection.c
+++ b/tls/tests/dtls-connection.c
@@ -783,7 +783,8 @@ main (int argc,
g_test_bug_base ("http://bugzilla.gnome.org/");
g_setenv ("GSETTINGS_BACKEND", "memory", TRUE);
- g_setenv ("GIO_USE_TLS", "gnutls", TRUE);
+ g_setenv ("GIO_USE_TLS", BACKEND, TRUE);
+ g_assert (g_ascii_strcasecmp (G_OBJECT_TYPE_NAME (g_tls_backend_get_default ()), "GTlsBackend" BACKEND) ==
0);
g_test_add ("/dtls/connection/basic/blocking", TestConnection, &blocking,
setup_connection, test_basic_connection, teardown_connection);
diff --git a/tls/tests/file-database.c b/tls/tests/file-database.c
index 3f01912..de9ea14 100644
--- a/tls/tests/file-database.c
+++ b/tls/tests/file-database.c
@@ -545,7 +545,8 @@ main (int argc,
g_test_init (&argc, &argv, NULL);
g_setenv ("GSETTINGS_BACKEND", "memory", TRUE);
- g_setenv ("GIO_USE_TLS", "gnutls", TRUE);
+ g_setenv ("GIO_USE_TLS", BACKEND, TRUE);
+ g_assert (g_ascii_strcasecmp (G_OBJECT_TYPE_NAME (g_tls_backend_get_default ()), "GTlsBackend" BACKEND) ==
0);
g_test_add_func ("/tls/backend/default-database-is-singleton",
test_default_database_is_singleton);
diff --git a/tls/tests/meson.build b/tls/tests/meson.build
index f7489f0..60890c6 100644
--- a/tls/tests/meson.build
+++ b/tls/tests/meson.build
@@ -8,9 +8,14 @@ deps = [
glib_dep,
gmodule_dep,
gobject_dep,
- gnutls_dep
]
+if enable_gnutls_support
+ deps += [
+ gnutls_dep
+ ]
+endif
+
cflags = [
'-DSRCDIR="@0@"'.format(meson.current_source_dir()),
'-DTOP_BUILDDIR="@0@"'.format(meson.build_root())
@@ -19,7 +24,6 @@ cflags = [
envs = [
'G_TEST_SRCDIR=' + meson.current_source_dir(),
'G_TEST_BUILDDIR=' + meson.current_build_dir(),
- 'GIO_MODULE_DIR=' + join_paths(meson.build_root(), 'tls', 'gnutls')
]
test_programs = [
@@ -43,35 +47,47 @@ if enable_pkcs11_support
]
endif
-foreach program: test_programs
- test_conf = configuration_data()
- test_conf.set('installed_tests_dir', installed_tests_execdir)
- test_conf.set('program', program[0])
-
- if enable_installed_tests
- configure_file(
- input: test_template,
- output: program[0] + '.test',
- install_dir: installed_tests_metadir,
- configuration: test_conf
+foreach backend: backends
+ foreach program: test_programs
+ program_name = program[0] + '-' + backend
+
+ test_conf = configuration_data()
+ test_conf.set('installed_tests_dir', installed_tests_execdir)
+ test_conf.set('program', program_name)
+
+ if enable_installed_tests
+ configure_file(
+ input: test_template,
+ output: program_name + '.test',
+ install_dir: installed_tests_metadir,
+ configuration: test_conf
+ )
+ endif
+
+ test_cflags = cflags + [
+ '-DBACKEND="@0@"'.format(backend),
+ ]
+
+ exe = executable(
+ program_name,
+ [program[0] + '.c'] + program[1],
+ include_directories: incs,
+ dependencies: program[2],
+ c_args: test_cflags,
+ install: enable_installed_tests,
+ install_dir: installed_tests_execdir
)
- endif
-
- exe = executable(
- program[0],
- [program[0] + '.c'] + program[1],
- include_directories: incs,
- dependencies: program[2],
- c_args: cflags,
- install: enable_installed_tests,
- install_dir: installed_tests_execdir
- )
- test(
- program[0],
- exe,
- env: envs
- )
+ test_envs = envs + [
+ 'GIO_MODULE_DIR=' + join_paths(meson.build_root(), 'tls', backend)
+ ]
+
+ test(
+ program_name,
+ exe,
+ env: test_envs
+ )
+ endforeach
endforeach
if enable_installed_tests
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]