Browse Source

cello: add package (#3864)

* add cello

* fix links

* Update xmake.lua

* hardcode

* fix windows shared

* limit plat

* limit arch
star9029 1 year ago
parent
commit
0fc02a5a0d
1 changed files with 49 additions and 0 deletions
  1. 49 0
      packages/c/cello/xmake.lua

+ 49 - 0
packages/c/cello/xmake.lua

@@ -0,0 +1,49 @@
+package("cello")
+    set_homepage("http://libcello.org/")
+    set_description("Higher level programming in C")
+
+    add_urls("https://github.com/orangeduck/Cello/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/orangeduck/Cello.git")
+
+    add_versions("2.1.0", "c138d974325fcb9640307c8b2d5dcc2d7127a1ccc5589d6c0794f86a5cb4001d")
+
+    if is_plat("windows", "mingw") then
+        add_syslinks("dbghelp")
+    elseif is_plat("linux", "bsd") then
+        add_syslinks("pthread")
+        if is_plat("bsd") then
+            add_syslinks("execinfo")
+        end
+    elseif is_plat("cross", "android", "wasm") then
+        add_defines("CELLO_NSTRACE")
+    end
+
+    on_install("!wasm and !windows|arm64", function(package)
+        io.writefile("xmake.lua", [[
+            add_rules("mode.release", "mode.debug")
+            target("cello")
+                set_kind("$(kind)")
+                add_files("src/*.c")
+                add_headerfiles("include/Cello.h")
+                add_includedirs("include")
+
+                if is_plat("windows", "mingw") then
+                    add_syslinks("dbghelp")
+                    if is_plat("windows") and is_kind("shared") then
+                        add_rules("utils.symbols.export_all")
+                    end
+                elseif is_plat("linux", "bsd") then
+                    add_syslinks("pthread")
+                    if is_plat("bsd") then
+                        add_syslinks("execinfo")
+                    end
+                elseif is_plat("cross", "android", "wasm") then
+                    add_defines("CELLO_NSTRACE")
+                end
+        ]])
+        import("package.tools.xmake").install(package)
+    end)
+
+    on_test(function(package)
+        assert(package:has_cfuncs("name", {includes = "Cello.h"}))
+    end)