| 3 |
3 |
|
| 4 |
4 |
EAPI=8
|
| 5 |
5 |
|
| 6 |
|
PYTHON_COMPAT=( python3_{11..13} )
|
|
6 |
PYTHON_COMPAT=( python3_{11..14} )
|
| 7 |
7 |
inherit cmake-multilib crossdev flag-o-matic llvm.org llvm-utils
|
| 8 |
8 |
inherit python-any-r1 toolchain-funcs
|
| 9 |
9 |
|
| ... | ... | |
| 26 |
26 |
BDEPEND="
|
| 27 |
27 |
clang? (
|
| 28 |
28 |
llvm-core/clang:${LLVM_MAJOR}
|
|
29 |
llvm-core/clang-linker-config:${LLVM_MAJOR}
|
|
30 |
llvm-runtimes/clang-rtlib-config:${LLVM_MAJOR}
|
| 29 |
31 |
)
|
| 30 |
32 |
!test? (
|
| 31 |
33 |
${PYTHON_DEPS}
|
| ... | ... | |
| 36 |
38 |
"
|
| 37 |
39 |
|
| 38 |
40 |
LLVM_COMPONENTS=( runtimes libunwind libcxx llvm/cmake cmake )
|
| 39 |
|
LLVM_TEST_COMPONENTS=( libcxxabi llvm/utils/llvm-lit )
|
|
41 |
LLVM_TEST_COMPONENTS=( libc libcxxabi llvm/utils/llvm-lit )
|
| 40 |
42 |
llvm.org_set_globals
|
| 41 |
43 |
|
| 42 |
44 |
python_check_deps() {
|
| ... | ... | |
| 44 |
46 |
python_has_version "dev-python/lit[${PYTHON_USEDEP}]"
|
| 45 |
47 |
}
|
| 46 |
48 |
|
|
49 |
test_compiler() {
|
|
50 |
target_is_not_host && return
|
|
51 |
local compiler=${1}
|
|
52 |
shift
|
|
53 |
${compiler} ${CFLAGS} ${LDFLAGS} "${@}" -o /dev/null -x c - \
|
|
54 |
<<<'int main() { return 0; }' &>/dev/null
|
|
55 |
}
|
|
56 |
|
| 47 |
57 |
multilib_src_configure() {
|
| 48 |
58 |
if use clang; then
|
| 49 |
59 |
llvm_prepend_path -b "${LLVM_MAJOR}"
|
| ... | ... | |
| 62 |
72 |
fi
|
| 63 |
73 |
|
| 64 |
74 |
if use clang; then
|
| 65 |
|
local -x CC=${CTARGET}-clang
|
| 66 |
|
local -x CXX=${CTARGET}-clang++
|
|
75 |
local -x CC=${CTARGET}-clang-${LLVM_MAJOR}
|
|
76 |
local -x CXX=${CTARGET}-clang++-${LLVM_MAJOR}
|
| 67 |
77 |
strip-unsupported-flags
|
|
78 |
|
|
79 |
# The full clang configuration might not be ready yet. Use the partial
|
|
80 |
# configuration files that are guaranteed to exist even during initial
|
|
81 |
# installations and upgrades.
|
|
82 |
local flags=(
|
|
83 |
--config="${ESYSROOT}"/etc/clang/"${LLVM_MAJOR}"/gentoo-{rtlib,linker}.cfg
|
|
84 |
)
|
|
85 |
local -x CFLAGS="${CFLAGS} ${flags[@]}"
|
|
86 |
local -x CXXFLAGS="${CXXFLAGS} ${flags[@]}"
|
|
87 |
local -x LDFLAGS="${LDFLAGS} ${flags[@]}"
|
|
88 |
fi
|
|
89 |
|
|
90 |
# Check whether C compiler runtime is available.
|
|
91 |
if ! test_compiler "$(tc-getCC)"; then
|
|
92 |
local nolib_flags=( -nodefaultlibs -lc )
|
|
93 |
if test_compiler "$(tc-getCC)" "${nolib_flags[@]}"; then
|
|
94 |
local -x LDFLAGS="${LDFLAGS} ${nolib_flags[*]}"
|
|
95 |
ewarn "${CC} seems to lack runtime, trying with ${nolib_flags[*]}"
|
|
96 |
elif test_compiler "$(tc-getCC)" "${nolib_flags[@]}" -nostartfiles; then
|
|
97 |
# Avoiding -nostartfiles earlier on for bug #862540,
|
|
98 |
# and set available entry symbol for bug #862798.
|
|
99 |
nolib_flags+=( -nostartfiles -e main )
|
|
100 |
local -x LDFLAGS="${LDFLAGS} ${nolib_flags[*]}"
|
|
101 |
ewarn "${CC} seems to lack runtime, trying with ${nolib_flags[*]}"
|
|
102 |
fi
|
|
103 |
fi
|
|
104 |
# Check whether C++ standard library is available,
|
|
105 |
local nostdlib_flags=( -nostdlib++ )
|
|
106 |
if ! test_compiler "$(tc-getCXX)" &&
|
|
107 |
test_compiler "$(tc-getCXX)" "${nostdlib_flags[@]}"
|
|
108 |
then
|
|
109 |
local -x LDFLAGS="${LDFLAGS} ${nostdlib_flags[*]}"
|
|
110 |
ewarn "${CXX} seems to lack runtime, trying with ${nostdlib_flags[*]}"
|
| 68 |
111 |
fi
|
| 69 |
112 |
|
| 70 |
113 |
# link to compiler-rt
|