Browse Source

add gyp-next (#1043)

* fix libcurl

* add gyp-next
Hoildkv 3 years ago
parent
commit
1cd6539c33
2 changed files with 28 additions and 3 deletions
  1. 24 0
      packages/g/gyp-next/xmake.lua
  2. 4 3
      packages/l/libcurl/xmake.lua

+ 24 - 0
packages/g/gyp-next/xmake.lua

@@ -0,0 +1,24 @@
+package("gyp-next")
+
+    set_kind("binary")
+    set_homepage("https://github.com/nodejs/gyp-next")
+    set_description("A fork of the GYP build system for use in the Node.js projects")
+    set_license("BSD-3-Clause")
+
+    add_urls("https://github.com/nodejs/gyp-next/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/nodejs/gyp-next.git")
+    add_versions("v0.11.0", "27fc51481d0e71d7fdc730b4c86dcee9825d11071875384d5fe4b263935501ef")
+
+    add_deps("python 3.x", {kind = "binary"})
+    on_install("@windows", "@macosx", "@linux", function (package)
+        os.cp("*", package:installdir())
+        package:addenv("PATH", ".")
+    end)
+
+    on_test(function (package)
+        if is_host("windows") then
+            os.vrun("cmd /c \"gyp --help\"")
+        else
+            os.vrun("gyp --help")
+        end
+    end)

+ 4 - 3
packages/l/libcurl/xmake.lua

@@ -60,16 +60,17 @@ package("libcurl")
         table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
         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, "-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"))
         table.insert(configs, (package:version():ge("7.80") and "-DCURL_USE_SCHANNEL=ON" or "-DCMAKE_USE_SCHANNEL=ON"))
+        local version = package:version()
         local configopts = {cares    = "ENABLE_ARES",
         local configopts = {cares    = "ENABLE_ARES",
-                            openssl  = "CURL_USE_OPENSSL",
-                            mbedtls  = "CURL_USE_MBEDTLS",
+                            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",
                             nghttp2  = "USE_NGHTTP2",
                             openldap = "CURL_USE_OPENLDAP",
                             openldap = "CURL_USE_OPENLDAP",
                             libidn2  = "USE_LIBIDN2",
                             libidn2  = "USE_LIBIDN2",
                             zlib     = "CURL_ZLIB",
                             zlib     = "CURL_ZLIB",
                             zstd     = "CURL_ZSTD",
                             zstd     = "CURL_ZSTD",
                             brotli   = "CURL_BROTLI",
                             brotli   = "CURL_BROTLI",
-                            libssh2  = "CURL_USE_LIBSSH2"}
+                            libssh2  = (version:ge("7.81") and "CURL_USE_LIBSSL2" or "CMAKE_USE_LIBSSL2")}
         for name, opt in pairs(configopts) do
         for name, opt in pairs(configopts) do
             table.insert(configs, "-D" .. opt .. "=" .. (package:config(name) and "ON" or "OFF"))
             table.insert(configs, "-D" .. opt .. "=" .. (package:config(name) and "ON" or "OFF"))
         end
         end