[librest/gwagner/soup3: 3/3] soup3: added conditional option to meson
- From: Günther Wagner <gwagner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librest/gwagner/soup3: 3/3] soup3: added conditional option to meson
- Date: Thu, 4 Nov 2021 22:10:33 +0000 (UTC)
commit 212da9ac01dc7e18c2fbb2682e564713c50420ac
Author: Günther Wagner <info gunibert de>
Date: Thu Nov 4 23:08:57 2021 +0100
soup3: added conditional option to meson
meson.build | 14 +++++++++++++-
meson_options.txt | 5 +++++
rest-extras/meson.build | 2 +-
rest/meson.build | 2 +-
tests/proxy.c | 3 +--
5 files changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/meson.build b/meson.build
index c6e77a1..81c5ed1 100644
--- a/meson.build
+++ b/meson.build
@@ -42,9 +42,21 @@ if get_option('ca_certificates')
endif
# Dependencies
+if get_option('soup2')
+ libsoup_name = 'libsoup-2.4'
+ libsoup_req_version = '>= 2.42'
+ libsoup_api_version = '2.4'
+ add_project_arguments('-DWITH_SOUP_2', language: 'c')
+else
+ libsoup_name = 'libsoup-3.0'
+ libsoup_req_version = '>= 2.99.2'
+ libsoup_api_version = '3.0'
+endif
+
+
glib_dep = dependency('glib-2.0', version: '>= 2.44')
gobject_dep = dependency('gobject-2.0', version: '>= 2.44')
-libsoup_dep = dependency('libsoup-2.4', version: '>= 2.42')
+libsoup_dep = dependency(libsoup_name, version: libsoup_req_version)
libxml_dep = dependency('libxml-2.0')
# config.h
diff --git a/meson_options.txt b/meson_options.txt
index ae4ba54..49f7a2d 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -23,3 +23,8 @@ option('gtk_doc',
value: false,
description: 'Build the gtk-doc reference docs',
)
+option('soup2',
+ type: 'boolean',
+ value: true,
+ description: 'Whether to build with libsoup2',
+)
diff --git a/rest-extras/meson.build b/rest-extras/meson.build
index f8c0ddd..1ad9ee1 100644
--- a/rest-extras/meson.build
+++ b/rest-extras/meson.build
@@ -50,7 +50,7 @@ if get_option('introspection')
sources: librest_extras_sources + librest_extras_headers,
namespace: 'RestExtras',
nsversion: librest_api_version,
- includes: [ 'GObject-2.0', 'Gio-2.0', 'Soup-2.4', librest_gir[0] ],
+ includes: [ 'GObject-2.0', 'Gio-2.0', 'Soup-@0@'.format(libsoup_api_version), librest_gir[0] ],
extra_args: [ '--accept-unprefixed' ],
install: true,
)
diff --git a/rest/meson.build b/rest/meson.build
index 7bf7338..396ec83 100644
--- a/rest/meson.build
+++ b/rest/meson.build
@@ -80,7 +80,7 @@ if get_option('introspection')
sources: [ librest_headers, librest_enums[1] ],
namespace: 'Rest',
nsversion: librest_api_version,
- includes: [ 'GObject-2.0', 'Gio-2.0', 'Soup-2.4' ],
+ includes: [ 'GObject-2.0', 'Gio-2.0', 'Soup-@0@'.format(libsoup_api_version) ],
extra_args: librest_gir_extra_args,
install: true,
)
diff --git a/tests/proxy.c b/tests/proxy.c
index 652c600..d6c05a5 100644
--- a/tests/proxy.c
+++ b/tests/proxy.c
@@ -365,12 +365,11 @@ test_status_ok (RestProxy *proxy, const char *function)
static void *
server_thread_func (gpointer data)
{
- GSocketAddress *address = g_inet_socket_address_new_from_string ("127.0.0.1", 8080);
server_loop = g_main_loop_new (NULL, TRUE);
/*SoupServer *server = soup_server_new (NULL);*/
soup_server_add_handler (server, NULL, server_callback, NULL, NULL);
- soup_server_listen (server, address, 0, NULL);
+ soup_server_listen_local (server, PORT, 0, NULL);
g_main_loop_run (server_loop);
return NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]