add rpmalloc (#1619)

pull/1625/head
ruki 2 years ago committed by GitHub
parent 6893fdd51f
commit 474b53a2d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 34
      packages/r/rpmalloc/xmake.lua
  2. 9
      scripts/new.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)

@ -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"')

Loading…
Cancel
Save