3 |
3 |
|
4 |
4 |
EAPI=8
|
5 |
5 |
|
6 |
|
PYTHON_COMPAT=( python3_{9..10} )
|
7 |
|
inherit cmake-multilib llvm llvm.org python-any-r1 toolchain-funcs
|
|
6 |
PYTHON_COMPAT=( python3_{9..11} )
|
|
7 |
inherit cmake-multilib flag-o-matic llvm llvm.org python-any-r1 \
|
|
8 |
toolchain-funcs
|
8 |
9 |
|
9 |
10 |
DESCRIPTION="Low level support for a standard C++ library"
|
10 |
11 |
HOMEPAGE="https://libcxxabi.llvm.org/"
|
... | ... | |
12 |
13 |
LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
|
13 |
14 |
SLOT="0"
|
14 |
15 |
KEYWORDS="amd64 arm arm64 ~riscv sparc x86 ~x64-macos"
|
15 |
|
IUSE="+libunwind +static-libs test"
|
|
16 |
IUSE="+clang +static-libs test"
|
|
17 |
REQUIRED_USE="test? ( clang )"
|
16 |
18 |
RESTRICT="!test? ( test )"
|
17 |
19 |
|
18 |
|
RDEPEND="
|
19 |
|
libunwind? (
|
20 |
|
|| (
|
21 |
|
>=sys-libs/libunwind-1.0.1-r1[static-libs?,${MULTILIB_USEDEP}]
|
22 |
|
>=sys-libs/llvm-libunwind-3.9.0-r1[static-libs?,${MULTILIB_USEDEP}]
|
23 |
|
)
|
24 |
|
)
|
|
20 |
# in 15.x, cxxabi.h is moving from libcxx to libcxxabi
|
|
21 |
RDEPEND+="
|
|
22 |
!<sys-libs/libcxx-15
|
25 |
23 |
"
|
26 |
|
# llvm-6 for new lit options
|
27 |
24 |
DEPEND="
|
28 |
25 |
${RDEPEND}
|
29 |
|
>=sys-devel/llvm-6
|
|
26 |
sys-devel/llvm:${LLVM_MAJOR}
|
30 |
27 |
"
|
31 |
28 |
BDEPEND="
|
|
29 |
clang? (
|
|
30 |
sys-devel/clang:${LLVM_MAJOR}
|
|
31 |
)
|
32 |
32 |
!test? (
|
33 |
33 |
${PYTHON_DEPS}
|
34 |
34 |
)
|
35 |
35 |
test? (
|
36 |
|
>=sys-devel/clang-3.9.0
|
37 |
36 |
$(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]')
|
38 |
37 |
)
|
39 |
38 |
"
|
... | ... | |
51 |
50 |
# darwin prefix builds do not have llvm installed yet, so rely on bootstrap-prefix
|
52 |
51 |
# to set the appropriate path vars to LLVM instead of using llvm_pkg_setup.
|
53 |
52 |
if [[ ${CHOST} != *-darwin* ]] || has_version sys-devel/llvm; then
|
54 |
|
llvm_pkg_setup
|
|
53 |
LLVM_MAX_SLOT=${LLVM_MAJOR} llvm_pkg_setup
|
55 |
54 |
fi
|
56 |
55 |
python-any-r1_pkg_setup
|
57 |
56 |
}
|
58 |
57 |
|
59 |
58 |
multilib_src_configure() {
|
60 |
|
# link against compiler-rt instead of libgcc if we are using clang with libunwind
|
61 |
|
local want_compiler_rt=OFF
|
62 |
|
if use libunwind && [[ $(tc-get-c-rtlib) == compiler-rt ]]; then
|
63 |
|
want_compiler_rt=ON
|
|
59 |
if use clang; then
|
|
60 |
local -x CC=${CHOST}-clang
|
|
61 |
local -x CXX=${CHOST}-clang++
|
|
62 |
strip-unsupported-flags
|
64 |
63 |
fi
|
65 |
64 |
|
|
65 |
# link to compiler-rt
|
|
66 |
local use_compiler_rt=OFF
|
|
67 |
[[ $(tc-get-c-rtlib) == compiler-rt ]] && use_compiler_rt=ON
|
|
68 |
|
66 |
69 |
local libdir=$(get_libdir)
|
67 |
70 |
local mycmakeargs=(
|
|
71 |
-DCMAKE_CXX_COMPILER_TARGET="${CHOST}"
|
68 |
72 |
-DPython3_EXECUTABLE="${PYTHON}"
|
69 |
73 |
-DLLVM_ENABLE_RUNTIMES="libcxxabi;libcxx"
|
70 |
74 |
-DLLVM_INCLUDE_TESTS=OFF
|
... | ... | |
72 |
76 |
-DLIBCXXABI_ENABLE_SHARED=ON
|
73 |
77 |
-DLIBCXXABI_ENABLE_STATIC=$(usex static-libs)
|
74 |
78 |
-DLIBCXXABI_INCLUDE_TESTS=$(usex test)
|
75 |
|
-DLIBCXXABI_USE_LLVM_UNWINDER=$(usex libunwind)
|
76 |
|
-DLIBCXXABI_USE_COMPILER_RT=${want_compiler_rt}
|
|
79 |
-DLIBCXXABI_USE_COMPILER_RT=${use_compiler_rt}
|
77 |
80 |
|
78 |
81 |
# upstream is omitting standard search path for this
|
79 |
82 |
# probably because gcc & clang are bundling their own unwind.h
|
80 |
83 |
-DLIBCXXABI_LIBUNWIND_INCLUDES="${EPREFIX}"/usr/include
|
81 |
|
-DLIBCXXABI_TARGET_TRIPLE="${CHOST}"
|
82 |
84 |
|
83 |
85 |
-DLIBCXX_LIBDIR_SUFFIX=
|
84 |
86 |
-DLIBCXX_ENABLE_SHARED=ON
|
85 |
87 |
-DLIBCXX_ENABLE_STATIC=OFF
|
86 |
|
-DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF
|
87 |
88 |
-DLIBCXX_CXX_ABI=libcxxabi
|
88 |
|
-DLIBCXX_CXX_ABI_INCLUDE_PATHS="${WORKDIR}"/libcxxabi/include
|
89 |
89 |
-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
|
90 |
90 |
-DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
|
91 |
91 |
-DLIBCXX_HAS_GCC_S_LIB=OFF
|
92 |
92 |
-DLIBCXX_INCLUDE_BENCHMARKS=OFF
|
93 |
93 |
-DLIBCXX_INCLUDE_TESTS=OFF
|
94 |
|
-DLIBCXX_TARGET_TRIPLE="${CHOST}"
|
95 |
94 |
)
|
96 |
95 |
if use test; then
|
97 |
|
local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null)
|
98 |
|
[[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests"
|
99 |
|
|
100 |
96 |
mycmakeargs+=(
|
101 |
97 |
-DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
|
102 |
|
-DLLVM_LIT_ARGS="$(get_lit_flags);--param=cxx_under_test=${clang_path}"
|
|
98 |
-DLLVM_LIT_ARGS="$(get_lit_flags)"
|
103 |
99 |
-DPython3_EXECUTABLE="${PYTHON}"
|
104 |
100 |
)
|
105 |
101 |
fi
|
... | ... | |
118 |
114 |
multilib_src_install() {
|
119 |
115 |
DESTDIR="${D}" cmake_build install-cxxabi
|
120 |
116 |
}
|
121 |
|
|
122 |
|
multilib_src_install_all() {
|
123 |
|
insinto /usr/include/libcxxabi
|
124 |
|
doins -r "${WORKDIR}"/libcxxabi/include/.
|
125 |
|
}
|