aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2020-05-21 22:55:26 +0100
committerSergei Trofimovich <slyfox@gentoo.org>2020-05-21 22:55:26 +0100
commit36eba05752348258a79bbe6a9937e6e406c262e6 (patch)
treed2ebba58eadbd9b8ac9a05e9784006fe6d85d896 /src
parentREADME.md: rename to plaitext README (diff)
downloadbinutils-config-36eba05752348258a79bbe6a9937e6e406c262e6.tar.gz
binutils-config-36eba05752348258a79bbe6a9937e6e406c262e6.tar.bz2
binutils-config-36eba05752348258a79bbe6a9937e6e406c262e6.zip
binutils-config: add build-time and runtime switches to disable native symlinks
We have two knobs here: 1. Build-time knob USE_NATIVE_LINKS to set a default, defaults to 'yes' (existing behaviour) 2. Run-time --enable-native-links / --disable-native-links knobs. These are not persistent across binutils-config runs and are meant for manual testing. Undocumented for now. Reported-by: Kent Fredric Bug: https://bugs.gentoo.org/724454 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/binutils-config16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/binutils-config b/src/binutils-config
index 69ca530..e6819a8 100755
--- a/src/binutils-config
+++ b/src/binutils-config
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# Format of /etc/env.d/binutils/:
@@ -130,8 +130,17 @@ switch_profile() {
for x in * ; do
atomic_ln "${BINPATH}/${x}" "${ROOT}/${BINPATH_LINKS}" "${x}"
atomic_ln "${BINPATH_LINKS}/${x}" "${EROOT}/usr/bin" "${TARGET}-${x}"
- if [[ ${TARGET} == ${HOST} ]] ; then
+ if [[ ${TARGET} == ${HOST} -a ${USE_NATIVE_LINKS} == yes ]] ; then
atomic_ln "${TARGET}-${x}" "${EROOT}/usr/bin" "${x}"
+ else
+ # Remove native links if exist from previous
+ # installations or set by user manually. binutils-config
+ # owns these symlinks.
+ #
+ # TODO: cleanup symlinks not just known to this
+ # release/configuration of binutils, but also list
+ # all possible ones.
+ rm -f "${EROOT}/usr/bin/${x}"
fi
done
@@ -357,6 +366,7 @@ DOIT="switch_profile"
PROFILE="current"
HOST=""
TARGET=""
+USE_NATIVE_LINKS="@USE_NATIVE_LINKS@"
unset UARG
select_action() {
@@ -377,6 +387,8 @@ while [[ $# -gt 0 ]] ; do
-u|--uninstall) select_action uninstall_target ;;
-d|--debug) DEBUG="yes" ;;
-h|--help) usage 0 ;;
+ --enable-native-links) USE_NATIVE_LINKS="yes" ;;
+ --disable-native-links) USE_NATIVE_LINKS="no" ;;
-V|--version)
ver="@PV@"
echo "binutils-config-${ver/@'PV'@/git}"