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, 05 Aug 2022 19:50:14
Message-Id: 1659728997.5dd692e5bffc6ff1e7ce4e3f41813bee07272d5a.mgorny@gentoo
1 commit: 5dd692e5bffc6ff1e7ce4e3f41813bee07272d5a
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Fri Aug 5 19:48:40 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Fri Aug 5 19:49:57 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5dd692e5
7
8 sys-libs/compiler-rt: Add 16.* live ebuilds
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 .../compiler-rt/compiler-rt-16.0.0.9999.ebuild | 138 +++++++++++++++++++++
13 1 file changed, 138 insertions(+)
14
15 diff --git a/sys-libs/compiler-rt/compiler-rt-16.0.0.9999.ebuild b/sys-libs/compiler-rt/compiler-rt-16.0.0.9999.ebuild
16 new file mode 100644
17 index 000000000000..8ef4aebf481d
18 --- /dev/null
19 +++ b/sys-libs/compiler-rt/compiler-rt-16.0.0.9999.ebuild
20 @@ -0,0 +1,138 @@
21 +# Copyright 1999-2022 Gentoo Authors
22 +# Distributed under the terms of the GNU General Public License v2
23 +
24 +EAPI=8
25 +
26 +PYTHON_COMPAT=( python3_{8..11} )
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="+abi_x86_32 abi_x86_64 +clang debug 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 +"
43 +BDEPEND="
44 + >=dev-util/cmake-3.16
45 + clang? ( sys-devel/clang )
46 + test? (
47 + $(python_gen_any_dep ">=dev-python/lit-15[\${PYTHON_USEDEP}]")
48 + =sys-devel/clang-${PV%_*}*:${CLANG_SLOT}
49 + )
50 + !test? (
51 + ${PYTHON_DEPS}
52 + )
53 +"
54 +
55 +LLVM_COMPONENTS=( runtimes compiler-rt cmake llvm/cmake )
56 +LLVM_PATCHSET=9999-1
57 +llvm.org_set_globals
58 +
59 +python_check_deps() {
60 + use test || return 0
61 + has_version "dev-python/lit[${PYTHON_USEDEP}]"
62 +}
63 +
64 +pkg_pretend() {
65 + if ! use clang && ! tc-is-clang; then
66 + ewarn "Building using a compiler other than clang may result in broken atomics"
67 + ewarn "library. Enable USE=clang unless you have a very good reason not to."
68 + fi
69 +}
70 +
71 +pkg_setup() {
72 + # Darwin Prefix builds do not have llvm installed yet, so rely on
73 + # bootstrap-prefix to set the appropriate path vars to LLVM instead
74 + # of using llvm_pkg_setup.
75 + if [[ ${CHOST} != *-darwin* ]] || has_version dev-lang/llvm; then
76 + llvm_pkg_setup
77 + fi
78 + python-any-r1_pkg_setup
79 +}
80 +
81 +test_compiler() {
82 + $(tc-getCC) ${CFLAGS} ${LDFLAGS} "${@}" -o /dev/null -x c - \
83 + <<<'int main() { return 0; }' &>/dev/null
84 +}
85 +
86 +src_configure() {
87 + # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844
88 + use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG"
89 +
90 + # pre-set since we need to pass it to cmake
91 + BUILD_DIR=${WORKDIR}/${P}_build
92 +
93 + if use clang; then
94 + # Only do this conditionally to allow overriding with
95 + # e.g. CC=clang-13 in case of breakage
96 + if ! tc-is-clang ; then
97 + local -x CC=${CHOST}-clang
98 + local -x CXX=${CHOST}-clang++
99 + fi
100 + strip-unsupported-flags
101 + fi
102 +
103 + local mycmakeargs=(
104 + -DLLVM_ENABLE_RUNTIMES=compiler-rt
105 + # this only adds unnecessary req on llvm-lit directory
106 + -DLLVM_INCLUDE_TESTS=OFF
107 +
108 + -DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${SLOT}"
109 + -DCOMPILER_RT_INCLUDE_TESTS=$(usex test)
110 + -DCOMPILER_RT_BUILD_LIBFUZZER=OFF
111 + -DCOMPILER_RT_BUILD_MEMPROF=OFF
112 + -DCOMPILER_RT_BUILD_ORC=OFF
113 + -DCOMPILER_RT_BUILD_PROFILE=OFF
114 + -DCOMPILER_RT_BUILD_SANITIZERS=OFF
115 + -DCOMPILER_RT_BUILD_XRAY=OFF
116 +
117 + -DPython3_EXECUTABLE="${PYTHON}"
118 + )
119 +
120 + if use amd64; then
121 + mycmakeargs+=(
122 + -DCAN_TARGET_i386=$(usex abi_x86_32)
123 + -DCAN_TARGET_x86_64=$(usex abi_x86_64)
124 + )
125 + fi
126 +
127 + if use prefix && [[ "${CHOST}" == *-darwin* ]] ; then
128 + mycmakeargs+=(
129 + # setting -isysroot is disabled with compiler-rt-prefix-paths.patch
130 + # this allows adding arm64 support using SDK in EPREFIX
131 + -DDARWIN_macosx_CACHED_SYSROOT="${EPREFIX}/MacOSX.sdk"
132 + # Set version based on the SDK in EPREFIX.
133 + # This disables i386 for SDK >= 10.15
134 + -DDARWIN_macosx_OVERRIDE_SDK_VERSION="$(realpath ${EPREFIX}/MacOSX.sdk | sed -e 's/.*MacOSX\(.*\)\.sdk/\1/')"
135 + # Use our libtool instead of looking it up with xcrun
136 + -DCMAKE_LIBTOOL="${EPREFIX}/usr/bin/${CHOST}-libtool"
137 + )
138 + fi
139 +
140 + if use test; then
141 + mycmakeargs+=(
142 + -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
143 + -DLLVM_LIT_ARGS="$(get_lit_flags)"
144 +
145 + -DCOMPILER_RT_TEST_COMPILER="${EPREFIX}/usr/lib/llvm/${CLANG_SLOT}/bin/clang"
146 + -DCOMPILER_RT_TEST_CXX_COMPILER="${EPREFIX}/usr/lib/llvm/${CLANG_SLOT}/bin/clang++"
147 + )
148 + fi
149 +
150 + cmake_src_configure
151 +}
152 +
153 +src_test() {
154 + # respect TMPDIR!
155 + local -x LIT_PRESERVES_TMP=1
156 +
157 + cmake_build check-builtins
158 +}