Bladeren bron

Update libcurl (#5892)

* libcurl: add versions 8.8.0~8.11.0

* libcurl: add openssl v3.

* libcurl: avoid implicitly enabling SSL support.

* libssh2: add openssl v3.

* revert "libssh2: add openssl v3."

This reverts commit 042bd1ae976f207932711c888b0ced076e0a6f64.

* libcurl: try fix build on apple platform.

* libcurl: fix wrong version to apply patch.

* try ninja & android on windows

* libcurl: remove broken mirror.

* libcurl: fix cmake defs.

* Update xmake.lua

---------

Co-authored-by: star9029 <[email protected]>
Co-authored-by: ruki <[email protected]>
RedbeanW 8 maanden geleden
bovenliggende
commit
a23c2b65fc

+ 42 - 0
packages/l/libcurl/patches/8.9.0/fix-apple-sdk-bug.patch

@@ -0,0 +1,42 @@
+From 5f6b9244ceecbb1e1b9c08bda5c9292f23f4ea57 Mon Sep 17 00:00:00 2001
+From: Viktor Szakats <[email protected]>
+Date: Fri, 26 Jul 2024 00:10:21 +0200
+Subject: [PATCH] macos: fix Apple SDK bug workaround for non-macOS targets
+
+Turns out that MAC != OSX, despite what these names otherwise mean and
+what's suggested by source code comments. "MAC" in fact means Darwin
+(aka Apple), not macOS. "OSX" means macOS.
+
+GitHub bumped the macos-14 runner default to Xcode 15.4, hitting the
+llvm@15 incompatibility bug by default. Meaning the previous workaround
+for the SDK bug is necessary.
+
+This patch extend the workaround to not apply to mobile OS variants.
+
+Follow-up to ff784af461175584c73e7e2b65af00b1a5a6f67f #14159
+Reported-by: Sergey
+Confirmed-by: Marcel Raad
+Fixes #14269
+Closes #14275
+---
+ lib/curl_setup.h | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/lib/curl_setup.h b/lib/curl_setup.h
+index 1e5371ef8..c8dba5e2b 100644
+--- a/lib/curl_setup.h
++++ b/lib/curl_setup.h
+@@ -71,7 +71,9 @@
+    the necessary dynamic detection features, so the SDK falls back to
+    a codepath that sets both the old and new macro to 1. */
+ #if defined(TARGET_OS_MAC) && TARGET_OS_MAC && \
+-  defined(TARGET_OS_OSX) && !TARGET_OS_OSX
++  defined(TARGET_OS_OSX) && !TARGET_OS_OSX && \
++  (!defined(TARGET_OS_IPHONE) || !TARGET_OS_IPHONE) && \
++  (!defined(TARGET_OS_SIMULATOR) || !TARGET_OS_SIMULATOR)
+ #undef TARGET_OS_OSX
+ #define TARGET_OS_OSX TARGET_OS_MAC
+ #endif
+-- 
+2.47.1
+

+ 6 - 0
packages/l/libcurl/versions.lua

@@ -1,4 +1,10 @@
 function add_versions_list()
+    add_versions("8.11.0", "c95d5a1368803729345a632ce42cceeefd5f09c3b4d9582f858f6779f4b8b254")
+    add_versions("8.10.1", "3763cd97aae41dcf41950d23e87ae23b2edb2ce3a5b0cf678af058c391b6ae31")
+    add_versions("8.10.0", "be30a51f7bbe8819adf5a8e8cc6991393ede31f782b8de7b46235cc1eb7beb9f")
+    add_versions("8.9.1", "b57285d9e18bf12a5f2309fc45244f6cf9cb14734e7454121099dd0a83d669a3")
+    add_versions("8.9.0", "1cb4c3657bd092b8c8e586afe87679c0aaa3d761af2aebabd6effd553e57936c")
+    add_versions("8.8.0", "40d3792d38cfa244d8f692974a567e9a5f3387c547579f1124e95ea2a1020d0d")
     add_versions("8.7.1", "05bbd2b698e9cfbab477c33aa5e99b4975501835a41b7ca6ca71de03d8849e76")
     add_versions("8.5.0", "ce4b6a6655431147624aaf582632a36fe1ade262d5fab385c60f78942dd8d87b")
     add_versions("8.4.0", "e5250581a9c032b1b6ed3cf2f9c114c811fc41881069e9892d115cc73f9e88c6")

+ 6 - 0
packages/l/libcurl/versions.txt

@@ -1,3 +1,9 @@
+8.11.0 c95d5a1368803729345a632ce42cceeefd5f09c3b4d9582f858f6779f4b8b254
+8.10.1 3763cd97aae41dcf41950d23e87ae23b2edb2ce3a5b0cf678af058c391b6ae31
+8.10.0 be30a51f7bbe8819adf5a8e8cc6991393ede31f782b8de7b46235cc1eb7beb9f
+8.9.1 b57285d9e18bf12a5f2309fc45244f6cf9cb14734e7454121099dd0a83d669a3
+8.9.0 1cb4c3657bd092b8c8e586afe87679c0aaa3d761af2aebabd6effd553e57936c
+8.8.0 40d3792d38cfa244d8f692974a567e9a5f3387c547579f1124e95ea2a1020d0d
 8.7.1 05bbd2b698e9cfbab477c33aa5e99b4975501835a41b7ca6ca71de03d8849e76
 8.6.0 b4785f2d8877fa92c0e45d7155cf8cc6750dbda961f4b1a45bcbec990cf2fa9b
 8.5.0 ce4b6a6655431147624aaf582632a36fe1ade262d5fab385c60f78942dd8d87b

+ 13 - 6
packages/l/libcurl/xmake.lua

@@ -5,8 +5,7 @@ package("libcurl")
     set_description("The multiprotocol file transfer library.")
     set_license("MIT")
 
-    set_urls("https://curl.haxx.se/download/curl-$(version).tar.bz2",
-             "http://curl.mirror.anstey.ca/curl-$(version).tar.bz2")
+    set_urls("https://curl.haxx.se/download/curl-$(version).tar.bz2")
     add_urls("https://github.com/curl/curl/releases/download/curl-$(version).tar.bz2",
              {version = function (version) return (version:gsub("%.", "_")) .. "/curl-" .. version end})
     if add_versionfiles then
@@ -17,9 +16,11 @@ package("libcurl")
 
     add_patches("7.84.0", path.join(os.scriptdir(), "patches", "7.84.0", "sched.patch"), "e79f56f840cbc6996a153f19d9266bd46fe4154e6b494c8ee0478cb5b87662d3")
     add_patches("8.7.1", path.join(os.scriptdir(), "patches", "8.7.1", "android_armv7.patch"), "b172fd25063fcf4bce987b47a3d95d9d79bcf80f45e7e45dbf4aba72c685fb24")
+    add_patches("8.9.0", path.join(os.scriptdir(), "patches", "8.9.0", "fix-apple-sdk-bug.patch"), "9503db07a76d828ab7d33565c6aa65c9df80626c11248a4b670aaf10b42e4de7")
 
     add_configs("cares",    {description = "Enable c-ares support.", default = false, type = "boolean"})
     add_configs("openssl",  {description = "Enable OpenSSL for SSL/TLS.", default = false, type = "boolean"})
+    add_configs("openssl3", {description = "Enable OpenSSL-3 for SSL/TLS.", default = false, type = "boolean"})
     add_configs("mbedtls",  {description = "Enable mbedTLS for SSL/TLS.", default = false, type = "boolean"})
     add_configs("nghttp2",  {description = "Use Nghttp2 library.", default = false, type = "boolean"})
     add_configs("openldap", {description = "Use OpenLDAP library.", default = false, type = "boolean"})
@@ -30,11 +31,14 @@ package("libcurl")
     add_configs("libssh2",  {description = "Use libSSH2 library.", default = false, type = "boolean"})
     add_configs("libpsl",   {description = "Use libpsl library.", default = false, type = "boolean"})
 
+    if is_plat("android") and is_host("windows") then
+        add_deps("ninja")
+        set_policy("package.cmake_generator.ninja", true)
+    end
+
     -- we init all configurations in on_load, because package("curl") need it.
     on_load(function (package)
-        if package:is_plat("linux", "android", "cross") then
-            package:config_set("openssl", true)
-        end
+        assert(not (package:config("openssl") and package:config("openssl3")), "OpenSSL and OpenSSL-3 cannot be enabled at the same time.")
 
         if package:is_plat("macosx", "iphoneos") then
             package:add("frameworks", "Security", "CoreFoundation", "SystemConfiguration")
@@ -61,6 +65,7 @@ package("libcurl")
         package:add("deps", "cmake")
         local configdeps = {cares    = "c-ares",
                             openssl  = "openssl",
+                            openssl3 = "openssl3",
                             mbedtls  = "mbedtls",
                             nghttp2  = "nghttp2",
                             openldap = "openldap",
@@ -94,7 +99,6 @@ package("libcurl")
         end
 
         local configopts = {cares    = "ENABLE_ARES",
-                            openssl  = (version:ge("7.81") and "CURL_USE_OPENSSL" or "CMAKE_USE_OPENSSL"),
                             mbedtls  = (version:ge("7.81") and "CURL_USE_MBEDTLS" or "CMAKE_USE_MBEDTLS"),
                             nghttp2  = "USE_NGHTTP2",
                             libidn2  = "USE_LIBIDN2",
@@ -106,6 +110,8 @@ package("libcurl")
         for name, opt in pairs(configopts) do
             table.insert(configs, "-D" .. opt .. "=" .. (package:config(name) and "ON" or "OFF"))
         end
+        table.insert(configs, "-D" .. (version:ge("7.81") and "CURL_USE_OPENSSL" or "CMAKE_USE_OPENSSL") .. "=" .. ((package:config("openssl") or package:config("openssl3")) and "ON" or "OFF"))
+
         if not package:config("openldap") then
             table.insert(configs, "-DCURL_DISABLE_LDAP=ON")
         end
@@ -160,6 +166,7 @@ package("libcurl")
         end
         handledependency("brotli", "brotli", "BROTLI_INCLUDE_DIR", {BROTLICOMMON_LIBRARY = "brotlicommon", BROTLIDEC_LIBRARY = "brotlidec"})
         handledependency("openssl", "openssl", "OPENSSL_INCLUDE_DIR", {OPENSSL_CRYPTO_LIBRARY = "crypto", OPENSSL_SSL_LIBRARY = "ssl"})
+        handledependency("openssl3", "openssl3", "OPENSSL_INCLUDE_DIR", {OPENSSL_CRYPTO_LIBRARY = "crypto", OPENSSL_SSL_LIBRARY = "ssl"})
         handledependency("mbedtls", "mbedtls", "MBEDTLS_INCLUDE_DIRS", {MBEDTLS_LIBRARY = "mbedtls", MBEDX509_LIBRARY = "mbedx509", MBEDCRYPTO_LIBRARY = "mbedcrypto"})
         handledependency("zlib", "zlib", "ZLIB_INCLUDE_DIR", "ZLIB_LIBRARY")
         handledependency("zstd", "zstd", "Zstd_INCLUDE_DIR", "Zstd_LIBRARY")