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.
parent a55f5507
......@@ -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)
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')
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment