mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-09-24 04:59:14 -07:00
dev-lang/rust: Require clang when building WASM sysroot
GCC does not support WASM. Require clang to build C code for WASM target and make sure it's actually used. [mgorny: added strip-unsupported-flags too] Bug: https://bugs.gentoo.org/965346 Signed-off-by: Michal Rostecki <vadorovsky@protonmail.com> Part-of: https://github.com/gentoo/gentoo/pull/44594 Closes: https://github.com/gentoo/gentoo/pull/44594 Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
committed by
Michał Górny
parent
668e8b50ef
commit
282749749d
@@ -125,6 +125,7 @@ BDEPEND="
|
||||
sys-devel/mold
|
||||
)
|
||||
) )
|
||||
rust_sysroots_wasm? ( llvm-core/clang )
|
||||
!system-llvm? (
|
||||
>=dev-build/cmake-3.13.4
|
||||
app-alternatives/ninja
|
||||
@@ -587,9 +588,23 @@ src_configure() {
|
||||
done
|
||||
if use rust_sysroots_wasm; then
|
||||
wasm_target="wasm32-unknown-unknown"
|
||||
export CFLAGS_${wasm_target//-/_}="$(filter-flags '-mcpu*' '-march*' '-mtune*'; echo "$CFLAGS")"
|
||||
if tc-is-clang; then
|
||||
local wasm_cc=$(tc-getCC)
|
||||
local wasm_cxx=$(tc-getCXX)
|
||||
else
|
||||
local wasm_cc=${CHOST}-clang
|
||||
local wasm_cxx=${CHOST}-clang++
|
||||
fi
|
||||
export CFLAGS_${wasm_target//-/_}="$(
|
||||
CC="${wasm_cc} --target=wasm32-unknown-unknown"
|
||||
filter-flags '-mcpu*' '-march*' '-mtune*'
|
||||
strip-unsupported-flags
|
||||
echo "${CFLAGS}"
|
||||
)"
|
||||
cat <<- _EOF_ >> "${S}"/bootstrap.toml
|
||||
[target.wasm32-unknown-unknown]
|
||||
cc = "${wasm_cc}"
|
||||
cxx = "${wasm_cxx}"
|
||||
linker = "$(usex system-llvm lld rust-lld)"
|
||||
# wasm target does not have profiler_builtins https://bugs.gentoo.org/848483
|
||||
profiler = false
|
||||
|
||||
@@ -125,6 +125,7 @@ BDEPEND="
|
||||
sys-devel/mold
|
||||
)
|
||||
) )
|
||||
rust_sysroots_wasm? ( llvm-core/clang )
|
||||
!system-llvm? (
|
||||
>=dev-build/cmake-3.13.4
|
||||
app-alternatives/ninja
|
||||
@@ -587,9 +588,23 @@ src_configure() {
|
||||
done
|
||||
if use rust_sysroots_wasm; then
|
||||
wasm_target="wasm32-unknown-unknown"
|
||||
export CFLAGS_${wasm_target//-/_}="$(filter-flags '-mcpu*' '-march*' '-mtune*'; echo "$CFLAGS")"
|
||||
if tc-is-clang; then
|
||||
local wasm_cc=$(tc-getCC)
|
||||
local wasm_cxx=$(tc-getCXX)
|
||||
else
|
||||
local wasm_cc=${CHOST}-clang
|
||||
local wasm_cxx=${CHOST}-clang++
|
||||
fi
|
||||
export CFLAGS_${wasm_target//-/_}="$(
|
||||
CC="${wasm_cc} --target=wasm32-unknown-unknown"
|
||||
filter-flags '-mcpu*' '-march*' '-mtune*'
|
||||
strip-unsupported-flags
|
||||
echo "${CFLAGS}"
|
||||
)"
|
||||
cat <<- _EOF_ >> "${S}"/bootstrap.toml
|
||||
[target.wasm32-unknown-unknown]
|
||||
cc = "${wasm_cc}"
|
||||
cxx = "${wasm_cxx}"
|
||||
linker = "$(usex system-llvm lld rust-lld)"
|
||||
# wasm target does not have profiler_builtins https://bugs.gentoo.org/848483
|
||||
profiler = false
|
||||
|
||||
Reference in New Issue
Block a user