Changes in tools/toolchain.sh [12735849:285589b] in mainline


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/toolchain.sh

    r12735849 r285589b  
    3636        GCC_GMP_VERSION_NUM(__GNU_MP_VERSION, __GNU_MP_VERSION_MINOR, __GNU_MP_VERSION_PATCHLEVEL)
    3737
    38 #if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4, 3, 2)
     38#if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4,3,2)
    3939        choke me
    4040#endif
     
    5555BINUTILS_VERSION="2.23.1"
    5656BINUTILS_RELEASE=""
    57 BINUTILS_PATCHES="toolchain-binutils-2.23.1.patch"
    5857GCC_VERSION="4.8.1"
    59 GCC_PATCHES="toolchain-gcc-4.8.1-targets.patch toolchain-gcc-4.8.1-headers.patch"
    60 GDB_VERSION="7.6.1"
    61 GDB_PATCHES="toolchain-gdb-7.6.1.patch"
     58GDB_VERSION="7.6"
    6259
    6360BASEDIR="`pwd`"
    64 SRCDIR="$(readlink -f $(dirname "$0"))"
    6561BINUTILS="binutils-${BINUTILS_VERSION}${BINUTILS_RELEASE}.tar.bz2"
    6662GCC="gcc-${GCC_VERSION}.tar.bz2"
    6763GDB="gdb-${GDB_VERSION}.tar.bz2"
    68 
    69 REAL_INSTALL=true
    70 USE_HELENOS_TARGET=false
    71 INSTALL_DIR="${BASEDIR}/PKG"
    7264
    7365#
     
    143135        echo
    144136        echo "Syntax:"
    145         echo " $0 [--no-install] [--helenos-target] <platform>"
     137        echo " $0 <platform>"
    146138        echo
    147139        echo "Possible target platforms are:"
     
    160152        echo " 2-way      same as 'all', but 2-way parallel"
    161153        echo
    162         echo "The toolchain is installed into directory specified by the"
    163         echo "CROSS_PREFIX environment variable. If the variable is not"
    164         echo "defined, /usr/local/cross/ is used as default."
    165         echo
    166         echo "If --no-install is present, the toolchain still uses the"
    167         echo "CROSS_PREFIX as the target directory but the installation"
    168         echo "copies the files into PKG/ subdirectory without affecting"
    169         echo "the actual root file system. That is only useful if you do"
    170         echo "not want to run the script under the super user."
    171         echo
    172         echo "The --helenos-target will build HelenOS-specific toolchain"
    173         echo "(i.e. it will use *-helenos-* triplet instead of *-linux-*)."
    174         echo "This toolchain is installed into /usr/local/cross-helenos by"
    175         echo "default. The settings can be changed by setting environment"
    176         echo "variable CROSS_HELENOS_PREFIX."
    177         echo "Using the HelenOS-specific toolchain is still an experimental"
    178         echo "feature that is not fully supported."
     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."
    179157        echo
    180158       
     
    314292}
    315293
    316 patch_sources() {
    317         PATCH_FILE="$1"
    318         PATCH_STRIP="$2"
    319         DESC="$3"
    320        
    321         change_title "Patching ${DESC}"
    322         echo " >>> Patching ${DESC} with ${PATCH_FILE}"
    323        
    324         patch -t "-p${PATCH_STRIP}" <"$PATCH_FILE"
    325         check_error $? "Error patching ${DESC}."
    326 }
    327 
    328294prepare() {
    329295        show_dependencies
     
    337303        download_fetch "${BINUTILS_SOURCE}" "${BINUTILS}" "33adb18c3048d057ac58d07a3f1adb38"
    338304        download_fetch "${GCC_SOURCE}" "${GCC}" "3b2386c114cd74185aa3754b58a79304"
    339         download_fetch "${GDB_SOURCE}" "${GDB}" "fbc4dab4181e6e9937075b43a4ce2732"
    340 }
    341 
    342 set_target_from_platform() {
    343         case "$1" in
    344                 "amd64")
    345                         LINUX_TARGET="amd64-linux-gnu"
    346                         HELENOS_TARGET="amd64-helenos"
    347                         ;;
    348                 "arm32")
    349                         LINUX_TARGET="arm-linux-gnueabi"
    350                         HELENOS_TARGET="arm-helenos-gnueabi"
    351                         ;;
    352                 "ia32")
    353                         LINUX_TARGET="i686-pc-linux-gnu"
    354                         HELENOS_TARGET="i686-pc-helenos"
    355                         ;;
    356                 "ia64")
    357                         LINUX_TARGET="ia64-pc-linux-gnu"
    358                         HELENOS_TARGET="ia64-pc-helenos"
    359                         ;;
    360                 "mips32")
    361                         LINUX_TARGET="mipsel-linux-gnu"
    362                         HELENOS_TARGET="mipsel-helenos"
    363                         ;;
    364                 "mips32eb")
    365                         LINUX_TARGET="mips-linux-gnu"
    366                         HELENOS_TARGET="mips-helenos"
    367                         ;;
    368                 "mips64")
    369                         LINUX_TARGET="mips64el-linux-gnu"
    370                         HELENOS_TARGET="mips64el-helenos"
    371                         ;;
    372                 "ppc32")
    373                         LINUX_TARGET="ppc-linux-gnu"
    374                         HELENOS_TARGET="ppc-helenos"
    375                         ;;
    376                 "ppc64")
    377                         LINUX_TARGET="ppc64-linux-gnu"
    378                         HELENOS_TARGET="ppc64-helenos"
    379                         ;;
    380                 "sparc64")
    381                         LINUX_TARGET="sparc64-linux-gnu"
    382                         HELENOS_TARGET="sparc64-helenos"
    383                         ;;
    384                 *)
    385                         check_error 1 "No target known for $1."
    386                         ;;
    387         esac
     305        download_fetch "${GDB_SOURCE}" "${GDB}" "fda57170e4d11cdde74259ca575412a8"
    388306}
    389307
    390308build_target() {
    391309        PLATFORM="$1"
    392         # This sets the *_TARGET variables
    393         set_target_from_platform "$PLATFORM"
    394         if $USE_HELENOS_TARGET; then
    395                 TARGET="$HELENOS_TARGET"
    396         else
    397                 TARGET="$LINUX_TARGET"
    398         fi
     310        TARGET="$2"
    399311       
    400312        WORKDIR="${BASEDIR}/${PLATFORM}"
     
    407319                CROSS_PREFIX="/usr/local/cross"
    408320        fi
    409         if [ -z "${CROSS_HELENOS_PREFIX}" ] ; then
    410                 CROSS_HELENOS_PREFIX="/usr/local/cross-helenos"
    411         fi
    412        
    413         if $USE_HELENOS_TARGET; then
    414                 PREFIX="${CROSS_HELENOS_PREFIX}/${PLATFORM}"
    415         else
    416                 PREFIX="${CROSS_PREFIX}/${PLATFORM}"
    417         fi
     321       
     322        PREFIX="${CROSS_PREFIX}/${PLATFORM}"
    418323       
    419324        echo ">>> Downloading tarballs"
     
    423328       
    424329        echo ">>> Removing previous content"
    425         $REAL_INSTALL && cleanup_dir "${PREFIX}"
     330        cleanup_dir "${PREFIX}"
    426331        cleanup_dir "${WORKDIR}"
    427332       
    428         $REAL_INSTALL && create_dir "${PREFIX}" "destination directory"
     333        create_dir "${PREFIX}" "destination directory"
    429334        create_dir "${OBJDIR}" "GCC object directory"
    430335       
     
    439344        unpack_tarball "${BASEDIR}/${GDB}" "GDB"
    440345       
    441         echo ">>> Applying patches"
    442         for p in $BINUTILS_PATCHES; do
    443                 patch_sources "${SRCDIR}/${p}" 0 "binutils"
    444         done
    445         for p in $GCC_PATCHES; do
    446                 patch_sources "${SRCDIR}/${p}" 0 "GCC"
    447         done
    448         for p in $GDB_PATCHES; do
    449                 patch_sources "${SRCDIR}/${p}" 0 "GDB"
    450         done
    451        
    452346        echo ">>> Processing binutils (${PLATFORM})"
    453347        cd "${BINUTILSDIR}"
     
    455349       
    456350        change_title "binutils: configure (${PLATFORM})"
    457         CFLAGS=-Wno-error ./configure \
    458                 "--target=${TARGET}" \
    459                 "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" \
    460                 --disable-nls --disable-werror
     351        CFLAGS=-Wno-error ./configure "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --disable-nls --disable-werror
    461352        check_error $? "Error configuring binutils."
    462353       
    463354        change_title "binutils: make (${PLATFORM})"
    464         make all
    465         check_error $? "Error compiling binutils."
    466        
    467         change_title "binutils: install (${PLATFORM})"
    468         if $REAL_INSTALL; then
    469                 make install
    470         else
    471                 make install "DESTDIR=${INSTALL_DIR}"
    472         fi
    473         check_error $? "Error installing binutils."
    474        
     355        make all install
     356        check_error $? "Error compiling/installing binutils."
    475357       
    476358        echo ">>> Processing GCC (${PLATFORM})"
     
    479361       
    480362        change_title "GCC: configure (${PLATFORM})"
    481         PATH="$PATH:${INSTALL_DIR}/${PREFIX}/bin" "${GCCDIR}/configure" \
    482                 "--target=${TARGET}" \
    483                 "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" \
    484                 --with-gnu-as --with-gnu-ld --disable-nls --disable-threads \
    485                 --enable-languages=c,objc,c++,obj-c++ \
    486                 --disable-multilib --disable-libgcj --without-headers \
    487                 --disable-shared --enable-lto --disable-werror
     363        "${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
    488364        check_error $? "Error configuring GCC."
    489365       
    490366        change_title "GCC: make (${PLATFORM})"
    491         PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all-gcc
    492         check_error $? "Error compiling GCC."
    493        
    494         change_title "GCC: install (${PLATFORM})"
    495         if $REAL_INSTALL; then
    496                 PATH="${PATH}:${PREFIX}/bin" make install-gcc
    497         else
    498                 PATH="${PATH}:${INSTALL_DIR}/${PREFIX}/bin" make install-gcc "DESTDIR=${INSTALL_DIR}"
    499         fi
    500         check_error $? "Error installing GCC."
    501        
     367        PATH="${PATH}:${PREFIX}/bin" make all-gcc install-gcc
     368        check_error $? "Error compiling/installing GCC."
    502369       
    503370        echo ">>> Processing GDB (${PLATFORM})"
     
    506373       
    507374        change_title "GDB: configure (${PLATFORM})"
    508         PATH="$PATH:${INSTALL_DIR}/${PREFIX}/bin" ./configure \
    509                 "--target=${TARGET}" \
    510                 "--prefix=${PREFIX}" "--program-prefix=${TARGET}-"
     375        ./configure "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-"
    511376        check_error $? "Error configuring GDB."
    512377       
    513378        change_title "GDB: make (${PLATFORM})"
    514         PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all
    515         check_error $? "Error compiling GDB."
    516        
    517         change_title "GDB: make (${PLATFORM})"
    518         if $REAL_INSTALL; then
    519                 PATH="${PATH}:${PREFIX}/bin" make install
    520         else
    521                 PATH="${PATH}:${INSTALL_DIR}/${PREFIX}/bin" make install "DESTDIR=${INSTALL_DIR}"
    522         fi
    523         check_error $? "Error installing GDB."
    524        
     379        make all install
     380        check_error $? "Error compiling/installing GDB."
    525381       
    526382        cd "${BASEDIR}"
     
    533389        echo ">>> Cross-compiler for ${TARGET} installed."
    534390}
    535 
    536 while [ "$#" -gt 1 ]; do
    537         case "$1" in
    538                 --no-install)
    539                         REAL_INSTALL=false
    540                         shift
    541                         ;;
    542                 --helenos-target)
    543                         USE_HELENOS_TARGET=true
    544                         shift
    545                         ;;
    546                 *)
    547                         show_usage
    548                         ;;
    549         esac
    550 done
    551391
    552392if [ "$#" -lt "1" ]; then
     
    555395
    556396case "$1" in
    557         amd64|arm32|ia32|ia64|mips32|mips32eb|mips64|ppc32|ppc64|sparc64)
    558                 prepare
    559                 build_target "$1"
     397        "amd64")
     398                prepare
     399                build_target "amd64" "amd64-linux-gnu"
     400                ;;
     401        "arm32")
     402                prepare
     403                build_target "arm32" "arm-linux-gnueabi"
     404                ;;
     405        "ia32")
     406                prepare
     407                build_target "ia32" "i686-pc-linux-gnu"
     408                ;;
     409        "ia64")
     410                prepare
     411                build_target "ia64" "ia64-pc-linux-gnu"
     412                ;;
     413        "mips32")
     414                prepare
     415                build_target "mips32" "mipsel-linux-gnu"
     416                ;;
     417        "mips32eb")
     418                prepare
     419                build_target "mips32eb" "mips-linux-gnu"
     420                ;;
     421        "mips64")
     422                prepare
     423                build_target "mips64" "mips64el-linux-gnu"
     424                ;;
     425        "ppc32")
     426                prepare
     427                build_target "ppc32" "ppc-linux-gnu"
     428                ;;
     429        "ppc64")
     430                prepare
     431                build_target "ppc64" "ppc64-linux-gnu"
     432                ;;
     433        "sparc64")
     434                prepare
     435                build_target "sparc64" "sparc64-linux-gnu"
    560436                ;;
    561437        "all")
    562438                prepare
    563                 build_target "amd64"
    564                 build_target "arm32"
    565                 build_target "ia32"
    566                 build_target "ia64"
    567                 build_target "mips32"
    568                 build_target "mips32eb"
    569                 build_target "mips64"
    570                 build_target "ppc32"
    571                 build_target "ppc64"
    572                 build_target "sparc64"
     439                build_target "amd64" "amd64-linux-gnu"
     440                build_target "arm32" "arm-linux-gnueabi"
     441                build_target "ia32" "i686-pc-linux-gnu"
     442                build_target "ia64" "ia64-pc-linux-gnu"
     443                build_target "mips32" "mipsel-linux-gnu"
     444                build_target "mips32eb" "mips-linux-gnu"
     445                build_target "mips64" "mips64el-linux-gnu"
     446                build_target "ppc32" "ppc-linux-gnu"
     447                build_target "ppc64" "ppc64-linux-gnu"
     448                build_target "sparc64" "sparc64-linux-gnu"
    573449                ;;
    574450        "parallel")
    575451                prepare
    576                 build_target "amd64" &
    577                 build_target "arm32" &
    578                 build_target "ia32" &
    579                 build_target "ia64" &
    580                 build_target "mips32" &
    581                 build_target "mips32eb" &
    582                 build_target "mips64" &
    583                 build_target "ppc32" &
    584                 build_target "ppc64" &
    585                 build_target "sparc64" &
     452                build_target "amd64" "amd64-linux-gnu" &
     453                build_target "arm32" "arm-linux-gnueabi" &
     454                build_target "ia32" "i686-pc-linux-gnu" &
     455                build_target "ia64" "ia64-pc-linux-gnu" &
     456                build_target "mips32" "mipsel-linux-gnu" &
     457                build_target "mips32eb" "mips-linux-gnu" &
     458                build_target "mips64" "mips64el-linux-gnu" &
     459                build_target "ppc32" "ppc-linux-gnu" &
     460                build_target "ppc64" "ppc64-linux-gnu" &
     461                build_target "sparc64" "sparc64-linux-gnu" &
    586462                wait
    587463                ;;
    588464        "2-way")
    589465                prepare
    590                 build_target "amd64" &
    591                 build_target "arm32" &
    592                 wait
    593                
    594                 build_target "ia32" &
    595                 build_target "ia64" &
    596                 wait
    597                
    598                 build_target "mips32" &
    599                 build_target "mips32eb" &
    600                 wait
    601                
    602                 build_target "mips64" &
    603                 build_target "ppc32" &
    604                 wait
    605                
    606                 build_target "ppc64" &
    607                 build_target "sparc64" &
     466                build_target "amd64" "amd64-linux-gnu" &
     467                build_target "arm32" "arm-linux-gnueabi" &
     468                wait
     469               
     470                build_target "ia32" "i686-pc-linux-gnu" &
     471                build_target "ia64" "ia64-pc-linux-gnu" &
     472                wait
     473               
     474                build_target "mips32" "mipsel-linux-gnu" &
     475                build_target "mips32eb" "mips-linux-gnu" &
     476                wait
     477               
     478                build_target "mips64" "mips64el-linux-gnu" &
     479                build_target "ppc32" "ppc-linux-gnu" &
     480                wait
     481               
     482                build_target "ppc64" "ppc64-linux-gnu" &
     483                build_target "sparc64" "sparc64-linux-gnu" &
    608484                wait
    609485                ;;
Note: See TracChangeset for help on using the changeset viewer.