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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
from devtools.yamaker import fileutil
from devtools.yamaker import platform_macros
from devtools.yamaker.modules import Linkable, Switch
from devtools.yamaker.project import CMakeNinjaNixProject
ATEXIT_SRC = """
SRC_C_PIC(
src/cxa_thread_atexit.cpp -fno-lto
)
"""
def post_install(self):
# libcxxabi-parts is built from libcxxabi sources
# Update VERSION and ORIGINAL_SOURCE values upon libcxxabi update.
fileutil.re_sub_file(
f"{self.ctx.arc}/contrib/libs/cxxsupp/libcxxabi-parts/ya.make",
r"ORIGINAL_SOURCE\(.*\)",
f"ORIGINAL_SOURCE({self.source_url})",
)
fileutil.re_sub_file(
f"{self.ctx.arc}/contrib/libs/cxxsupp/libcxxabi-parts/ya.make",
r"VERSION\(.*\)",
f"VERSION({self.version})",
)
with self.yamakes["."] as libcxxabi:
# Files are distributed between libcxxabi and libcxx in a weird manner
# but we can not peerdir the latter to avoid loops (see below)
# FIXME: sort includes open moving glibcxx-shims into its own dir
libcxxabi.ADDINCL = [
f"{self.arcdir}/include",
"contrib/libs/cxxsupp/libcxx/include",
# libcxxabi includes libcxx's private "include/refstring.h" header from src subdirectory
"contrib/libs/cxxsupp/libcxx/src",
]
# We link libpthread.so automatically depending on the target platform
libcxxabi.CFLAGS.remove("-D_LIBCXXABI_LINK_PTHREAD_LIB")
# -DHAVE___CXA_THREAD_ATEXIT_IMPL MUST NOT BE SET
# until we will start to compile against pure OS_SDK=ubuntu-14 by default
libcxxabi.CFLAGS.remove("-DHAVE___CXA_THREAD_ATEXIT_IMPL")
# Do not create loop from libcxx, libcxxrt and libcxxabi
libcxxabi.NO_UTIL = True
libcxxabi.NO_RUNTIME = True
# disable lto to allow replacing __cxa_thread_atexit_impl in runtime
libcxxabi.SRCS.remove("src/cxa_thread_atexit.cpp")
libcxxabi.after("SRCS", ATEXIT_SRC)
libcxxabi.after(
"SRCS",
Switch(
{
"OS_EMSCRIPTEN AND NOT ARCH_WASM32": Linkable(
CFLAGS=[
"-D_LIBCPP_SAFE_STATIC=",
"-D_LIBCXXABI_DTOR_FUNC=",
"-D__USING_WASM_EXCEPTIONS__",
]
),
"OS_EMSCRIPTEN AND ARCH_WASM32": Linkable(
CFLAGS=[
"-D_LIBCPP_SAFE_STATIC=",
"-D_LIBCXXABI_DTOR_FUNC=",
]
),
}
),
)
libcxxabi.PEERDIR.add("library/cpp/sanitizer/include")
llvm_libcxxabi = CMakeNinjaNixProject(
owners=["g:cpp-committee", "g:cpp-contrib"],
arcdir="contrib/libs/cxxsupp/libcxxabi",
copy_sources=[
"include/__cxxabi_config.h",
"include/cxxabi.h",
],
disable_includes=[
"aix_state_tab_eh.inc",
],
nixattr=platform_macros.make_llvm_nixattr("libcxxabi"),
post_install=post_install,
)
|