aboutsummaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorhrxi <hrrrxi@gmail.com>2023-11-24 20:53:50 +0100
committerMarvin W <git@larma.de>2026-10-23 16:58:30 +0200
commit76a91fca2fc7dd5975e8ff0e6695f27c98539dba (patch)
tree7829340be71fe60ef847247e578c4589571fecc5 /meson.build
parentb013d28182ce582f229185c23b6011f566f1f8cc (diff)
Add support for OpenSSL
Uses work by @hrxi in https://github.com/dino/dino/pull/1515 Co-Authored-By: hrxi <hrrrxi@gmail.com>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build25
1 files changed, 20 insertions, 5 deletions
diff --git a/meson.build b/meson.build
index df5a2b80..84597fd4 100644
--- a/meson.build
+++ b/meson.build
@@ -47,9 +47,6 @@ vala_c_args = cc.get_supported_arguments([
'-Wno-unused-variable',
])
-# plugin_crypto is enabled if any of the crypto plugins is enabled, auto if
-# none of them are explicitly enabled but at least one is set to auto, or
-# disabled if all of them are disabled.
plugin_crypto = get_option('plugin-ice')
foreach plugin : ['plugin-ice', 'plugin-omemo', 'plugin-rtp']
if get_option(plugin).enabled() and not plugin_crypto.enabled()
@@ -59,11 +56,30 @@ foreach plugin : ['plugin-ice', 'plugin-omemo', 'plugin-rtp']
endif
endforeach
+if get_option('crypto-backend') == 'auto'
+ # Prefer libgcrypt/gnutls over openssl because glib-networking is usually
+ # built with gnutls anyway.
+ dep_libgcrypt = dependency('libgcrypt', required: false)
+ dep_gnutls = dependency('gnutls', required: false)
+ if dep_libgcrypt.found() and dep_gnutls.found()
+ crypto_backend = 'gnutls'
+ else
+ dep_openssl = dependency('openssl', disabler: true, required: plugin_crypto)
+ crypto_backend = 'openssl'
+ endif
+elif get_option('crypto-backend') == 'openssl'
+ dep_openssl = dependency('openssl', disabler: true, required: plugin_crypto)
+ crypto_backend = 'openssl'
+elif get_option('crypto-backend') == 'gnutls'
+ dep_libgcrypt = dependency('libgcrypt', disabler: true, required: plugin_crypto)
+ dep_gnutls = dependency('gnutls', disabler: true, required: get_option('plugin-ice'))
+ crypto_backend = 'gnutls'
+endif
+
dep_gdk_pixbuf = dependency('gdk-pixbuf-2.0')
dep_gee = dependency('gee-0.8')
dep_gio = dependency('gio-2.0')
dep_glib = dependency('glib-2.0')
-dep_gnutls = dependency('gnutls', disabler: true, required: get_option('plugin-ice'))
dep_gmodule = dependency('gmodule-2.0')
dep_gpgme = dependency('gpgme', disabler: true, required: get_option('plugin-openpgp'))
dep_gstreamer = dependency('gstreamer-1.0', disabler: true, required: get_option('plugin-rtp'))
@@ -75,7 +91,6 @@ dep_gtk4 = dependency('gtk4')
dep_icu_uc = dependency('icu-uc')
dep_libadwaita = dependency('libadwaita-1', version: '>=1.5')
dep_libcanberra = dependency('libcanberra', disabler: true, required: get_option('plugin-notification-sound'))
-dep_libgcrypt = dependency('libgcrypt', disabler: true, required: plugin_crypto)
dep_libqrencode = dependency('libqrencode', disabler: true, required: get_option('plugin-omemo'))
dep_libsrtp2 = dependency('libsrtp2', disabler: true, required: plugin_crypto)
dep_libomemo_c = dependency('libomemo-c', disabler: true, required: get_option('plugin-omemo'))