Changes in tools/toolchain.sh [5a65d29:8876b0d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/toolchain.sh
r5a65d29 r8876b0d 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" 61 GDB_PATCHES="toolchain-gdb-7.6.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." 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." 176 157 echo 177 158 … … 284 265 } 285 266 286 patch_sources() {287 PATCH_FILE="$1"288 PATCH_STRIP="$2"289 DESC="$3"290 291 change_title "Patching ${DESC}"292 echo " >>> Patching ${DESC} with ${PATCH_FILE}"293 294 patch -t "-p${PATCH_STRIP}" <"$PATCH_FILE"295 check_error $? "Error patching ${DESC}."296 }297 298 267 prepare() { 299 268 show_dependencies … … 310 279 } 311 280 312 set_target_from_platform() {313 case "$1" in314 "amd64")315 LINUX_TARGET="amd64-linux-gnu"316 HELENOS_TARGET="amd64-helenos"317 ;;318 "arm32")319 LINUX_TARGET="arm-linux-gnueabi"320 HELENOS_TARGET="arm-helenos-gnueabi"321 ;;322 "ia32")323 LINUX_TARGET="i686-pc-linux-gnu"324 HELENOS_TARGET="i686-pc-helenos"325 ;;326 "ia64")327 LINUX_TARGET="ia64-pc-linux-gnu"328 HELENOS_TARGET="ia64-pc-helenos"329 ;;330 "mips32")331 LINUX_TARGET="mipsel-linux-gnu"332 HELENOS_TARGET="mipsel-helenos"333 ;;334 "mips32eb")335 LINUX_TARGET="mips-linux-gnu"336 HELENOS_TARGET="mips-helenos"337 ;;338 "mips64")339 LINUX_TARGET="mips64el-linux-gnu"340 HELENOS_TARGET="mips64el-helenos"341 ;;342 "ppc32")343 LINUX_TARGET="ppc-linux-gnu"344 HELENOS_TARGET="ppc-helenos"345 ;;346 "ppc64")347 LINUX_TARGET="ppc64-linux-gnu"348 HELENOS_TARGET="ppc64-helenos"349 ;;350 "sparc64")351 LINUX_TARGET="sparc64-linux-gnu"352 HELENOS_TARGET="sparc64-helenos"353 ;;354 *)355 check_error 1 "No target known for $1."356 ;;357 esac358 }359 360 281 build_target() { 361 282 PLATFORM="$1" 362 # This sets the *_TARGET variables 363 set_target_from_platform "$PLATFORM" 364 if $USE_HELENOS_TARGET; then 365 TARGET="$HELENOS_TARGET" 366 else 367 TARGET="$LINUX_TARGET" 368 fi 283 TARGET="$2" 369 284 370 285 WORKDIR="${BASEDIR}/${PLATFORM}" … … 377 292 CROSS_PREFIX="/usr/local/cross" 378 293 fi 379 if [ -z "${CROSS_HELENOS_PREFIX}" ] ; then 380 CROSS_HELENOS_PREFIX="/usr/local/cross-helenos" 381 fi 382 383 if $USE_HELENOS_TARGET; then 384 PREFIX="${CROSS_HELENOS_PREFIX}/${PLATFORM}" 385 else 386 PREFIX="${CROSS_PREFIX}/${PLATFORM}" 387 fi 294 295 PREFIX="${CROSS_PREFIX}/${PLATFORM}" 388 296 389 297 echo ">>> Downloading tarballs" … … 393 301 394 302 echo ">>> Removing previous content" 395 $REAL_INSTALL &&cleanup_dir "${PREFIX}"303 cleanup_dir "${PREFIX}" 396 304 cleanup_dir "${WORKDIR}" 397 305 398 $REAL_INSTALL &&create_dir "${PREFIX}" "destination directory"306 create_dir "${PREFIX}" "destination directory" 399 307 create_dir "${OBJDIR}" "GCC object directory" 400 308 … … 407 315 unpack_tarball "${BASEDIR}/${GDB}" "GDB" 408 316 409 echo ">>> Applying patches"410 for p in $BINUTILS_PATCHES; do411 patch_sources "${BASEDIR}/${p}" 0 "binutils"412 done413 for p in $GCC_PATCHES; do414 patch_sources "${BASEDIR}/${p}" 0 "GCC"415 done416 for p in $GDB_PATCHES; do417 patch_sources "${BASEDIR}/${p}" 0 "GDB"418 done419 420 317 echo ">>> Processing binutils (${PLATFORM})" 421 318 cd "${BINUTILSDIR}" … … 423 320 424 321 change_title "binutils: configure (${PLATFORM})" 425 CFLAGS=-Wno-error ./configure \ 426 "--target=${TARGET}" \ 427 "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" \ 428 --disable-nls --disable-werror 322 CFLAGS=-Wno-error ./configure "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --disable-nls --disable-werror 429 323 check_error $? "Error configuring binutils." 430 324 431 325 change_title "binutils: make (${PLATFORM})" 432 make all 433 check_error $? "Error compiling binutils." 434 435 change_title "binutils: install (${PLATFORM})" 436 if $REAL_INSTALL; then 437 make install 438 else 439 make install "DESTDIR=${INSTALL_DIR}" 440 fi 441 check_error $? "Error installing binutils." 442 326 make all install 327 check_error $? "Error compiling/installing binutils." 443 328 444 329 echo ">>> Processing GCC (${PLATFORM})" … … 447 332 448 333 change_title "GCC: configure (${PLATFORM})" 449 PATH="$PATH:${INSTALL_DIR}/${PREFIX}/bin" "${GCCDIR}/configure" \ 450 "--target=${TARGET}" \ 451 "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" \ 452 --with-gnu-as --with-gnu-ld --disable-nls --disable-threads \ 453 --enable-languages=c,objc,c++,obj-c++ \ 454 --disable-multilib --disable-libgcj --without-headers \ 455 --disable-shared --enable-lto --disable-werror 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 456 335 check_error $? "Error configuring GCC." 457 336 458 337 change_title "GCC: make (${PLATFORM})" 459 PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all-gcc 460 check_error $? "Error compiling GCC." 461 462 change_title "GCC: install (${PLATFORM})" 463 if $REAL_INSTALL; then 464 PATH="${PATH}:${PREFIX}/bin" make install-gcc 465 else 466 PATH="${PATH}:${INSTALL_DIR}/${PREFIX}/bin" make install-gcc "DESTDIR=${INSTALL_DIR}" 467 fi 468 check_error $? "Error installing GCC." 469 338 PATH="${PATH}:${PREFIX}/bin" make all-gcc install-gcc 339 check_error $? "Error compiling/installing GCC." 470 340 471 341 echo ">>> Processing GDB (${PLATFORM})" … … 474 344 475 345 change_title "GDB: configure (${PLATFORM})" 476 PATH="$PATH:${INSTALL_DIR}/${PREFIX}/bin" ./configure \ 477 "--target=${TARGET}" \ 478 "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" 346 ./configure "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" 479 347 check_error $? "Error configuring GDB." 480 348 481 349 change_title "GDB: make (${PLATFORM})" 482 PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all 483 check_error $? "Error compiling GDB." 484 485 change_title "GDB: make (${PLATFORM})" 486 if $REAL_INSTALL; then 487 PATH="${PATH}:${PREFIX}/bin" make install 488 else 489 PATH="${PATH}:${INSTALL_DIR}/${PREFIX}/bin" make install "DESTDIR=${INSTALL_DIR}" 490 fi 491 check_error $? "Error installing GDB." 492 350 make all install 351 check_error $? "Error compiling/installing GDB." 493 352 494 353 cd "${BASEDIR}" … … 501 360 echo ">>> Cross-compiler for ${TARGET} installed." 502 361 } 503 504 while [ "$#" -gt 1 ]; do505 case "$1" in506 --no-install)507 REAL_INSTALL=false508 shift509 ;;510 --helenos-target)511 USE_HELENOS_TARGET=true512 shift513 ;;514 *)515 show_usage516 ;;517 esac518 done519 362 520 363 if [ "$#" -lt "1" ]; then … … 523 366 524 367 case "$1" in 525 amd64|arm32|ia32|ia64|mips32|mips32eb|mips64|ppc32|ppc64|sparc64) 526 prepare 527 build_target "$1" 368 "amd64") 369 prepare 370 build_target "amd64" "amd64-linux-gnu" 371 ;; 372 "arm32") 373 prepare 374 build_target "arm32" "arm-linux-gnueabi" 375 ;; 376 "ia32") 377 prepare 378 build_target "ia32" "i686-pc-linux-gnu" 379 ;; 380 "ia64") 381 prepare 382 build_target "ia64" "ia64-pc-linux-gnu" 383 ;; 384 "mips32") 385 prepare 386 build_target "mips32" "mipsel-linux-gnu" 387 ;; 388 "mips32eb") 389 prepare 390 build_target "mips32eb" "mips-linux-gnu" 391 ;; 392 "mips64") 393 prepare 394 build_target "mips64" "mips64el-linux-gnu" 395 ;; 396 "ppc32") 397 prepare 398 build_target "ppc32" "ppc-linux-gnu" 399 ;; 400 "ppc64") 401 prepare 402 build_target "ppc64" "ppc64-linux-gnu" 403 ;; 404 "sparc64") 405 prepare 406 build_target "sparc64" "sparc64-linux-gnu" 528 407 ;; 529 408 "all") 530 409 prepare 531 build_target "amd64" 532 build_target "arm32" 533 build_target "ia32" 534 build_target "ia64" 535 build_target "mips32" 536 build_target "mips32eb" 537 build_target "mips64" 538 build_target "ppc32" 539 build_target "ppc64" 540 build_target "sparc64" 410 build_target "amd64" "amd64-linux-gnu" 411 build_target "arm32" "arm-linux-gnueabi" 412 build_target "ia32" "i686-pc-linux-gnu" 413 build_target "ia64" "ia64-pc-linux-gnu" 414 build_target "mips32" "mipsel-linux-gnu" 415 build_target "mips32eb" "mips-linux-gnu" 416 build_target "mips64" "mips64el-linux-gnu" 417 build_target "ppc32" "ppc-linux-gnu" 418 build_target "ppc64" "ppc64-linux-gnu" 419 build_target "sparc64" "sparc64-linux-gnu" 541 420 ;; 542 421 "parallel") 543 422 prepare 544 build_target "amd64" &545 build_target "arm32" &546 build_target "ia32" &547 build_target "ia64" &548 build_target "mips32" &549 build_target "mips32eb" &550 build_target "mips64" &551 build_target "ppc32" &552 build_target "ppc64" &553 build_target "sparc64" &423 build_target "amd64" "amd64-linux-gnu" & 424 build_target "arm32" "arm-linux-gnueabi" & 425 build_target "ia32" "i686-pc-linux-gnu" & 426 build_target "ia64" "ia64-pc-linux-gnu" & 427 build_target "mips32" "mipsel-linux-gnu" & 428 build_target "mips32eb" "mips-linux-gnu" & 429 build_target "mips64" "mips64el-linux-gnu" & 430 build_target "ppc32" "ppc-linux-gnu" & 431 build_target "ppc64" "ppc64-linux-gnu" & 432 build_target "sparc64" "sparc64-linux-gnu" & 554 433 wait 555 434 ;; 556 435 "2-way") 557 436 prepare 558 build_target "amd64" &559 build_target "arm32" &560 wait 561 562 build_target "ia32" &563 build_target "ia64" &564 wait 565 566 build_target "mips32" &567 build_target "mips32eb" &568 wait 569 570 build_target "mips64" &571 build_target "ppc32" &572 wait 573 574 build_target "ppc64" &575 build_target "sparc64" &437 build_target "amd64" "amd64-linux-gnu" & 438 build_target "arm32" "arm-linux-gnueabi" & 439 wait 440 441 build_target "ia32" "i686-pc-linux-gnu" & 442 build_target "ia64" "ia64-pc-linux-gnu" & 443 wait 444 445 build_target "mips32" "mipsel-linux-gnu" & 446 build_target "mips32eb" "mips-linux-gnu" & 447 wait 448 449 build_target "mips64" "mips64el-linux-gnu" & 450 build_target "ppc32" "ppc-linux-gnu" & 451 wait 452 453 build_target "ppc64" "ppc64-linux-gnu" & 454 build_target "sparc64" "sparc64-linux-gnu" & 576 455 wait 577 456 ;;
Note:
See TracChangeset
for help on using the changeset viewer.