build(meson): add support for libomemo-c as OMEMO backend

Add the ability to choose between libsignal-protocol-c (default)
and libomemo-c when building with OMEMO support enabled in Meson.

Close: https://github.com/profanity-im/profanity/pull/2020
This commit is contained in:
Michael Vetter
2026-03-19 18:59:21 +01:00
parent d395cfb6b9
commit 27b5f0fbda
6 changed files with 47 additions and 4 deletions

View File

@@ -18,6 +18,7 @@ Both build systems support several features that can be enabled or disabled.
| **OTR** | Off-the-Record encryption | `--enable-otr` | `-Dotr=enabled` |
| **PGP** | PGP encryption support | `--enable-pgp` | `-Dpgp=enabled` |
| **OMEMO** | OMEMO encryption support | `--enable-omemo` | `-Domemo=enabled` |
| **OMEMO Backend** | Select OMEMO backend library | *N/A* | `-Domemo-backend=libsignal\|libomemo-c` |
| **QR Code** | OMEMO QR code display | `--enable-omemo-qrcode` | `-Domemo-qrcode=enabled` |
| **Icons/Clipboard** | GTK tray icons & clipboard | `--enable-icons-and-clipboard` | `-Dicons-and-clipboard=enabled` |
| **GDK Pixbuf** | Avatar scaling support | `--enable-gdk-pixbuf` | `-Dgdk-pixbuf=enabled` |
@@ -25,6 +26,16 @@ Both build systems support several features that can be enabled or disabled.
| **Tests** | Build unit tests | *Built by default* | `-Dtests=true` |
| **Sanitizers** | Run-time error detection | *Via CFLAGS* | `-Db_sanitize=address,undefined` |
### Selecting OMEMO Backend
When building with OMEMO support enabled in Meson, you can choose between two backend libraries:
- `libsignal`: The default backend using `libsignal-protocol-c`.
- `libomemo-c`: An alternative backend using `libomemo-c`.
Example of choosing the `libomemo-c` backend:
```bash
meson setup build_run -Domemo=enabled -Domemo-backend=libomemo-c
```
### Using Autotools
1. Generate configuration files: `./bootstrap.sh`
2. Configure: `./configure --enable-otr --enable-omemo`

View File

@@ -157,7 +157,7 @@ dl_dep = disabler()
gpgme_dep = disabler()
libotr_dep = disabler()
gdk_pixbuf_dep = disabler()
libsignal_dep = disabler()
omemo_dep = disabler()
gcrypt_dep = disabler()
qrencode_dep = disabler()
@@ -251,7 +251,13 @@ endif
# OMEMO support
if get_option('omemo').enabled()
libsignal_dep = dependency('libsignal-protocol-c', version: '>= 2.3.2', required: true)
omemo_backend = get_option('omemo-backend')
if omemo_backend == 'libsignal'
omemo_dep = dependency('libsignal-protocol-c', version: '>= 2.3.2', required: true)
elif omemo_backend == 'libomemo-c'
omemo_dep = dependency('libomemo-c', version: '>= 0.5.1', required: true)
conf_data.set('HAVE_LIBOMEMO_C', 1)
endif
gcrypt_dep = dependency('libgcrypt', version: '>= 1.7.0', required: true)
build_omemo = true
conf_data.set('HAVE_OMEMO', 1)
@@ -337,8 +343,8 @@ if gdk_pixbuf_dep.found()
profanity_deps += gdk_pixbuf_dep
endif
if libsignal_dep.found()
profanity_deps += libsignal_dep
if omemo_dep.found()
profanity_deps += omemo_dep
endif
if gcrypt_dep.found()

View File

@@ -35,6 +35,13 @@ option('omemo',
description: 'Enable OMEMO encryption'
)
option('omemo-backend',
type: 'combo',
choices: ['libsignal', 'libomemo-c'],
value: 'libsignal',
description: 'Select OMEMO backend library'
)
option('xscreensaver',
type: 'feature',
value: 'disabled',

View File

@@ -9,8 +9,13 @@
#include "config.h"
#include <assert.h>
#ifdef HAVE_LIBOMEMO_C
#include <omemo/signal_protocol.h>
#include <omemo/signal_protocol_types.h>
#else
#include <signal/signal_protocol.h>
#include <signal/signal_protocol_types.h>
#endif
#include "log.h"
#include "omemo/omemo.h"

View File

@@ -16,11 +16,20 @@
#include <errno.h>
#include <glib.h>
#include <pthread.h>
#ifdef HAVE_LIBOMEMO_C
#include <omemo/key_helper.h>
#include <omemo/protocol.h>
#include <omemo/signal_protocol.h>
#include <omemo/session_builder.h>
#include <omemo/session_cipher.h>
#else
#include <signal/key_helper.h>
#include <signal/protocol.h>
#include <signal/signal_protocol.h>
#include <signal/session_builder.h>
#include <signal/session_cipher.h>
#endif
#include "config/account.h"
#include "config/files.h"

View File

@@ -7,7 +7,12 @@
* SPDX-License-Identifier: GPL-3.0-or-later WITH OpenSSL-exception
*/
#include <glib.h>
#ifdef HAVE_LIBOMEMO_C
#include <omemo/signal_protocol.h>
#else
#include <signal/signal_protocol.h>
#endif
#include "config.h"
#include "log.h"