__init__.py 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. from devtools.yamaker.project import CMakeNinjaNixProject
  2. from devtools.yamaker.modules import GLOBAL, Linkable, Switch
  3. def post_install(self):
  4. with self.yamakes["."] as libunwind:
  5. libunwind.DISABLE.add("USE_LTO")
  6. libunwind.NO_COMPILER_WARNINGS = False
  7. libunwind.NO_RUNTIME = True
  8. libunwind.NO_SANITIZE = True
  9. libunwind.NO_SANITIZE_COVERAGE = True
  10. libunwind.ADDINCL = [f"{self.arcdir}/include"]
  11. libunwind.CFLAGS = [GLOBAL("-D_libunwind_")]
  12. libunwind.CFLAGS += ["-fno-exceptions", "-fno-rtti", "-funwind-tables"]
  13. libunwind.after("CFLAGS", Switch({"SANITIZER_TYPE == memory": "CFLAGS(-fPIC)"}))
  14. libunwind.PEERDIR.add("library/cpp/sanitizer/include")
  15. libunwind.SRCS.add("src/UnwindRegistersSave.S")
  16. libunwind.SRCS.add("src/UnwindRegistersRestore.S")
  17. sources = libunwind.SRCS
  18. libunwind.SRCS = []
  19. libunwind.after(
  20. "SRCS",
  21. Switch(
  22. {
  23. "NOT OS_EMSCRIPTEN": Linkable(
  24. SRCS=sources,
  25. CFLAGS=["-D_LIBUNWIND_IS_NATIVE_ONLY"],
  26. ),
  27. "OS_EMSCRIPTEN AND ARCH_WASM32": Linkable(
  28. SRCS=["src/Unwind-wasm.c"],
  29. PEERDIR=["contrib/restricted/emscripten/include"],
  30. CFLAGS=[
  31. "-D_LIBUNWIND_HIDE_SYMBOLS",
  32. ],
  33. ),
  34. "OS_EMSCRIPTEN AND NOT ARCH_WASM32": Linkable(
  35. SRCS=["src/Unwind-wasm.c"],
  36. PEERDIR=["contrib/restricted/emscripten/include"],
  37. CFLAGS=[
  38. "-D_LIBUNWIND_HIDE_SYMBOLS",
  39. "-D__USING_WASM_EXCEPTIONS__",
  40. ],
  41. ),
  42. }
  43. ),
  44. )
  45. llvm_libunwind = CMakeNinjaNixProject(
  46. owners=["g:cpp-contrib", "g:cpp-committee"],
  47. arcdir="contrib/libs/libunwind",
  48. nixattr="llvmPackages_latest.libunwind",
  49. copy_sources=[
  50. "include/unwind_arm_ehabi.h",
  51. "include/unwind_unwind_itanium.h",
  52. "src/assembly.h",
  53. "src/FrameHeaderCache.hpp",
  54. "src/UnwindRegistersSave.S",
  55. "src/UnwindRegistersRestore.S",
  56. ],
  57. disable_includes=[
  58. "sys/debug.h",
  59. "sys/pseg.h",
  60. "System/pthread_machdep.h",
  61. ],
  62. post_install=post_install,
  63. )