3 |
3 |
|
4 |
4 |
EAPI=8
|
5 |
5 |
|
6 |
|
PYTHON_COMPAT=( python3_{9..11} )
|
|
6 |
PYTHON_COMPAT=( python3_{10..12} )
|
7 |
7 |
inherit check-reqs cmake flag-o-matic llvm llvm.org python-any-r1
|
8 |
8 |
|
9 |
9 |
DESCRIPTION="Compiler runtime libraries for clang (sanitizers & xray)"
|
10 |
10 |
HOMEPAGE="https://llvm.org/"
|
11 |
11 |
|
12 |
12 |
LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
|
13 |
|
SLOT="${LLVM_VERSION}"
|
14 |
|
KEYWORDS="amd64 arm arm64 ppc64 ~riscv x86 ~amd64-linux ~ppc-macos ~x64-macos"
|
|
13 |
SLOT="${LLVM_MAJOR}"
|
|
14 |
KEYWORDS="amd64 arm arm64 ~loong ppc64 ~riscv x86 ~amd64-linux ~ppc-macos ~x64-macos"
|
15 |
15 |
IUSE="+abi_x86_32 abi_x86_64 +clang debug test"
|
16 |
16 |
# base targets
|
17 |
17 |
IUSE+=" +libfuzzer +memprof +orc +profile +xray"
|
... | ... | |
43 |
43 |
clang? ( sys-devel/clang )
|
44 |
44 |
elibc_glibc? ( net-libs/libtirpc )
|
45 |
45 |
test? (
|
46 |
|
!!<sys-apps/sandbox-2.13
|
47 |
46 |
$(python_gen_any_dep ">=dev-python/lit-15[\${PYTHON_USEDEP}]")
|
48 |
47 |
=sys-devel/clang-${LLVM_VERSION}*:${LLVM_MAJOR}
|
49 |
|
sys-libs/compiler-rt:${LLVM_VERSION}
|
|
48 |
sys-libs/compiler-rt:${LLVM_MAJOR}
|
50 |
49 |
)
|
51 |
50 |
!test? (
|
52 |
51 |
${PYTHON_DEPS}
|
... | ... | |
54 |
53 |
"
|
55 |
54 |
|
56 |
55 |
LLVM_COMPONENTS=( compiler-rt cmake llvm/cmake )
|
57 |
|
LLVM_TEST_COMPONENTS=( llvm/lib/Testing/Support llvm/utils/unittest )
|
58 |
|
LLVM_PATCHSET=${PV/_/-}
|
|
56 |
LLVM_TEST_COMPONENTS=( llvm/lib/Testing/Support third-party )
|
59 |
57 |
llvm.org_set_globals
|
60 |
58 |
|
61 |
59 |
python_check_deps() {
|
... | ... | |
100 |
98 |
> test/cfi/CMakeLists.txt || die
|
101 |
99 |
fi
|
102 |
100 |
|
|
101 |
if has_version -b ">=sys-libs/glibc-2.37"; then
|
|
102 |
# known failures with glibc-2.37
|
|
103 |
# https://github.com/llvm/llvm-project/issues/60678
|
|
104 |
rm test/dfsan/custom.cpp || die
|
|
105 |
rm test/dfsan/release_shadow_space.c || die
|
|
106 |
fi
|
|
107 |
|
103 |
108 |
llvm.org_src_prepare
|
104 |
109 |
}
|
105 |
110 |
|
... | ... | |
125 |
130 |
done
|
126 |
131 |
|
127 |
132 |
local mycmakeargs=(
|
128 |
|
-DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${LLVM_VERSION}"
|
|
133 |
-DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${LLVM_MAJOR}"
|
129 |
134 |
# use a build dir structure consistent with install
|
130 |
135 |
# this makes it possible to easily deploy test-friendly clang
|
131 |
|
-DCOMPILER_RT_OUTPUT_DIR="${BUILD_DIR}/lib/clang/${LLVM_VERSION}"
|
|
136 |
-DCOMPILER_RT_OUTPUT_DIR="${BUILD_DIR}/lib/clang/${LLVM_MAJOR}"
|
132 |
137 |
|
133 |
138 |
-DCOMPILER_RT_INCLUDE_TESTS=$(usex test)
|
134 |
139 |
# builtins & crt installed by sys-libs/compiler-rt
|
... | ... | |
153 |
158 |
|
154 |
159 |
if use test; then
|
155 |
160 |
mycmakeargs+=(
|
156 |
|
-DLLVM_MAIN_SRC_DIR="${WORKDIR}/llvm"
|
157 |
161 |
-DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
|
158 |
162 |
-DLLVM_LIT_ARGS="$(get_lit_flags)"
|
159 |
163 |
|
... | ... | |
186 |
190 |
cmake_src_configure
|
187 |
191 |
|
188 |
192 |
if use test; then
|
189 |
|
local sys_dir=( "${EPREFIX}"/usr/lib/clang/${LLVM_VERSION}/lib/* )
|
|
193 |
local sys_dir=( "${EPREFIX}"/usr/lib/clang/${LLVM_MAJOR}/lib/* )
|
190 |
194 |
[[ -e ${sys_dir} ]] || die "Unable to find ${sys_dir}"
|
191 |
195 |
[[ ${#sys_dir[@]} -eq 1 ]] || die "Non-deterministic compiler-rt install: ${sys_dir[*]}"
|
192 |
196 |
|
193 |
197 |
# copy clang over since resource_dir is located relatively to binary
|
194 |
198 |
# therefore, we can put our new libraries in it
|
195 |
|
mkdir -p "${BUILD_DIR}"/lib/{llvm/${LLVM_MAJOR}/{bin,$(get_libdir)},clang/${LLVM_VERSION}/include} || die
|
|
199 |
mkdir -p "${BUILD_DIR}"/lib/{llvm/${LLVM_MAJOR}/{bin,$(get_libdir)},clang/${LLVM_MAJOR}/include} || die
|
196 |
200 |
cp "${EPREFIX}"/usr/lib/llvm/${LLVM_MAJOR}/bin/clang{,++} \
|
197 |
201 |
"${BUILD_DIR}"/lib/llvm/${LLVM_MAJOR}/bin/ || die
|
198 |
|
cp "${EPREFIX}"/usr/lib/clang/${LLVM_VERSION}/include/*.h \
|
199 |
|
"${BUILD_DIR}"/lib/clang/${LLVM_VERSION}/include/ || die
|
|
202 |
cp "${EPREFIX}"/usr/lib/clang/${LLVM_MAJOR}/include/*.h \
|
|
203 |
"${BUILD_DIR}"/lib/clang/${LLVM_MAJOR}/include/ || die
|
200 |
204 |
cp "${sys_dir}"/*builtins*.a \
|
201 |
|
"${BUILD_DIR}/lib/clang/${LLVM_VERSION}/lib/${sys_dir##*/}/" || die
|
|
205 |
"${BUILD_DIR}/lib/clang/${LLVM_MAJOR}/lib/${sys_dir##*/}/" || die
|
202 |
206 |
# we also need LLVMgold.so for gold-based tests
|
203 |
207 |
if [[ -f ${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}/$(get_libdir)/LLVMgold.so ]]; then
|
204 |
208 |
ln -s "${EPREFIX}"/usr/lib/llvm/${LLVM_MAJOR}/$(get_libdir)/LLVMgold.so \
|
... | ... | |
214 |
218 |
local -x SANDBOX_ON=0
|
215 |
219 |
# wipe LD_PRELOAD to make ASAN happy
|
216 |
220 |
local -x LD_PRELOAD=
|
217 |
|
# avoid confusing with hardening, upstreamed for >= 16
|
218 |
|
# https://github.com/llvm/llvm-project/issues/60394
|
219 |
|
local -x CLANG_NO_DEFAULT_CONFIG=1
|
220 |
221 |
|
221 |
222 |
cmake_build check-all
|
222 |
223 |
}
|