Przeglądaj źródła

update co (#458)

* update co

* update co

* update co

* update co
ruki 4 lat temu
rodzic
commit
33492c1eef
1 zmienionych plików z 30 dodań i 1 usunięć
  1. 30 1
      packages/c/co/xmake.lua

+ 30 - 1
packages/c/co/xmake.lua

@@ -3,10 +3,39 @@ package("co")
     set_homepage("https://github.com/idealvin/co")
     set_description("Yet another libco and more.")
 
+--    add_urls("https://github.com/idealvin/co/archive/refs/tags/$(version).tar.gz")
     add_urls("https://github.com/idealvin/co.git")
 
+--    add_versions("v2.0.0", "1bf687ebc08f9951869a111c56b90898b2c320e988dc86355ce17368f279e44d")
+    add_versions("v2.0.0+1", "d962c6f77680cfc3337d1fc718f5ccda04210bd0")
+
+    if is_plat("windows") then
+        -- disable shared library
+        add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
+    end
+    for _, name in ipairs({"libcurl", "openssl"}) do
+        add_configs(name, {description = "Enable " .. name .. " library.", default = false, type = "boolean"})
+    end
+
+    on_load(function (package)
+        for _, dep in ipairs({"libcurl", "openssl"}) do
+            if package:config(dep) then
+                package:add("deps", dep)
+            end
+        end
+    end)
+
     on_install("macosx", "linux", "windows", function (package)
-        import("package.tools.xmake").install(package)
+        local configs = {}
+        if package:config("shared") then
+            configs.kind = "shared"
+        end
+        for _, name in ipairs({"libcurl", "openssl"}) do
+            if package:config(name) then
+                configs["with_" .. name] = true
+            end
+        end
+        import("package.tools.xmake").install(package, configs)
     end)
 
     on_test(function (package)