| 1 |
|
# Copyright 1999-2025 Gentoo Authors
|
|
1 |
# Copyright 1999-2026 Gentoo Authors
|
| 2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
3 |
|
| 4 |
4 |
EAPI=8
|
| ... | ... | |
| 11 |
11 |
|
| 12 |
12 |
LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
|
| 13 |
13 |
SLOT="${LLVM_MAJOR}"
|
| 14 |
|
KEYWORDS="amd64 arm arm64 ~loong ~mips ppc64 ~riscv x86 ~x64-macos"
|
|
14 |
KEYWORDS="~amd64 ~arm ~arm64 ~loong ~mips ~ppc64 ~riscv ~x86 ~x64-macos"
|
| 15 |
15 |
IUSE="+abi_x86_32 abi_x86_64 +clang debug test"
|
| 16 |
16 |
# base targets
|
| 17 |
17 |
IUSE+=" +ctx-profile +libfuzzer +memprof +orc +profile +xray"
|
| ... | ... | |
| 19 |
19 |
# NB: ubsan, scudo deliberately match two entries
|
| 20 |
20 |
SANITIZER_FLAGS=(
|
| 21 |
21 |
asan dfsan lsan msan hwasan tsan ubsan safestack cfi scudo
|
| 22 |
|
shadowcallstack gwp-asan
|
|
22 |
shadowcallstack gwp-asan nsan rtsan
|
| 23 |
23 |
)
|
| 24 |
24 |
IUSE+=" ${SANITIZER_FLAGS[@]/#/+}"
|
| 25 |
25 |
REQUIRED_USE="
|
| ... | ... | |
| 41 |
41 |
BDEPEND="
|
| 42 |
42 |
clang? (
|
| 43 |
43 |
llvm-core/clang:${LLVM_MAJOR}
|
|
44 |
llvm-core/clang-linker-config:${LLVM_MAJOR}
|
|
45 |
llvm-runtimes/clang-rtlib-config:${LLVM_MAJOR}
|
|
46 |
llvm-runtimes/clang-stdlib-config:${LLVM_MAJOR}
|
| 44 |
47 |
llvm-runtimes/compiler-rt:${LLVM_MAJOR}
|
| 45 |
48 |
)
|
| 46 |
49 |
elibc_glibc? ( net-libs/libtirpc )
|
| ... | ... | |
| 57 |
60 |
LLVM_TEST_COMPONENTS=(
|
| 58 |
61 |
llvm/include/llvm/ProfileData llvm/lib/Testing/Support third-party
|
| 59 |
62 |
)
|
| 60 |
|
LLVM_PATCHSET=${PV}-r1
|
| 61 |
63 |
llvm.org_set_globals
|
| 62 |
64 |
|
| 63 |
65 |
python_check_deps() {
|
| ... | ... | |
| 117 |
119 |
BUILD_DIR=${WORKDIR}/compiler-rt_build
|
| 118 |
120 |
|
| 119 |
121 |
if use clang; then
|
| 120 |
|
local -x CC=${CHOST}-clang
|
| 121 |
|
local -x CXX=${CHOST}-clang++
|
|
122 |
local -x CC=${CHOST}-clang-${LLVM_MAJOR}
|
|
123 |
local -x CXX=${CHOST}-clang++-${LLVM_MAJOR}
|
| 122 |
124 |
strip-unsupported-flags
|
|
125 |
|
|
126 |
# The full clang configuration might not be ready yet. Use the partial
|
|
127 |
# configuration files that are guaranteed to exist even during initial
|
|
128 |
# installations and upgrades.
|
|
129 |
local flags=(
|
|
130 |
--config="${ESYSROOT}"/etc/clang/"${LLVM_MAJOR}"/gentoo-{rtlib,stdlib,linker}.cfg
|
|
131 |
)
|
|
132 |
local -x CFLAGS="${CFLAGS} ${flags[@]}"
|
|
133 |
local -x CXXFLAGS="${CXXFLAGS} ${flags[@]}"
|
|
134 |
local -x LDFLAGS="${LDFLAGS} ${flags[@]}"
|
| 123 |
135 |
fi
|
| 124 |
136 |
|
| 125 |
137 |
local flag want_sanitizer=OFF
|
| ... | ... | |
| 192 |
204 |
cmake_src_configure
|
| 193 |
205 |
|
| 194 |
206 |
if use test; then
|
| 195 |
|
local sys_dir=( "${EPREFIX}"/usr/lib/clang/${LLVM_MAJOR}/lib/* )
|
| 196 |
|
[[ -e ${sys_dir} ]] || die "Unable to find ${sys_dir}"
|
| 197 |
|
[[ ${#sys_dir[@]} -eq 1 ]] || die "Non-deterministic compiler-rt install: ${sys_dir[*]}"
|
|
207 |
local sys_dest=( "${BUILD_DIR}"/lib/clang/${LLVM_MAJOR}/lib/* )
|
|
208 |
[[ ! -e ${sys_dest} ]] && die "Unable to find ${sys_dest}"
|
|
209 |
[[ ${#sys_dest[@]} -ne 1 ]] && die "Non-deterministic compiler-rt install: ${sys_dest[*]}"
|
|
210 |
local sys_dir=( "${EPREFIX}/usr/lib/clang/${LLVM_MAJOR}/lib/${sys_dest##*/}" )
|
|
211 |
[[ ! -e ${sys_dir} ]] && die "${sys_dir} is missing"
|
| 198 |
212 |
|
| 199 |
213 |
# copy clang over since resource_dir is located relatively to binary
|
| 200 |
214 |
# therefore, we can put our new libraries in it
|
| ... | ... | |
| 203 |
217 |
"${BUILD_DIR}"/lib/llvm/${LLVM_MAJOR}/bin/ || die
|
| 204 |
218 |
cp "${EPREFIX}"/usr/lib/clang/${LLVM_MAJOR}/include/*.h \
|
| 205 |
219 |
"${BUILD_DIR}"/lib/clang/${LLVM_MAJOR}/include/ || die
|
| 206 |
|
cp "${sys_dir}"/*builtins*.a \
|
| 207 |
|
"${BUILD_DIR}/lib/clang/${LLVM_MAJOR}/lib/${sys_dir##*/}/" || die
|
|
220 |
cp "${sys_dir}"/*builtins*.a "${sys_dest}/" || die
|
| 208 |
221 |
# we also need LLVMgold.so for gold-based tests
|
| 209 |
222 |
if [[ -f ${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}/$(get_libdir)/LLVMgold.so ]]; then
|
| 210 |
223 |
ln -s "${EPREFIX}"/usr/lib/llvm/${LLVM_MAJOR}/$(get_libdir)/LLVMgold.so \
|