xmake.lua 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package("libunwind")
  2. set_homepage("https://www.nongnu.org/libunwind/")
  3. set_description("A portable and efficient C programming interface (API) to determine the call-chain of a program.")
  4. add_urls("https://github.com/libunwind/libunwind/releases/download/$(version).tar.gz", {version = function (version)
  5. if version:eq("v1.5") then
  6. return "v1.5/libunwind-1.5.0"
  7. else
  8. return version .. "/libunwind-" .. (version:gsub("v", ""))
  9. end
  10. end})
  11. add_urls("http://download.savannah.nongnu.org/releases/libunwind/libunwind-$(version).tar.gz", {version = function (version)
  12. return version:gsub("v", "")
  13. end})
  14. add_urls("https://github.com/libunwind/libunwind.git")
  15. add_versions("v1.5", "90337653d92d4a13de590781371c604f9031cdb50520366aa1e3a91e1efb1017")
  16. add_versions("v1.6.2", "4a6aec666991fb45d0889c44aede8ad6eb108071c3554fcdff671f9c94794976")
  17. add_configs("minidebuginfo", {description = "Enables support for LZMA-compressed symbol tables", default = false, type = "boolean"})
  18. add_configs("zlibdebuginfo", {description = "Enables support for ZLIB-compressed symbol tables", default = false, type = "boolean"})
  19. add_deps("autoconf")
  20. add_defines("_GNU_SOURCE=1")
  21. on_load("android", "linux", "bsd", "cross", function (package)
  22. if package:config("minidebuginfo") then
  23. package:add("deps", "lzma")
  24. end
  25. if package:config("zlibdebuginfo") then
  26. package:add("deps", "zlib")
  27. end
  28. end)
  29. on_install("android", "linux", "bsd", "cross", function (package)
  30. local configs = {"--enable-coredump=no", "--disable-tests"}
  31. table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
  32. table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
  33. if package:debug() then
  34. table.insert(configs, "--enable-debug")
  35. end
  36. if package:config("pic") ~= false then
  37. table.insert(configs, "--with-pic")
  38. end
  39. table.insert(configs, (package:config("minidebuginfo") and "--enable" or "--disable") .. "-minidebuginfo")
  40. table.insert(configs, (package:config("zlibdebuginfo") and "--enable" or "--disable") .. "-zlibdebuginfo")
  41. import("package.tools.autoconf").install(package, configs)
  42. end)
  43. on_test(function (package)
  44. assert(package:has_cfuncs("_Unwind_Backtrace(0, 0)", {includes = "unwind.h"}))
  45. end)