aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/libunwind/.yandex_meta/__init__.py
blob: 7641a9967e5ab0288cbe714912a42744760971b0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
from devtools.yamaker.project import CMakeNinjaNixProject
from devtools.yamaker.modules import GLOBAL, Linkable, Switch


def post_install(self):
    with self.yamakes["."] as libunwind:
        libunwind.DISABLE.add("USE_LTO")
        libunwind.NO_COMPILER_WARNINGS = False
        libunwind.NO_RUNTIME = True
        libunwind.NO_SANITIZE = True
        libunwind.NO_SANITIZE_COVERAGE = True
        libunwind.ADDINCL = [f"{self.arcdir}/include"]
        libunwind.CFLAGS = [GLOBAL("-D_libunwind_")]
        libunwind.CFLAGS += ["-fno-exceptions", "-fno-rtti", "-funwind-tables"]
        libunwind.after("CFLAGS", Switch({"SANITIZER_TYPE == memory": "CFLAGS(-fPIC)"}))
        libunwind.PEERDIR.add("library/cpp/sanitizer/include")
        libunwind.SRCS.add("src/UnwindRegistersSave.S")
        libunwind.SRCS.add("src/UnwindRegistersRestore.S")

        sources = libunwind.SRCS
        libunwind.SRCS = []

        libunwind.after(
            "SRCS",
            Switch(
                {
                    "NOT OS_EMSCRIPTEN": Linkable(
                        SRCS=sources,
                        CFLAGS=["-D_LIBUNWIND_IS_NATIVE_ONLY"],
                    ),
                    "OS_EMSCRIPTEN AND ARCH_WASM32": Linkable(
                        SRCS=["src/Unwind-wasm.c"],
                        PEERDIR=["contrib/restricted/emscripten/include"],
                        CFLAGS=[
                            "-D_LIBUNWIND_HIDE_SYMBOLS",
                        ],
                    ),
                    "OS_EMSCRIPTEN AND NOT ARCH_WASM32": Linkable(
                        SRCS=["src/Unwind-wasm.c"],
                        PEERDIR=["contrib/restricted/emscripten/include"],
                        CFLAGS=[
                            "-D_LIBUNWIND_HIDE_SYMBOLS",
                            "-D__USING_WASM_EXCEPTIONS__",
                        ],
                    ),
                }
            ),
        )


llvm_libunwind = CMakeNinjaNixProject(
    owners=["g:cpp-contrib", "g:cpp-committee"],
    arcdir="contrib/libs/libunwind",
    nixattr="llvmPackages_latest.libunwind",
    copy_sources=[
        "include/unwind_arm_ehabi.h",
        "include/unwind_unwind_itanium.h",
        "src/assembly.h",
        "src/FrameHeaderCache.hpp",
        "src/UnwindRegistersSave.S",
        "src/UnwindRegistersRestore.S",
    ],
    disable_includes=[
        "sys/debug.h",
        "sys/pseg.h",
        "System/pthread_machdep.h",
    ],
    post_install=post_install,
)