xmake.lua 1.0 KB

1234567891011121314151617181920212223
  1. package("libbacktrace")
  2. set_homepage("https://github.com/ianlancetaylor/libbacktrace")
  3. set_description("A C library that may be linked into a C/C++ program to produce symbolic backtraces")
  4. add_urls("https://github.com/ianlancetaylor/libbacktrace.git")
  5. add_versions("v1.0", "d0f5e95a87a4d3e0a1ed6c069b5dae7cbab3ed2a")
  6. on_install("linux", "macosx", function (package)
  7. local configs = {}
  8. local cxflags = {}
  9. table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
  10. table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
  11. if package:config("pic") ~= false then
  12. table.insert(cxflags, "-fPIC")
  13. end
  14. import("package.tools.autoconf").install(package, configs, {cxflags = cxflags})
  15. end)
  16. on_test(function (package)
  17. assert(package:has_cfuncs("backtrace_create_state", {includes = "backtrace.h"}))
  18. assert(package:has_cfuncs("backtrace_full", {includes = "backtrace.h"}))
  19. end)