From c23a1345e9c75a0e1ae7d5d5affcc6af5df24d38 Mon Sep 17 00:00:00 2001 From: Jan-Michael Brummer Date: Thu, 9 Mar 2023 17:34:02 +0100 Subject: 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 --- meson.build | 12 +++++++----- meson_options.txt | 7 +++++++ src/backend/px-manager.c | 8 ++++++++ 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 +#endif #include 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 { -- cgit v1.2.1