dev-dotnet/dotnet-sdk: fix setting clang version from SLOT

Signed-off-by: Maciej Barć <xgqt@gentoo.org>
This commit is contained in:
Maciej Barć
2024-12-31 02:17:09 +01:00
parent fa1e14f109
commit 0df037f7d5

View File

@@ -85,6 +85,7 @@ BDEPEND="
dev-vcs/git
$(llvm_gen_dep '
llvm-core/clang:${LLVM_SLOT}
llvm-core/lld:${LLVM_SLOT}
llvm-core/llvm:${LLVM_SLOT}
')
"
@@ -177,9 +178,13 @@ src_prepare() {
filter-flags -Wlto-type-mismatch
filter-lto
local llvm_prefix="$(get_llvm_prefix -b)"
export CC="${llvm_prefix}/bin/clang-${LLVM_SLOT}"
export CXX="${llvm_prefix}/bin/clang++-${LLVM_SLOT}"
export LD="${llvm_prefix}/bin/lld"
unset DOTNET_ROOT
unset NUGET_PACKAGES
unset CLR_ICU_VERSION_OVERRIDE
unset USER_CLR_ICU_VERSION_OVERRIDE
@@ -209,6 +214,20 @@ src_prepare() {
echo "$(makeopts_jobs)"
EOF
chmod +x "${fake_bin}/nproc" || die
# Overwrite "init-compiler" scripts.
# TODO: Consider - this probably overshadows CCache.
cat <<EOF > ./init-compiler.sh || die
export CC="${CC}"
export CXX="${CXX}"
export LDFLAGS="${LDFLAGS} -fuse-ld=lld"
export SCAN_BUILD_COMMAND="scan-build"
EOF
local init_compiler=""
for init_compiler in diagnostics runtime ; do
mv "./src/${init_compiler}/eng/common/native/init-compiler.sh"{,.orig} || die
cp ./init-compiler.sh "./src/${init_compiler}/eng/common/native/" || die
done
}
src_compile() {
@@ -220,6 +239,10 @@ src_compile() {
ewarn "Failed to remove ${package_versions_path}, build may fail!"
fi
local -x EXTRA_CFLAGS="${CFLAGS}"
local -x EXTRA_CXXFLAGS="${CXXFLAGS}"
local -x EXTRA_LDFLAGS="${LDFLAGS}"
# The "source_repository" should always be the same.
local source_repository="https://github.com/dotnet/dotnet"
local verbosity="${GENTOO_DOTNET_BUILD_VERBOSITY:-minimal}"