summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Michael Brummer <jan.brummer@tabos.org>2023-03-09 17:34:02 +0100
committerJan-Michael Brummer <jan.brummer@tabos.org>2023-03-27 16:31:58 +0200
commitc23a1345e9c75a0e1ae7d5d5affcc6af5df24d38 (patch)
treecdab72f43a092b3a4c0044adecc041bd39912d63
parente7713214c85ded42112aefdd05bf7af37a80fd6e (diff)
downloadlibproxy-git-c23a1345e9c75a0e1ae7d5d5affcc6af5df24d38.tar.gz
Add flag to toggle curl integration (#65)
In order to fix a possible build cycle between libproxy and curl add a toggle to switch off curl if necessary. Fixes: https://github.com/janbrummer/libproxy2/issues/57
-rw-r--r--meson.build12
-rw-r--r--meson_options.txt7
-rw-r--r--src/backend/px-manager.c8
3 files changed, 22 insertions, 5 deletions
diff --git a/meson.build b/meson.build
index baf668e..96f22fe 100644
--- a/meson.build
+++ b/meson.build
@@ -15,10 +15,6 @@ girdir = get_option('datadir') / 'gir-1.0'
typelibdir = get_option('libdir') / 'girepository-1.0'
vapidir = get_option('datadir') / 'vala' / 'vapi'
-config_h = configuration_data()
-config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
-config_h.set_quoted('PX_PLUGINS_DIR', px_plugins_dir)
-configure_file(output: 'config.h', configuration: config_h)
add_project_arguments(['-I' + meson.project_build_root()], language: 'c')
version_arr = meson.project_version().split('-')[0].split('.')
@@ -115,12 +111,18 @@ glib_dep = dependency('glib-2.0', version: '>= 2.71.3')
gio_dep = dependency('gio-2.0', version: '>= 2.71.3')
peas_dep = dependency('libpeas-1.0')
soup_dep = dependency('libsoup-3.0', required: get_option('tests'))
-curl_dep = dependency('libcurl')
+curl_dep = dependency('libcurl', required: get_option('curl'))
ws2_32_dep = cc.find_library('ws2_32', required : with_platform_windows)
gsettings_desktop_schema = dependency('gsettings-desktop-schemas', required: get_option('config-gnome'))
build_dbus = get_option('dbus').disable_auto_if(['window', 'darwin'].contains(host_system)).allowed()
+config_h = configuration_data()
+config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
+config_h.set_quoted('PX_PLUGINS_DIR', px_plugins_dir)
+config_h.set10('HAVE_CURL', get_option('curl'))
+configure_file(output: 'config.h', configuration: config_h)
+
subdir('src')
subdir('tests')
subdir('docs')
diff --git a/meson_options.txt b/meson_options.txt
index 4a212d8..1c530b8 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -73,4 +73,11 @@ option(
type: 'boolean',
value: true,
description: 'Whether to build vapi support'
+)
+
+option(
+ 'curl',
+ type: 'boolean',
+ value: true,
+ description: 'Whether to build cURL support'
) \ No newline at end of file
diff --git a/src/backend/px-manager.c b/src/backend/px-manager.c
index f69dab3..ad230ac 100644
--- a/src/backend/px-manager.c
+++ b/src/backend/px-manager.c
@@ -25,7 +25,9 @@
#include "px-plugin-config.h"
#include "px-plugin-pacrunner.h"
+#ifdef HAVE_CURL
#include <curl/curl.h>
+#endif
#include <libpeas/peas.h>
enum {
@@ -51,7 +53,9 @@ struct _PxManager {
PeasExtensionSet *config_set;
PeasExtensionSet *pacrunner_set;
GNetworkMonitor *network_monitor;
+#ifdef HAVE_CURL
CURL *curl;
+#endif
char *plugins_dir;
GCancellable *cancellable;
@@ -309,6 +313,7 @@ GBytes *
px_manager_pac_download (PxManager *self,
const char *uri)
{
+#ifdef HAVE_CURL
GByteArray *byte_array = g_byte_array_new ();
CURLcode res;
const char *url = uri;
@@ -339,6 +344,9 @@ px_manager_pac_download (PxManager *self,
}
return g_byte_array_free_to_bytes (byte_array);
+#else
+ return NULL;
+#endif
}
struct ConfigData {