summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schlemmer <azarah@gentoo.org>2004-06-19 17:53:18 +0000
committerMartin Schlemmer <azarah@gentoo.org>2004-06-19 17:53:18 +0000
commit1b1146f6c02228547c892c94fa54b66e4e427b5d (patch)
treee05a18e85de8ffc5bbabec9f4250e097449b7960
parentfix #29950 #48492 and more ! (diff)
downloadgcc-config-1b1146f6c02228547c892c94fa54b66e4e427b5d.tar.gz
gcc-config-1b1146f6c02228547c892c94fa54b66e4e427b5d.tar.bz2
gcc-config-1b1146f6c02228547c892c94fa54b66e4e427b5d.zip
Make sure we cleanup stale wrappers, bug #36388.
-rwxr-xr-xgcc-config40
1 files changed, 27 insertions, 13 deletions
diff --git a/gcc-config b/gcc-config
index ac7b8b1..4c6241c 100755
--- a/gcc-config
+++ b/gcc-config
@@ -1,7 +1,7 @@
#!/bin/bash
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: gentoo-x86/sys-devel/gcc-config/files/gcc-config-1.3.5,v 1.4 2004/05/07 00:45:06 vapier Exp $
+# $Header: gentoo-x86/sys-devel/gcc-config/files/gcc-config-1.3.6,v 1.1 2004/06/19 17:53:18 azarah Exp $
# Author: Martin Schlemmer <azarah@gentoo.org>
source /etc/init.d/functions.sh || {
@@ -99,7 +99,7 @@ cmd_setup() {
ENV_UPDATE="$(find_path env-update)"
}
-CC_COMP=""
+CC_COMP=
get_real_chost() {
[ -n "${REAL_CHOST}" ] && return 0
@@ -115,9 +115,10 @@ get_real_chost() {
}
switch_profile() {
- local MY_LDPATH=""
- local GCC_PROFILES=""
- local OLD_CC_COMP=""
+ local MY_LDPATH=
+ local GCC_PROFILES=
+ local OLD_CC_COMP=
+ local GCC_BIN_PATH=
if [ -r /etc/env.d/gcc/config ]
then
@@ -161,7 +162,7 @@ switch_profile() {
# Handle LDPATH's that have multiple directories
local old_IFS="${IFS}"
export IFS=":"
- local sub_ldpath
+ local sub_ldpath=
for sub_ldpath in ${LDPATH}
do
if [ -z "${MY_LDPATH}" ]
@@ -196,20 +197,33 @@ switch_profile() {
echo "CURRENT=${CC_COMP}" > /etc/env.d/gcc/config
+ # Save PATH
+ GCC_BIN_PATH="${PATH}"
+ # Fix environment
source /etc/profile
# These might not be installed, and we want to update the mtime
# for ccache and distcc anyhow ...
${RM} -f /lib/cpp
${CP} -f /usr/lib/gcc-config/wrapper /lib/cpp
- for x in gcc cpp cc c++ g++ "${REAL_CHOST}-gcc" "${REAL_CHOST}-c++" "${REAL_CHOST}-g++"
+ for x in gcc cpp cc c++ g++ f77 gcj \
+ ${REAL_CHOST}-gcc ${REAL_CHOST}-c++ ${REAL_CHOST}-g++ \
+ ${REAL_CHOST}-f77 ${REAL_CHOST}-gcj
do
+ # Make sure we have no stale wrappers
${RM} -f "/usr/bin/${x}"
- ${CP} -f /usr/lib/gcc-config/wrapper "/usr/bin/${x}"
- if [ "${OLD_CC_COMP}" != "${CC_COMP}" ]
+ if [ -x "${GCC_BIN_PATH}/${x}" -o \
+ "${x}" = "c++" -o "${x}" = "${REAL_CHOST}-c++" -o \
+ "${x}" = "cpp" -o "${x}" = "cc" ]
then
- ${TOUCH} -m "/usr/bin/${x}"
+ # Only install a wrapper if the binary exists ...
+ ${CP} -f /usr/lib/gcc-config/wrapper "/usr/bin/${x}"
+
+ if [ "${OLD_CC_COMP}" != "${CC_COMP}" ]
+ then
+ ${TOUCH} -m "/usr/bin/${x}"
+ fi
fi
done
@@ -252,7 +266,7 @@ get_current_profile() {
}
list_profiles() {
- i=1
+ local i=1
if [ ! -f /etc/env.d/gcc/config ]
then
@@ -272,8 +286,8 @@ list_profiles() {
print_environ() {
local OLDPATH="${PATH}"
- local ENV_CMD=""
- local SET_ELEMENT=""
+ local ENV_CMD=
+ local SET_ELEMENT=
source "/etc/env.d/gcc/${CC_COMP}"