2
0
Эх сурвалжийг харах

Add libaco (#747)

* Add libaco

* Add pprint

* Update xmake.lua

Co-authored-by: ruki <[email protected]>
Kelvin Zhang 3 жил өмнө
parent
commit
0c5a4f9e21

+ 30 - 0
packages/l/libaco/xmake.lua

@@ -0,0 +1,30 @@
+package("libaco")
+
+    set_homepage("https://github.com/hnes/libaco")
+    set_description("A blazing fast and lightweight C asymmetric coroutine library")
+
+    add_urls("https://github.com/hnes/libaco/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/hnes/libaco.git")
+
+    add_versions("v1.2.4", "25e0777ec2c686cc8c8433537d9b3694d196b0287abe6df4f0c21f8605fa5a06")
+
+    on_install("macosx", "linux", function (package)
+        io.writefile("xmake.lua", [[
+        add_rules("mode.debug", "mode.release")
+
+        target("libaco")
+            set_kind("$(kind)")
+            add_files("acosw.S")
+            add_headerfiles("aco.h")
+            add_files("aco.c")
+        ]])
+        local configs = {}
+        if package:config("shared") then
+            configs.kind = "shared"
+        end
+        import("package.tools.xmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("aco_resume", {includes = "aco.h"}))
+    end)