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/compiler-rt/
Date: Thu, 28 Jan 2021 09:04:10
Message-Id: 1611824556.7fbbcd0bdd6bfce599627f36bebbd54bafa47f93.mgorny@gentoo
1 commit: 7fbbcd0bdd6bfce599627f36bebbd54bafa47f93
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jan 28 09:00:57 2021 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Thu Jan 28 09:02:36 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7fbbcd0b
7
8 sys-libs/compiler-rt: Add 13.x live ebuild
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 .../compiler-rt/compiler-rt-13.0.0.9999.ebuild | 126 +++++++++++++++++++++
13 1 file changed, 126 insertions(+)
14
15 diff --git a/sys-libs/compiler-rt/compiler-rt-13.0.0.9999.ebuild b/sys-libs/compiler-rt/compiler-rt-13.0.0.9999.ebuild
16 new file mode 100644
17 index 00000000000..07412646ab2
18 --- /dev/null
19 +++ b/sys-libs/compiler-rt/compiler-rt-13.0.0.9999.ebuild
20 @@ -0,0 +1,126 @@
21 +# Copyright 1999-2021 Gentoo Authors
22 +# Distributed under the terms of the GNU General Public License v2
23 +
24 +EAPI=7
25 +
26 +PYTHON_COMPAT=( python3_{6..9} )
27 +inherit cmake flag-o-matic llvm llvm.org python-any-r1 toolchain-funcs
28 +
29 +DESCRIPTION="Compiler runtime library for clang (built-in part)"
30 +HOMEPAGE="https://llvm.org/"
31 +
32 +LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
33 +SLOT="$(ver_cut 1-3)"
34 +KEYWORDS=""
35 +IUSE="+clang test"
36 +RESTRICT="!test? ( test ) !clang? ( test )"
37 +
38 +CLANG_SLOT=${SLOT%%.*}
39 +# llvm-6 for new lit options
40 +DEPEND="
41 + >=sys-devel/llvm-6"
42 +BDEPEND="
43 + >=dev-util/cmake-3.16
44 + clang? ( sys-devel/clang )
45 + test? (
46 + $(python_gen_any_dep ">=dev-python/lit-9.0.1[\${PYTHON_USEDEP}]")
47 + =sys-devel/clang-${PV%_*}*:${CLANG_SLOT}
48 + )
49 + ${PYTHON_DEPS}"
50 +
51 +LLVM_COMPONENTS=( compiler-rt )
52 +llvm.org_set_globals
53 +
54 +PATCHES=(
55 + "${FILESDIR}/9999/${PN}-prefix-paths.patch"
56 +)
57 +
58 +python_check_deps() {
59 + use test || return 0
60 + has_version "dev-python/lit[${PYTHON_USEDEP}]"
61 +}
62 +
63 +pkg_pretend() {
64 + if ! use clang && ! tc-is-clang; then
65 + ewarn "Building using a compiler other than clang may result in broken atomics"
66 + ewarn "library. Enable USE=clang unless you have a very good reason not to."
67 + fi
68 +}
69 +
70 +pkg_setup() {
71 + # Darwin Prefix builds do not have llvm installed yet, so rely on
72 + # bootstrap-prefix to set the appropriate path vars to LLVM instead
73 + # of using llvm_pkg_setup.
74 + if [[ ${CHOST} != *-darwin* ]] || has_version dev-lang/llvm; then
75 + llvm_pkg_setup
76 + fi
77 + python-any-r1_pkg_setup
78 +}
79 +
80 +test_compiler() {
81 + $(tc-getCC) ${CFLAGS} ${LDFLAGS} "${@}" -o /dev/null -x c - \
82 + <<<'int main() { return 0; }' &>/dev/null
83 +}
84 +
85 +src_configure() {
86 + # pre-set since we need to pass it to cmake
87 + BUILD_DIR=${WORKDIR}/${P}_build
88 +
89 + local nolib_flags=( -nodefaultlibs -lc )
90 + if use clang; then
91 + local -x CC=${CHOST}-clang
92 + local -x CXX=${CHOST}-clang++
93 + strip-unsupported-flags
94 + # ensure we can use clang before installing compiler-rt
95 + local -x LDFLAGS="${LDFLAGS} ${nolib_flags[*]}"
96 + elif ! test_compiler; then
97 + if test_compiler "${nolib_flags[@]}"; then
98 + local -x LDFLAGS="${LDFLAGS} ${nolib_flags[*]}"
99 + ewarn "${CC} seems to lack runtime, trying with ${nolib_flags[*]}"
100 + fi
101 + fi
102 +
103 + local mycmakeargs=(
104 + -DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${SLOT}"
105 +
106 + -DCOMPILER_RT_INCLUDE_TESTS=$(usex test)
107 + -DCOMPILER_RT_BUILD_LIBFUZZER=OFF
108 + -DCOMPILER_RT_BUILD_PROFILE=OFF
109 + -DCOMPILER_RT_BUILD_SANITIZERS=OFF
110 + -DCOMPILER_RT_BUILD_XRAY=OFF
111 +
112 + -DPython3_EXECUTABLE="${PYTHON}"
113 + )
114 +
115 + if use prefix && [[ "${CHOST}" == *-darwin* ]] ; then
116 + mycmakeargs+=(
117 + # setting -isysroot is disabled with compiler-rt-prefix-paths.patch
118 + # this allows adding arm64 support using SDK in EPREFIX
119 + -DDARWIN_macosx_CACHED_SYSROOT="${EPREFIX}/MacOSX.sdk"
120 + # Set version based on the SDK in EPREFIX.
121 + # This disables i386 for SDK >= 10.15
122 + -DDARWIN_macosx_OVERRIDE_SDK_VERSION="$(realpath ${EPREFIX}/MacOSX.sdk | sed -e 's/.*MacOSX\(.*\)\.sdk/\1/')"
123 + # Use our libtool instead of looking it up with xcrun
124 + -DCMAKE_LIBTOOL="${EPREFIX}/usr/bin/${CHOST}-libtool"
125 + )
126 + fi
127 +
128 + if use test; then
129 + mycmakeargs+=(
130 + -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
131 + -DLLVM_LIT_ARGS="$(get_lit_flags)"
132 +
133 + -DCOMPILER_RT_TEST_COMPILER="${EPREFIX}/usr/lib/llvm/${CLANG_SLOT}/bin/clang"
134 + -DCOMPILER_RT_TEST_CXX_COMPILER="${EPREFIX}/usr/lib/llvm/${CLANG_SLOT}/bin/clang++"
135 + )
136 + fi
137 +
138 + cmake_src_configure
139 +}
140 +
141 +src_test() {
142 + # respect TMPDIR!
143 + local -x LIT_PRESERVES_TMP=1
144 +
145 + cmake_build check-builtins
146 +}