From e0d3bd857f8fcfbebf985c1a5dc52287597babbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Leclercq?= Date: Sun, 14 Jan 2024 14:34:04 +0100 Subject: [PATCH] Fix libcurl on macOS ARM64 (#3102) * libcurl: Use CMake to build * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua * Update xmake.lua --- packages/l/libcurl/xmake.lua | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/packages/l/libcurl/xmake.lua b/packages/l/libcurl/xmake.lua index d0e147309..a2618ccdf 100644 --- a/packages/l/libcurl/xmake.lua +++ b/packages/l/libcurl/xmake.lua @@ -1,7 +1,6 @@ includes(path.join(os.scriptdir(), "versions.lua")) package("libcurl") - set_homepage("https://curl.haxx.se/") set_description("The multiprotocol file transfer library.") set_license("MIT") @@ -12,12 +11,13 @@ package("libcurl") {version = function (version) return (version:gsub("%.", "_")) .. "/curl-" .. version end}) add_versions_list() + add_deps("cmake") + if is_plat("macosx", "iphoneos") then add_frameworks("Security", "CoreFoundation", "SystemConfiguration") elseif is_plat("linux") then add_syslinks("pthread") elseif is_plat("windows", "mingw") then - add_deps("cmake") add_syslinks("advapi32", "crypt32", "wldap32", "winmm", "ws2_32", "user32") end @@ -70,12 +70,12 @@ package("libcurl") end end) - on_install("windows", "mingw", function (package) + on_install("windows", "mingw", "linux", "macosx", "iphoneos", "cross", function (package) + local version = package:version() + local configs = {"-DBUILD_TESTING=OFF", "-DENABLE_MANUAL=OFF"} table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) - table.insert(configs, (package:version():ge("7.80") and "-DCURL_USE_SCHANNEL=ON" or "-DCMAKE_USE_SCHANNEL=ON")) - local version = package:version() if (package:is_plat("mingw") and version:ge("7.85")) then package:add("syslinks", "bcrypt") @@ -85,7 +85,6 @@ package("libcurl") 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", - openldap = "CURL_USE_OPENLDAP", libidn2 = "USE_LIBIDN2", zlib = "CURL_ZLIB", zstd = "CURL_ZSTD", @@ -95,16 +94,25 @@ package("libcurl") for name, opt in pairs(configopts) do table.insert(configs, "-D" .. opt .. "=" .. (package:config(name) and "ON" or "OFF")) end + if not package:config("openldap") then + table.insert(configs, "-DCURL_DISABLE_LDAP=ON") + end + if package:is_plat("windows", "mingw") then + table.insert(configs, (version:ge("7.80") and "-DCURL_USE_SCHANNEL=ON" or "-DCMAKE_USE_SCHANNEL=ON")) + end + if package:is_plat("macosx", "iphoneos") then + table.insert(configs, (version:ge("7.65") and "-DCURL_USE_SECTRANSP=ON" or "-DCMAKE_USE_DARWINSSL=ON")) + end if package:is_plat("windows") then table.insert(configs, "-DCURL_STATIC_CRT=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF")) end if package:is_plat("mingw") and version:le("7.85.0") then io.replace("src/CMakeLists.txt", 'COMMAND ${CMAKE_COMMAND} -E echo "/* built-in manual is disabled, blank function */" > tool_hugehelp.c', "", {plain = true}) end - import("package.tools.cmake").install(package, configs) + import("package.tools.cmake").install(package, configs, opt) end) - on_install("macosx", "linux", "android", "cross", function (package) + on_install("android", function (package) local configs = {"--disable-silent-rules", "--disable-dependency-tracking", "--without-hyper",