Changes in tools/toolchain.sh [3a75cb8:8876b0d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/toolchain.sh
r3a75cb8 r8876b0d 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 ISL_MAIN=<<EOF 56 isl_ctx_get_max_operations (isl_ctx_alloc ()); 57 EOF 58 59 BINUTILS_VERSION="2.27" 55 BINUTILS_VERSION="2.23.1" 60 56 BINUTILS_RELEASE="" 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" 57 GCC_VERSION="4.8.1" 58 GDB_VERSION="7.6" 66 59 67 60 BASEDIR="`pwd`" 68 SRCDIR="$(readlink -f $(dirname "$0"))"69 61 BINUTILS="binutils-${BINUTILS_VERSION}${BINUTILS_RELEASE}.tar.bz2" 70 62 GCC="gcc-${GCC_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" 63 GDB="gdb-${GDB_VERSION}.tar.bz2" 76 64 77 65 # … … 94 82 echo "}" >> "${FNAME}.c" 95 83 96 cc $CFLAGS-c -o "${FNAME}.o" "${FNAME}.c" 2> "${FNAME}.log"84 cc -c -o "${FNAME}.o" "${FNAME}.c" 2> "${FNAME}.log" 97 85 RC="$?" 98 86 … … 118 106 check_dependency "MPFR" "<mpfr.h>" "${MPFR_MAIN}" 119 107 check_dependency "MPC" "<mpc.h>" "${MPC_MAIN}" 120 check_dependency "isl" "<isl/ctx.h>" "${ISL_MAIN}"121 108 echo 122 109 } … … 148 135 echo 149 136 echo "Syntax:" 150 echo " $0 [--no-install] [--helenos-target]<platform>"137 echo " $0 <platform>" 151 138 echo 152 139 echo "Possible target platforms are:" … … 165 152 echo " 2-way same as 'all', but 2-way parallel" 166 153 echo 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." 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." 184 157 echo 185 158 … … 219 192 echo " - SED, AWK, Flex, Bison, gzip, bzip2, Bourne Shell" 220 193 echo " - gettext, zlib, Texinfo, libelf, libgomp" 221 echo " - GNU Make, Coreutils, Sharutils, tar"194 echo " - terminfo" 222 195 echo " - GNU Multiple Precision Library (GMP)" 196 echo " - GNU Make" 197 echo " - GNU tar" 198 echo " - GNU Coreutils" 199 echo " - GNU Sharutils" 223 200 echo " - MPFR" 224 201 echo " - MPC" 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" 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" 228 206 echo 229 207 } … … 276 254 } 277 255 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}" ] ; then298 echo299 echo "CROSS_PREFIX cannot reside within the working directory."300 301 exit 5302 fi303 }304 305 256 unpack_tarball() { 306 257 FILE="$1" … … 310 261 echo " >>> Unpacking ${DESC}" 311 262 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 263 tar -xjf "${FILE}" 326 264 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}."339 265 } 340 266 … … 348 274 GDB_SOURCE="ftp://ftp.gnu.org/gnu/gdb/" 349 275 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 276 download_fetch "${BINUTILS_SOURCE}" "${BINUTILS}" "33adb18c3048d057ac58d07a3f1adb38" 277 download_fetch "${GCC_SOURCE}" "${GCC}" "3b2386c114cd74185aa3754b58a79304" 278 download_fetch "${GDB_SOURCE}" "${GDB}" "fda57170e4d11cdde74259ca575412a8" 401 279 } 402 280 403 281 build_target() { 404 282 PLATFORM="$1" 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 283 TARGET="$2" 412 284 413 285 WORKDIR="${BASEDIR}/${PLATFORM}" … … 420 292 CROSS_PREFIX="/usr/local/cross" 421 293 fi 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 294 295 PREFIX="${CROSS_PREFIX}/${PLATFORM}" 431 296 432 297 echo ">>> Downloading tarballs" … … 436 301 437 302 echo ">>> Removing previous content" 438 $REAL_INSTALL &&cleanup_dir "${PREFIX}"303 cleanup_dir "${PREFIX}" 439 304 cleanup_dir "${WORKDIR}" 440 305 441 $REAL_INSTALL &&create_dir "${PREFIX}" "destination directory"306 create_dir "${PREFIX}" "destination directory" 442 307 create_dir "${OBJDIR}" "GCC object directory" 443 444 check_dirs "${PREFIX}" "${WORKDIR}"445 308 446 309 echo ">>> Unpacking tarballs" … … 452 315 unpack_tarball "${BASEDIR}/${GDB}" "GDB" 453 316 454 echo ">>> Applying patches"455 for p in $BINUTILS_PATCHES; do456 patch_sources "${SRCDIR}/${p}" 0 "binutils"457 done458 for p in $GCC_PATCHES; do459 patch_sources "${SRCDIR}/${p}" 0 "GCC"460 done461 for p in $GDB_PATCHES; do462 patch_sources "${SRCDIR}/${p}" 0 "GDB"463 done464 465 317 echo ">>> Processing binutils (${PLATFORM})" 466 318 cd "${BINUTILSDIR}" … … 468 320 469 321 change_title "binutils: configure (${PLATFORM})" 470 CFLAGS=-Wno-error ./configure \ 471 "--target=${TARGET}" \ 472 "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" \ 473 --disable-nls --disable-werror 322 CFLAGS=-Wno-error ./configure "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --disable-nls --disable-werror 474 323 check_error $? "Error configuring binutils." 475 324 476 325 change_title "binutils: make (${PLATFORM})" 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 326 make all install 327 check_error $? "Error compiling/installing binutils." 488 328 489 329 echo ">>> Processing GCC (${PLATFORM})" … … 492 332 493 333 change_title "GCC: configure (${PLATFORM})" 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 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 501 335 check_error $? "Error configuring GCC." 502 336 503 337 change_title "GCC: make (${PLATFORM})" 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 338 PATH="${PATH}:${PREFIX}/bin" make all-gcc install-gcc 339 check_error $? "Error compiling/installing GCC." 515 340 516 341 echo ">>> Processing GDB (${PLATFORM})" … … 519 344 520 345 change_title "GDB: configure (${PLATFORM})" 521 PATH="$PATH:${INSTALL_DIR}/${PREFIX}/bin" ./configure \ 522 "--target=${TARGET}" \ 523 "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" \ 524 --enable-werror=no 346 ./configure "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" 525 347 check_error $? "Error configuring GDB." 526 348 527 349 change_title "GDB: make (${PLATFORM})" 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 350 make all install 351 check_error $? "Error compiling/installing GDB." 539 352 540 353 cd "${BASEDIR}" … … 547 360 echo ">>> Cross-compiler for ${TARGET} installed." 548 361 } 549 550 while [ "$#" -gt 1 ]; do551 case "$1" in552 --no-install)553 REAL_INSTALL=false554 shift555 ;;556 --helenos-target)557 USE_HELENOS_TARGET=true558 shift559 ;;560 *)561 show_usage562 ;;563 esac564 done565 362 566 363 if [ "$#" -lt "1" ]; then … … 569 366 570 367 case "$1" in 571 amd64|arm32|ia32|ia64|mips32|mips32eb|mips64|ppc32|ppc64|sparc64) 572 prepare 573 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" 574 407 ;; 575 408 "all") 576 409 prepare 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" 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" 587 420 ;; 588 421 "parallel") 589 422 prepare 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" &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" & 600 433 wait 601 434 ;; 602 435 "2-way") 603 436 prepare 604 build_target "amd64" &605 build_target "arm32" &606 wait 607 608 build_target "ia32" &609 build_target "ia64" &610 wait 611 612 build_target "mips32" &613 build_target "mips32eb" &614 wait 615 616 build_target "mips64" &617 build_target "ppc32" &618 wait 619 620 build_target "ppc64" &621 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" & 622 455 wait 623 456 ;;
Note:
See TracChangeset
for help on using the changeset viewer.