lmdb: add package (#4063)

* lmdb: add package

* Update xmake.lua
pull/4067/head
star9029 6 months ago committed by GitHub
parent ab54b6fda1
commit 0cc9a8d6ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 29
      packages/l/lmdb/port/xmake.lua
  2. 40
      packages/l/lmdb/xmake.lua

@ -0,0 +1,29 @@
option("robust_mutex", {default = false})
option("tools", {default = false})
add_rules("mode.debug", "mode.release")
target("lmdb")
set_kind("$(kind)")
add_files("mdb.c", "midl.c")
add_headerfiles("lmdb.h")
add_defines("MDB_USE_ROBUST=" .. (has_config("robust_mutex") and "1" or "0"))
if is_plat("windows") then
add_syslinks("Advapi32")
if is_kind("shared") then
add_rules("utils.symbols.export_all")
end
elseif is_plat("linux", "bsd") then
add_syslinks("pthread")
end
if has_config("tools") and (not is_plat("windows")) then
for _, name in ipairs({"mdb_stat", "mdb_copy", "mdb_dump", "mdb_load"}) do
target(name)
set_kind("binary")
add_files(name .. ".c")
add_deps("lmdb")
end
end

@ -0,0 +1,40 @@
package("lmdb")
set_homepage("http://www.openldap.org/software/repo.html")
set_description("Read-only mirror of official repo on openldap.org. Issues and pull requests here are ignored. Use OpenLDAP ITS for issues.")
add_urls("https://github.com/LMDB/lmdb/archive/refs/tags/LMDB_$(version).tar.gz",
"https://github.com/LMDB/lmdb.git")
add_versions("0.9.31", "dd70a8c67807b3b8532b3e987b0a4e998962ecc28643e1af5ec77696b081c9b0")
add_configs("robust_mutex", {description = "Enable robust mutex", default = false, type = "boolean"})
if is_plat("windows") then
add_configs("tools", {description = "Build tools", default = false, type = "boolean", readonly = true})
else
add_configs("tools", {description = "Build tools", default = false, type = "boolean"})
end
if is_plat("windows") then
add_syslinks("Advapi32")
elseif is_plat("linux", "bsd") then
add_syslinks("pthread")
end
on_install(function (package)
local configs = {
robust_mutex = package:config("robust_mutex"),
tools = package:config("tools"),
}
package:add("defines", "MDB_USE_ROBUST=" .. (configs.robust_mutex and "1" or "0"))
if configs.tools then
package:addenv("PATH", "bin")
end
os.cd("libraries/liblmdb")
os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
import("package.tools.xmake").install(package)
end)
on_test(function (package)
assert(package:has_cfuncs("mdb_version", {includes = "lmdb.h"}))
end)
Loading…
Cancel
Save