www-client/chromium: do a better job of forcing Clang

When enabling the Rust eclass, we started directly using
`llvm-r1_pkg_setup`, assuming that this combination would be
sufficicent, however due to forcing `CC` (etc) to variations
on `${CHOST}-clang" _before_ calling `llvm-r1_pkg_setup`,
these would always be forced to the newest version in
`PATH` instead of the one matching `LLVM_SLOT` due to
the eclass fixing the version before doing any `PATH`
manipulation.

To ensure a consistent build environment, we will:

1. Explicitly include `-${LLVM_SLOT}` in `CC`, `CPP`, `CXX`
2. Set these variables (and `AR` and `NM`) after `llvm-r1_pkg_setup`
   has done its PATH manipulation.

Bug: https://bugs.gentoo.org/935689
Signed-off-by: Matt Jolly <kangie@gentoo.org>
This commit is contained in:
Matt Jolly
2024-11-30 13:35:01 +10:00
parent d7a78f38ae
commit 4fa8d71be3
4 changed files with 35 additions and 39 deletions

View File

@@ -50,7 +50,6 @@ if [[ ${SLOT} != "0/dev" ]]; then
KEYWORDS="~amd64 ~arm64 ~ppc64"
fi
IUSE_SYSTEM_LIBS="+system-harfbuzz +system-icu +system-png +system-zstd"
IUSE="+X ${IUSE_SYSTEM_LIBS} bindist cups debug ffmpeg-chromium gtk4 +hangouts headless kerberos +official pax-kernel pgo +proprietary-codecs pulseaudio"
IUSE+=" qt5 qt6 +screencast selinux test +vaapi +wayland +widevine cpu_flags_ppc_vsx3"
@@ -309,23 +308,20 @@ pkg_setup() {
die "Please switch to a different linker."
fi
# We're forcing Clang here. User choice is respected via llvm_slot_# USE flags.
AR=llvm-ar
CPP="${CHOST}-clang++ -E"
NM=llvm-nm
CC=${CHOST}-clang
CXX=${CHOST}-clang++
if tc-is-cross-compiler; then
use pgo && die "The pgo USE flag cannot be used when cross-compiling"
CPP="${CBUILD}-clang++ -E"
fi
llvm-r1_pkg_setup
rust_pkg_setup
einfo "Using LLVM/Clang slot ${LLVM_SLOT} to build"
einfo "Using Rust slot ${RUST_SLOT}, ${RUST_TYPE} to build"
# Forcing clang; respect llvm_slot_x to enable selection of impl from LLVM_COMPAT
AR=llvm-ar
CPP="${CHOST}-clang++-${LLVM_SLOT} -E"
NM=llvm-nm
CC="${CHOST}-clang-${LLVM_SLOT}"
CXX="${CHOST}-clang++-${LLVM_SLOT}"
if tc-is-cross-compiler; then
use pgo && die "The pgo USE flag cannot be used when cross-compiling"
CPP="${CBUILD}-clang++-${LLVM_SLOT} -E"
fi
# I hate doing this but upstream Rust have yet to come up with a better solution for
# us poor packagers. Required for Split LTO units, which are required for CFI.

View File

@@ -311,21 +311,21 @@ pkg_setup() {
die "Please switch to a different linker."
fi
# Forcing clang; user choice respected by llvm_slot_x USE
llvm-r1_pkg_setup
rust_pkg_setup
# Forcing clang; respect llvm_slot_x to enable selection of impl from LLVM_COMPAT
AR=llvm-ar
CPP="${CHOST}-clang++ -E"
CPP="${CHOST}-clang++-${LLVM_SLOT} -E"
NM=llvm-nm
CC=${CHOST}-clang
CXX=${CHOST}-clang++
CC="${CHOST}-clang-${LLVM_SLOT}"
CXX="${CHOST}-clang++-${LLVM_SLOT}"
if tc-is-cross-compiler; then
use pgo && die "The pgo USE flag cannot be used when cross-compiling"
CPP="${CBUILD}-clang++ -E"
CPP="${CBUILD}-clang++-${LLVM_SLOT} -E"
fi
llvm-r1_pkg_setup
rust_pkg_setup
# I hate doing this but upstream Rust have yet to come up with a better solution for
# us poor packagers. Required for Split LTO units, which are required for CFI.
export RUSTC_BOOTSTRAP=1

View File

@@ -310,21 +310,21 @@ pkg_setup() {
die "Please switch to a different linker."
fi
# Forcing clang; user choice respected by llvm_slot_x USE
llvm-r1_pkg_setup
rust_pkg_setup
# Forcing clang; respect llvm_slot_x to enable selection of impl from LLVM_COMPAT
AR=llvm-ar
CPP="${CHOST}-clang++ -E"
CPP="${CHOST}-clang++-${LLVM_SLOT} -E"
NM=llvm-nm
CC=${CHOST}-clang
CXX=${CHOST}-clang++
CC="${CHOST}-clang-${LLVM_SLOT}"
CXX="${CHOST}-clang++-${LLVM_SLOT}"
if tc-is-cross-compiler; then
use pgo && die "The pgo USE flag cannot be used when cross-compiling"
CPP="${CBUILD}-clang++ -E"
CPP="${CBUILD}-clang++-${LLVM_SLOT} -E"
fi
llvm-r1_pkg_setup
rust_pkg_setup
# I hate doing this but upstream Rust have yet to come up with a better solution for
# us poor packagers. Required for Split LTO units, which are required for CFI.
export RUSTC_BOOTSTRAP=1

View File

@@ -319,21 +319,21 @@ pkg_setup() {
die "Please switch to a different linker."
fi
# Forcing clang; user choice respected by llvm_slot_x USE
llvm-r1_pkg_setup
rust_pkg_setup
# Forcing clang; respect llvm_slot_x to enable selection of impl from LLVM_COMPAT
AR=llvm-ar
CPP="${CHOST}-clang++ -E"
CPP="${CHOST}-clang++-${LLVM_SLOT} -E"
NM=llvm-nm
CC=${CHOST}-clang
CXX=${CHOST}-clang++
CC="${CHOST}-clang-${LLVM_SLOT}"
CXX="${CHOST}-clang++-${LLVM_SLOT}"
if tc-is-cross-compiler; then
use pgo && die "The pgo USE flag cannot be used when cross-compiling"
CPP="${CBUILD}-clang++ -E"
CPP="${CBUILD}-clang++-${LLVM_SLOT} -E"
fi
llvm-r1_pkg_setup
rust_pkg_setup
# I hate doing this but upstream Rust have yet to come up with a better solution for
# us poor packagers. Required for Split LTO units, which are required for CFI.
export RUSTC_BOOTSTRAP=1