3 |
3 |
|
4 |
4 |
EAPI=8
|
5 |
5 |
|
6 |
|
PYTHON_COMPAT=( python3_{9..11} )
|
7 |
|
inherit cmake llvm llvm.org multilib multilib-minimal \
|
8 |
|
prefix python-single-r1 toolchain-funcs
|
|
6 |
PYTHON_COMPAT=( python3_{10..12} )
|
|
7 |
|
|
8 |
inherit cmake flag-o-matic llvm llvm.org multilib multilib-minimal
|
|
9 |
inherit prefix python-single-r1 toolchain-funcs
|
9 |
10 |
|
10 |
11 |
DESCRIPTION="C language family frontend for LLVM"
|
11 |
12 |
HOMEPAGE="https://llvm.org/"
|
... | ... | |
14 |
15 |
# sorttable.js: MIT
|
15 |
16 |
|
16 |
17 |
LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA MIT"
|
17 |
|
SLOT="${LLVM_MAJOR}/${LLVM_SOABI}g1"
|
18 |
|
KEYWORDS="amd64 ~arm arm64 ~ppc ppc64 ~riscv sparc ~x86 ~amd64-linux ~x64-macos"
|
|
18 |
SLOT="${LLVM_MAJOR}/${LLVM_SOABI}"
|
|
19 |
KEYWORDS="amd64 arm arm64 ~loong ppc ppc64 ~riscv sparc x86 ~amd64-linux ~x64-macos"
|
19 |
20 |
IUSE="debug doc +extra ieee-long-double +pie +static-analyzer test xml"
|
20 |
21 |
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
|
21 |
22 |
RESTRICT="!test? ( test )"
|
... | ... | |
41 |
42 |
xml? ( virtual/pkgconfig )
|
42 |
43 |
"
|
43 |
44 |
PDEPEND="
|
44 |
|
sys-devel/clang-toolchain-symlinks:${LLVM_MAJOR}
|
45 |
45 |
~sys-devel/clang-runtime-${PV}
|
|
46 |
sys-devel/clang-toolchain-symlinks:${LLVM_MAJOR}
|
46 |
47 |
"
|
47 |
48 |
|
48 |
49 |
LLVM_COMPONENTS=(
|
... | ... | |
51 |
52 |
)
|
52 |
53 |
LLVM_MANPAGES=1
|
53 |
54 |
LLVM_TEST_COMPONENTS=(
|
54 |
|
llvm/lib/Testing/Support
|
55 |
|
llvm/utils/{lit,llvm-lit,unittest}
|
56 |
|
llvm/utils/{UpdateTestChecks,update_cc_test_checks.py}
|
|
55 |
llvm/lib/Testing
|
|
56 |
llvm/utils
|
|
57 |
third-party
|
57 |
58 |
)
|
58 |
|
LLVM_PATCHSET=${PV/_/-}-r3
|
|
59 |
LLVM_PATCHSET=${PV}
|
59 |
60 |
LLVM_USE_TARGETS=llvm
|
60 |
61 |
llvm.org_set_globals
|
61 |
62 |
|
... | ... | |
192 |
193 |
libclang-python-bindings
|
193 |
194 |
|
194 |
195 |
# tools
|
|
196 |
amdgpu-arch
|
195 |
197 |
c-index-test
|
196 |
198 |
clang
|
197 |
199 |
clang-format
|
|
200 |
clang-linker-wrapper
|
198 |
201 |
clang-offload-bundler
|
199 |
202 |
clang-offload-packager
|
200 |
|
clang-offload-wrapper
|
201 |
203 |
clang-refactor
|
202 |
204 |
clang-repl
|
203 |
205 |
clang-rename
|
204 |
206 |
clang-scan-deps
|
205 |
207 |
diagtool
|
206 |
208 |
hmaptool
|
|
209 |
nvptx-arch
|
207 |
210 |
|
208 |
211 |
# needed for cross-compiling Clang
|
209 |
212 |
clang-tblgen
|
... | ... | |
215 |
218 |
clang-apply-replacements
|
216 |
219 |
clang-change-namespace
|
217 |
220 |
clang-doc
|
|
221 |
clang-include-cleaner
|
218 |
222 |
clang-include-fixer
|
219 |
223 |
clang-move
|
220 |
224 |
clang-pseudo
|
... | ... | |
252 |
256 |
}
|
253 |
257 |
|
254 |
258 |
multilib_src_configure() {
|
|
259 |
tc-is-gcc && filter-lto # GCC miscompiles LLVM, bug #873670
|
|
260 |
|
255 |
261 |
local mycmakeargs=(
|
256 |
262 |
-DDEFAULT_SYSROOT=$(usex prefix-guest "" "${EPREFIX}")
|
257 |
263 |
-DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}"
|
258 |
264 |
-DCMAKE_INSTALL_MANDIR="${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}/share/man"
|
259 |
265 |
-DCLANG_CONFIG_FILE_SYSTEM_DIR="${EPREFIX}/etc/clang"
|
260 |
266 |
# relative to bindir
|
261 |
|
-DCLANG_RESOURCE_DIR="../../../../lib/clang/${LLVM_VERSION}"
|
|
267 |
-DCLANG_RESOURCE_DIR="../../../../lib/clang/${LLVM_MAJOR}"
|
262 |
268 |
|
263 |
269 |
-DBUILD_SHARED_LIBS=OFF
|
264 |
270 |
-DCLANG_LINK_CLANG_DYLIB=ON
|
265 |
271 |
-DLLVM_DISTRIBUTION_COMPONENTS=$(get_distribution_components)
|
|
272 |
-DCLANG_INCLUDE_TESTS=$(usex test)
|
266 |
273 |
|
267 |
274 |
-DLLVM_TARGETS_TO_BUILD="${LLVM_TARGETS// /;}"
|
268 |
|
-DLLVM_BUILD_TESTS=$(usex test)
|
269 |
275 |
|
270 |
276 |
# these are not propagated reliably, so redefine them
|
271 |
277 |
-DLLVM_ENABLE_EH=ON
|
... | ... | |
278 |
284 |
|
279 |
285 |
# disable using CUDA to autodetect GPU, just build for all
|
280 |
286 |
-DCMAKE_DISABLE_FIND_PACKAGE_CUDA=ON
|
|
287 |
# disable linking to HSA to avoid automagic dep,
|
|
288 |
# load it dynamically instead
|
|
289 |
-DCMAKE_DISABLE_FIND_PACKAGE_hsa-runtime64=ON
|
281 |
290 |
|
282 |
291 |
-DCLANG_DEFAULT_PIE_ON_LINUX=$(usex pie)
|
283 |
292 |
|
... | ... | |
294 |
303 |
fi
|
295 |
304 |
|
296 |
305 |
use test && mycmakeargs+=(
|
297 |
|
-DLLVM_MAIN_SRC_DIR="${WORKDIR}/llvm"
|
298 |
|
-DLLVM_EXTERNAL_LIT="${BUILD_DIR}/bin/llvm-lit"
|
|
306 |
-DLLVM_BUILD_TESTS=ON
|
299 |
307 |
-DLLVM_LIT_ARGS="$(get_lit_flags)"
|
300 |
308 |
)
|
301 |
309 |
|
... | ... | |
429 |
437 |
multilib_src_install() {
|
430 |
438 |
DESTDIR=${D} cmake_build install-distribution
|
431 |
439 |
|
432 |
|
if multilib_is_native_abi; then
|
433 |
|
# install clang-*-wrapper tools
|
434 |
|
# https://bugs.gentoo.org/904143
|
435 |
|
exeinto "/usr/lib/llvm/${LLVM_MAJOR}/bin"
|
436 |
|
doexe "${BUILD_DIR}"/bin/clang-{linker,nvlink}-wrapper
|
437 |
|
fi
|
438 |
|
|
439 |
440 |
# move headers to /usr/include for wrapping & ABI mismatch checks
|
440 |
441 |
# (also drop the version suffix from runtime headers)
|
441 |
442 |
rm -rf "${ED}"/usr/include || die
|