xmake.lua 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package("xunwind")
  2. set_homepage("https://github.com/hexhacking/xUnwind")
  3. set_description(":fire: xUnwind is a collection of Android native stack unwinding solutions.")
  4. set_license("MIT")
  5. add_urls("https://github.com/hexhacking/xUnwind/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/hexhacking/xUnwind.git")
  7. add_versions("v2.0.0", "c5d82cb62b864bedaa5fe47290f6b4bfd9be7255e4cd4fd0e68c600b49694b1d")
  8. add_deps("xdl")
  9. on_install("android", function (package)
  10. os.cd("xunwind/src/main/cpp")
  11. os.mv("xunwind.map.txt", "xunwind.map")
  12. io.writefile("xmake.lua", [[
  13. add_rules("mode.asan", "mode.release", "mode.debug")
  14. add_requires("xdl")
  15. target("xUnwind")
  16. set_kind("$(kind)")
  17. set_languages("c17")
  18. add_files("*.c")
  19. add_includedirs("include", ".")
  20. add_headerfiles("include/(**.h)")
  21. add_packages("xdl")
  22. add_syslinks("log")
  23. if is_mode("asan") then
  24. add_cflags("-fno-omit-frame-pointer")
  25. else
  26. set_optimize("smallest")
  27. add_cflags("-faddrsig", "-ffunction-sections", "-fdata-sections")
  28. add_ldflags("-Wl,--icf=all", "-Wl,--exclude-libs,ALL", "-Wl,--gc-sections")
  29. add_files("xunwind.map")
  30. end
  31. ]])
  32. import("package.tools.xmake").install(package)
  33. end)
  34. on_test(function (package)
  35. assert(package:has_cfuncs("xunwind_cfi_log", {includes = "xunwind.h"}))
  36. end)