Skip to content

Commit

Permalink
gcc-config: update /etc/clang/gentoo-gcc-install.cfg if exists
Browse files Browse the repository at this point in the history
* 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: llvm/llvm-project#57570
Bug: https://bugs.gentoo.org/868639
Signed-off-by: Sam James <sam@gentoo.org>
  • Loading branch information
thesamesam committed Oct 9, 2022
1 parent 11c3a59 commit 3ba93fb
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions gcc-config
Original file line number Diff line number Diff line change
Expand Up @@ -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 += $? ))
Expand Down

0 comments on commit 3ba93fb

Please sign in to comment.