Changes in / [a49c39c8:59564e6] in mainline


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/toolchain.sh

    ra49c39c8 r59564e6  
    6161        echo "Syntax:"
    6262        echo " $0 [--no-install] [--non-helenos-target] <platform>"
     63        echo " $0 --test-version [<platform>]"
    6364        echo
    6465        echo "Possible target platforms are:"
     
    9596}
    9697
     98test_version() {
     99        echo "Cross-compiler toolchain build script"
     100        echo
     101        echo "Start testing the version of the installed software"
     102        echo
     103       
     104        if [ -z "$1" ] || [ "$1" == "all" ] ; then
     105                PLATFORMS=("amd64" "arm32" "ia32" "ia64" "mips32" "mips32eb" "ppc32" "riscv64" "sparc64")
     106        else
     107                PLATFORMS=("$1")
     108        fi
     109       
     110       
     111        if [ -z "${CROSS_PREFIX}" ] ; then
     112                CROSS_PREFIX="/usr/local/cross"
     113        fi
     114
     115        for i in "${PLATFORMS[@]}"
     116        do
     117                PLATFORM="$i"
     118                set_target_from_platform "$PLATFORM"
     119                PREFIX="${CROSS_PREFIX}/bin/${HELENOS_TARGET}"
     120
     121                echo "== $PLATFORM =="
     122                test_app_version "Binutils" "ld" "GNU\ ld\ \(GNU\ Binutils\)\ ((\.|[0-9])+)" "$BINUTILS_VERSION"
     123                test_app_version "GCC" "gcc" "gcc\ version\ ((\.|[0-9])+)" "$GCC_VERSION"
     124                test_app_version "GDB" "gdb" "GNU\ gdb\ \(GDB\)\s+((\.|[0-9])+)" "$GDB_VERSION"
     125        done
     126
     127        exit
     128}
     129
     130test_app_version() {
     131        PKGNAME="$1"
     132        APPNAME="$2"
     133        REGEX="$3"
     134        INS_VERSION="$4"
     135
     136
     137        APP="${PREFIX}-${APPNAME}"
     138        if [ ! -e $APP ]; then
     139                echo "- $PKGNAME is missing"
     140        else
     141                {
     142                        OUT=$(${APP} -v 2>&1)
     143                } &> /dev/null
     144
     145                if [[ "$OUT" =~ $REGEX ]]; then
     146                VERSION="${BASH_REMATCH[1]}"
     147                if [ "$INS_VERSION" = "$VERSION" ]; then
     148                        echo "+ $PKGNAME is uptodate ($INS_VERSION)"
     149                else
     150                        echo "- $PKGNAME ($VERSION) is outdated ($INS_VERSION)"
     151                fi
     152            else
     153                echo "- $PKGNAME Unexpected output"
     154            fi
     155        fi
     156}
     157
     158
     159
    97160change_title() {
    98161        echo -en "\e]0;$1\a"
     
    408471while [ "$#" -gt 1 ] ; do
    409472        case "$1" in
     473                --test-version)
     474                        test_version "$2"
     475                        exit
     476                        ;;
    410477                --no-install)
    411478                        REAL_INSTALL=false
     
    427494
    428495case "$1" in
     496        --test-version)
     497                test_version
     498                ;;
    429499        amd64|arm32|ia32|ia64|mips32|mips32eb|ppc32|riscv64|sparc64)
    430500                prepare
Note: See TracChangeset for help on using the changeset viewer.