ruki 2 rokov pred
rodič
commit
474b53a2d8
2 zmenil súbory, kde vykonal 37 pridanie a 6 odobranie
  1. 34 0
      packages/r/rpmalloc/xmake.lua
  2. 3 6
      scripts/new.lua

+ 34 - 0
packages/r/rpmalloc/xmake.lua

@@ -0,0 +1,34 @@
+package("rpmalloc")
+    set_homepage("https://github.com/mjansson/rpmalloc")
+    set_description("Public domain cross platform lock free thread caching 16-byte aligned memory allocator implemented in C")
+
+    add_urls("https://github.com/mjansson/rpmalloc/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/mjansson/rpmalloc.git")
+    add_versions("1.4.4", "3859620c03e6473f0b3f16a4e965e7c049594253f70e8370fb9caa0e4118accb")
+
+    if is_plat("windows") then
+        add_syslinks("advapi32")
+    end
+
+    on_install(function (package)
+        local configs = {}
+        io.writefile("xmake.lua", [[
+            add_rules("mode.release", "mode.debug")
+            target("rpmalloc")
+                set_kind("$(kind)")
+                add_files("rpmalloc/rpmalloc.c")
+                add_headerfiles("rpmalloc/(*.h)")
+                if is_plat("windows") and is_kind("shared") then
+                    add_rules("utils.symbols.export_all")
+                    add_syslinks("advapi32")
+                end
+        ]])
+        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("rpmalloc", {includes = "rpmalloc.h"}))
+    end)

+ 3 - 6
scripts/new.lua

@@ -140,9 +140,6 @@ function _generate_package_from_github(reponame)
         file:print('        if package:debug() then')
         file:print('            table.insert(configs, "--enable-debug")')
         file:print('        end')
-        file:print('        if package:is_plat("linux") and package:config("pic") ~= false then')
-        file:print('            table.insert(configs, "--with-pic")')
-        file:print('        end')
         file:print('        import("package.tools.autoconf").install(package, configs)')
     elseif has_meson then
         file:print('        table.insert(configs, "-Ddefault_library=" .. (package:config("shared") and "shared" or "static"))')
@@ -153,9 +150,9 @@ function _generate_package_from_github(reponame)
         file:print('        io.writefile("xmake.lua", [[')
         file:print('            add_rules("mode.release", "mode.debug")')
         file:print('            target("%s")', packagename)
-        file:write('               set_kind("$(kind)")\n')
-        file:print('               add_files("src/*.c")')
-        file:print('               add_headerfiles("src/(*.h)")')
+        file:write('                set_kind("$(kind)")\n')
+        file:print('                add_files("src/*.c")')
+        file:print('                add_headerfiles("src/(*.h)")')
         file:print('        ]])')
         file:print('        if package:config("shared") then')
         file:print('            configs.kind = "shared"')