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: Fri, 30 Jul 2021 18:14:31
Message-Id: 1627668834.d1a744500dcf8a3077060f0f3a735dc0871bd325.mgorny@gentoo
1 commit: d1a744500dcf8a3077060f0f3a735dc0871bd325
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jul 30 11:16:39 2021 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Fri Jul 30 18:13:54 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d1a74450
7
8 sys-libs/compiler-rt: Bump live to 14*
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 .../compiler-rt/compiler-rt-14.0.0.9999.ebuild | 124 +++++++++++++++++++++
13 1 file changed, 124 insertions(+)
14
15 diff --git a/sys-libs/compiler-rt/compiler-rt-14.0.0.9999.ebuild b/sys-libs/compiler-rt/compiler-rt-14.0.0.9999.ebuild
16 new file mode 100644
17 index 00000000000..6f732cc60ab
18 --- /dev/null
19 +++ b/sys-libs/compiler-rt/compiler-rt-14.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 +PYTHON_COMPAT=( python3_{8..10} )
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_PATCHSET=9999-1
53 +llvm.org_set_globals
54 +
55 +python_check_deps() {
56 + use test || return 0
57 + has_version "dev-python/lit[${PYTHON_USEDEP}]"
58 +}
59 +
60 +pkg_pretend() {
61 + if ! use clang && ! tc-is-clang; then
62 + ewarn "Building using a compiler other than clang may result in broken atomics"
63 + ewarn "library. Enable USE=clang unless you have a very good reason not to."
64 + fi
65 +}
66 +
67 +pkg_setup() {
68 + # Darwin Prefix builds do not have llvm installed yet, so rely on
69 + # bootstrap-prefix to set the appropriate path vars to LLVM instead
70 + # of using llvm_pkg_setup.
71 + if [[ ${CHOST} != *-darwin* ]] || has_version dev-lang/llvm; then
72 + llvm_pkg_setup
73 + fi
74 + python-any-r1_pkg_setup
75 +}
76 +
77 +test_compiler() {
78 + $(tc-getCC) ${CFLAGS} ${LDFLAGS} "${@}" -o /dev/null -x c - \
79 + <<<'int main() { return 0; }' &>/dev/null
80 +}
81 +
82 +src_configure() {
83 + # pre-set since we need to pass it to cmake
84 + BUILD_DIR=${WORKDIR}/${P}_build
85 +
86 + local nolib_flags=( -nodefaultlibs -lc )
87 + if use clang; then
88 + local -x CC=${CHOST}-clang
89 + local -x CXX=${CHOST}-clang++
90 + strip-unsupported-flags
91 + # ensure we can use clang before installing compiler-rt
92 + local -x LDFLAGS="${LDFLAGS} ${nolib_flags[*]}"
93 + elif ! test_compiler; then
94 + if test_compiler "${nolib_flags[@]}"; then
95 + local -x LDFLAGS="${LDFLAGS} ${nolib_flags[*]}"
96 + ewarn "${CC} seems to lack runtime, trying with ${nolib_flags[*]}"
97 + fi
98 + fi
99 +
100 + local mycmakeargs=(
101 + -DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${SLOT}"
102 +
103 + -DCOMPILER_RT_INCLUDE_TESTS=$(usex test)
104 + -DCOMPILER_RT_BUILD_LIBFUZZER=OFF
105 + -DCOMPILER_RT_BUILD_MEMPROF=OFF
106 + -DCOMPILER_RT_BUILD_PROFILE=OFF
107 + -DCOMPILER_RT_BUILD_SANITIZERS=OFF
108 + -DCOMPILER_RT_BUILD_XRAY=OFF
109 +
110 + -DPython3_EXECUTABLE="${PYTHON}"
111 + )
112 +
113 + if use prefix && [[ "${CHOST}" == *-darwin* ]] ; then
114 + mycmakeargs+=(
115 + # setting -isysroot is disabled with compiler-rt-prefix-paths.patch
116 + # this allows adding arm64 support using SDK in EPREFIX
117 + -DDARWIN_macosx_CACHED_SYSROOT="${EPREFIX}/MacOSX.sdk"
118 + # Set version based on the SDK in EPREFIX.
119 + # This disables i386 for SDK >= 10.15
120 + -DDARWIN_macosx_OVERRIDE_SDK_VERSION="$(realpath ${EPREFIX}/MacOSX.sdk | sed -e 's/.*MacOSX\(.*\)\.sdk/\1/')"
121 + # Use our libtool instead of looking it up with xcrun
122 + -DCMAKE_LIBTOOL="${EPREFIX}/usr/bin/${CHOST}-libtool"
123 + )
124 + fi
125 +
126 + if use test; then
127 + mycmakeargs+=(
128 + -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
129 + -DLLVM_LIT_ARGS="$(get_lit_flags)"
130 +
131 + -DCOMPILER_RT_TEST_COMPILER="${EPREFIX}/usr/lib/llvm/${CLANG_SLOT}/bin/clang"
132 + -DCOMPILER_RT_TEST_CXX_COMPILER="${EPREFIX}/usr/lib/llvm/${CLANG_SLOT}/bin/clang++"
133 + )
134 + fi
135 +
136 + cmake_src_configure
137 +}
138 +
139 +src_test() {
140 + # respect TMPDIR!
141 + local -x LIT_PRESERVES_TMP=1
142 +
143 + cmake_build check-builtins
144 +}