Changes in tools/toolchain.sh [9d5bb4e:603c8740] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/toolchain.sh
r9d5bb4e r603c8740 29 29 # 30 30 31 GMP_MAIN=<<EOF 32 #define GCC_GMP_VERSION_NUM(a, b, c) \ 33 (((a) << 16L) | ((b) << 8) | (c)) 34 35 #define GCC_GMP_VERSION \ 36 GCC_GMP_VERSION_NUM(__GNU_MP_VERSION, __GNU_MP_VERSION_MINOR, __GNU_MP_VERSION_PATCHLEVEL) 37 38 #if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4,3,2) 39 choke me 40 #endif 41 EOF 42 43 MPFR_MAIN=<<EOF 44 #if MPFR_VERSION < MPFR_VERSION_NUM(2, 4, 2) 45 choke me 46 #endif 47 EOF 48 49 MPC_MAIN=<<EOF 50 #if MPC_VERSION < MPC_VERSION_NUM(0, 8, 1) 51 choke me 52 #endif 53 EOF 54 55 BINUTILS_VERSION="2.21" 56 GCC_VERSION="4.6.0" 57 58 BASEDIR="`pwd`" 59 BINUTILS="binutils-${BINUTILS_VERSION}.tar.bz2" 60 GCC_CORE="gcc-core-${GCC_VERSION}.tar.bz2" 61 GCC_OBJC="gcc-objc-${GCC_VERSION}.tar.bz2" 62 GCC_CPP="gcc-g++-${GCC_VERSION}.tar.bz2" 63 64 # 65 # Check if the library described in the argument 66 # exists and has acceptable version. 67 # 68 check_dependency() { 69 DEPENDENCY="$1" 70 HEADER="$2" 71 BODY="$3" 72 73 FNAME="/tmp/conftest-$$" 74 75 echo "#include ${HEADER}" > "${FNAME}.c" 76 echo >> "${FNAME}.c" 77 echo "int main()" >> "${FNAME}.c" 78 echo "{" >> "${FNAME}.c" 79 echo "${BODY}" >> "${FNAME}.c" 80 echo " return 0;" >> "${FNAME}.c" 81 echo "}" >> "${FNAME}.c" 82 83 cc -c -o "${FNAME}.o" "${FNAME}.c" 2> "${FNAME}.log" 84 RC="$?" 85 86 if [ "$RC" -ne "0" ] ; then 87 echo " ${DEPENDENCY} not found, too old or compiler error." 88 echo " Please recheck manually the source file \"${FNAME}.c\"." 89 echo " The compilation of the toolchain is probably going to fail," 90 echo " you have been warned." 91 echo 92 echo " ===== Compiler output =====" 93 cat "${FNAME}.log" 94 echo " ===========================" 95 echo 96 else 97 echo " ${DEPENDENCY} found" 98 rm -f "${FNAME}.log" "${FNAME}.o" "${FNAME}.c" 99 fi 100 } 101 102 check_dependecies() { 103 echo ">>> Basic dependency check" 104 check_dependency "GMP" "<gmp.h>" "${GMP_MAIN}" 105 check_dependency "MPFR" "<mpfr.h>" "${MPFR_MAIN}" 106 check_dependency "MPC" "<mpc.h>" "${MPC_MAIN}" 107 echo 108 } 109 31 110 check_error() { 32 111 if [ "$1" -ne "0" ]; then … … 62 141 echo " ia32 IA-32 (x86, i386)" 63 142 echo " ia64 IA-64 (Itanium)" 64 echo " mips32 MIPS little-endian" 65 echo " mips32eb MIPS big-endian" 143 echo " mips32 MIPS little-endian 32b" 144 echo " mips32eb MIPS big-endian 32b" 145 echo " mips64 MIPS little-endian 64b" 66 146 echo " ppc32 32-bit PowerPC" 67 147 echo " ppc64 64-bit PowerPC" 68 148 echo " sparc64 SPARC V9" 69 149 echo " all build all targets" 150 echo " parallel same as 'all', but in parallel" 151 echo 152 echo "The toolchain will be installed to the directory specified by" 153 echo "the CROSS_PREFIX environment variable. If the variable is not" 154 echo "defined, /usr/local/cross will be used by default." 70 155 echo 71 156 … … 117 202 echo " - native C library with headers" 118 203 echo 119 120 show_countdown 10 121 } 122 123 download_check() { 204 } 205 206 download_fetch() { 124 207 SOURCE="$1" 125 208 FILE="$2" … … 135 218 } 136 219 220 source_check() { 221 FILE="$1" 222 223 if [ ! -f "${FILE}" ]; then 224 echo 225 echo "File ${FILE} not found." 226 227 exit 4 228 fi 229 } 230 137 231 cleanup_dir() { 138 232 DIR="$1" … … 168 262 } 169 263 170 patch_binutils() { 171 PLATFORM="$1" 172 173 if [ "${PLATFORM}" == "arm32" ] ; then 174 patch -p1 <<EOF 175 diff -Naur binutils-2.20.orig/gas/config/tc-arm.c binutils-2.20/gas/config/tc-arm.c 176 --- binutils-2.20.orig/gas/config/tc-arm.c 2009-08-30 00:10:59.000000000 +0200 177 +++ binutils-2.20/gas/config/tc-arm.c 2009-11-02 14:25:11.000000000 +0100 178 @@ -2485,8 +2485,9 @@ 179 know (frag->tc_frag_data.first_map == NULL); 180 frag->tc_frag_data.first_map = symbolP; 181 } 182 - if (frag->tc_frag_data.last_map != NULL) 183 + if (frag->tc_frag_data.last_map != NULL) { 184 know (S_GET_VALUE (frag->tc_frag_data.last_map) < S_GET_VALUE (symbolP)); 185 + } 186 frag->tc_frag_data.last_map = symbolP; 187 } 188 EOF 189 check_error $? "Error patching binutils" 190 fi 264 prepare() { 265 show_dependencies 266 check_dependecies 267 show_countdown 10 268 269 BINUTILS_SOURCE="ftp://ftp.gnu.org/gnu/binutils/" 270 GCC_SOURCE="ftp://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/" 271 272 download_fetch "${BINUTILS_SOURCE}" "${BINUTILS}" "c84c5acc9d266f1a7044b51c85a823f5" 273 download_fetch "${GCC_SOURCE}" "${GCC_CORE}" "b1957f3209080b2f55bc3756d3a62b7c" 274 download_fetch "${GCC_SOURCE}" "${GCC_OBJC}" "120d4675366ee82ea52f9ed65b57da04" 275 download_fetch "${GCC_SOURCE}" "${GCC_CPP}" "a30090fa655d0db4c970740d353c81f1" 191 276 } 192 277 … … 195 280 TARGET="$2" 196 281 197 BINUTILS_VERSION="2.20" 198 GCC_VERSION="4.5.1" 199 200 BINUTILS="binutils-${BINUTILS_VERSION}.tar.bz2" 201 GCC_CORE="gcc-core-${GCC_VERSION}.tar.bz2" 202 GCC_OBJC="gcc-objc-${GCC_VERSION}.tar.bz2" 203 GCC_CPP="gcc-g++-${GCC_VERSION}.tar.bz2" 204 205 BINUTILS_SOURCE="ftp://ftp.gnu.org/gnu/binutils/" 206 GCC_SOURCE="ftp://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/" 207 208 WORKDIR="`pwd`" 282 WORKDIR="${BASEDIR}/${PLATFORM}" 209 283 BINUTILSDIR="${WORKDIR}/binutils-${BINUTILS_VERSION}" 210 284 GCCDIR="${WORKDIR}/gcc-${GCC_VERSION}" … … 212 286 213 287 if [ -z "${CROSS_PREFIX}" ] ; then 214 CROSS_PREFIX="/usr/local "288 CROSS_PREFIX="/usr/local/cross" 215 289 fi 216 290 … … 218 292 219 293 echo ">>> Downloading tarballs" 220 download_check "${BINUTILS_SOURCE}" "${BINUTILS}" "ee2d3e996e9a2d669808713360fa96f8"221 download_check "${GCC_SOURCE}" "${GCC_CORE}" "dc8959e31b01a65ce10d269614815054"222 download_check "${GCC_SOURCE}" "${GCC_OBJC}" "3c11b7037896e967eddf8178af2ddd98"223 download_check "${GCC_SOURCE}" "${GCC_CPP}" "b294953ff0bb2f20c7acb2bf005d832a"294 source_check "${BASEDIR}/${BINUTILS}" 295 source_check "${BASEDIR}/${GCC_CORE}" 296 source_check "${BASEDIR}/${GCC_OBJC}" 297 source_check "${BASEDIR}/${GCC_CPP}" 224 298 225 299 echo ">>> Removing previous content" 226 300 cleanup_dir "${PREFIX}" 227 cleanup_dir "${OBJDIR}" 228 cleanup_dir "${BINUTILSDIR}" 229 cleanup_dir "${GCCDIR}" 301 cleanup_dir "${WORKDIR}" 230 302 231 303 create_dir "${PREFIX}" "destination directory" … … 233 305 234 306 echo ">>> Unpacking tarballs" 235 unpack_tarball "${BINUTILS}" "binutils" 236 unpack_tarball "${GCC_CORE}" "GCC Core" 237 unpack_tarball "${GCC_OBJC}" "Objective C" 238 unpack_tarball "${GCC_CPP}" "C++" 307 cd "${WORKDIR}" 308 check_error $? "Change directory failed." 309 310 unpack_tarball "${BASEDIR}/${BINUTILS}" "binutils" 311 unpack_tarball "${BASEDIR}/${GCC_CORE}" "GCC Core" 312 unpack_tarball "${BASEDIR}/${GCC_OBJC}" "Objective C" 313 unpack_tarball "${BASEDIR}/${GCC_CPP}" "C++" 239 314 240 315 echo ">>> Processing binutils (${PLATFORM})" 241 316 cd "${BINUTILSDIR}" 242 317 check_error $? "Change directory failed." 243 patch_binutils "${PLATFORM}"244 318 245 319 change_title "binutils: configure (${PLATFORM})" … … 263 337 check_error $? "Error compiling/installing GCC." 264 338 265 cd "${ WORKDIR}"339 cd "${BASEDIR}" 266 340 check_error $? "Change directory failed." 267 341 268 342 echo ">>> Cleaning up" 269 cleanup_dir "${OBJDIR}" 270 cleanup_dir "${BINUTILSDIR}" 271 cleanup_dir "${GCCDIR}" 343 cleanup_dir "${WORKDIR}" 272 344 273 345 echo … … 279 351 fi 280 352 281 show_dependencies282 283 353 case "$1" in 284 354 "amd64") 355 prepare 285 356 build_target "amd64" "amd64-linux-gnu" 286 357 ;; 287 358 "arm32") 359 prepare 288 360 build_target "arm32" "arm-linux-gnu" 289 361 ;; 290 362 "ia32") 363 prepare 291 364 build_target "ia32" "i686-pc-linux-gnu" 292 365 ;; 293 366 "ia64") 367 prepare 294 368 build_target "ia64" "ia64-pc-linux-gnu" 295 369 ;; 296 "ia64")297 build_target "ia64" "ia64-pc-linux-gnu"298 ;;299 370 "mips32") 371 prepare 300 372 build_target "mips32" "mipsel-linux-gnu" 301 373 ;; 302 374 "mips32eb") 375 prepare 303 376 build_target "mips32eb" "mips-linux-gnu" 304 377 ;; 378 "mips64") 379 prepare 380 build_target "mips64" "mips64el-linux-gnu" 381 ;; 305 382 "ppc32") 383 prepare 306 384 build_target "ppc32" "ppc-linux-gnu" 307 385 ;; 308 386 "ppc64") 387 prepare 309 388 build_target "ppc64" "ppc64-linux-gnu" 310 389 ;; 311 390 "sparc64") 391 prepare 312 392 build_target "sparc64" "sparc64-linux-gnu" 313 393 ;; 314 394 "all") 395 prepare 315 396 build_target "amd64" "amd64-linux-gnu" 316 397 build_target "arm32" "arm-linux-gnu" 317 398 build_target "ia32" "i686-pc-linux-gnu" 318 399 build_target "ia64" "ia64-pc-linux-gnu" 319 build_target "ia64" "ia64-pc-linux-gnu"320 400 build_target "mips32" "mipsel-linux-gnu" 321 401 build_target "mips32eb" "mips-linux-gnu" 402 build_target "mips64" "mips64el-linux-gnu" 322 403 build_target "ppc32" "ppc-linux-gnu" 323 404 build_target "ppc64" "ppc64-linux-gnu" 324 405 build_target "sparc64" "sparc64-linux-gnu" 325 406 ;; 407 "parallel") 408 prepare 409 build_target "amd64" "amd64-linux-gnu" & 410 build_target "arm32" "arm-linux-gnu" & 411 build_target "ia32" "i686-pc-linux-gnu" & 412 build_target "ia64" "ia64-pc-linux-gnu" & 413 build_target "mips32" "mipsel-linux-gnu" & 414 build_target "mips32eb" "mips-linux-gnu" & 415 build_target "mips64" "mips64el-linux-gnu" & 416 build_target "ppc32" "ppc-linux-gnu" & 417 build_target "ppc64" "ppc64-linux-gnu" & 418 build_target "sparc64" "sparc64-linux-gnu" & 419 wait 420 ;; 326 421 *) 327 422 show_usage
Note:
See TracChangeset
for help on using the changeset viewer.