Changeset 322ac35c in mainline


Ignore:
Timestamp:
2013-07-16T13:01:08Z (11 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6c9f1a6
Parents:
cdc8a391
Message:

Allow non-superuser toolchain compilation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/toolchain.sh

    rcdc8a391 r322ac35c  
    6262GCC="gcc-${GCC_VERSION}.tar.bz2"
    6363GDB="gdb-${GDB_VERSION}.tar.bz2"
     64
     65REAL_INSTALL=true
     66INSTALL_DIR="${BASEDIR}/PKG"
    6467
    6568#
     
    135138        echo
    136139        echo "Syntax:"
    137         echo " $0 <platform>"
     140        echo " $0 [--no-install] <platform>"
    138141        echo
    139142        echo "Possible target platforms are:"
     
    152155        echo " 2-way      same as 'all', but 2-way parallel"
    153156        echo
    154         echo "The toolchain will be installed to the directory specified by"
    155         echo "the CROSS_PREFIX environment variable. If the variable is not"
    156         echo "defined, /usr/local/cross will be used by default."
     157        echo "The toolchain is installed into directory specified by the"
     158        echo "CROSS_PREFIX environment variable. If the variable is not"
     159        echo "defined, /usr/local/cross/ is used as default."
     160        echo "If --no-install is present, the toolchain still uses the"
     161        echo "CROSS_PREFIX as the target directory but the installation"
     162        echo "copies the files into PKG/ subdirectory without affecting"
     163        echo "the actual root file system. That is only useful if you do"
     164        echo "not want to run the script under the super user."
    157165        echo
    158166       
     
    301309       
    302310        echo ">>> Removing previous content"
    303         cleanup_dir "${PREFIX}"
     311        $REAL_INSTALL && cleanup_dir "${PREFIX}"
    304312        cleanup_dir "${WORKDIR}"
    305313       
    306         create_dir "${PREFIX}" "destination directory"
     314        $REAL_INSTALL && create_dir "${PREFIX}" "destination directory"
    307315        create_dir "${OBJDIR}" "GCC object directory"
    308316       
     
    315323        unpack_tarball "${BASEDIR}/${GDB}" "GDB"
    316324       
     325       
    317326        echo ">>> Processing binutils (${PLATFORM})"
    318327        cd "${BINUTILSDIR}"
     
    320329       
    321330        change_title "binutils: configure (${PLATFORM})"
    322         CFLAGS=-Wno-error ./configure "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --disable-nls --disable-werror
     331        CFLAGS=-Wno-error ./configure \
     332                "--target=${TARGET}" \
     333                "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" \
     334                --disable-nls --disable-werror
    323335        check_error $? "Error configuring binutils."
    324336       
    325337        change_title "binutils: make (${PLATFORM})"
    326         make all install
    327         check_error $? "Error compiling/installing binutils."
     338        make all
     339        check_error $? "Error compiling binutils."
     340       
     341        change_title "binutils: install (${PLATFORM})"
     342        if $REAL_INSTALL; then
     343                make install
     344        else
     345                make install "DESTDIR=${INSTALL_DIR}"
     346        fi
     347        check_error $? "Error installing binutils."
     348       
    328349       
    329350        echo ">>> Processing GCC (${PLATFORM})"
     
    332353       
    333354        change_title "GCC: configure (${PLATFORM})"
    334         "${GCCDIR}/configure" "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --with-gnu-as --with-gnu-ld --disable-nls --disable-threads --enable-languages=c,objc,c++,obj-c++ --disable-multilib --disable-libgcj --without-headers --disable-shared --enable-lto --disable-werror
     355        PATH="$PATH:${INSTALL_DIR}/${PREFIX}/bin" "${GCCDIR}/configure" \
     356                "--target=${TARGET}" \
     357                "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" \
     358                --with-gnu-as --with-gnu-ld --disable-nls --disable-threads \
     359                --enable-languages=c,objc,c++,obj-c++ \
     360                --disable-multilib --disable-libgcj --without-headers \
     361                --disable-shared --enable-lto --disable-werror
    335362        check_error $? "Error configuring GCC."
    336363       
    337364        change_title "GCC: make (${PLATFORM})"
    338         PATH="${PATH}:${PREFIX}/bin" make all-gcc install-gcc
    339         check_error $? "Error compiling/installing GCC."
     365        PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all-gcc
     366        check_error $? "Error compiling GCC."
     367       
     368        change_title "GCC: install (${PLATFORM})"
     369        if $REAL_INSTALL; then
     370                PATH="${PATH}:${PREFIX}/bin" make install-gcc
     371        else
     372                PATH="${PATH}:${INSTALL_DIR}/${PREFIX}/bin" make install-gcc "DESTDIR=${INSTALL_DIR}"
     373        fi
     374        check_error $? "Error installing GCC."
     375       
    340376       
    341377        echo ">>> Processing GDB (${PLATFORM})"
     
    344380       
    345381        change_title "GDB: configure (${PLATFORM})"
    346         ./configure "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-"
     382        PATH="$PATH:${INSTALL_DIR}/${PREFIX}/bin" ./configure \
     383                "--target=${TARGET}" \
     384                "--prefix=${PREFIX}" "--program-prefix=${TARGET}-"
    347385        check_error $? "Error configuring GDB."
    348386       
    349387        change_title "GDB: make (${PLATFORM})"
    350         make all install
    351         check_error $? "Error compiling/installing GDB."
     388        PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all
     389        check_error $? "Error compiling GDB."
     390       
     391        change_title "GDB: make (${PLATFORM})"
     392        if $REAL_INSTALL; then
     393                PATH="${PATH}:${PREFIX}/bin" make install
     394        else
     395                PATH="${PATH}:${INSTALL_DIR}/${PREFIX}/bin" make install "DESTDIR=${INSTALL_DIR}"
     396        fi
     397        check_error $? "Error installing GDB."
     398       
    352399       
    353400        cd "${BASEDIR}"
     
    360407        echo ">>> Cross-compiler for ${TARGET} installed."
    361408}
     409
     410if [ "$1" = "--no-install" ]; then
     411        REAL_INSTALL=false
     412        shift
     413fi
    362414
    363415if [ "$#" -lt "1" ]; then
Note: See TracChangeset for help on using the changeset viewer.