diff options
author | Mike Frysinger <vapier@gentoo.org> | 2007-07-25 14:33:01 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2007-07-25 14:33:01 +0000 |
commit | 76b413b18d028685262cf1848357a1b36ff5a412 (patch) | |
tree | b926f6155c9d4eaed42b564ea9cd1aa3dd32314b /sys-devel | |
parent | Oops, fix regression I caused wrt bug 153084. (diff) | |
download | gentoo-2-76b413b18d028685262cf1848357a1b36ff5a412.tar.gz gentoo-2-76b413b18d028685262cf1848357a1b36ff5a412.tar.bz2 gentoo-2-76b413b18d028685262cf1848357a1b36ff5a412.zip |
fix a few more places that need a -${CTARGET} postfix, add a --debug option, and make list_profiles nicer
(Portage version: 2.1.3_rc9)
Diffstat (limited to 'sys-devel')
-rwxr-xr-x | sys-devel/gcc-config/files/gcc-config-1.4.0 | 48 |
1 files changed, 35 insertions, 13 deletions
diff --git a/sys-devel/gcc-config/files/gcc-config-1.4.0 b/sys-devel/gcc-config/files/gcc-config-1.4.0 index 73bd4bc62e43..d9bec1662fa2 100755 --- a/sys-devel/gcc-config/files/gcc-config-1.4.0 +++ b/sys-devel/gcc-config/files/gcc-config-1.4.0 @@ -1,7 +1,7 @@ #!/bin/bash # Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/files/gcc-config-1.4.0,v 1.17 2007/07/25 14:03:56 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/files/gcc-config-1.4.0,v 1.18 2007/07/25 14:33:01 vapier Exp $ trap ":" INT QUIT TSTP @@ -10,6 +10,7 @@ source /etc/init.d/functions.sh || { echo "${argv0}: Could not source /etc/init.d/functions.sh!" exit 1 } +esyslog() { :; } umask 022 usage() { @@ -68,10 +69,10 @@ try_real_hard_to_find_CHOST() { fi # - # Then we try /etc/env.d/gcc/config + # Then we try /etc/env.d/gcc/config-${CTARGET} # - if [[ -s ${ROOT}/etc/env.d/gcc/config ]] ; then - ret=$(split_gcc_ver $(eval $(<"${ROOT}"/etc/env.d/gcc/config) ; echo ${CURRENT})) + if [[ -s ${ROOT}/etc/env.d/gcc/config-${CTARGET} ]] ; then + ret=$(split_gcc_ver $(eval $(<"${ROOT}"/etc/env.d/gcc/config-${CTARGET}) ; echo ${CURRENT})) echo ${ret% *} fi } @@ -210,7 +211,6 @@ switch_profile() { unset GCC_SPECS LDPATH source "${GCC_ENV_D}/${CC_COMP}" OLD_CC_COMP=$(get_current_profile) - CTARGET=${CTARGET:-${REAL_CHOST}} # What kind of env.d entry are we going to generate ? if is_cross_compiler ; then @@ -373,8 +373,10 @@ switch_profile() { } get_current_profile() { - local conf="${GCC_ENV_D}/config-${CTARGET}" - if [[ -n ${CC_COMP} ]] && is_cross_compiler ; then + local conf="${GCC_ENV_D}/config" + if [[ ! -f ${conf} ]] ; then + conf="${GCC_ENV_D}/config-${CTARGET}" + elif [[ -n ${CC_COMP} ]] && is_cross_compiler ; then conf="${conf}-${CC_COMP}" fi @@ -399,22 +401,33 @@ get_current_profile() { } list_profiles() { - local i=1 + local i=0 + local filter= if [[ ${ROOT} != "/" ]] ; then echo "Using gcc-config info in ${ROOT}" fi - if [[ ! -f ${GCC_ENV_D}/config ]] ; then - eerror "${argv0}: No gcc profile is active; please select one!" + if [[ ! -f ${GCC_ENV_D}/config-${CTARGET} ]] ; then + if ! is_cross_compiler && [[ -e ${GCC_ENV_D}/config ]] ; then + [[ -w ${GCC_ENV_D}/config ]] && mv ${GCC_ENV_D}/config ${GCC_ENV_D}/config-${CTARGET} + else + eerror "${argv0}: No gcc profile is active; please select one!" + filter=${CTARGET} + fi fi - eval $(grep -s ^CURRENT= "${GCC_ENV_D}"/config) + eval $(grep -s ^CURRENT= "${GCC_ENV_D}"/config-${CTARGET}) CURRENT_NATIVE=${CURRENT} local target= for x in "${GCC_ENV_D}"/* ; do if [[ -f ${x} ]] && [[ ${x/\/config} == ${x} ]] ; then - CTARGET=$(source "${x}"; echo ${CTARGET}) + CTARGET=$(unset CTARGET; source "${x}"; echo ${CTARGET}) + + ((++i)) + + [[ -n ${filter} ]] && [[ ${filter} != ${CTARGET:-${REAL_CHOST}} ]] && continue + if [[ ${target} != ${CTARGET} ]] ; then [[ -n ${target} ]] && echo target=${CTARGET} @@ -429,7 +442,6 @@ list_profiles() { [[ ${x} == ${CURRENT} ]] && x="${x} ${HILITE}*${NORMAL}" fi echo " [${i}] ${x}" - ((++i)) fi done } @@ -560,6 +572,7 @@ chop_gcc_ver_spec() { echo ${splitTED/ /-} # ver-spec } +SET_X=false NEED_ACTION="yes" DOIT="switch_profile" CHECK_CHOST="no" @@ -634,6 +647,9 @@ for x in "$@" ; do DOIT="get_stdcxx_incdir" fi ;; + -x|--debug) + SET_X=true + ;; -h|--help) usage 0 ;; @@ -646,6 +662,7 @@ for x in "$@" ; do exit 1 ;; *) + ${SET_X} && set -x if [[ -z ${CC_COMP} ]] ; then if [[ -z $(echo ${x} | tr -d '[:digit:]') ]] ; then # User gave us a # representing the profile @@ -685,6 +702,11 @@ for x in "$@" ; do esac done +${SET_X} && set -x + +get_real_chost +CTARGET=${CTARGET:-${REAL_CHOST}} + if [[ ${DOIT} == "switch_profile" ]] && [[ -z ${CC_COMP} ]] ; then usage 1 fi |