From bfc1962f70cebdd2933218052a172bed73d06fb9 Mon Sep 17 00:00:00 2001 From: hrxi Date: Sat, 30 Sep 2023 02:28:50 +0200 Subject: [PATCH] meson: Allow enabling/disabling plugins --- meson.build | 50 +++++++++++++++++++++++++++++++++-------------- meson_options.txt | 7 +++++++ 2 files changed, 42 insertions(+), 15 deletions(-) diff --git a/meson.build b/meson.build index e3c6b72e..3276158f 100644 --- a/meson.build +++ b/meson.build @@ -5,34 +5,54 @@ gnome = import('gnome') i18n = import('i18n') python = import('python') +# 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() + plugin_crypto = get_option(plugin) + elif get_option(plugin).allowed() and not plugin_crypto.allowed() + plugin_crypto = get_option(plugin) + endif +endforeach + +if get_option('plugin-ice').enabled() and not get_option('plugin-rtp').enabled() + dep_gnutls_required = get_option('plugin-ice') +elif get_option('plugin-ice').allowed() and not get_option('plugin-rtp').allowed() + dep_gnutls_required = get_option('plugin-ice') +else + dep_gnutls_required = get_option('plugin-rtp') +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') +dep_gnutls = dependency('gnutls', disabler: true, required: dep_gnutls_required) dep_gmodule = dependency('gmodule-2.0') -dep_gpgme = dependency('gpgme') -dep_gstreamer = dependency('gstreamer-1.0') -dep_gstreamer_app = dependency('gstreamer-app-1.0') -dep_gstreamer_audio = dependency('gstreamer-audio-1.0') -dep_gstreamer_rtp = dependency('gstreamer-rtp-1.0') -dep_gstreamer_video = dependency('gstreamer-video-1.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')) +dep_gstreamer_app = dependency('gstreamer-app-1.0', disabler: true, required: get_option('plugin-rtp')) +dep_gstreamer_audio = dependency('gstreamer-audio-1.0', disabler: true, required: get_option('plugin-rtp')) +dep_gstreamer_rtp = dependency('gstreamer-rtp-1.0', disabler: true, required: get_option('plugin-rtp')) +dep_gstreamer_video = dependency('gstreamer-video-1.0', disabler: true, required: get_option('plugin-rtp')) dep_gtk4 = dependency('gtk4') dep_icu_uc = dependency('icu-uc') dep_libadwaita = dependency('libadwaita-1') -dep_libcanberra = dependency('libcanberra') -dep_libgcrypt = dependency('libgcrypt') -dep_libqrencode = dependency('libqrencode') -dep_libsrtp2 = dependency('libsrtp2') +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) # libsignal-protocol-c has a history of breaking compatibility on the patch level # we'll have to check compatibility for every new release # distro maintainers may update this dependency after compatibility tests -dep_libsignal_protocol_c = dependency('libsignal-protocol-c', version: ['>=2.3.2', '<2.3.4']) -dep_libsoup = dependency('libsoup-3.0') -dep_nice = dependency('nice', version: '>=0.1.15') +dep_libsignal_protocol_c = dependency('libsignal-protocol-c', version: ['>=2.3.2', '<2.3.4'], disabler: true, required: get_option('plugin-omemo')) +dep_libsoup = dependency('libsoup-3.0', disabler: true, required: get_option('plugin-http-files')) +dep_nice = dependency('nice', version: '>=0.1.15', disabler: true, required: get_option('plugin-ice')) dep_m = meson.get_compiler('c').find_library('m', required: false) dep_sqlite3 = dependency('sqlite3', version: '>=3.24') -dep_webrtc_audio_processing = dependency('webrtc-audio-processing', version: ['>=0.2', '<0.4']) +dep_webrtc_audio_processing = dependency('webrtc-audio-processing', version: ['>=0.2', '<0.4'], disabler: true, required: get_option('plugin-rtp')) prog_git = find_program('git', required: false) prog_python = python.find_installation() diff --git a/meson_options.txt b/meson_options.txt index a1dcd3c2..ee0ac3c0 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1 +1,8 @@ option('plugindir', type: 'string', value: 'lib/dino/plugins', description: 'Dino plugin directory') + +option('plugin-http-files', type: 'feature', description: 'HTTP file upload') +option('plugin-ice', type: 'feature', description: '') +option('plugin-notification-sound', type: 'feature', description: 'Sound for chat notifications') +option('plugin-omemo', type: 'feature', description: 'End-to-end encryption') +option('plugin-openpgp', type: 'feature', description: 'End-to-end encryption using PGP') +option('plugin-rtp', type: 'feature', description: 'Voice/video calls')