diff options
author | Iñigo Martínez <inigomartinez@gmail.com> | 2019-09-05 09:11:07 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-10-01 09:49:33 +0200 |
commit | ad4834009b2e520303a2483d23084c37f07ace93 (patch) | |
tree | 691ca0678e135facb734d31210e191f00ae5fbd7 | |
parent | de90fc0810465a67b7e5ff6e6fcb29941162d1a9 (diff) |
meson: Improve crypto support build
There are multiple conditional steps for building encryption
support. This is because the support varies from `gnutls` or `nss`.
This has been improved to reduce the number of used conditions.
-rw-r--r-- | libnm-core/meson.build | 46 | ||||
-rw-r--r-- | meson.build | 14 |
2 files changed, 25 insertions, 35 deletions
diff --git a/libnm-core/meson.build b/libnm-core/meson.build index fb9be04a2c..0b6acf8557 100644 --- a/libnm-core/meson.build +++ b/libnm-core/meson.build @@ -177,11 +177,8 @@ shared_nm_libnm_core_intern_dep = declare_dependency( ############################################################################### deps = [ - dl_dep, + crypto_dep, libnm_utils_base_dep, - libudev_dep, - uuid_dep, - shared_nm_libnm_core_intern_dep, ] cflags = [ @@ -189,37 +186,26 @@ cflags = [ '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE', ] +libnm_crypto = static_library( + 'nm-crypto', + sources: 'nm-crypto-@0@.c'.format(crypto), + dependencies: deps, + c_args: cflags, +) + +deps = [ + dl_dep, + libnm_utils_base_dep, + libudev_dep, + uuid_dep, + shared_nm_libnm_core_intern_dep, +] + if enable_json_validation libnm_core_sources += files('nm-json.c') deps += jansson_dep endif -if (crypto_gnutls_dep.found()) - libnm_crypto_gnutls = static_library( - 'nm-crypto-gnutls', - sources: [ 'nm-crypto-gnutls.c' ], - dependencies: deps + [ crypto_gnutls_dep ], - c_args: cflags, - ) -endif - -if (crypto_nss_dep.found()) - libnm_crypto_nss = static_library( - 'nm-crypto-nss', - sources: [ 'nm-crypto-nss.c' ], - dependencies: deps + [ crypto_nss_dep ], - c_args: cflags, - ) -endif - -if crypto == 'gnutls' - libnm_crypto = libnm_crypto_gnutls -elif crypto == 'nss' - libnm_crypto = libnm_crypto_nss -else - error('bug') -endif - libnm_core_sources_all = libnm_core_sources libnm_core_sources_all += libnm_core_enum libnm_core_sources_all += nm_meta_setting_source diff --git a/meson.build b/meson.build index 85b5f6a306..73f161485c 100644 --- a/meson.build +++ b/meson.build @@ -475,14 +475,18 @@ if enable_polkit_agent endif config_h.set10('WITH_POLKIT_AGENT', enable_polkit_agent) -crypto_gnutls_dep = dependency('gnutls', version: '>= 2.12', required: false) -crypto_nss_dep = dependency('nss', required: false) crypto = get_option('crypto') if crypto == 'nss' - assert(crypto_nss_dep.found(), 'Requires gnutls crypto support') + crypto_dep = dependency('nss', required: false) + assert(crypto_dep.found(), 'Requires nss crypto support') elif crypto == 'gnutls' - assert(crypto_gnutls_dep.found(), 'Requires gnutls crypto support') + crypto_dep = dependency( + 'gnutls', + version: '>= 2.12', + required: false, + ) + assert(crypto_dep.found(), 'Requires gnutls crypto support') else error('bug') endif @@ -961,7 +965,7 @@ output += ' code coverage: ' + get_option('b_coverage').to_string() + '\n' output += ' LTO: ' + enable_lto.to_string() + '\n' output += ' Linker garbage collection: ' + enable_ld_gc.to_string() + '\n' output += ' JSON validation for libnm: ' + enable_json_validation.to_string() + '\n' -output += ' crypto: ' + crypto + ' (have-gnutls: ' + crypto_gnutls_dep.found().to_string() + ', have-nss: ' + crypto_nss_dep.found().to_string() + ')\n' +output += ' crypto: ' + crypto + '\n' output += ' sanitizers: ' + get_option('b_sanitize') + '\n' output += ' Mozilla Public Suffix List: ' + enable_libpsl.to_string() + '\n' output += ' vapi: ' + enable_vapi.to_string() + '\n' |