xmake.lua 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. set_license("MIT")
  5. add_urls("https://github.com/libunwind/libunwind/releases/download/$(version).tar.gz", {version = function (version)
  6. if version:eq("v1.5") then
  7. return "v1.5/libunwind-1.5.0"
  8. else
  9. return version .. "/libunwind-" .. (version:gsub("v", ""))
  10. end
  11. end})
  12. add_urls("http://download.savannah.nongnu.org/releases/libunwind/libunwind-$(version).tar.gz", {version = function (version)
  13. return version:gsub("v", "")
  14. end})
  15. add_urls("https://github.com/libunwind/libunwind.git")
  16. add_versions("v1.8.2", "7f262f1a1224f437ede0f96a6932b582c8f5421ff207c04e3d9504dfa04c8b82")
  17. add_versions("v1.8.1", "ddf0e32dd5fafe5283198d37e4bf9decf7ba1770b6e7e006c33e6df79e6a6157")
  18. add_versions("v1.8.0", "b6b3df40a0970c8f2865fb39aa2af7b5d6f12ad6c5774e266ccca4d6b8b72268")
  19. add_versions("v1.7.2", "a18a6a24307443a8ace7a8acc2ce79fbbe6826cd0edf98d6326d0225d6a5d6e6")
  20. add_versions("v1.6.2", "4a6aec666991fb45d0889c44aede8ad6eb108071c3554fcdff671f9c94794976")
  21. add_versions("v1.5", "90337653d92d4a13de590781371c604f9031cdb50520366aa1e3a91e1efb1017")
  22. add_patches("1.8.0", path.join(os.scriptdir(), "patches", "1.8.0", "fix-arm64.patch"), "5f679af80859b6a50504ec830a4d328c3cf25bef9f2107baed866b438f3818d3")
  23. add_configs("minidebuginfo", {description = "Enables support for LZMA-compressed symbol tables", default = false, type = "boolean"})
  24. add_configs("zlibdebuginfo", {description = "Enables support for ZLIB-compressed symbol tables", default = false, type = "boolean"})
  25. add_deps("autoconf")
  26. add_defines("_GNU_SOURCE=1")
  27. on_load("android", "linux", "bsd", "cross", function (package)
  28. if package:config("minidebuginfo") then
  29. package:add("deps", "lzma")
  30. end
  31. if package:config("zlibdebuginfo") then
  32. package:add("deps", "zlib")
  33. end
  34. end)
  35. on_install("android|arm64@linux,macosx", "linux", "bsd", "cross", function (package)
  36. if package:is_plat("bsd") then
  37. io.replace("src/setjmp/siglongjmp.c", "&wp[JB_MASK]", "(unw_word_t)&wp[JB_MASK]", {plain = true})
  38. end
  39. local configs = {"--enable-coredump=no", "--disable-tests"}
  40. table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
  41. table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
  42. if package:debug() then
  43. table.insert(configs, "--enable-debug")
  44. end
  45. if package:config("pic") ~= false then
  46. table.insert(configs, "--with-pic")
  47. end
  48. table.insert(configs, (package:config("minidebuginfo") and "--enable" or "--disable") .. "-minidebuginfo")
  49. table.insert(configs, (package:config("zlibdebuginfo") and "--enable" or "--disable") .. "-zlibdebuginfo")
  50. import("package.tools.autoconf").install(package, configs)
  51. end)
  52. on_test(function (package)
  53. assert(package:has_cfuncs("_Unwind_Backtrace(0, 0)", {includes = "unwind.h"}))
  54. end)