aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2020-05-22 14:18:58 +0100
committerSergei Trofimovich <slyfox@gentoo.org>2020-05-22 14:18:58 +0100
commit8a4854aec042fc347066a8e73053490c403d7649 (patch)
tree8d20eb495262a4864dd0b3b616400960e6f589af
parentgcc-config: clarify comments on how aliases are expanded (diff)
downloadgcc-config-8a4854aec042fc347066a8e73053490c403d7649.tar.gz
gcc-config-8a4854aec042fc347066a8e73053490c403d7649.tar.bz2
gcc-config-8a4854aec042fc347066a8e73053490c403d7649.zip
gcc-config: make USE_NATIVE_LINKS=no to clean stale symlinks
Before the change symlinks like /usr/bin/cc were untouched. After the change they are explicitly removed. Bug: https://bugs.gentoo.org/724454 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-rwxr-xr-xgcc-config13
1 files changed, 6 insertions, 7 deletions
diff --git a/gcc-config b/gcc-config
index 847cde2..8f9d64c 100755
--- a/gcc-config
+++ b/gcc-config
@@ -287,7 +287,7 @@ update_wrappers() {
# `tuple-foo`. Only native ones do we want the simple `foo`
# and only for USE_NATIVE_LINKS=yes mode.
local all_wrappers=( ${new_wrappers[@]/#/${CTARGET}-} )
- if ! is_cross_compiler && [[ ${USE_NATIVE_LINKS} == yes ]] ; then
+ if ! is_cross_compiler ; then
all_wrappers+=( "${new_wrappers[@]}" )
# There are a few fun extra progs which we have to handle #412319
all_wrappers+=( cc:gcc f77:g77 )
@@ -303,12 +303,9 @@ update_wrappers() {
#
# x=cc:gcc -> ref=/path/to/gcc
ref="${ROOT}${GCC_PATH}/${x#*:}"
- if [[ ${x} == *:* ]] ; then
- # Only install a wrapper if the reference binary exists ...
- [[ -x ${ref} ]] || continue
- fi
# x=cc:gcc -> x=cc
x=${x%:*}
+
if [[ ! -x ${ref} ]] ; then
if is_cross_compiler ; then
ewarn "insanity with ${x} and ${ref}"
@@ -320,10 +317,12 @@ update_wrappers() {
fi
# Now do the actual linking to the target binary
- if [[ -x ${ref} ]] ; then
+ if [[ ${x#${CTARGET}-} == ${x} && ${USE_NATIVE_LINKS} != yes ]]; then
+ # Delete stale native symlink.
+ rm -f "${EROOT}usr/bin/${x}"
+ elif [[ -x ${ref} ]] ; then
atomic_ln "${ref#${ROOT}}" "${EROOT}usr/bin" "${x}"
else
- ewarn "double insanity with ${x} and ${ref}"
# Make sure we have no stale wrappers
rm -f "${EROOT}usr/bin/${x}"
fi