aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-10-09 21:33:59 +0100
committerSam James <sam@gentoo.org>2022-10-09 21:55:26 +0100
commit3ba93fbb30984b59eb99883292f336e6a0b1ea8b (patch)
tree1a3da558498d47ee69e4f7458ebe475340e9ac73
parentMakefile: drop excessive EPREFIXing (diff)
downloadgcc-config-3ba93fbb30984b59eb99883292f336e6a0b1ea8b.tar.gz
gcc-config-3ba93fbb30984b59eb99883292f336e6a0b1ea8b.tar.bz2
gcc-config-3ba93fbb30984b59eb99883292f336e6a0b1ea8b.zip
gcc-config: update /etc/clang/gentoo-gcc-install.cfg if exists
* Set '--gcc-install-dir' for Clang to direct it to the currently active GCC installation. * Only write to /etc/clang/gentoo-gcc-install.cfg if it already exists to allow us to back out the change gracefully (by stopping installation in sys-devel/clang-common) as there's some concerns wrt sysroot compatibility. Bug: https://github.com/llvm/llvm-project/issues/57570 Bug: https://bugs.gentoo.org/868639 Signed-off-by: Sam James <sam@gentoo.org>
-rwxr-xr-xgcc-config15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc-config b/gcc-config
index dfc01d0..31a7f4a 100755
--- a/gcc-config
+++ b/gcc-config
@@ -783,6 +783,21 @@ switch_profile() {
find "${pkgconfdir}"/libgcj*.pc -xtype l -delete 2>/dev/null
done
+ # Only update the file if it already exists to allow us to
+ # walk it back if necessary by dropping it from clang-common.
+ # See bug #868639 for background.
+ if [[ -f "${EROOT}/etc/clang/gentoo-gcc-install.cfg" ]] ; then
+ local gcc_lib_path="$(get_lib_path)"
+ gcc_lib_path="${gcc_lib_path%%:*}"
+ cat > "${EROOT}/etc/clang/gentoo-gcc-install.cfg.tmp" <<-EOF
+ # This file is maintained by gcc-config.
+ # It is used to specify the selected GCC installation.
+ --gcc-install-dir="${gcc_lib_path}"
+ EOF
+
+ mv_if_diff "${EROOT}/etc/clang/gentoo-gcc-install.cfg.tmp" "${EROOT}/etc/clang/gentoo-gcc-install.cfg"
+ fi
+
prefix_copy_gcc_libs
handle_split_usr
: $(( envd_changed += $? ))