Changeset 3e828ea in mainline for tools/toolchain.sh


Ignore:
Timestamp:
2019-09-23T12:49:29Z (6 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9be2358
Parents:
9259d20 (diff), 1a4ec93f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jiri Svoboda <jiri@…> (2019-09-22 12:49:07)
git-committer:
Jiri Svoboda <jiri@…> (2019-09-23 12:49:29)
Message:

Merge changes from master, especially Meson build

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/toolchain.sh

    r9259d20 r3e828ea  
    1 #! /bin/bash
     1#!/bin/sh
    22
    33#
     
    6666        echo " amd64      AMD64 (x86-64, x64)"
    6767        echo " arm32      ARM 32b"
     68        echo " arm64      AArch64"
    6869        echo " ia32       IA-32 (x86, i386)"
    6970        echo " ia64       IA-64 (Itanium)"
     
    102103        echo
    103104       
    104         if [ -z "$1" ] || [ "$1" == "all" ] ; then
    105                 PLATFORMS=("amd64" "arm32" "ia32" "ia64" "mips32" "mips32eb" "ppc32" "riscv64" "sparc64")
     105        if [ -z "$1" ] || [ "$1" = "all" ] ; then
     106                PLATFORMS='amd64 arm32 arm64 ia32 ia64 mips32 mips32eb ppc32 riscv64 sparc64'
    106107        else
    107                 PLATFORMS=("$1")
     108                PLATFORMS="$1"
    108109        fi
    109110       
     
    113114        fi
    114115
    115         for i in "${PLATFORMS[@]}"
     116        for i in $PLATFORMS
    116117        do
    117118                PLATFORM="$i"
     
    120121
    121122                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"
     123                test_app_version "Binutils" "ld" "GNU ld (.*) \([.0-9]*\)" "$BINUTILS_VERSION"
     124                test_app_version "GCC" "gcc" "gcc version \([.0-9]*\)" "$GCC_VERSION"
     125                test_app_version "GDB" "gdb" "GNU gdb (.*)[[:space:]]\+\([.0-9]*\)" "$GDB_VERSION"
    125126        done
    126127
     
    139140                echo "- $PKGNAME is missing"
    140141        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
     142                VERSION=`${APP} -v 2>&1 | sed -n "s:^${REGEX}.*:\1:p"`
     143
     144                if [ -z "$VERSION" ]; then
     145                        echo "- $PKGNAME Unexpected output"
     146                        return 1
     147                fi
     148
     149                if [ "$INS_VERSION" = "$VERSION" ]; then
     150                        echo "+ $PKGNAME is uptodate ($INS_VERSION)"
     151                else
     152                        echo "- $PKGNAME ($VERSION) is outdated ($INS_VERSION)"
     153                fi
    155154        fi
    156155}
     
    159158
    160159change_title() {
    161         echo -en "\e]0;$1\a"
     160        printf "\e]0;$1\a"
    162161}
    163162
     
    170169        fi
    171170
    172         echo -n "${TM} "
     171        printf "${TM} "
    173172        change_title "${TM}"
    174173        sleep 1
     
    221220        OUTSIDE="$1"
    222221        BASE="$2"
    223         ORIGINAL="`pwd`"
     222        ORIGINAL="$PWD"
     223
     224        cd "${BASE}"
     225        check_error $? "Unable to change directory to ${BASE}."
     226        ABS_BASE="$PWD"
     227        cd "${ORIGINAL}"
     228        check_error $? "Unable to change directory to ${ORIGINAL}."
    224229
    225230        mkdir -p "${OUTSIDE}"
    226 
    227231        cd "${OUTSIDE}"
    228232        check_error $? "Unable to change directory to ${OUTSIDE}."
    229         ABS_OUTSIDE="`pwd`"
    230 
    231         cd "${BASE}"
    232         check_error $? "Unable to change directory to ${BASE}."
    233         ABS_BASE="`pwd`"
     233
     234        while [ "${#PWD}" -gt "${#ABS_BASE}" ]; do
     235                cd ..
     236        done
     237
     238        if [ "$PWD" = "$ABS_BASE" ]; then
     239                echo
     240                echo "CROSS_PREFIX cannot reside within the working directory."
     241
     242                exit 5
     243        fi
    234244
    235245        cd "${ORIGINAL}"
    236246        check_error $? "Unable to change directory to ${ORIGINAL}."
    237 
    238         BASE_LEN="${#ABS_BASE}"
    239         OUTSIDE_TRIM="${ABS_OUTSIDE:0:${BASE_LEN}}"
    240 
    241         if [ "${OUTSIDE_TRIM}" == "${ABS_BASE}" ] ; then
    242                 echo
    243                 echo "CROSS_PREFIX cannot reside within the working directory."
    244 
    245                 exit 5
    246         fi
    247247}
    248248
     
    275275                "arm32")
    276276                        GNU_ARCH="arm"
     277                        ;;
     278                "arm64")
     279                        GNU_ARCH="aarch64"
    277280                        ;;
    278281                "ia32")
     
    341344                mkdir -p "${WORKDIR}/sysroot/include"
    342345                mkdir "${WORKDIR}/sysroot/lib"
     346                ARCH="$PLATFORM"
     347                if [ "$ARCH" = "mips32eb" ]; then
     348                        ARCH=mips32
     349                fi
     350
    343351                cp -r -L -t "${WORKDIR}/sysroot/include" \
    344352                        ${SRCDIR}/../abi/include/* \
    345                         ${SRCDIR}/../uspace/lib/c/arch/${PLATFORM}/include/* \
     353                        ${SRCDIR}/../uspace/lib/c/arch/${ARCH}/include/* \
    346354                        ${SRCDIR}/../uspace/lib/c/include/*
    347355                check_error $? "Failed to create build sysroot."
     
    497505                test_version
    498506                ;;
    499         amd64|arm32|ia32|ia64|mips32|mips32eb|ppc32|riscv64|sparc64)
     507        amd64|arm32|arm64|ia32|ia64|mips32|mips32eb|ppc32|riscv64|sparc64)
    500508                prepare
    501509                build_target "$1"
     
    505513                build_target "amd64"
    506514                build_target "arm32"
     515                build_target "arm64"
    507516                build_target "ia32"
    508517                build_target "ia64"
     
    517526                build_target "amd64"
    518527                build_target "arm32"
     528                build_target "arm64"
    519529                build_target "ia32"
    520530                build_target "ia64"
     
    528538                build_target "amd64" &
    529539                build_target "arm32" &
     540                build_target "arm64" &
    530541                build_target "ia32" &
    531542                build_target "ia64" &
     
    543554                wait
    544555
     556                build_target "arm64" &
    545557                build_target "ia32" &
     558                wait
     559
    546560                build_target "ia64" &
     561                build_target "mips32" &
    547562                wait
    548563
    549                 build_target "mips32" &
    550564                build_target "mips32eb" &
     565                build_target "ppc32" &
    551566                wait
    552567
    553                 build_target "ppc32" &
    554568                build_target "riscv64" &
    555                 wait
    556 
    557569                build_target "sparc64" &
    558570                wait
Note: See TracChangeset for help on using the changeset viewer.