summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Wagner <info@gunibert.de>2021-11-04 23:08:57 +0100
committerGünther Wagner <info@gunibert.de>2021-11-04 23:08:57 +0100
commit212da9ac01dc7e18c2fbb2682e564713c50420ac (patch)
treef2bd0f5c9b0b5bca8f9bc546190e9024ae1595a9
parentf014c22bbb1e5dd857d6e47c5acf5f58fc28cecf (diff)
downloadlibrest-gwagner/soup3.tar.gz
soup3: added conditional option to mesongwagner/soup3
-rw-r--r--meson.build14
-rw-r--r--meson_options.txt5
-rw-r--r--rest-extras/meson.build2
-rw-r--r--rest/meson.build2
-rw-r--r--tests/proxy.c3
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;