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/llvm-libunwind/
Date: Fri, 30 Jul 2021 18:14:29
Message-Id: 1627668837.c4e49754b0b1b1604ec5f5fb62d582e4a29dfc37.mgorny@gentoo
1 commit: c4e49754b0b1b1604ec5f5fb62d582e4a29dfc37
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jul 30 11:16:41 2021 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Fri Jul 30 18:13:57 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c4e49754
7
8 sys-libs/llvm-libunwind: Bump live to 14*
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 .../llvm-libunwind-14.0.0.9999.ebuild | 138 +++++++++++++++++++++
13 1 file changed, 138 insertions(+)
14
15 diff --git a/sys-libs/llvm-libunwind/llvm-libunwind-14.0.0.9999.ebuild b/sys-libs/llvm-libunwind/llvm-libunwind-14.0.0.9999.ebuild
16 new file mode 100644
17 index 00000000000..d64e79cc6b3
18 --- /dev/null
19 +++ b/sys-libs/llvm-libunwind/llvm-libunwind-14.0.0.9999.ebuild
20 @@ -0,0 +1,138 @@
21 +# Copyright 1999-2021 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="C++ runtime stack unwinder from LLVM"
31 +HOMEPAGE="https://github.com/llvm-mirror/libunwind"
32 +
33 +LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
34 +SLOT="0"
35 +KEYWORDS=""
36 +IUSE="debug static-libs test"
37 +RESTRICT="!test? ( test )"
38 +
39 +RDEPEND="!sys-libs/libunwind"
40 +# llvm-6 for new lit options
41 +DEPEND="
42 + >=sys-devel/llvm-6"
43 +BDEPEND="
44 + test? ( >=sys-devel/clang-3.9.0
45 + $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]')
46 + )"
47 +
48 +LLVM_COMPONENTS=( libunwind libcxx llvm/cmake/modules )
49 +LLVM_TEST_COMPONENTS=( libcxxabi )
50 +llvm.org_set_globals
51 +
52 +python_check_deps() {
53 + has_version "dev-python/lit[${PYTHON_USEDEP}]"
54 +}
55 +
56 +pkg_setup() {
57 + use test && python-any-r1_pkg_setup
58 +}
59 +
60 +multilib_src_configure() {
61 + local use_compiler_rt=OFF
62 + local libdir=$(get_libdir)
63 +
64 + # link to compiler-rt
65 + # https://github.com/gentoo/gentoo/pull/21516
66 + if tc-is-clang; then
67 + local compiler-rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \
68 + ${LD_FLAGS} -print-libgcc-file-name)
69 + if [[ ${compiler_rt} == *libclang_rt* ]]; then
70 + use_compiler_rt=ON
71 + fi
72 + fi
73 +
74 + local mycmakeargs=(
75 + -DLLVM_LIBDIR_SUFFIX=${libdir#lib}
76 + -DLIBUNWIND_ENABLE_ASSERTIONS=$(usex debug)
77 + -DLIBUNWIND_ENABLE_STATIC=$(usex static-libs)
78 + -DLLVM_INCLUDE_TESTS=$(usex test)
79 +
80 + # support non-native unwinding; given it's small enough,
81 + # enable it unconditionally
82 + -DLIBUNWIND_ENABLE_CROSS_UNWINDING=ON
83 +
84 + # avoid dependency on libgcc_s if compiler-rt is used
85 + -DLIBUNWIND_USE_COMPILER_RT=${use_compiler_rt}
86 + )
87 + if use test; then
88 + local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null)
89 + [[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests"
90 +
91 + mycmakeargs+=(
92 + -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
93 + -DLLVM_LIT_ARGS="$(get_lit_flags);--param=cxx_under_test=${clang_path}"
94 + -DLIBUNWIND_LIBCXX_PATH="${WORKDIR}/libcxx"
95 + )
96 + fi
97 +
98 + cmake_src_configure
99 +}
100 +
101 +build_libcxxabi() {
102 + local -x LDFLAGS="${LDFLAGS} -L${BUILD_DIR}/$(get_libdir)"
103 + local CMAKE_USE_DIR=${WORKDIR}/libcxxabi
104 + local BUILD_DIR=${BUILD_DIR}/libcxxabi
105 + local mycmakeargs=(
106 + -DLIBCXXABI_LIBDIR_SUFFIX=
107 + -DLIBCXXABI_ENABLE_SHARED=OFF
108 + -DLIBCXXABI_ENABLE_STATIC=ONF
109 + -DLIBCXXABI_USE_LLVM_UNWINDER=ON
110 + -DLIBCXXABI_INCLUDE_TESTS=OFF
111 +
112 + -DLIBCXXABI_LIBCXX_INCLUDES="${WORKDIR}"/libcxx/include
113 + -DLIBCXXABI_LIBUNWIND_INCLUDES="${S}"/include
114 + )
115 +
116 + cmake_src_configure
117 + cmake_src_compile
118 +}
119 +
120 +build_libcxx() {
121 + local -x LDFLAGS="${LDFLAGS} -L${BUILD_DIR}/libcxxabi/lib -L${BUILD_DIR}/$(get_libdir)"
122 + local CMAKE_USE_DIR=${WORKDIR}/libcxx
123 + local BUILD_DIR=${BUILD_DIR}/libcxx
124 + local mycmakeargs=(
125 + -DLIBCXX_LIBDIR_SUFFIX=
126 + -DLIBCXX_ENABLE_SHARED=OFF
127 + -DLIBCXX_ENABLE_STATIC=ON
128 + -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF
129 + -DLIBCXXABI_USE_LLVM_UNWINDER=ON
130 + -DLIBCXX_CXX_ABI=libcxxabi
131 + -DLIBCXX_CXX_ABI_INCLUDE_PATHS="${WORKDIR}"/libcxxabi/include
132 + -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
133 + -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
134 + -DLIBCXX_HAS_GCC_S_LIB=OFF
135 + -DLIBCXX_INCLUDE_TESTS=OFF
136 + )
137 +
138 + cmake_src_configure
139 + cmake_src_compile
140 +}
141 +
142 +multilib_src_test() {
143 + # build local copies of libc++ & libc++abi for testing to avoid
144 + # circular deps
145 + build_libcxxabi
146 + build_libcxx
147 + mv "${BUILD_DIR}"/libcxx*/lib/libc++* "${BUILD_DIR}/$(get_libdir)/" || die
148 +
149 + local -x LIT_PRESERVES_TMP=1
150 + cmake_build check-unwind
151 +}
152 +
153 +multilib_src_install() {
154 + cmake_src_install
155 +
156 + # install headers like sys-libs/libunwind
157 + doheader "${S}"/include/*.h
158 +}