Changes in tools/toolchain.sh [56210a7:ce52c333] in mainline


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/toolchain.sh

    r56210a7 rce52c333  
    3131BINUTILS_GDB_GIT="https://github.com/HelenOS/binutils-gdb.git"
    3232
    33 BINUTILS_BRANCH="binutils-2_43-helenos"
    34 BINUTILS_VERSION="2.43"
    35 
    36 GDB_BRANCH="gdb-13.2-helenos"
    37 GDB_VERSION="13.2"
     33BINUTILS_BRANCH="binutils-2_31_1-helenos"
     34BINUTILS_VERSION="2.31.1"
     35
     36GDB_BRANCH="gdb-8_2-helenos"
     37GDB_VERSION="8.2"
    3838
    3939GCC_GIT="https://github.com/HelenOS/gcc.git"
    40 GCC_BRANCH="14_2_0-helenos"
    41 GCC_VERSION="14.2"
    42 
    43 BASEDIR="$PWD"
     40GCC_BRANCH="8_2_0-helenos"
     41GCC_VERSION="8.2.0"
     42
     43BASEDIR="`pwd`"
    4444SRCDIR="$(readlink -f $(dirname "$0"))"
    4545
    46 # If we install into a temporary directory and copy from there,
    47 # we don't have to trust the upstream makefiles respect the prefix for
    48 # all files, and we also have a ready-made package for distribution.
    49 INSTALL_DIR="${BASEDIR}/PKG"
    50 
    51 SYSTEM_INSTALL=false
    52 
    53 BUILD_GDB=false
    54 BUILD_BINUTILS=true
    55 BUILD_GCC=true
    56 
    57 if [ -z "$JOBS" ] ; then
    58         JOBS="`nproc`"
    59 fi
     46REAL_INSTALL=true
     47USE_HELENOS_TARGET=true
    6048
    6149check_error() {
     
    6957
    7058show_usage() {
    71         echo "HelenOS cross-compiler toolchain build script"
     59        echo "Cross-compiler toolchain build script"
    7260        echo
    7361        echo "Syntax:"
    74         echo " $0 [--system-wide] [--with-gdb|--only-gdb] <platform>"
    75         echo " $0 [--system-wide] --test-version [<platform>]"
     62        echo " $0 [--no-install] [--non-helenos-target] <platform>"
     63        echo " $0 --test-version [<platform>]"
    7664        echo
    7765        echo "Possible target platforms are:"
     
    8775        echo " sparc64    SPARC V9"
    8876        echo " all        build all targets"
     77        echo " essential  build only targets currently needed for HelenOS development"
    8978        echo " parallel   same as 'all', but all in parallel"
    9079        echo " 2-way      same as 'all', but 2-way parallel"
    9180        echo
    92         echo "The toolchain target installation directory is determined by matching"
    93         echo "the first of the following conditions:"
    94         echo
    95         echo " (1) If the \$CROSS_PREFIX environment variable is set, then it is"
    96         echo "     used as the target installation directory."
    97         echo " (2) If the --system-wide option is used, then /opt/HelenOS/cross"
    98         echo "     is used as the target installation directory. This usually"
    99         echo "     requires running this script with super user privileges."
    100         echo " (3) In other cases, \$XDG_DATA_HOME/HelenOS/cross is used as the"
    101         echo "     target installation directory. If the \$XDG_DATA_HOME environment"
    102         echo "     variable is not set, then the default value of \$HOME/.local/share"
    103         echo "     is assumed."
    104         echo
    105         echo "The --non-helenos-target option will build non-HelenOS-specific"
    106         echo "toolchain (i.e. it will use *-linux-* triplet instead of *-helenos)."
     81        echo "The toolchain is installed into directory specified by the"
     82        echo "CROSS_PREFIX environment variable. If the variable is not"
     83        echo "defined, /usr/local/cross/ is used as default."
     84        echo
     85        echo "If --no-install is present, the toolchain still uses the"
     86        echo "CROSS_PREFIX as the target directory but the installation"
     87        echo "copies the files into PKG/ subdirectory without affecting"
     88        echo "the actual root file system. That is only useful if you do"
     89        echo "not want to run the script under the super user."
     90        echo
     91        echo "The --non-helenos-target will build non-HelenOS-specific toolchain"
     92        echo "(i.e. it will use *-linux-* triplet instead of *-helenos)."
    10793        echo "Using this toolchain for building HelenOS is not supported."
    10894        echo
    109         echo "The --test-version mode tests the currently installed version of the"
    110         echo "toolchain."
    11195
    11296        exit 3
    11397}
    11498
    115 set_cross_prefix() {
    116         if [ -z "$CROSS_PREFIX" ] ; then
    117                 if $SYSTEM_INSTALL ; then
    118                         CROSS_PREFIX="/opt/HelenOS/cross"
    119                 else
    120                         if [ -z "$XDG_DATA_HOME" ] ; then
    121                                 XDG_DATA_HOME="$HOME/.local/share"
    122                         fi
    123                         CROSS_PREFIX="$XDG_DATA_HOME/HelenOS/cross"
    124                 fi
    125         fi
    126 }
    127 
    12899test_version() {
    129         set_cross_prefix
    130 
    131         echo "HelenOS cross-compiler toolchain build script"
    132         echo
    133         echo "Testing the version of the installed software in $CROSS_PREFIX"
    134         echo
    135 
     100        echo "Cross-compiler toolchain build script"
     101        echo
     102        echo "Start testing the version of the installed software"
     103        echo
     104       
    136105        if [ -z "$1" ] || [ "$1" = "all" ] ; then
    137106                PLATFORMS='amd64 arm32 arm64 ia32 ia64 mips32 mips32eb ppc32 riscv64 sparc64'
     
    139108                PLATFORMS="$1"
    140109        fi
    141 
    142         for PLATFORM in $PLATFORMS ; do
     110       
     111       
     112        if [ -z "${CROSS_PREFIX}" ] ; then
     113                CROSS_PREFIX="/usr/local/cross"
     114        fi
     115
     116        for i in $PLATFORMS
     117        do
     118                PLATFORM="$i"
    143119                set_target_from_platform "$PLATFORM"
    144                 PREFIX="${CROSS_PREFIX}/bin/${TARGET}"
     120                PREFIX="${CROSS_PREFIX}/bin/${HELENOS_TARGET}"
    145121
    146122                echo "== $PLATFORM =="
     
    149125                test_app_version "GDB" "gdb" "GNU gdb (.*)[[:space:]]\+\([.0-9]*\)" "$GDB_VERSION"
    150126        done
     127
     128        exit
    151129}
    152130
     
    157135        INS_VERSION="$4"
    158136
     137
    159138        APP="${PREFIX}-${APPNAME}"
    160139        if [ ! -e $APP ]; then
     
    169148
    170149                if [ "$INS_VERSION" = "$VERSION" ]; then
    171                         echo "+ $PKGNAME is up-to-date ($INS_VERSION)"
     150                        echo "+ $PKGNAME is uptodate ($INS_VERSION)"
    172151                else
    173152                        echo "- $PKGNAME ($VERSION) is outdated ($INS_VERSION)"
     
    176155}
    177156
     157
     158
    178159change_title() {
    179160        printf "\e]0;$1\a"
    180 }
    181 
    182 ring_bell() {
    183         printf '\a'
    184         sleep 0.1
    185         printf '\a'
    186         sleep 0.1
    187         printf '\a'
    188         sleep 0.1
    189         printf '\a'
    190         sleep 0.1
    191         printf '\a'
    192161}
    193162
     
    209178
    210179show_dependencies() {
    211         set_cross_prefix
    212 
    213         echo "HelenOS cross-compiler toolchain build script"
    214         echo
    215         echo "Installing software to $CROSS_PREFIX"
    216         echo
    217         echo
    218180        echo "IMPORTANT NOTICE:"
    219181        echo
     
    256218
    257219check_dirs() {
    258         cd "${BASEDIR}"
    259         check_error $? "Unable to change directory to ${BASEDIR}."
     220        OUTSIDE="$1"
     221        BASE="$2"
     222        ORIGINAL="$PWD"
     223
     224        cd "${BASE}"
     225        check_error $? "Unable to change directory to ${BASE}."
    260226        ABS_BASE="$PWD"
    261 
    262         if $SYSTEM_INSTALL && [ ! -d "${CROSS_PREFIX}" ]; then
    263                 ring_bell
    264                 ( set -x ; sudo -k mkdir -p "${CROSS_PREFIX}" )
    265         else
    266                 mkdir -p "${CROSS_PREFIX}"
    267         fi
    268 
    269         cd "${CROSS_PREFIX}"
    270         check_error $? "Unable to change directory to ${CROSS_PREFIX}."
     227        cd "${ORIGINAL}"
     228        check_error $? "Unable to change directory to ${ORIGINAL}."
     229
     230        mkdir -p "${OUTSIDE}"
     231        cd "${OUTSIDE}"
     232        check_error $? "Unable to change directory to ${OUTSIDE}."
    271233
    272234        while [ "${#PWD}" -gt "${#ABS_BASE}" ]; do
     
    281243        fi
    282244
    283         cd "${BASEDIR}"
     245        cd "${ORIGINAL}"
     246        check_error $? "Unable to change directory to ${ORIGINAL}."
    284247}
    285248
     
    292255        check_error $? "Change directory failed."
    293256
    294         change_title "Downloading sources"
    295257        echo ">>> Downloading sources"
    296 
    297         if $BUILD_BINUTILS ; then
    298                 git clone --depth 1 -b "$BINUTILS_BRANCH" "$BINUTILS_GDB_GIT" "binutils-$BINUTILS_VERSION"
    299                 # If the directory already existed, pull upstream changes.
    300                 git -C "binutils-$BINUTILS_VERSION" pull
    301         fi
    302 
    303         if $BUILD_GCC ; then
    304                 git clone --depth 1 -b "$GCC_BRANCH" "$GCC_GIT" "gcc-$GCC_VERSION"
    305                 git -C "gcc-$GCC_VERSION" pull
    306 
    307                 change_title "Downloading GCC prerequisites"
    308                 echo ">>> Downloading GCC prerequisites"
    309                 cd "gcc-${GCC_VERSION}"
    310                 ./contrib/download_prerequisites
    311                 cd ..
    312         fi
    313 
    314         if $BUILD_GDB ; then
    315                 git clone --depth 1 -b "$GDB_BRANCH" "$BINUTILS_GDB_GIT" "gdb-$GDB_VERSION"
    316                 git -C "gdb-$GDB_VERSION" pull
    317         fi
    318 
    319         # This sets the CROSS_PREFIX variable
    320         set_cross_prefix
    321 
    322         DESTDIR_SPEC="DESTDIR=${INSTALL_DIR}"
    323 
    324         check_dirs
     258        git clone --depth 1 -b "$BINUTILS_BRANCH" "$BINUTILS_GDB_GIT" "binutils-$BINUTILS_VERSION"
     259        git clone --depth 1 -b "$GDB_BRANCH" "$BINUTILS_GDB_GIT" "gdb-$GDB_VERSION"
     260        git clone --depth 1 -b "$GCC_BRANCH" "$GCC_GIT" "gcc-$GCC_VERSION"
     261
     262        # If the directory already existed, pull upstream changes.
     263        git -C "binutils-$BINUTILS_VERSION" pull
     264        git -C "gdb-$GDB_VERSION" pull
     265        git -C "gcc-$GCC_VERSION" pull
     266
     267        echo ">>> Downloading GCC prerequisites"
     268        cd "gcc-${GCC_VERSION}"
     269        ./contrib/download_prerequisites
     270        cd ..
    325271}
    326272
     
    350296        esac
    351297
    352         TARGET="${GNU_ARCH}-helenos"
    353 }
    354 
    355 build_binutils() {
    356         # This sets the TARGET variable
    357         set_target_from_platform "$1"
     298        HELENOS_TARGET="${GNU_ARCH}-helenos"
     299
     300        case "$1" in
     301                "arm32")
     302                        LINUX_TARGET="${GNU_ARCH}-linux-gnueabi"
     303                        ;;
     304                *)
     305                        LINUX_TARGET="${GNU_ARCH}-linux-gnu"
     306                        ;;
     307        esac
     308}
     309
     310build_target() {
     311        PLATFORM="$1"
     312
     313        # This sets the *_TARGET variables
     314        set_target_from_platform "$PLATFORM"
     315        if $USE_HELENOS_TARGET ; then
     316                TARGET="$HELENOS_TARGET"
     317        else
     318                TARGET="$LINUX_TARGET"
     319        fi
    358320
    359321        WORKDIR="${BASEDIR}/${TARGET}"
     322        INSTALL_DIR="${BASEDIR}/PKG"
    360323        BINUTILSDIR="${WORKDIR}/binutils-${BINUTILS_VERSION}"
     324        GCCDIR="${WORKDIR}/gcc-${GCC_VERSION}"
     325        GDBDIR="${WORKDIR}/gdb-${GDB_VERSION}"
     326
     327        if [ -z "${CROSS_PREFIX}" ] ; then
     328                CROSS_PREFIX="/usr/local/cross"
     329        fi
     330
     331        if [ -z "$JOBS" ] ; then
     332                JOBS=`nproc`
     333        fi
     334
     335        PREFIX="${CROSS_PREFIX}"
    361336
    362337        echo ">>> Removing previous content"
    363338        cleanup_dir "${WORKDIR}"
    364339        mkdir -p "${WORKDIR}"
    365 
    366         echo ">>> Processing binutils (${TARGET})"
     340        check_dirs "${PREFIX}" "${WORKDIR}"
     341
     342        if $USE_HELENOS_TARGET ; then
     343                echo ">>> Creating build sysroot"
     344                mkdir -p "${WORKDIR}/sysroot/include"
     345                mkdir "${WORKDIR}/sysroot/lib"
     346                ARCH="$PLATFORM"
     347                if [ "$ARCH" = "mips32eb" ]; then
     348                        ARCH=mips32
     349                fi
     350
     351                cp -r -L -t "${WORKDIR}/sysroot/include" \
     352                        ${SRCDIR}/../abi/include/* \
     353                        ${SRCDIR}/../uspace/lib/c/arch/${ARCH}/include/* \
     354                        ${SRCDIR}/../uspace/lib/c/include/*
     355                check_error $? "Failed to create build sysroot."
     356        fi
     357
     358        echo ">>> Processing binutils (${PLATFORM})"
    367359        mkdir -p "${BINUTILSDIR}"
    368360        cd "${BINUTILSDIR}"
    369361        check_error $? "Change directory failed."
    370362
    371         change_title "binutils: configure (${TARGET})"
     363        change_title "binutils: configure (${PLATFORM})"
    372364        CFLAGS="-Wno-error -fcommon" "${BASEDIR}/downloads/binutils-${BINUTILS_VERSION}/configure" \
    373365                "--target=${TARGET}" \
    374                 "--prefix=${CROSS_PREFIX}" \
     366                "--prefix=${PREFIX}" \
    375367                "--program-prefix=${TARGET}-" \
    376368                --disable-nls \
     
    382374        check_error $? "Error configuring binutils."
    383375
    384         change_title "binutils: make (${TARGET})"
     376        change_title "binutils: make (${PLATFORM})"
    385377        make all -j$JOBS
    386378        check_error $? "Error compiling binutils."
    387379
    388         change_title "binutils: install (${TARGET})"
    389         make install $DESTDIR_SPEC
     380        change_title "binutils: install (${PLATFORM})"
     381        make install "DESTDIR=${INSTALL_DIR}"
    390382        check_error $? "Error installing binutils."
    391 }
    392 
    393 build_gcc() {
    394         # This sets the TARGET variable
    395         set_target_from_platform "$1"
    396 
    397         WORKDIR="${BASEDIR}/${TARGET}"
    398         GCCDIR="${WORKDIR}/gcc-${GCC_VERSION}"
    399 
    400         echo ">>> Removing previous content"
    401         cleanup_dir "${WORKDIR}"
    402         mkdir -p "${WORKDIR}"
    403 
    404         echo ">>> Processing GCC (${TARGET})"
     383
     384
     385        echo ">>> Processing GCC (${PLATFORM})"
    405386        mkdir -p "${GCCDIR}"
    406387        cd "${GCCDIR}"
    407388        check_error $? "Change directory failed."
    408389
    409         BUILDPATH="${CROSS_PREFIX}/bin:${PATH}"
    410 
    411         change_title "GCC: configure (${TARGET})"
    412         PATH="${BUILDPATH}" "${BASEDIR}/downloads/gcc-${GCC_VERSION}/configure" \
     390        if $USE_HELENOS_TARGET ; then
     391                SYSROOT=--with-sysroot --with-build-sysroot="${WORKDIR}/sysroot"
     392        else
     393                SYSROOT=--without-headers
     394        fi
     395
     396        change_title "GCC: configure (${PLATFORM})"
     397        PATH="$PATH:${INSTALL_DIR}/${PREFIX}/bin" "${BASEDIR}/downloads/gcc-${GCC_VERSION}/configure" \
    413398                "--target=${TARGET}" \
    414                 "--prefix=${CROSS_PREFIX}" \
     399                "--prefix=${PREFIX}" \
    415400                "--program-prefix=${TARGET}-" \
    416401                --with-gnu-as \
     
    419404                --enable-languages=c,c++,go \
    420405                --enable-lto \
    421                 --enable-obsolete \
    422406                --disable-shared \
    423407                --disable-werror \
    424                 --without-headers  # TODO: Replace with proper sysroot so we can build more libs
     408                $SYSROOT
    425409        check_error $? "Error configuring GCC."
    426410
    427         change_title "GCC: make (${TARGET})"
    428         PATH="${BUILDPATH}" make all-gcc -j$JOBS
     411        change_title "GCC: make (${PLATFORM})"
     412        PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all-gcc -j$JOBS
    429413        check_error $? "Error compiling GCC."
    430414
    431         change_title "GCC: install (${TARGET})"
    432         PATH="${BUILDPATH}" make install-gcc $DESTDIR_SPEC
     415        if $USE_HELENOS_TARGET ; then
     416                PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all-target-libgcc -j$JOBS
     417                check_error $? "Error compiling libgcc."
     418                # TODO: needs some extra care
     419                #PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all-target-libatomic -j$JOBS
     420                #check_error $? "Error compiling libatomic."
     421                #PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all-target-libstdc++-v3 -j$JOBS
     422                #check_error $? "Error compiling libstdc++."
     423        fi
     424
     425        change_title "GCC: install (${PLATFORM})"
     426        PATH="${PATH}:${INSTALL_DIR}/${PREFIX}/bin" make install-gcc "DESTDIR=${INSTALL_DIR}"
     427        if $USE_HELENOS_TARGET ; then
     428                PATH="${PATH}:${INSTALL_DIR}/${PREFIX}/bin" make install-target-libgcc "DESTDIR=${INSTALL_DIR}"
     429                #PATH="${PATH}:${INSTALL_DIR}/${PREFIX}/bin" make install-target-libatomic "DESTDIR=${INSTALL_DIR}"
     430                #PATH="${PATH}:${INSTALL_DIR}/${PREFIX}/bin" make install-target-libstdc++-v3 "DESTDIR=${INSTALL_DIR}"
     431        fi
    433432        check_error $? "Error installing GCC."
    434 }
    435 
    436 build_libgcc() {
    437         # This sets the TARGET variable
    438         set_target_from_platform "$1"
    439 
    440         WORKDIR="${BASEDIR}/${TARGET}"
    441         GCCDIR="${WORKDIR}/gcc-${GCC_VERSION}"
    442 
    443         # No removing previous content here, we need the previous GCC build
    444 
    445         cd "${GCCDIR}"
    446         check_error $? "Change directory failed."
    447 
    448         BUILDPATH="${CROSS_PREFIX}/bin:${PATH}"
    449 
    450         change_title "libgcc: make (${TARGET})"
    451 
    452         PATH="${BUILDPATH}" make all-target-libgcc -j$JOBS
    453         check_error $? "Error compiling libgcc."
    454         # TODO: libatomic and libstdc++ need some extra care
    455         #    PATH="${BUILDPATH}" make all-target-libatomic -j$JOBS
    456         #    check_error $? "Error compiling libatomic."
    457         #    PATH="${BUILDPATH}" make all-target-libstdc++-v3 -j$JOBS
    458         #    check_error $? "Error compiling libstdc++."
    459 
    460         change_title "libgcc: install (${TARGET})"
    461 
    462         PATH="${BUILDPATH}" make install-target-libgcc $DESTDIR_SPEC
    463         #    PATH="${BUILDPATH}" make install-target-libatomic $DESTDIR_SPEC
    464         #    PATH="${BUILDPATH}" make install-target-libstdc++-v3 $DESTDIR_SPEC
    465         check_error $? "Error installing libgcc."
    466 }
    467 
    468 build_gdb() {
    469         # This sets the TARGET variable
    470         set_target_from_platform "$1"
    471 
    472         WORKDIR="${BASEDIR}/${TARGET}"
    473         GDBDIR="${WORKDIR}/gdb-${GDB_VERSION}"
    474 
    475         echo ">>> Removing previous content"
    476         cleanup_dir "${WORKDIR}"
    477         mkdir -p "${WORKDIR}"
    478 
    479         echo ">>> Processing GDB (${TARGET})"
     433
     434
     435        echo ">>> Processing GDB (${PLATFORM})"
    480436        mkdir -p "${GDBDIR}"
    481437        cd "${GDBDIR}"
    482438        check_error $? "Change directory failed."
    483439
    484         change_title "GDB: configure (${TARGET})"
    485         CFLAGS="-fcommon" "${BASEDIR}/downloads/gdb-${GDB_VERSION}/configure" \
     440        change_title "GDB: configure (${PLATFORM})"
     441        CFLAGS="-fcommon" PATH="$PATH:${INSTALL_DIR}/${PREFIX}/bin" "${BASEDIR}/downloads/gdb-${GDB_VERSION}/configure" \
    486442                "--target=${TARGET}" \
    487                 "--prefix=${CROSS_PREFIX}" \
     443                "--prefix=${PREFIX}" \
    488444                "--program-prefix=${TARGET}-" \
    489445                --enable-werror=no
    490446        check_error $? "Error configuring GDB."
    491447
    492         change_title "GDB: make (${TARGET})"
    493         make all-gdb -j$JOBS
     448        change_title "GDB: make (${PLATFORM})"
     449        PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all-gdb -j$JOBS
    494450        check_error $? "Error compiling GDB."
    495451
    496         change_title "GDB: install (${TARGET})"
    497         make install-gdb $DESTDIR_SPEC
     452        change_title "GDB: make (${PLATFORM})"
     453        PATH="${PATH}:${INSTALL_DIR}/${PREFIX}/bin" make install-gdb "DESTDIR=${INSTALL_DIR}"
    498454        check_error $? "Error installing GDB."
    499 }
    500 
    501 install_pkg() {
    502         echo ">>> Moving to the destination directory."
    503         if $SYSTEM_INSTALL ; then
    504                 ring_bell
    505                 ( set -x ; sudo -k cp -r -t "${CROSS_PREFIX}" "${INSTALL_DIR}${CROSS_PREFIX}/"* )
    506         else
    507                 ( set -x ; cp -r -t "${CROSS_PREFIX}" "${INSTALL_DIR}${CROSS_PREFIX}/"* )
    508         fi
    509 }
    510 
    511 link_clang() {
     455
    512456        # Symlink clang and lld to the install path.
    513457        CLANG="`which clang 2> /dev/null || echo "/usr/bin/clang"`"
    514458        LLD="`which ld.lld 2> /dev/null || echo "/usr/bin/ld.lld"`"
    515459
    516         ln -s $CLANG "${INSTALL_DIR}${CROSS_PREFIX}/bin/${TARGET}-clang"
    517         ln -s $LLD "${INSTALL_DIR}${CROSS_PREFIX}/bin/${TARGET}-ld.lld"
     460        ln -s $CLANG "${INSTALL_DIR}/${PREFIX}/bin/${TARGET}-clang"
     461        ln -s $LLD "${INSTALL_DIR}/${PREFIX}/bin/${TARGET}-ld.lld"
     462
     463        if $REAL_INSTALL ; then
     464                echo ">>> Moving to the destination directory."
     465                echo cp -r -t "${PREFIX}" "${INSTALL_DIR}/${PREFIX}/"*
     466                cp -r -t "${PREFIX}" "${INSTALL_DIR}/${PREFIX}/"*
     467        fi
     468
     469        cd "${BASEDIR}"
     470        check_error $? "Change directory failed."
     471
     472        echo ">>> Cleaning up"
     473        cleanup_dir "${WORKDIR}"
     474
     475        echo
     476        echo ">>> Cross-compiler for ${TARGET} installed."
    518477}
    519478
    520479while [ "$#" -gt 1 ] ; do
    521480        case "$1" in
    522                 --system-wide)
    523                         SYSTEM_INSTALL=true
    524                         shift
    525                         ;;
    526481                --test-version)
    527482                        test_version "$2"
    528483                        exit
    529484                        ;;
    530                 --with-gdb)
    531                         BUILD_GDB=true
     485                --no-install)
     486                        REAL_INSTALL=false
    532487                        shift
    533488                        ;;
    534                 --only-gdb)
    535                         BUILD_GDB=true
    536                         BUILD_BINUTILS=false
    537                         BUILD_GCC=false
     489                --non-helenos-target)
     490                        USE_HELENOS_TARGET=false
    538491                        shift
    539492                        ;;
     
    548501fi
    549502
    550 PLATFORMS="amd64 arm32 arm64 ia32 ia64 mips32 mips32eb ppc32 riscv64 sparc64"
    551 
    552 run_one() {
    553         $1 $PLATFORM
    554 }
    555 
    556 run_all() {
    557         for x in $PLATFORMS ; do
    558                 $1 $x
    559         done
    560 }
    561 
    562 run_parallel() {
    563         for x in $PLATFORMS ; do
    564                 $1 $x &
    565         done
    566         wait
    567 }
    568 
    569 run_2way() {
    570         $1 amd64 &
    571         $1 arm32 &
    572         wait
    573 
    574         $1 arm64 &
    575         $1 ia32 &
    576         wait
    577 
    578         $1 ia64 &
    579         $1 mips32 &
    580         wait
    581 
    582         $1 mips32eb &
    583         $1 ppc32 &
    584         wait
    585 
    586         $1 riscv64 &
    587         $1 sparc64 &
    588         wait
    589 }
    590 
    591 everything() {
    592         RUNNER="$1"
    593 
    594         prepare
    595 
    596         if $BUILD_BINUTILS ; then
    597                 $RUNNER build_binutils
    598 
    599                 if $BUILD_GCC ; then
    600                         # gcc/libgcc may fail to build correctly if binutils is not installed first
    601                         echo ">>> Installing binutils"
    602                         install_pkg
    603                 fi
    604         fi
    605 
    606         if $BUILD_GCC ; then
    607                 $RUNNER build_gcc
    608 
    609                 # libgcc may fail to build correctly if gcc is not installed first
    610                 echo ">>> Installing GCC"
    611                 install_pkg
    612 
    613                 $RUNNER build_libgcc
    614         fi
    615 
    616         if $BUILD_GDB ; then
    617                 $RUNNER build_gdb
    618         fi
    619 
    620         echo ">>> Installing all files"
    621         install_pkg
    622 
    623         link_clang
    624 }
    625 
    626503case "$1" in
    627504        --test-version)
    628505                test_version
    629                 exit
    630506                ;;
    631507        amd64|arm32|arm64|ia32|ia64|mips32|mips32eb|ppc32|riscv64|sparc64)
    632                 PLATFORM="$1"
    633                 everything run_one
     508                prepare
     509                build_target "$1"
    634510                ;;
    635511        "all")
    636                 everything run_all
     512                prepare
     513                build_target "amd64"
     514                build_target "arm32"
     515                build_target "arm64"
     516                build_target "ia32"
     517                build_target "ia64"
     518                build_target "mips32"
     519                build_target "mips32eb"
     520                build_target "ppc32"
     521                build_target "riscv64"
     522                build_target "sparc64"
     523                ;;
     524        "essential")
     525                prepare
     526                build_target "amd64"
     527                build_target "arm32"
     528                build_target "arm64"
     529                build_target "ia32"
     530                build_target "ia64"
     531                build_target "mips32"
     532                build_target "mips32eb"
     533                build_target "ppc32"
     534                build_target "sparc64"
    637535                ;;
    638536        "parallel")
    639                 everything run_parallel
     537                prepare
     538                build_target "amd64" &
     539                build_target "arm32" &
     540                build_target "arm64" &
     541                build_target "ia32" &
     542                build_target "ia64" &
     543                build_target "mips32" &
     544                build_target "mips32eb" &
     545                build_target "ppc32" &
     546                build_target "riscv64" &
     547                build_target "sparc64" &
     548                wait
    640549                ;;
    641550        "2-way")
    642                 everything run_2way
     551                prepare
     552                build_target "amd64" &
     553                build_target "arm32" &
     554                wait
     555
     556                build_target "arm64" &
     557                build_target "ia32" &
     558                wait
     559
     560                build_target "ia64" &
     561                build_target "mips32" &
     562                wait
     563
     564                build_target "mips32eb" &
     565                build_target "ppc32" &
     566                wait
     567
     568                build_target "riscv64" &
     569                build_target "sparc64" &
     570                wait
    643571                ;;
    644572        *)
Note: See TracChangeset for help on using the changeset viewer.