Changes in tools/toolchain.sh [8876b0d:3a75cb8] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/toolchain.sh
r8876b0d r3a75cb8 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 … … 53 53 EOF 54 54 55 BINUTILS_VERSION="2.23.1" 55 ISL_MAIN=<<EOF 56 isl_ctx_get_max_operations (isl_ctx_alloc ()); 57 EOF 58 59 BINUTILS_VERSION="2.27" 56 60 BINUTILS_RELEASE="" 57 GCC_VERSION="4.8.1" 58 GDB_VERSION="7.6" 61 ## BINUTILS_PATCHES="toolchain-binutils-2.23.1.patch" 62 GCC_VERSION="6.3.0" 63 ## GCC_PATCHES="toolchain-gcc-4.8.1-targets.patch toolchain-gcc-4.8.1-headers.patch" 64 GDB_VERSION="7.12.1" 65 ## GDB_PATCHES="toolchain-gdb-7.6.1.patch" 59 66 60 67 BASEDIR="`pwd`" 68 SRCDIR="$(readlink -f $(dirname "$0"))" 61 69 BINUTILS="binutils-${BINUTILS_VERSION}${BINUTILS_RELEASE}.tar.bz2" 62 70 GCC="gcc-${GCC_VERSION}.tar.bz2" 63 GDB="gdb-${GDB_VERSION}.tar.bz2" 71 GDB="gdb-${GDB_VERSION}.tar.gz" 72 73 REAL_INSTALL=true 74 USE_HELENOS_TARGET=false 75 INSTALL_DIR="${BASEDIR}/PKG" 64 76 65 77 # … … 82 94 echo "}" >> "${FNAME}.c" 83 95 84 cc -c -o "${FNAME}.o" "${FNAME}.c" 2> "${FNAME}.log"96 cc $CFLAGS -c -o "${FNAME}.o" "${FNAME}.c" 2> "${FNAME}.log" 85 97 RC="$?" 86 98 … … 106 118 check_dependency "MPFR" "<mpfr.h>" "${MPFR_MAIN}" 107 119 check_dependency "MPC" "<mpc.h>" "${MPC_MAIN}" 120 check_dependency "isl" "<isl/ctx.h>" "${ISL_MAIN}" 108 121 echo 109 122 } … … 135 148 echo 136 149 echo "Syntax:" 137 echo " $0 <platform>"150 echo " $0 [--no-install] [--helenos-target] <platform>" 138 151 echo 139 152 echo "Possible target platforms are:" … … 152 165 echo " 2-way same as 'all', but 2-way parallel" 153 166 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." 167 echo "The toolchain is installed into directory specified by the" 168 echo "CROSS_PREFIX environment variable. If the variable is not" 169 echo "defined, /usr/local/cross/ is used as default." 170 echo 171 echo "If --no-install is present, the toolchain still uses the" 172 echo "CROSS_PREFIX as the target directory but the installation" 173 echo "copies the files into PKG/ subdirectory without affecting" 174 echo "the actual root file system. That is only useful if you do" 175 echo "not want to run the script under the super user." 176 echo 177 echo "The --helenos-target will build HelenOS-specific toolchain" 178 echo "(i.e. it will use *-helenos-* triplet instead of *-linux-*)." 179 echo "This toolchain is installed into /usr/local/cross-helenos by" 180 echo "default. The settings can be changed by setting environment" 181 echo "variable CROSS_HELENOS_PREFIX." 182 echo "Using the HelenOS-specific toolchain is still an experimental" 183 echo "feature that is not fully supported." 157 184 echo 158 185 … … 192 219 echo " - SED, AWK, Flex, Bison, gzip, bzip2, Bourne Shell" 193 220 echo " - gettext, zlib, Texinfo, libelf, libgomp" 194 echo " - terminfo"221 echo " - GNU Make, Coreutils, Sharutils, tar" 195 222 echo " - GNU Multiple Precision Library (GMP)" 196 echo " - GNU Make"197 echo " - GNU tar"198 echo " - GNU Coreutils"199 echo " - GNU Sharutils"200 223 echo " - MPFR" 201 224 echo " - MPC" 202 echo " - Parma Polyhedra Library (PPL)" 203 echo " - ClooG-PPL" 204 echo " - native C compiler, assembler and linker" 205 echo " - native C library with headers" 225 echo " - integer point manipulation library (isl)" 226 echo " - native C and C++ compiler, assembler and linker" 227 echo " - native C and C++ standard library with headers" 206 228 echo 207 229 } … … 254 276 } 255 277 278 check_dirs() { 279 OUTSIDE="$1" 280 BASE="$2" 281 ORIGINAL="`pwd`" 282 283 cd "${OUTSIDE}" 284 check_error $? "Unable to change directory to ${OUTSIDE}." 285 ABS_OUTSIDE="`pwd`" 286 287 cd "${BASE}" 288 check_error $? "Unable to change directory to ${BASE}." 289 ABS_BASE="`pwd`" 290 291 cd "${ORIGINAL}" 292 check_error $? "Unable to change directory to ${ORIGINAL}." 293 294 BASE_LEN="${#ABS_BASE}" 295 OUTSIDE_TRIM="${ABS_OUTSIDE:0:${BASE_LEN}}" 296 297 if [ "${OUTSIDE_TRIM}" == "${ABS_BASE}" ] ; then 298 echo 299 echo "CROSS_PREFIX cannot reside within the working directory." 300 301 exit 5 302 fi 303 } 304 256 305 unpack_tarball() { 257 306 FILE="$1" … … 261 310 echo " >>> Unpacking ${DESC}" 262 311 263 tar -xjf "${FILE}" 312 case "${FILE}" in 313 *.gz) 314 tar -xzf "${FILE}" 315 ;; 316 *.xz) 317 tar -xJf "${FILE}" 318 ;; 319 *.bz2) 320 tar -xjf "${FILE}" 321 ;; 322 *) 323 check_error 1 "Don't know how to unpack ${DESC}." 324 ;; 325 esac 264 326 check_error $? "Error unpacking ${DESC}." 327 } 328 329 patch_sources() { 330 PATCH_FILE="$1" 331 PATCH_STRIP="$2" 332 DESC="$3" 333 334 change_title "Patching ${DESC}" 335 echo " >>> Patching ${DESC} with ${PATCH_FILE}" 336 337 patch -t "-p${PATCH_STRIP}" <"$PATCH_FILE" 338 check_error $? "Error patching ${DESC}." 265 339 } 266 340 … … 274 348 GDB_SOURCE="ftp://ftp.gnu.org/gnu/gdb/" 275 349 276 download_fetch "${BINUTILS_SOURCE}" "${BINUTILS}" "33adb18c3048d057ac58d07a3f1adb38" 277 download_fetch "${GCC_SOURCE}" "${GCC}" "3b2386c114cd74185aa3754b58a79304" 278 download_fetch "${GDB_SOURCE}" "${GDB}" "fda57170e4d11cdde74259ca575412a8" 350 download_fetch "${BINUTILS_SOURCE}" "${BINUTILS}" "2869c9bf3e60ee97c74ac2a6bf4e9d68" 351 download_fetch "${GCC_SOURCE}" "${GCC}" "677a7623c7ef6ab99881bc4e048debb6" 352 download_fetch "${GDB_SOURCE}" "${GDB}" "06c8f40521ed65fe36ebc2be29b56942" 353 } 354 355 set_target_from_platform() { 356 case "$1" in 357 "amd64") 358 LINUX_TARGET="amd64-linux-gnu" 359 HELENOS_TARGET="amd64-helenos" 360 ;; 361 "arm32") 362 LINUX_TARGET="arm-linux-gnueabi" 363 HELENOS_TARGET="arm-helenos-gnueabi" 364 ;; 365 "ia32") 366 LINUX_TARGET="i686-pc-linux-gnu" 367 HELENOS_TARGET="i686-pc-helenos" 368 ;; 369 "ia64") 370 LINUX_TARGET="ia64-pc-linux-gnu" 371 HELENOS_TARGET="ia64-pc-helenos" 372 ;; 373 "mips32") 374 LINUX_TARGET="mipsel-linux-gnu" 375 HELENOS_TARGET="mipsel-helenos" 376 ;; 377 "mips32eb") 378 LINUX_TARGET="mips-linux-gnu" 379 HELENOS_TARGET="mips-helenos" 380 ;; 381 "mips64") 382 LINUX_TARGET="mips64el-linux-gnu" 383 HELENOS_TARGET="mips64el-helenos" 384 ;; 385 "ppc32") 386 LINUX_TARGET="ppc-linux-gnu" 387 HELENOS_TARGET="ppc-helenos" 388 ;; 389 "ppc64") 390 LINUX_TARGET="ppc64-linux-gnu" 391 HELENOS_TARGET="ppc64-helenos" 392 ;; 393 "sparc64") 394 LINUX_TARGET="sparc64-linux-gnu" 395 HELENOS_TARGET="sparc64-helenos" 396 ;; 397 *) 398 check_error 1 "No target known for $1." 399 ;; 400 esac 279 401 } 280 402 281 403 build_target() { 282 404 PLATFORM="$1" 283 TARGET="$2" 405 # This sets the *_TARGET variables 406 set_target_from_platform "$PLATFORM" 407 if $USE_HELENOS_TARGET; then 408 TARGET="$HELENOS_TARGET" 409 else 410 TARGET="$LINUX_TARGET" 411 fi 284 412 285 413 WORKDIR="${BASEDIR}/${PLATFORM}" … … 292 420 CROSS_PREFIX="/usr/local/cross" 293 421 fi 294 295 PREFIX="${CROSS_PREFIX}/${PLATFORM}" 422 if [ -z "${CROSS_HELENOS_PREFIX}" ] ; then 423 CROSS_HELENOS_PREFIX="/usr/local/cross-helenos" 424 fi 425 426 if $USE_HELENOS_TARGET; then 427 PREFIX="${CROSS_HELENOS_PREFIX}/${PLATFORM}" 428 else 429 PREFIX="${CROSS_PREFIX}/${PLATFORM}" 430 fi 296 431 297 432 echo ">>> Downloading tarballs" … … 301 436 302 437 echo ">>> Removing previous content" 303 cleanup_dir "${PREFIX}"438 $REAL_INSTALL && cleanup_dir "${PREFIX}" 304 439 cleanup_dir "${WORKDIR}" 305 440 306 create_dir "${PREFIX}" "destination directory"441 $REAL_INSTALL && create_dir "${PREFIX}" "destination directory" 307 442 create_dir "${OBJDIR}" "GCC object directory" 443 444 check_dirs "${PREFIX}" "${WORKDIR}" 308 445 309 446 echo ">>> Unpacking tarballs" … … 315 452 unpack_tarball "${BASEDIR}/${GDB}" "GDB" 316 453 454 echo ">>> Applying patches" 455 for p in $BINUTILS_PATCHES; do 456 patch_sources "${SRCDIR}/${p}" 0 "binutils" 457 done 458 for p in $GCC_PATCHES; do 459 patch_sources "${SRCDIR}/${p}" 0 "GCC" 460 done 461 for p in $GDB_PATCHES; do 462 patch_sources "${SRCDIR}/${p}" 0 "GDB" 463 done 464 317 465 echo ">>> Processing binutils (${PLATFORM})" 318 466 cd "${BINUTILSDIR}" … … 320 468 321 469 change_title "binutils: configure (${PLATFORM})" 322 CFLAGS=-Wno-error ./configure "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --disable-nls --disable-werror 470 CFLAGS=-Wno-error ./configure \ 471 "--target=${TARGET}" \ 472 "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" \ 473 --disable-nls --disable-werror 323 474 check_error $? "Error configuring binutils." 324 475 325 476 change_title "binutils: make (${PLATFORM})" 326 make all install 327 check_error $? "Error compiling/installing binutils." 477 make all 478 check_error $? "Error compiling binutils." 479 480 change_title "binutils: install (${PLATFORM})" 481 if $REAL_INSTALL; then 482 make install 483 else 484 make install "DESTDIR=${INSTALL_DIR}" 485 fi 486 check_error $? "Error installing binutils." 487 328 488 329 489 echo ">>> Processing GCC (${PLATFORM})" … … 332 492 333 493 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 494 PATH="$PATH:${INSTALL_DIR}/${PREFIX}/bin" "${GCCDIR}/configure" \ 495 "--target=${TARGET}" \ 496 "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" \ 497 --with-gnu-as --with-gnu-ld --disable-nls --disable-threads \ 498 --enable-languages=c,objc,c++,obj-c++ \ 499 --disable-multilib --disable-libgcj --without-headers \ 500 --disable-shared --enable-lto --disable-werror 335 501 check_error $? "Error configuring GCC." 336 502 337 503 change_title "GCC: make (${PLATFORM})" 338 PATH="${PATH}:${PREFIX}/bin" make all-gcc install-gcc 339 check_error $? "Error compiling/installing GCC." 504 PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all-gcc 505 check_error $? "Error compiling GCC." 506 507 change_title "GCC: install (${PLATFORM})" 508 if $REAL_INSTALL; then 509 PATH="${PATH}:${PREFIX}/bin" make install-gcc 510 else 511 PATH="${PATH}:${INSTALL_DIR}/${PREFIX}/bin" make install-gcc "DESTDIR=${INSTALL_DIR}" 512 fi 513 check_error $? "Error installing GCC." 514 340 515 341 516 echo ">>> Processing GDB (${PLATFORM})" … … 344 519 345 520 change_title "GDB: configure (${PLATFORM})" 346 ./configure "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" 521 PATH="$PATH:${INSTALL_DIR}/${PREFIX}/bin" ./configure \ 522 "--target=${TARGET}" \ 523 "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" \ 524 --enable-werror=no 347 525 check_error $? "Error configuring GDB." 348 526 349 527 change_title "GDB: make (${PLATFORM})" 350 make all install 351 check_error $? "Error compiling/installing GDB." 528 PATH="${PATH}:${PREFIX}/bin:${INSTALL_DIR}/${PREFIX}/bin" make all 529 check_error $? "Error compiling GDB." 530 531 change_title "GDB: make (${PLATFORM})" 532 if $REAL_INSTALL; then 533 PATH="${PATH}:${PREFIX}/bin" make install 534 else 535 PATH="${PATH}:${INSTALL_DIR}/${PREFIX}/bin" make install "DESTDIR=${INSTALL_DIR}" 536 fi 537 check_error $? "Error installing GDB." 538 352 539 353 540 cd "${BASEDIR}" … … 360 547 echo ">>> Cross-compiler for ${TARGET} installed." 361 548 } 549 550 while [ "$#" -gt 1 ]; do 551 case "$1" in 552 --no-install) 553 REAL_INSTALL=false 554 shift 555 ;; 556 --helenos-target) 557 USE_HELENOS_TARGET=true 558 shift 559 ;; 560 *) 561 show_usage 562 ;; 563 esac 564 done 362 565 363 566 if [ "$#" -lt "1" ]; then … … 366 569 367 570 case "$1" in 368 "amd64")571 amd64|arm32|ia32|ia64|mips32|mips32eb|mips64|ppc32|ppc64|sparc64) 369 572 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" 573 build_target "$1" 407 574 ;; 408 575 "all") 409 576 prepare 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"577 build_target "amd64" 578 build_target "arm32" 579 build_target "ia32" 580 build_target "ia64" 581 build_target "mips32" 582 build_target "mips32eb" 583 build_target "mips64" 584 build_target "ppc32" 585 build_target "ppc64" 586 build_target "sparc64" 420 587 ;; 421 588 "parallel") 422 589 prepare 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"&590 build_target "amd64" & 591 build_target "arm32" & 592 build_target "ia32" & 593 build_target "ia64" & 594 build_target "mips32" & 595 build_target "mips32eb" & 596 build_target "mips64" & 597 build_target "ppc32" & 598 build_target "ppc64" & 599 build_target "sparc64" & 433 600 wait 434 601 ;; 435 602 "2-way") 436 603 prepare 437 build_target "amd64" "amd64-linux-gnu"&438 build_target "arm32" "arm-linux-gnueabi"&604 build_target "amd64" & 605 build_target "arm32" & 439 606 wait 440 607 441 build_target "ia32" "i686-pc-linux-gnu"&442 build_target "ia64" "ia64-pc-linux-gnu"&608 build_target "ia32" & 609 build_target "ia64" & 443 610 wait 444 611 445 build_target "mips32" "mipsel-linux-gnu"&446 build_target "mips32eb" "mips-linux-gnu"&612 build_target "mips32" & 613 build_target "mips32eb" & 447 614 wait 448 615 449 build_target "mips64" "mips64el-linux-gnu"&450 build_target "ppc32" "ppc-linux-gnu"&616 build_target "mips64" & 617 build_target "ppc32" & 451 618 wait 452 619 453 build_target "ppc64" "ppc64-linux-gnu"&454 build_target "sparc64" "sparc64-linux-gnu"&620 build_target "ppc64" & 621 build_target "sparc64" & 455 622 wait 456 623 ;;
Note:
See TracChangeset
for help on using the changeset viewer.