From c0d4c09a02a40167e9de57f82c0033bb92e24167 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Fri, 11 Dec 2020 16:20:19 +0000 Subject: [PATCH] Lower libcurl requirement further still This allows us to build on Ubuntu 16.04! --- libfwupd/fwupd-client.c | 12 ++++++++++++ meson.build | 5 ++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/libfwupd/fwupd-client.c b/libfwupd/fwupd-client.c index 8838d11c8..fd4a01800 100644 --- a/libfwupd/fwupd-client.c +++ b/libfwupd/fwupd-client.c @@ -65,7 +65,9 @@ typedef struct { typedef struct { CURL *curl; +#ifdef HAVE_LIBCURL_7_56_0 curl_mime *mime; +#endif struct curl_slist *headers; } FwupdCurlHelper; @@ -106,8 +108,10 @@ fwupd_client_curl_helper_free (FwupdCurlHelper *helper) { if (helper->curl != NULL) curl_easy_cleanup (helper->curl); +#ifdef HAVE_LIBCURL_7_56_0 if (helper->mime != NULL) curl_mime_free (helper->mime); +#endif if (helper->headers != NULL) curl_slist_free_all (helper->headers); g_free (helper); @@ -4263,6 +4267,7 @@ fwupd_client_upload_bytes_async (FwupdClient *self, /* build message */ if ((flags & FWUPD_CLIENT_UPLOAD_FLAG_ALWAYS_MULTIPART) > 0 || signature != NULL) { +#ifdef HAVE_LIBCURL_7_56_0 curl_mimepart *part; helper->mime = curl_mime_init (helper->curl); curl_easy_setopt (helper->curl, CURLOPT_MIMEPOST, helper->mime); @@ -4274,6 +4279,13 @@ fwupd_client_upload_bytes_async (FwupdClient *self, curl_mime_data (part, signature, CURL_ZERO_TERMINATED); curl_mime_name (part, "signature"); } +#else + g_task_return_new_error (task, + FWUPD_ERROR, + FWUPD_ERROR_INTERNAL, + "not supported as libcurl is too old"); + return; +#endif } else { helper->headers = curl_slist_append (helper->headers, "Content-Type: text/plain"); curl_easy_setopt (helper->curl, CURLOPT_HTTPHEADER, helper->headers); diff --git a/meson.build b/meson.build index c8a797d0a..e5243cc6b 100644 --- a/meson.build +++ b/meson.build @@ -213,7 +213,10 @@ endif libjcat = dependency('jcat', version : '>= 0.1.0', fallback : ['libjcat', 'libjcat_dep']) libjsonglib = dependency('json-glib-1.0', version : '>= 1.1.1') valgrind = dependency('valgrind', required: false) -libcurl = dependency('libcurl', version : '>= 7.61.0') +libcurl = dependency('libcurl', version : '>= 7.47.0') +if libcurl.version().version_compare('>= 7.56.0') + conf.set('HAVE_LIBCURL_7_56_0', '1') +endif if libcurl.version().version_compare('>= 7.62.0') conf.set('HAVE_LIBCURL_7_62_0', '1') endif