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: Thu, 28 Jan 2021 09:04:09
Message-Id: 1611824559.fdbc304045bd3ae0f770fb7ea55dc36d4fb08688.mgorny@gentoo
1 commit: fdbc304045bd3ae0f770fb7ea55dc36d4fb08688
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jan 28 09:00:59 2021 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Thu Jan 28 09:02:39 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fdbc3040
7
8 sys-libs/llvm-libunwind: Add 13.x live ebuild
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 .../llvm-libunwind-13.0.0.9999.ebuild | 124 +++++++++++++++++++++
13 1 file changed, 124 insertions(+)
14
15 diff --git a/sys-libs/llvm-libunwind/llvm-libunwind-13.0.0.9999.ebuild b/sys-libs/llvm-libunwind/llvm-libunwind-13.0.0.9999.ebuild
16 new file mode 100644
17 index 00000000000..37357781fb4
18 --- /dev/null
19 +++ b/sys-libs/llvm-libunwind/llvm-libunwind-13.0.0.9999.ebuild
20 @@ -0,0 +1,124 @@
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_{6..9} )
28 +inherit cmake-multilib llvm llvm.org python-any-r1
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 )
49 +LLVM_TEST_COMPONENTS=( libcxx{,abi} llvm/cmake )
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 libdir=$(get_libdir)
62 +
63 + local mycmakeargs=(
64 + -DLLVM_LIBDIR_SUFFIX=${libdir#lib}
65 + -DLIBUNWIND_ENABLE_ASSERTIONS=$(usex debug)
66 + -DLIBUNWIND_ENABLE_STATIC=$(usex static-libs)
67 + -DLLVM_INCLUDE_TESTS=$(usex test)
68 +
69 + # support non-native unwinding; given it's small enough,
70 + # enable it unconditionally
71 + -DLIBUNWIND_ENABLE_CROSS_UNWINDING=ON
72 + )
73 + if use test; then
74 + local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null)
75 + [[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests"
76 +
77 + mycmakeargs+=(
78 + -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
79 + -DLLVM_LIT_ARGS="$(get_lit_flags);--param=cxx_under_test=${clang_path}"
80 + -DLIBUNWIND_LIBCXX_PATH="${WORKDIR}/libcxx"
81 + )
82 + fi
83 +
84 + cmake_src_configure
85 +}
86 +
87 +build_libcxxabi() {
88 + local -x LDFLAGS="${LDFLAGS} -L${BUILD_DIR}/$(get_libdir)"
89 + local CMAKE_USE_DIR=${WORKDIR}/libcxxabi
90 + local BUILD_DIR=${BUILD_DIR}/libcxxabi
91 + local mycmakeargs=(
92 + -DLIBCXXABI_LIBDIR_SUFFIX=
93 + -DLIBCXXABI_ENABLE_SHARED=OFF
94 + -DLIBCXXABI_ENABLE_STATIC=ONF
95 + -DLIBCXXABI_USE_LLVM_UNWINDER=ON
96 + -DLIBCXXABI_INCLUDE_TESTS=OFF
97 +
98 + -DLIBCXXABI_LIBCXX_INCLUDES="${WORKDIR}"/libcxx/include
99 + -DLIBCXXABI_LIBUNWIND_INCLUDES="${S}"/include
100 + )
101 +
102 + cmake_src_configure
103 + cmake_src_compile
104 +}
105 +
106 +build_libcxx() {
107 + local -x LDFLAGS="${LDFLAGS} -L${BUILD_DIR}/libcxxabi/lib -L${BUILD_DIR}/$(get_libdir)"
108 + local CMAKE_USE_DIR=${WORKDIR}/libcxx
109 + local BUILD_DIR=${BUILD_DIR}/libcxx
110 + local mycmakeargs=(
111 + -DLIBCXX_LIBDIR_SUFFIX=
112 + -DLIBCXX_ENABLE_SHARED=OFF
113 + -DLIBCXX_ENABLE_STATIC=ON
114 + -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF
115 + -DLIBCXXABI_USE_LLVM_UNWINDER=ON
116 + -DLIBCXX_CXX_ABI=libcxxabi
117 + -DLIBCXX_CXX_ABI_INCLUDE_PATHS="${WORKDIR}"/libcxxabi/include
118 + -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
119 + -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
120 + -DLIBCXX_HAS_GCC_S_LIB=OFF
121 + -DLIBCXX_INCLUDE_TESTS=OFF
122 + )
123 +
124 + cmake_src_configure
125 + cmake_src_compile
126 +}
127 +
128 +multilib_src_test() {
129 + # build local copies of libc++ & libc++abi for testing to avoid
130 + # circular deps
131 + build_libcxxabi
132 + build_libcxx
133 + mv "${BUILD_DIR}"/libcxx*/lib/libc++* "${BUILD_DIR}/$(get_libdir)/" || die
134 +
135 + local -x LIT_PRESERVES_TMP=1
136 + cmake_build check-unwind
137 +}
138 +
139 +multilib_src_install() {
140 + cmake_src_install
141 +
142 + # install headers like sys-libs/libunwind
143 + doheader "${S}"/include/*.h
144 +}