Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/libcxxabi/
Date: Sun, 06 Feb 2022 15:35:16
Message-Id: 1644161667.e24229f606a51be3e803838c01116e904e0dfd48.mgorny@gentoo
1 commit: e24229f606a51be3e803838c01116e904e0dfd48
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sun Feb 6 15:16:49 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Sun Feb 6 15:34:27 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e24229f6
7
8 sys-libs/libcxxabi: Add 15.x live ebuild
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 sys-libs/libcxxabi/libcxxabi-15.0.0.9999.ebuild | 124 ++++++++++++++++++++++++
13 1 file changed, 124 insertions(+)
14
15 diff --git a/sys-libs/libcxxabi/libcxxabi-15.0.0.9999.ebuild b/sys-libs/libcxxabi/libcxxabi-15.0.0.9999.ebuild
16 new file mode 100644
17 index 000000000000..2bd92bc0287d
18 --- /dev/null
19 +++ b/sys-libs/libcxxabi/libcxxabi-15.0.0.9999.ebuild
20 @@ -0,0 +1,124 @@
21 +# Copyright 1999-2022 Gentoo Authors
22 +# Distributed under the terms of the GNU General Public License v2
23 +
24 +EAPI=7
25 +
26 +CMAKE_ECLASS=cmake
27 +PYTHON_COMPAT=( python3_{8..10} )
28 +inherit cmake-multilib llvm llvm.org python-any-r1 toolchain-funcs
29 +
30 +DESCRIPTION="Low level support for a standard C++ library"
31 +HOMEPAGE="https://libcxxabi.llvm.org/"
32 +
33 +LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
34 +SLOT="0"
35 +KEYWORDS=""
36 +IUSE="+libunwind static-libs test"
37 +RESTRICT="!test? ( test )"
38 +
39 +RDEPEND="
40 + libunwind? (
41 + || (
42 + >=sys-libs/libunwind-1.0.1-r1[static-libs?,${MULTILIB_USEDEP}]
43 + >=sys-libs/llvm-libunwind-3.9.0-r1[static-libs?,${MULTILIB_USEDEP}]
44 + )
45 + )"
46 +# llvm-6 for new lit options
47 +DEPEND="${RDEPEND}
48 + >=sys-devel/llvm-6"
49 +BDEPEND="
50 + test? ( >=sys-devel/clang-3.9.0
51 + $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]')
52 + )"
53 +
54 +LLVM_COMPONENTS=( libcxx{abi,} llvm/cmake cmake )
55 +llvm.org_set_globals
56 +
57 +python_check_deps() {
58 + has_version "dev-python/lit[${PYTHON_USEDEP}]"
59 +}
60 +
61 +pkg_setup() {
62 + # darwin prefix builds do not have llvm installed yet, so rely on bootstrap-prefix
63 + # to set the appropriate path vars to LLVM instead of using llvm_pkg_setup.
64 + if [[ ${CHOST} != *-darwin* ]] || has_version dev-lang/llvm; then
65 + llvm_pkg_setup
66 + fi
67 + use test && python-any-r1_pkg_setup
68 +}
69 +
70 +multilib_src_configure() {
71 + # we need a configured libc++ for __config_site
72 + wrap_libcxx cmake_src_configure
73 + wrap_libcxx cmake_build generate-cxx-headers
74 +
75 + # link against compiler-rt instead of libgcc if we are using clang with libunwind
76 + local want_compiler_rt=OFF
77 + if use libunwind && tc-is-clang; then
78 + local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \
79 + ${LDFLAGS} -print-libgcc-file-name)
80 + if [[ ${compiler_rt} == *libclang_rt* ]]; then
81 + want_compiler_rt=ON
82 + fi
83 + fi
84 +
85 + local libdir=$(get_libdir)
86 + local mycmakeargs=(
87 + -DLIBCXXABI_LIBDIR_SUFFIX=${libdir#lib}
88 + -DLIBCXXABI_ENABLE_SHARED=ON
89 + -DLIBCXXABI_ENABLE_STATIC=$(usex static-libs)
90 + -DLIBCXXABI_USE_LLVM_UNWINDER=$(usex libunwind)
91 + -DLIBCXXABI_INCLUDE_TESTS=$(usex test)
92 + -DLIBCXXABI_USE_COMPILER_RT=${want_compiler_rt}
93 +
94 + -DLIBCXXABI_LIBCXX_INCLUDES="${BUILD_DIR}"/libcxx/include/c++/v1
95 + # upstream is omitting standard search path for this
96 + # probably because gcc & clang are bundling their own unwind.h
97 + -DLIBCXXABI_LIBUNWIND_INCLUDES="${EPREFIX}"/usr/include
98 + -DLIBCXXABI_TARGET_TRIPLE="${CHOST}"
99 + )
100 + if use test; then
101 + local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null)
102 + [[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests"
103 +
104 + mycmakeargs+=(
105 + -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
106 + -DLLVM_LIT_ARGS="$(get_lit_flags);--param=cxx_under_test=${clang_path}"
107 + -DPython3_EXECUTABLE="${PYTHON}"
108 + )
109 + fi
110 + cmake_src_configure
111 +}
112 +
113 +wrap_libcxx() {
114 + local CMAKE_USE_DIR=${WORKDIR}/libcxx
115 + local BUILD_DIR=${BUILD_DIR}/libcxx
116 + local mycmakeargs=(
117 + -DLIBCXX_LIBDIR_SUFFIX=
118 + -DLIBCXX_ENABLE_SHARED=OFF
119 + -DLIBCXX_ENABLE_STATIC=ON
120 + -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF
121 + -DLIBCXX_CXX_ABI=libcxxabi
122 + -DLIBCXX_CXX_ABI_INCLUDE_PATHS="${S}"/include
123 + -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
124 + -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
125 + -DLIBCXX_HAS_GCC_S_LIB=OFF
126 + -DLIBCXX_INCLUDE_TESTS=OFF
127 + -DLIBCXX_TARGET_TRIPLE="${CHOST}"
128 + )
129 +
130 + "${@}"
131 +}
132 +
133 +multilib_src_test() {
134 + wrap_libcxx cmake_src_compile
135 + mv "${BUILD_DIR}"/libcxx/lib/libc++* "${BUILD_DIR}/lib/" || die
136 +
137 + local -x LIT_PRESERVES_TMP=1
138 + cmake_build check-cxxabi
139 +}
140 +
141 +multilib_src_install_all() {
142 + insinto /usr/include/libcxxabi
143 + doins -r include/.
144 +}