diff options
author | 2017-12-16 00:38:50 +0100 | |
---|---|---|
committer | 2017-12-16 00:38:50 +0100 | |
commit | 8fec946781138fc7a4f95b747c3a6a992471a218 (patch) | |
tree | 61e052f49c042141e381717ce1b1c70d0d435e45 | |
parent | Version 1.6 (diff) | |
download | binutils-config-8fec946781138fc7a4f95b747c3a6a992471a218.tar.gz binutils-config-8fec946781138fc7a4f95b747c3a6a992471a218.tar.bz2 binutils-config-8fec946781138fc7a4f95b747c3a6a992471a218.zip |
Version 1.7
https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-devel/binutils-config/files/binutils-config-1.7?revision=1.2
-rw-r--r-- | binutils-config | 113 |
1 files changed, 68 insertions, 45 deletions
diff --git a/binutils-config b/binutils-config index 539db7e..d73a32f 100644 --- a/binutils-config +++ b/binutils-config @@ -1,7 +1,7 @@ #!/bin/bash # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-config/files/Attic/binutils-config-1.6,v 1.5 2005/01/07 00:30:25 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-config/files/Attic/binutils-config-1.7,v 1.2 2005/01/15 00:54:05 vapier Exp $ # Format of /etc/env.d/binutils/: # config-TARGET: CURRENT=version for TARGET @@ -16,22 +16,26 @@ source /etc/init.d/functions.sh || { umask 022 usage() { -cat << "USAGE_END" -Usage: binutils-config [options] [binutils profile] -Change the current binutils profile, or give info about profiles. +cat << USAGE_END -Options: - -c, --get-current-profile Print current profile - -l, --list-profiles Print a list of available profiles - -u, --uninstall Remove all signs of specified target +Usage: ${HILITE}binutils-config${NORMAL} ${GOOD}[options]${NORMAL} ${BRACKET}[binutils profile]${NORMAL} -Profile names are of the form: <CHOST>-<binutils version> -For example: x86_64-pc-linux-gnu-2.15.92.0.2 +${HILITE}General Options:${NORMAL} + ${GOOD}-c, --get-current-profile${NORMAL} Print current profile + ${GOOD}-l, --list-profiles${NORMAL} Print a list of available profiles + ${GOOD}-u, --uninstall${NORMAL} Remove all signs of specified target + +${HILITE}Specific Cruft:${NORMAL} + ${GOOD}--x86${NORMAL} Install extra x86 links (i[3-6]86) + ${GOOD}--amd64${NORMAL} Install extra amd64 links (x86_64) + +Profile names are of the form: ${BRACKET}<CTARGET>-<binutils version>${NORMAL} +For example: ${BRACKET}i686-pc-linux-gnu-2.15.92.0.2${NORMAL} + +For more info, please see ${HILITE}binutils-config${NORMAL}(8). USAGE_END } -[[ $# -lt 1 ]] && usage && exit 1 - switch_profile() { unset TARGET VER LIBPATH FAKE_TARGETS source "${ENV_D}/${PROFILE}" @@ -49,9 +53,9 @@ switch_profile() { # update these env.d entries so that we don't force the poor # user to re-emerge their binutils just for 1 envvar :/ # - if [[ ${FAKE_TARGETS-poor user} = "poor user" ]] ; then + if [[ ${FAKE_TARGETS-poor user} == "poor user" ]] ; then local targ=${TARGET/-*} - local FAKE_TARGETS="${TARGET}" + local FAKE_TARGETS=${TARGET} case ${targ} in mips|powerpc|sparc) FAKE_TARGETS="${FAKE_TARGETS} ${TARGET/-/64-}";; @@ -60,6 +64,7 @@ switch_profile() { esac echo "FAKE_TARGETS=\"${FAKE_TARGETS}\"" >> "${ENV_D}/${PROFILE}" fi + FAKE_TARGETS="${FAKE_TARGETS} ${FAKE_TARGETS_USER}" ebegin "Switching to ${PROFILE}" @@ -68,7 +73,7 @@ switch_profile() { # On systems that do 32bit/64bit, we need to fake an # extra set of binary names (${FAKE_TARGETS}) # - BINPATH="/usr/${TARGET}/binutils-bin/${VER}" + BINPATH=/usr/${TARGET}/binutils-bin/${VER} cd "${ROOT}/${BINPATH}" || exit 1 mkdir -p "${ROOT}"/usr/${TARGET}/bin for x in * ; do @@ -78,7 +83,7 @@ switch_profile() { [[ -f ${ENV_D}/config-${fake} ]] && continue ln -sf ../${TARGET}/bin/${x} "${ROOT}"/usr/bin/${fake}-${x} done - if [[ ${TARGET} = "${HOST}" ]] ; then + if [[ ${TARGET} == ${HOST} ]] ; then ln -sf ${TARGET}-${x} "${ROOT}"/usr/bin/${x} fi done @@ -86,7 +91,7 @@ switch_profile() { # # Generate library / ldscripts symlinks # - LIBPATH="${LIBPATH:-/usr/lib/binutils/${TARGET}/${VER}}" + LIBPATH=${LIBPATH:-/usr/lib/binutils/${TARGET}/${VER}} cd "${ROOT}/${LIBPATH}" || exit 1 mkdir -p "${ROOT}"/usr/${TARGET}/lib if [[ -d ${ROOT}/usr/${TARGET}/lib/ldscripts ]] ; then @@ -96,10 +101,10 @@ switch_profile() { rm -f "${ROOT}"/usr/${TARGET}/lib/ldscripts fi ln -sf "${LIBPATH}/ldscripts" "${ROOT}"/usr/${TARGET}/lib/ldscripts - if [[ ${TARGET} = "${HOST}" ]] ; then - dstlib="${ROOT}"/usr/${HOST}/lib + if [[ ${TARGET} == ${HOST} ]] ; then + dstlib=${ROOT}/usr/${HOST}/lib else - dstlib="${ROOT}"/usr/${HOST}/${TARGET}/lib + dstlib=${ROOT}/usr/${HOST}/${TARGET}/lib fi mkdir -p "${dstlib}" for x in lib* ; do @@ -109,12 +114,12 @@ switch_profile() { # # Generate include symlinks # - INCPATH="${LIBPATH}/include" + INCPATH=${LIBPATH}/include cd "${ROOT}/${INCPATH}" || exit 1 - if [[ ${TARGET} = "${HOST}" ]] ; then - dstinc="${ROOT}"/usr/include + if [[ ${TARGET} == ${HOST} ]] ; then + dstinc=${ROOT}/usr/include else - dstinc="${ROOT}"/usr/${TARGET}/include + dstinc=${ROOT}/usr/${TARGET}/include fi mkdir -p "${dstinc}" for x in * ; do @@ -124,8 +129,8 @@ switch_profile() { # # Make sure proper paths get updated # - if [[ ${TARGET} = "${HOST}" ]] ; then - DATAPATH="/usr/share/binutils-data/${TARGET}/${VER}" + if [[ ${TARGET} == ${HOST} ]] ; then + DATAPATH=/usr/share/binutils-data/${TARGET}/${VER} [[ -d ${DATAPATH}/man ]] && \ echo "MANPATH=${DATAPATH}/man" > "${ROOT}"/etc/env.d/05binutils [[ -d ${DATAPATH}/info ]] && \ @@ -140,7 +145,7 @@ switch_profile() { # # Regen env.d if need/can be # - if [[ ${ROOT} = "/" ]] && [[ ${TARGET} = "${HOST}" ]] ; then + if [[ ${ROOT} == "/" ]] && [[ ${TARGET} == ${HOST} ]] ; then env-update echo ewarn "Please remember to run:" @@ -153,7 +158,7 @@ switch_profile() { } uninstall_target() { - if [[ ${TARGET} = "${HOST}" ]] ; then + if [[ ${TARGET} == ${HOST} ]] ; then eerror "$0: Refusing to uninstall native binutils" exit 1 fi @@ -181,6 +186,8 @@ uninstall_target() { rm -f "${ROOT}"/usr/${TARGET}/include/${x} done rm -f "${ROOT}"/usr/${TARGET}/lib/ldscripts + + rm -f "${ENV_D}"/${TARGET}-* } get_current_profile() { @@ -209,17 +216,17 @@ list_profiles() { fi target= for x in "${ENV_D}"/* ; do - if [[ -f ${x} ]] && [[ ${x/\/config-} = "${x}" ]] ; then + if [[ -f ${x} ]] && [[ ${x/\/config-} == ${x} ]] ; then source "${x}" if [[ ${target} != ${TARGET} ]] ; then [[ -n ${target} ]] && echo - target="${TARGET}" + target=${TARGET} fi - x="${x##*/}" + x=${x##*/} if [[ -e ${ENV_D}/config-${TARGET} ]] ; then source "${ENV_D}/config-${TARGET}" - [[ ${VER} = "${CURRENT}" ]] && x="${x} *" + [[ ${VER} == ${CURRENT} ]] && x="${x} ${GOOD}*${NORMAL}" fi echo " [${i}] ${x}" i=$((i + 1)) @@ -233,28 +240,29 @@ ENV_D="${ROOT}etc/env.d/binutils" NEED_ACTION="yes" DOIT="switch_profile" PROFILE="" +FAKE_TARGETS_USER="" while [[ $# -gt 0 ]] ; do x=$1 shift - case "${x}" in + case ${x} in -c|--get-current-profile) - if [[ ${NEED_ACTION} = "yes" ]] ; then + if [[ ${NEED_ACTION} == "yes" ]] ; then NEED_ACTION="no" DOIT="get_current_profile" fi ;; -l|--list-profiles) - if [[ ${NEED_ACTION} = "yes" ]] ; then + if [[ ${NEED_ACTION} == "yes" ]] ; then NEED_ACTION="no" DOIT="list_profiles" fi ;; -u|--uninstall) - if [[ ${NEED_ACTION} = "yes" ]] ; then + if [[ ${NEED_ACTION} == "yes" ]] ; then NEED_ACTION="no" DOIT="uninstall_target" - TARGET="$1" + TARGET=$1 shift fi ;; @@ -263,13 +271,23 @@ while [[ $# -gt 0 ]] ; do exit 0 ;; -v|--version) - cvsver="$Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-config/files/Attic/binutils-config-1.6,v 1.5 2005/01/07 00:30:25 vapier Exp $" + cvsver="$Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-config/files/Attic/binutils-config-1.7,v 1.2 2005/01/15 00:54:05 vapier Exp $" cvsver=${cvsver##*binutils-config-} echo "binutils-config-${cvsver%%,v *}" exit 0 ;; + --x86|--amd64) + if [[ ${NEED_ACTION} == "yes" ]] ; then + NEED_ACTION="no" + PROFILE="current" + case ${x} in + --x86) FAKE_TARGETS_USER="i386-pc-linux-gnu i486-pc-linux-gnu i586-pc-linux-gnu i686-pc-linux-gnu";; + --amd64) FAKE_TARGETS_USER="x86_64-pc-linux-gnu";; + esac + fi + ;; -*) - eerror "$0: Invalid switch! Run $0 without parameters for help." + eerror "${0##*/}: Invalid switch! Try '--help'." exit 1 ;; *) @@ -285,32 +303,37 @@ while [[ $# -gt 0 ]] ; do [[ ${y/config-} != ${y} ]] && continue if [[ -f ${y} ]] && [[ ${x} -eq ${i} ]] ; then - PROFILE="${y##*/}" + PROFILE=${y##*/} + NEED_ACTION="no" break fi i=$((i + 1)) done else # User gave us a full HOST-ver - x="${x##*/}" + x=${x##*/} if [[ ! -f ${ENV_D}/${x} ]] && [[ ! -f ${ENV_D}/config-${x} ]] ; then eerror "$0: Could not locate '$x' in '${ENV_D}/'!" exit 1 fi - PROFILE="${x}" + PROFILE=${x} + NEED_ACTION="no" fi ;; esac done +[[ ${NEED_ACTION} == "yes" ]] && usage && exit 1 + if [[ ${DOIT} != "list_profiles" ]] ; then if [[ -z ${CHOST} ]] ; then - HOST="$(portageq envvar CHOST)" + HOST=$(portageq envvar CHOST) else - HOST="${CHOST}" + HOST=${CHOST} fi fi -[ -z "${PROFILE}" ] && PROFILE="${HOST}" +[[ -z ${PROFILE} ]] && PROFILE=${HOST} +[[ ${PROFILE} == "current" ]] && PROFILE=$(PROFILE=${HOST} get_current_profile) eval ${DOIT} # vim:ts=4 |