Changeset 4c14b88 in mainline for tools/toolchain.sh
- Timestamp:
- 2013-12-31T07:57:14Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1b973dc
- Parents:
- 6297465 (diff), 208b5f5 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/toolchain.sh
r6297465 r4c14b88 36 36 GCC_GMP_VERSION_NUM(__GNU_MP_VERSION, __GNU_MP_VERSION_MINOR, __GNU_MP_VERSION_PATCHLEVEL) 37 37 38 #if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4, 3,2)38 #if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4, 3, 2) 39 39 choke me 40 40 #endif … … 55 55 BINUTILS_VERSION="2.23.1" 56 56 BINUTILS_RELEASE="" 57 BINUTILS_PATCHES="toolchain-binutils-2.23.1.patch" 57 58 GCC_VERSION="4.8.1" 58 GDB_VERSION="7.6" 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" 59 62 60 63 BASEDIR="`pwd`" 64 SRCDIR="$(readlink -f $(dirname "$0"))" 61 65 BINUTILS="binutils-${BINUTILS_VERSION}${BINUTILS_RELEASE}.tar.bz2" 62 66 GCC="gcc-${GCC_VERSION}.tar.bz2" 63 67 GDB="gdb-${GDB_VERSION}.tar.bz2" 68 69 REAL_INSTALL=true 70 USE_HELENOS_TARGET=false 71 INSTALL_DIR="${BASEDIR}/PKG" 64 72 65 73 # … … 135 143 echo 136 144 echo "Syntax:" 137 echo " $0 <platform>"145 echo " $0 [--no-install] [--helenos-target] <platform>" 138 146 echo 139 147 echo "Possible target platforms are:" … … 147 155 echo " ppc32 32-bit PowerPC" 148 156 echo " ppc64 64-bit PowerPC" 157 echo " sparc32 SPARC V8" 149 158 echo " sparc64 SPARC V9" 150 159 echo " all build all targets" … … 152 161 echo " 2-way same as 'all', but 2-way parallel" 153 162 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." 163 echo "The toolchain is installed into directory specified by the" 164 echo "CROSS_PREFIX environment variable. If the variable is not" 165 echo "defined, /usr/local/cross/ is used as default." 166 echo 167 echo "If --no-install is present, the toolchain still uses the" 168 echo "CROSS_PREFIX as the target directory but the installation" 169 echo "copies the files into PKG/ subdirectory without affecting" 170 echo "the actual root file system. That is only useful if you do" 171 echo "not want to run the script under the super user." 172 echo 173 echo "The --helenos-target will build HelenOS-specific toolchain" 174 echo "(i.e. it will use *-helenos-* triplet instead of *-linux-*)." 175 echo "This toolchain is installed into /usr/local/cross-helenos by" 176 echo "default. The settings can be changed by setting environment" 177 echo "variable CROSS_HELENOS_PREFIX." 178 echo "Using the HelenOS-specific toolchain is still an experimental" 179 echo "feature that is not fully supported." 157 180 echo 158 181 … … 292 315 } 293 316 317 patch_sources() { 318 PATCH_FILE="$1" 319 PATCH_STRIP="$2" 320 DESC="$3" 321 322 change_title "Patching ${DESC}" 323 echo " >>> Patching ${DESC} with ${PATCH_FILE}" 324 325 patch -t "-p${PATCH_STRIP}" <"$PATCH_FILE" 326 check_error $? "Error patching ${DESC}." 327 } 328 294 329 prepare() { 295 330 show_dependencies … … 303 338 download_fetch "${BINUTILS_SOURCE}" "${BINUTILS}" "33adb18c3048d057ac58d07a3f1adb38" 304 339 download_fetch "${GCC_SOURCE}" "${GCC}" "3b2386c114cd74185aa3754b58a79304" 305 download_fetch "${GDB_SOURCE}" "${GDB}" "fda57170e4d11cdde74259ca575412a8" 340 download_fetch "${GDB_SOURCE}" "${GDB}" "fbc4dab4181e6e9937075b43a4ce2732" 341 } 342 343 set_target_from_platform() { 344 case "$1" in 345 "amd64") 346 LINUX_TARGET="amd64-linux-gnu" 347 HELENOS_TARGET="amd64-helenos" 348 ;; 349 "arm32") 350 LINUX_TARGET="arm-linux-gnueabi" 351 HELENOS_TARGET="arm-helenos-gnueabi" 352 ;; 353 "ia32") 354 LINUX_TARGET="i686-pc-linux-gnu" 355 HELENOS_TARGET="i686-pc-helenos" 356 ;; 357 "ia64") 358 LINUX_TARGET="ia64-pc-linux-gnu" 359 HELENOS_TARGET="ia64-pc-helenos" 360 ;; 361 "mips32") 362 LINUX_TARGET="mipsel-linux-gnu" 363 HELENOS_TARGET="mipsel-helenos" 364 ;; 365 "mips32eb") 366 LINUX_TARGET="mips-linux-gnu" 367 HELENOS_TARGET="mips-helenos" 368 ;; 369 "mips64") 370 LINUX_TARGET="mips64el-linux-gnu" 371 HELENOS_TARGET="mips64el-helenos" 372 ;; 373 "ppc32") 374 LINUX_TARGET="ppc-linux-gnu" 375 HELENOS_TARGET="ppc-helenos" 376 ;; 377 "ppc64") 378 LINUX_TARGET="ppc64-linux-gnu" 379 HELENOS_TARGET="ppc64-helenos" 380 ;; 381 "sparc32") 382 LINUX_TARGET="sparc-leon3-linux-gnu" 383 HELENOS_TARGET="sparc-leon3-helenos" 384 ;; 385 "sparc64") 386 LINUX_TARGET="sparc64-linux-gnu" 387 HELENOS_TARGET="sparc64-helenos" 388 ;; 389 *) 390 check_error 1 "No target known for $1." 391 ;; 392 esac 306 393 } 307 394 308 395 build_target() { 309 396 PLATFORM="$1" 310 TARGET="$2" 397 # This sets the *_TARGET variables 398 set_target_from_platform "$PLATFORM" 399 if $USE_HELENOS_TARGET; then 400 TARGET="$HELENOS_TARGET" 401 else 402 TARGET="$LINUX_TARGET" 403 fi 311 404 312 405 WORKDIR="${BASEDIR}/${PLATFORM}" … … 319 412 CROSS_PREFIX="/usr/local/cross" 320 413 fi 321 322 PREFIX="${CROSS_PREFIX}/${PLATFORM}" 414 if [ -z "${CROSS_HELENOS_PREFIX}" ] ; then 415 CROSS_HELENOS_PREFIX="/usr/local/cross-helenos" 416 fi 417 418 if $USE_HELENOS_TARGET; then 419 PREFIX="${CROSS_HELENOS_PREFIX}/${PLATFORM}" 420 else 421 PREFIX="${CROSS_PREFIX}/${PLATFORM}" 422 fi 323 423 324 424 echo ">>> Downloading tarballs" … … 328 428 329 429 echo ">>> Removing previous content" 330 cleanup_dir "${PREFIX}"430 $REAL_INSTALL && cleanup_dir "${PREFIX}" 331 431 cleanup_dir "${WORKDIR}" 332 432 333 create_dir "${PREFIX}" "destination directory"433 $REAL_INSTALL && create_dir "${PREFIX}" "destination directory" 334 434 create_dir "${OBJDIR}" "GCC object directory" 335 435 … … 344 444 unpack_tarball "${BASEDIR}/${GDB}" "GDB" 345 445 446 echo ">>> Applying patches" 447 for p in $BINUTILS_PATCHES; do 448 patch_sources "${SRCDIR}/${p}" 0 "binutils" 449 done 450 for p in $GCC_PATCHES; do 451 patch_sources "${SRCDIR}/${p}" 0 "GCC" 452 done 453 for p in $GDB_PATCHES; do 454 patch_sources "${SRCDIR}/${p}" 0 "GDB" 455 done 456 346 457 echo ">>> Processing binutils (${PLATFORM})" 347 458 cd "${BINUTILSDIR}" … … 349 460 350 461 change_title "binutils: configure (${PLATFORM})" 351 CFLAGS=-Wno-error ./configure "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --disable-nls --disable-werror 462 CFLAGS=-Wno-error ./configure \ 463 "--target=${TARGET}" \ 464 "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" \ 465 --disable-nls --disable-werror 352 466 check_error $? "Error configuring binutils." 353 467 354 468 change_title "binutils: make (${PLATFORM})" 355 make all install 356 check_error $? "Error compiling/installing binutils." 469 make all 470 check_error $? "Error compiling binutils." 471 472 change_title "binutils: install (${PLATFORM})" 473 if $REAL_INSTALL; then 474 make install 475 else 476 make install "DESTDIR=${INSTALL_DIR}" 477 fi 478 check_error $? "Error installing binutils." 479 357 480 358 481 echo ">>> Processing GCC (${PLATFORM})" … … 361 484 362 485 change_title "GCC: configure (${PLATFORM})" 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 486 PATH="$PATH:${INSTALL_DIR}/${PREFIX}/bin" "${GCCDIR}/configure" \ 487 "--target=${TARGET}" \ 488 "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" \ 489 --with-gnu-as --with-gnu-ld --disable-nls --disable-threads \ 490 --enable-languages=c,objc,c++,obj-c++ \ 491 --disable-multilib --disable-libgcj --without-headers \ 492 --disable-shared --enable-lto --disable-werror 364 493 check_error $? "Error configuring GCC." 365 494 366 495 change_title "GCC: make (${PLATFORM})" 367 PATH="${PATH}:${PREFIX}/bin" make all-gcc install-gcc 368 check_error $? "Error compiling/installing GCC." 496 PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all-gcc 497 check_error $? "Error compiling GCC." 498 499 change_title "GCC: install (${PLATFORM})" 500 if $REAL_INSTALL; then 501 PATH="${PATH}:${PREFIX}/bin" make install-gcc 502 else 503 PATH="${PATH}:${INSTALL_DIR}/${PREFIX}/bin" make install-gcc "DESTDIR=${INSTALL_DIR}" 504 fi 505 check_error $? "Error installing GCC." 506 369 507 370 508 echo ">>> Processing GDB (${PLATFORM})" … … 373 511 374 512 change_title "GDB: configure (${PLATFORM})" 375 ./configure "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" 513 PATH="$PATH:${INSTALL_DIR}/${PREFIX}/bin" ./configure \ 514 "--target=${TARGET}" \ 515 "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" 376 516 check_error $? "Error configuring GDB." 377 517 378 518 change_title "GDB: make (${PLATFORM})" 379 make all install 380 check_error $? "Error compiling/installing GDB." 519 PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all 520 check_error $? "Error compiling GDB." 521 522 change_title "GDB: make (${PLATFORM})" 523 if $REAL_INSTALL; then 524 PATH="${PATH}:${PREFIX}/bin" make install 525 else 526 PATH="${PATH}:${INSTALL_DIR}/${PREFIX}/bin" make install "DESTDIR=${INSTALL_DIR}" 527 fi 528 check_error $? "Error installing GDB." 529 381 530 382 531 cd "${BASEDIR}" … … 389 538 echo ">>> Cross-compiler for ${TARGET} installed." 390 539 } 540 541 while [ "$#" -gt 1 ]; do 542 case "$1" in 543 --no-install) 544 REAL_INSTALL=false 545 shift 546 ;; 547 --helenos-target) 548 USE_HELENOS_TARGET=true 549 shift 550 ;; 551 *) 552 show_usage 553 ;; 554 esac 555 done 391 556 392 557 if [ "$#" -lt "1" ]; then … … 395 560 396 561 case "$1" in 397 "amd64")562 amd64|arm32|ia32|ia64|mips32|mips32eb|mips64|ppc32|ppc64|sparc32|sparc64) 398 563 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" 564 build_target "$1" 436 565 ;; 437 566 "all") 438 567 prepare 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" 568 build_target "amd64" 569 build_target "arm32" 570 build_target "ia32" 571 build_target "ia64" 572 build_target "mips32" 573 build_target "mips32eb" 574 build_target "mips64" 575 build_target "ppc32" 576 build_target "ppc64" 577 build_target "sparc32" 578 build_target "sparc64" 449 579 ;; 450 580 "parallel") 451 581 prepare 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" & 582 build_target "amd64" & 583 build_target "arm32" & 584 build_target "ia32" & 585 build_target "ia64" & 586 build_target "mips32" & 587 build_target "mips32eb" & 588 build_target "mips64" & 589 build_target "ppc32" & 590 build_target "ppc64" & 591 build_target "sparc32" & 592 build_target "sparc64" & 462 593 wait 463 594 ;; 464 595 "2-way") 465 596 prepare 466 build_target "amd64" "amd64-linux-gnu"&467 build_target "arm32" "arm-linux-gnueabi"&597 build_target "amd64" & 598 build_target "arm32" & 468 599 wait 469 600 470 build_target "ia32" "i686-pc-linux-gnu"&471 build_target "ia64" "ia64-pc-linux-gnu"&601 build_target "ia32" & 602 build_target "ia64" & 472 603 wait 473 604 474 build_target "mips32" "mipsel-linux-gnu"&475 build_target "mips32eb" "mips-linux-gnu"&605 build_target "mips32" & 606 build_target "mips32eb" & 476 607 wait 477 608 478 build_target "mips64" "mips64el-linux-gnu"&479 build_target "ppc32" "ppc-linux-gnu"&609 build_target "mips64" & 610 build_target "ppc32" & 480 611 wait 481 612 482 build_target "ppc64" "ppc64-linux-gnu" & 483 build_target "sparc64" "sparc64-linux-gnu" & 613 build_target "ppc64" & 614 build_target "sparc32" & 615 wait 616 617 build_target "sparc64" & 484 618 wait 485 619 ;;
Note:
See TracChangeset
for help on using the changeset viewer.