Ticket #21170: gcc_select.patch

File gcc_select.patch, 2.0 KB (added by akimd (Akim Demaille), 15 years ago)
  • gcc_select

    old new  
    22#
    33# $Id: portdestroot.tcl 27199 2007-07-24 09:09:43Z mww@macports.org $
    44#
    5 # Copyright (c) 2007 The MacPorts Project
     5# Copyright (c) 2007, 2009 The MacPorts Project
    66# Copyright (c) 2007 Markus W. Weissmann <mww@macports.org>
    77# All rights reserved.
    88#
     
    8989
    9090# perform an action (command) or just display it
    9191action() {
    92         if [ "rm" == ${1} ]; then
    93                 if [ 1 == ${noexec} ]; then
    94                         echo "rm -f ${2}"
    95                 else
    96                         rm -f ${2}
    97                 fi
    98         elif [ "ln" == ${1} ]; then
    99                 if [ 1 == ${noexec} ]; then
    100                         echo "ln -sf ${2} ${3}"
    101                 else
    102                         ln -sf ${2} ${3}
    103                 fi
    104         else
    105                 return 1
    106         fi
     92    case ${1}:${noexec} in
     93        (rm:1)  echo "rm -f ${2}";;
     94        (rm:*)  rm -f ${2};;
     95        (ln:1)  echo "ln -sf ${2} ${3}";;
     96        (rm:*)  ln -sf ${2} ${3};;
     97        (*)     return 1;;
     98    esac
    10799}
    108100
    109101# change symlinks
     
    118110
    119111                empty=0
    120112                # test if line starts with '-' -> dont link, just rm original
    121                 if [ "-" == $(echo ${src} | colrm 2) ]; then
     113                case ${src} in
     114                    (-*)
    122115                        # source is unavailable for this file
    123                         action "rm" "${DESTDIR}${PREFIX}/${target}"
    124                 elif [ "/" == $(echo ${src} | colrm 2) ]; then
     116                        action "rm" "${DESTDIR}${PREFIX}/${target}";;
     117                    (/*)
    125118                        # source has an absolute path
    126                         action "ln" "${src}" "${DESTDIR}${PREFIX}/${target}"
    127                 else
     119                        action "ln" "${src}" "${DESTDIR}${PREFIX}/${target}";;
     120                    (*)
    128121                        # source has relative path
    129122                        action "ln" "${PREFIX}/${src}" "${DESTDIR}${PREFIX}/${target}"
    130                 fi
     123                esac
    131124                let "error = error + ${?}"
    132125                let "i = i + 1"
    133126        done
     
    181174
    182175# execute selection
    183176select_version ${1}
    184 if [ 0 != ${?} ]; then
    185         echo "there were ${?} errors selecting version \"${version}\"!"
     177status=${?}
     178if [ 0 != ${status} ]; then
     179        echo "there were ${status} errors selecting version \"${version}\"!"
    186180        exit 5
    187181fi
    188182
    189183exit 0
    190