Subject: Re: Build with older versions of curl
From: Ondřej Jirman
Date: Thu, 30 Mar 2023 09:15:05 +0200
Hello,

On Thu, Mar 30, 2023 at 11:36:21AM +0600, raven@sysadmins.ws wrote:
> Hi there,
> 
> I found out that it is impossible to build the latest version of megatools
> in distributions with older versions of curl. I am building RPM packages for
> current versions of RHEL that ship curl versions 7.29, 7.61 and 7.76 and all
> my builds have failed. So I added some conditions to commit
> 82c8421b31af77559c5c61b60955fe586c8ec5f2 to make the build go without
> errors. The patch is attached.

+#if CURL_AT_LEAST_VERSION(7, 32, 0)
                curl_easy_setopt(h->curl, CURLOPT_XFERINFOFUNCTION, curl_progress);
+#else
+               curl_easy_setopt(h->curl, CURLOPT_PROGRESSFUNCTION, (curl_progress_callback)curl_progress);
+#endif

On older libcurl curl_progress has parameters of double, so this will not
work. You'll need a compatibility wrapper, that accepts double type arguments
and calls curl_progress.

https://curl.se/libcurl/c/CURLOPT_PROGRESSFUNCTION.html

Thanks and kind regards,
	o.

> 
> Regards,
> 
> Andrey K.