From 39f6724d6a61d66e87e39f29e298db22675ddfa2 Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 30 Mar 2021 10:52:37 +0800 Subject: [PATCH] add libunwind (#346) --- packages/l/libunwind/xmake.lua | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 packages/l/libunwind/xmake.lua diff --git a/packages/l/libunwind/xmake.lua b/packages/l/libunwind/xmake.lua new file mode 100644 index 000000000..f2c0df129 --- /dev/null +++ b/packages/l/libunwind/xmake.lua @@ -0,0 +1,34 @@ +package("libunwind") + + set_homepage("https://github.com/libunwind/libunwind") + set_description("This library provides functions for manipulating Unicode strings and for manipulating C strings according to the Unicode standard.") + + add_urls("https://github.com/libunwind/libunwind/releases/download/$(version).tar.gz", {version = function (version) + return version .. "/libunwind-" .. (version:gsub("v", "")) .. ".0" + end}) + add_urls("http://download.savannah.nongnu.org/releases/libunwind/libunwind-$(version).tar.gz", {version = function (version) + return (version:gsub("v", "")) .. ".0" + end}) + add_urls("https://github.com/libunwind/libunwind.git") + add_versions("v1.5", "90337653d92d4a13de590781371c604f9031cdb50520366aa1e3a91e1efb1017") + + add_deps("autoconf") + + add_defines("_GNU_SOURCE=1") + + on_install("android", "linux", function (package) + local configs = {"--enable-coredump=no", "--disable-tests"} + table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no")) + table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes")) + if package:debug() then + table.insert(configs, "--enable-debug") + end + if package:config("pic") ~= false then + table.insert(configs, "--with-pic") + end + import("package.tools.autoconf").install(package, configs) + end) + + on_test(function (package) + assert(package:has_cfuncs("_Unwind_Backtrace(0, 0)", {includes = "unwind.h"})) + end)