From 583a381c741de9b152a3e265bae038768eec30bc Mon Sep 17 00:00:00 2001 From: Igor Sharonov Date: Tue, 2 Apr 2024 10:30:59 +0300 Subject: [PATCH] Support libsoup-2.4 in meson --- .github/workflows/build.yml | 5 +++-- README.md | 8 ++++++++ meson.build | 8 +++++++- meson_options.txt | 2 ++ plugins/http-files/meson.build | 8 +++++--- 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7e6f75cd..a22a5c35 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,9 +22,10 @@ jobs: fetch-depth: 0 - run: sudo apt-get update - run: sudo apt-get remove libunwind-14-dev - - run: sudo apt-get install -y build-essential gettext libadwaita-1-dev libcanberra-dev libgcrypt20-dev libgee-0.8-dev libgpgme-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev libgtk-4-dev libnice-dev libnotify-dev libqrencode-dev libsignal-protocol-c-dev libsoup-3.0-dev libsqlite3-dev libsrtp2-dev libwebrtc-audio-processing-dev meson valac - - run: meson setup build + - run: sudo apt-get install -y build-essential gettext libadwaita-1-dev libcanberra-dev libgcrypt20-dev libgee-0.8-dev libgpgme-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev libgtk-4-dev libnice-dev libnotify-dev libqrencode-dev libsignal-protocol-c-dev libsoup2.4-dev libsqlite3-dev libsrtp2-dev libwebrtc-audio-processing-dev meson valac + - run: meson setup build -Dcrypto-backend=auto -Dplugin-ice=enabled -Duse-soup2=true - run: meson compile -C build + - run: build/plugins/omemo/test_omemo build-flatpak: runs-on: ubuntu-22.04 container: diff --git a/README.md b/README.md index 802e2c9f..eba4ff22 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,14 @@ Make sure to install all [dependencies](https://github.com/dino/dino/wiki/Build# make build/dino +If you want to use `meson` build system, follow the next instructions: + + meson setup build -Duse-soup2=true -Dcrypto-backend=gnutls -Dplugin-ice=enabled + meson compile -C build + build/main/dino + +If your `nice` library depends on `libsoup-3.0`, you can omit `-Duse-soup2=true` option. + Build on Windows (x86_64) ------------ - Install and configure the [MSYS2](https://www.msys2.org/) package; diff --git a/meson.build b/meson.build index aabf9c21..3364d3bb 100644 --- a/meson.build +++ b/meson.build @@ -52,6 +52,12 @@ elif get_option('crypto-backend') == 'gnutls' crypto_backend = 'gnutls' endif +if get_option('use-soup2') + libsoup_version = '2.4' +else + libsoup_version = '3.0' +endif + dep_gdk_pixbuf = dependency('gdk-pixbuf-2.0') dep_gee = dependency('gee-0.8') dep_gio = dependency('gio-2.0') @@ -73,7 +79,7 @@ dep_libsrtp2 = dependency('libsrtp2', disabler: true, required: plugin_crypto) # 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'], disabler: true, required: get_option('plugin-omemo')) -dep_libsoup = dependency('libsoup-3.0', disabler: true, required: get_option('plugin-http-files')) +dep_libsoup = dependency('libsoup-@0@'.format(libsoup_version), 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') diff --git a/meson_options.txt b/meson_options.txt index aa0c5bc2..be486cb2 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -14,3 +14,5 @@ option('plugin-rtp-msdk', type: 'feature', value: 'disabled', description: 'Inte option('plugin-rtp-vaapi', type: 'feature', value: 'disabled', description: 'Video Acceleration API') option('plugin-rtp-vp9', type: 'feature', value: 'disabled', description: 'VP9 codec') option('plugin-rtp-webrtc-audio-processing', type: 'feature', description: 'Voice preprocessing') + +option('use-soup2', type: 'boolean', value: false, description: 'Use libsoup version 2 instead of 3') diff --git a/plugins/http-files/meson.build b/plugins/http-files/meson.build index 6b0f3820..09986c09 100644 --- a/plugins/http-files/meson.build +++ b/plugins/http-files/meson.build @@ -15,8 +15,10 @@ sources = files( 'src/register_plugin.vala', ) -vala_args = [ - '--define=SOUP_3_0', -] +vala_args = [] +if dep_libsoup.version().version_compare('>=3.0') + vala_args += ['--define=SOUP_3_0'] +endif + lib_http_files = shared_library('http-files', sources, name_prefix: '', vala_args: vala_args, dependencies: dependencies, install: true, install_dir: get_option('libdir') / 'dino/plugins') dep_http_files = declare_dependency(link_with: lib_http_files, include_directories: include_directories('.'))