[tracker: 1/2] build: Add config options for libsoup




commit 9a8433c47b8326f5291c841de27253ab601efeed
Author: Matt Turner <mattst88 gmail com>
Date:   Wed Jan 26 18:08:24 2022 -0800

    build: Add config options for libsoup
    
    This allows distributions that ship both versions to choose which
    version of libsoup will be linked.

 meson.build       | 21 +++++++++++++++++----
 meson_options.txt |  4 ++++
 2 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/meson.build b/meson.build
index f4dd58fd4..69736cbfb 100644
--- a/meson.build
+++ b/meson.build
@@ -53,11 +53,21 @@ json_glib = dependency('json-glib-1.0', version: '>= 1.4', required: true)
 libxml2 = dependency('libxml-2.0', version: '> 2.6')
 sqlite = dependency('sqlite3', version: '>' + sqlite_required)
 dbus = dependency('dbus-1')
-libsoup2 = dependency('libsoup-2.4', version: '> 2.40', required: false)
-libsoup3 = dependency('libsoup-3.0', version: '>= 2.99.2', required: false)
 
-libmath = cc.find_library('m', required: false)
-libdl = cc.find_library('dl')
+soup = get_option('soup')
+if soup.contains('soup2') or soup.contains('auto')
+  libsoup2 = dependency('libsoup-2.4', version: '> 2.40',
+                        required: soup.contains('soup2'))
+else
+  libsoup2 = disabler()
+endif
+
+if soup.contains('soup3') or soup.contains('auto')
+  libsoup3 = dependency('libsoup-3.0', version: '>= 2.99.2',
+                        required: soup.contains('soup3'))
+else
+  libsoup3 = disabler()
+endif
 
 soup_backends = ''
 if libsoup2.found()
@@ -71,6 +81,9 @@ if not libsoup2.found() and not libsoup3.found()
   error('At least one of libsoup2 or libsoup3 is required')
 endif
 
+libmath = cc.find_library('m', required: false)
+libdl = cc.find_library('dl')
+
 if get_option('man')
   a2x = find_program('a2x')
 endif
diff --git a/meson_options.txt b/meson_options.txt
index ec8ea8bc2..0b5d51759 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -30,3 +30,7 @@ option('tests_tap_protocol', type: 'boolean', value: false,
        description: 'Whether to enable TAP protocol on tests')
 option('introspection', type: 'feature', value: 'enabled',
        description: 'Whether to enable introspection')
+
+option('soup', type: 'array', value: ['auto'],
+       choices: ['auto', 'soup2', 'soup3'],
+       description: 'Which major versions of libsoup to use')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]