Changes in tools/toolchain.sh [9f9450b:d7f2cd6] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/toolchain.sh
r9f9450b rd7f2cd6 55 55 BINUTILS_VERSION="2.23.1" 56 56 BINUTILS_RELEASE="" 57 BINUTILS_PATCHES="toolchain-binutils-2.23.1.patch"58 57 GCC_VERSION="4.8.1" 59 GCC_PATCHES="toolchain-gcc-4.8.1-targets.patch toolchain-gcc-4.8.1-headers.patch"60 58 GDB_VERSION="7.6.1" 61 GDB_PATCHES="toolchain-gdb-7.6.1.patch"62 59 63 60 BASEDIR="`pwd`" … … 65 62 GCC="gcc-${GCC_VERSION}.tar.bz2" 66 63 GDB="gdb-${GDB_VERSION}.tar.bz2" 67 68 REAL_INSTALL=true69 USE_HELENOS_TARGET=false70 INSTALL_DIR="${BASEDIR}/PKG"71 64 72 65 # … … 142 135 echo 143 136 echo "Syntax:" 144 echo " $0 [--no-install] [--helenos-target]<platform>"137 echo " $0 <platform>" 145 138 echo 146 139 echo "Possible target platforms are:" … … 159 152 echo " 2-way same as 'all', but 2-way parallel" 160 153 echo 161 echo "The toolchain is installed into directory specified by the" 162 echo "CROSS_PREFIX environment variable. If the variable is not" 163 echo "defined, /usr/local/cross/ is used as default." 164 echo 165 echo "If --no-install is present, the toolchain still uses the" 166 echo "CROSS_PREFIX as the target directory but the installation" 167 echo "copies the files into PKG/ subdirectory without affecting" 168 echo "the actual root file system. That is only useful if you do" 169 echo "not want to run the script under the super user." 170 echo 171 echo "The --helenos-target will build HelenOS-specific toolchain" 172 echo "(i.e. it will use *-helenos-* triplet instead of *-linux-*)." 173 echo "This toolchain is installed into /usr/local/cross-helenos by" 174 echo "default. The settings can be changed by setting environment" 175 echo "variable CROSS_HELENOS_PREFIX." 176 echo "Using the HelenOS-specific toolchain is still an experimental" 177 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." 178 157 echo 179 158 … … 313 292 } 314 293 315 patch_sources() {316 PATCH_FILE="$1"317 PATCH_STRIP="$2"318 DESC="$3"319 320 change_title "Patching ${DESC}"321 echo " >>> Patching ${DESC} with ${PATCH_FILE}"322 323 patch -t "-p${PATCH_STRIP}" <"$PATCH_FILE"324 check_error $? "Error patching ${DESC}."325 }326 327 294 prepare() { 328 295 show_dependencies … … 339 306 } 340 307 341 set_target_from_platform() {342 case "$1" in343 "amd64")344 LINUX_TARGET="amd64-linux-gnu"345 HELENOS_TARGET="amd64-helenos"346 ;;347 "arm32")348 LINUX_TARGET="arm-linux-gnueabi"349 HELENOS_TARGET="arm-helenos-gnueabi"350 ;;351 "ia32")352 LINUX_TARGET="i686-pc-linux-gnu"353 HELENOS_TARGET="i686-pc-helenos"354 ;;355 "ia64")356 LINUX_TARGET="ia64-pc-linux-gnu"357 HELENOS_TARGET="ia64-pc-helenos"358 ;;359 "mips32")360 LINUX_TARGET="mipsel-linux-gnu"361 HELENOS_TARGET="mipsel-helenos"362 ;;363 "mips32eb")364 LINUX_TARGET="mips-linux-gnu"365 HELENOS_TARGET="mips-helenos"366 ;;367 "mips64")368 LINUX_TARGET="mips64el-linux-gnu"369 HELENOS_TARGET="mips64el-helenos"370 ;;371 "ppc32")372 LINUX_TARGET="ppc-linux-gnu"373 HELENOS_TARGET="ppc-helenos"374 ;;375 "ppc64")376 LINUX_TARGET="ppc64-linux-gnu"377 HELENOS_TARGET="ppc64-helenos"378 ;;379 "sparc64")380 LINUX_TARGET="sparc64-linux-gnu"381 HELENOS_TARGET="sparc64-helenos"382 ;;383 *)384 check_error 1 "No target known for $1."385 ;;386 esac387 }388 389 308 build_target() { 390 309 PLATFORM="$1" 391 # This sets the *_TARGET variables 392 set_target_from_platform "$PLATFORM" 393 if $USE_HELENOS_TARGET; then 394 TARGET="$HELENOS_TARGET" 395 else 396 TARGET="$LINUX_TARGET" 397 fi 310 TARGET="$2" 398 311 399 312 WORKDIR="${BASEDIR}/${PLATFORM}" … … 406 319 CROSS_PREFIX="/usr/local/cross" 407 320 fi 408 if [ -z "${CROSS_HELENOS_PREFIX}" ] ; then 409 CROSS_HELENOS_PREFIX="/usr/local/cross-helenos" 410 fi 411 412 if $USE_HELENOS_TARGET; then 413 PREFIX="${CROSS_HELENOS_PREFIX}/${PLATFORM}" 414 else 415 PREFIX="${CROSS_PREFIX}/${PLATFORM}" 416 fi 321 322 PREFIX="${CROSS_PREFIX}/${PLATFORM}" 417 323 418 324 echo ">>> Downloading tarballs" … … 422 328 423 329 echo ">>> Removing previous content" 424 $REAL_INSTALL &&cleanup_dir "${PREFIX}"330 cleanup_dir "${PREFIX}" 425 331 cleanup_dir "${WORKDIR}" 426 332 427 $REAL_INSTALL &&create_dir "${PREFIX}" "destination directory"333 create_dir "${PREFIX}" "destination directory" 428 334 create_dir "${OBJDIR}" "GCC object directory" 429 335 … … 438 344 unpack_tarball "${BASEDIR}/${GDB}" "GDB" 439 345 440 echo ">>> Applying patches"441 for p in $BINUTILS_PATCHES; do442 patch_sources "${BASEDIR}/${p}" 0 "binutils"443 done444 for p in $GCC_PATCHES; do445 patch_sources "${BASEDIR}/${p}" 0 "GCC"446 done447 for p in $GDB_PATCHES; do448 patch_sources "${BASEDIR}/${p}" 0 "GDB"449 done450 451 346 echo ">>> Processing binutils (${PLATFORM})" 452 347 cd "${BINUTILSDIR}" … … 454 349 455 350 change_title "binutils: configure (${PLATFORM})" 456 CFLAGS=-Wno-error ./configure \ 457 "--target=${TARGET}" \ 458 "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" \ 459 --disable-nls --disable-werror 351 CFLAGS=-Wno-error ./configure "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --disable-nls --disable-werror 460 352 check_error $? "Error configuring binutils." 461 353 462 354 change_title "binutils: make (${PLATFORM})" 463 make all 464 check_error $? "Error compiling binutils." 465 466 change_title "binutils: install (${PLATFORM})" 467 if $REAL_INSTALL; then 468 make install 469 else 470 make install "DESTDIR=${INSTALL_DIR}" 471 fi 472 check_error $? "Error installing binutils." 473 355 make all install 356 check_error $? "Error compiling/installing binutils." 474 357 475 358 echo ">>> Processing GCC (${PLATFORM})" … … 478 361 479 362 change_title "GCC: configure (${PLATFORM})" 480 PATH="$PATH:${INSTALL_DIR}/${PREFIX}/bin" "${GCCDIR}/configure" \ 481 "--target=${TARGET}" \ 482 "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" \ 483 --with-gnu-as --with-gnu-ld --disable-nls --disable-threads \ 484 --enable-languages=c,objc,c++,obj-c++ \ 485 --disable-multilib --disable-libgcj --without-headers \ 486 --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 487 364 check_error $? "Error configuring GCC." 488 365 489 366 change_title "GCC: make (${PLATFORM})" 490 PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all-gcc 491 check_error $? "Error compiling GCC." 492 493 change_title "GCC: install (${PLATFORM})" 494 if $REAL_INSTALL; then 495 PATH="${PATH}:${PREFIX}/bin" make install-gcc 496 else 497 PATH="${PATH}:${INSTALL_DIR}/${PREFIX}/bin" make install-gcc "DESTDIR=${INSTALL_DIR}" 498 fi 499 check_error $? "Error installing GCC." 500 367 PATH="${PATH}:${PREFIX}/bin" make all-gcc install-gcc 368 check_error $? "Error compiling/installing GCC." 501 369 502 370 echo ">>> Processing GDB (${PLATFORM})" … … 505 373 506 374 change_title "GDB: configure (${PLATFORM})" 507 PATH="$PATH:${INSTALL_DIR}/${PREFIX}/bin" ./configure \ 508 "--target=${TARGET}" \ 509 "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" 375 ./configure "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" 510 376 check_error $? "Error configuring GDB." 511 377 512 378 change_title "GDB: make (${PLATFORM})" 513 PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all 514 check_error $? "Error compiling GDB." 515 516 change_title "GDB: make (${PLATFORM})" 517 if $REAL_INSTALL; then 518 PATH="${PATH}:${PREFIX}/bin" make install 519 else 520 PATH="${PATH}:${INSTALL_DIR}/${PREFIX}/bin" make install "DESTDIR=${INSTALL_DIR}" 521 fi 522 check_error $? "Error installing GDB." 523 379 make all install 380 check_error $? "Error compiling/installing GDB." 524 381 525 382 cd "${BASEDIR}" … … 532 389 echo ">>> Cross-compiler for ${TARGET} installed." 533 390 } 534 535 while [ "$#" -gt 1 ]; do536 case "$1" in537 --no-install)538 REAL_INSTALL=false539 shift540 ;;541 --helenos-target)542 USE_HELENOS_TARGET=true543 shift544 ;;545 *)546 show_usage547 ;;548 esac549 done550 391 551 392 if [ "$#" -lt "1" ]; then … … 554 395 555 396 case "$1" in 556 amd64|arm32|ia32|ia64|mips32|mips32eb|mips64|ppc32|ppc64|sparc64) 557 prepare 558 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" 559 436 ;; 560 437 "all") 561 438 prepare 562 build_target "amd64" 563 build_target "arm32" 564 build_target "ia32" 565 build_target "ia64" 566 build_target "mips32" 567 build_target "mips32eb" 568 build_target "mips64" 569 build_target "ppc32" 570 build_target "ppc64" 571 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" 572 449 ;; 573 450 "parallel") 574 451 prepare 575 build_target "amd64" &576 build_target "arm32" &577 build_target "ia32" &578 build_target "ia64" &579 build_target "mips32" &580 build_target "mips32eb" &581 build_target "mips64" &582 build_target "ppc32" &583 build_target "ppc64" &584 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" & 585 462 wait 586 463 ;; 587 464 "2-way") 588 465 prepare 589 build_target "amd64" &590 build_target "arm32" &591 wait 592 593 build_target "ia32" &594 build_target "ia64" &595 wait 596 597 build_target "mips32" &598 build_target "mips32eb" &599 wait 600 601 build_target "mips64" &602 build_target "ppc32" &603 wait 604 605 build_target "ppc64" &606 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" & 607 484 wait 608 485 ;;
Note:
See TracChangeset
for help on using the changeset viewer.