Browse Source

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
Jérôme Leclercq 1 year ago
parent
commit
e0d3bd857f
1 changed files with 16 additions and 8 deletions
  1. 16 8
      packages/l/libcurl/xmake.lua

+ 16 - 8
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",