Changeset ad7a6c9 in mainline for tools/toolchain.sh
- Timestamp:
- 2011-03-30T13:10:24Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4ae90f9
- Parents:
- 6e50466 (diff), d6b81941 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/toolchain.sh
r6e50466 rad7a6c9 28 28 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 29 # 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 } 30 109 31 110 check_error() { … … 69 148 echo " sparc64 SPARC V9" 70 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." 71 155 echo 72 156 … … 118 202 echo " - native C library with headers" 119 203 echo 120 121 show_countdown 10 122 } 123 124 download_check() { 204 } 205 206 download_fetch() { 125 207 SOURCE="$1" 126 208 FILE="$2" … … 136 218 } 137 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 138 231 cleanup_dir() { 139 232 DIR="$1" … … 169 262 } 170 263 171 patch_binutils() { 172 PLATFORM="$1" 173 174 if [ "${PLATFORM}" == "arm32" ] ; then 175 patch -p1 <<EOF 176 diff -Naur binutils-2.20.orig/gas/config/tc-arm.c binutils-2.20/gas/config/tc-arm.c 177 --- binutils-2.20.orig/gas/config/tc-arm.c 2009-08-30 00:10:59.000000000 +0200 178 +++ binutils-2.20/gas/config/tc-arm.c 2009-11-02 14:25:11.000000000 +0100 179 @@ -2485,8 +2485,9 @@ 180 know (frag->tc_frag_data.first_map == NULL); 181 frag->tc_frag_data.first_map = symbolP; 182 } 183 - if (frag->tc_frag_data.last_map != NULL) 184 + if (frag->tc_frag_data.last_map != NULL) { 185 know (S_GET_VALUE (frag->tc_frag_data.last_map) < S_GET_VALUE (symbolP)); 186 + } 187 frag->tc_frag_data.last_map = symbolP; 188 } 189 EOF 190 check_error $? "Error patching binutils" 191 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" 192 276 } 193 277 … … 196 280 TARGET="$2" 197 281 198 BINUTILS_VERSION="2.20" 199 GCC_VERSION="4.5.1" 200 201 BINUTILS="binutils-${BINUTILS_VERSION}.tar.bz2" 202 GCC_CORE="gcc-core-${GCC_VERSION}.tar.bz2" 203 GCC_OBJC="gcc-objc-${GCC_VERSION}.tar.bz2" 204 GCC_CPP="gcc-g++-${GCC_VERSION}.tar.bz2" 205 206 BINUTILS_SOURCE="ftp://ftp.gnu.org/gnu/binutils/" 207 GCC_SOURCE="ftp://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/" 208 209 WORKDIR="`pwd`" 282 WORKDIR="${BASEDIR}/${PLATFORM}" 210 283 BINUTILSDIR="${WORKDIR}/binutils-${BINUTILS_VERSION}" 211 284 GCCDIR="${WORKDIR}/gcc-${GCC_VERSION}" … … 213 286 214 287 if [ -z "${CROSS_PREFIX}" ] ; then 215 CROSS_PREFIX="/usr/local "288 CROSS_PREFIX="/usr/local/cross" 216 289 fi 217 290 … … 219 292 220 293 echo ">>> Downloading tarballs" 221 download_check "${BINUTILS_SOURCE}" "${BINUTILS}" "ee2d3e996e9a2d669808713360fa96f8"222 download_check "${GCC_SOURCE}" "${GCC_CORE}" "dc8959e31b01a65ce10d269614815054"223 download_check "${GCC_SOURCE}" "${GCC_OBJC}" "3c11b7037896e967eddf8178af2ddd98"224 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}" 225 298 226 299 echo ">>> Removing previous content" 227 300 cleanup_dir "${PREFIX}" 228 cleanup_dir "${OBJDIR}" 229 cleanup_dir "${BINUTILSDIR}" 230 cleanup_dir "${GCCDIR}" 301 cleanup_dir "${WORKDIR}" 231 302 232 303 create_dir "${PREFIX}" "destination directory" … … 234 305 235 306 echo ">>> Unpacking tarballs" 236 unpack_tarball "${BINUTILS}" "binutils" 237 unpack_tarball "${GCC_CORE}" "GCC Core" 238 unpack_tarball "${GCC_OBJC}" "Objective C" 239 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++" 240 314 241 315 echo ">>> Processing binutils (${PLATFORM})" 242 316 cd "${BINUTILSDIR}" 243 317 check_error $? "Change directory failed." 244 patch_binutils "${PLATFORM}"245 318 246 319 change_title "binutils: configure (${PLATFORM})" … … 264 337 check_error $? "Error compiling/installing GCC." 265 338 266 cd "${ WORKDIR}"339 cd "${BASEDIR}" 267 340 check_error $? "Change directory failed." 268 341 269 342 echo ">>> Cleaning up" 270 cleanup_dir "${OBJDIR}" 271 cleanup_dir "${BINUTILSDIR}" 272 cleanup_dir "${GCCDIR}" 343 cleanup_dir "${WORKDIR}" 273 344 274 345 echo … … 280 351 fi 281 352 282 show_dependencies283 284 353 case "$1" in 285 354 "amd64") 355 prepare 286 356 build_target "amd64" "amd64-linux-gnu" 287 357 ;; 288 358 "arm32") 359 prepare 289 360 build_target "arm32" "arm-linux-gnu" 290 361 ;; 291 362 "ia32") 363 prepare 292 364 build_target "ia32" "i686-pc-linux-gnu" 293 365 ;; 294 366 "ia64") 367 prepare 295 368 build_target "ia64" "ia64-pc-linux-gnu" 296 369 ;; 297 "ia64")298 build_target "ia64" "ia64-pc-linux-gnu"299 ;;300 370 "mips32") 371 prepare 301 372 build_target "mips32" "mipsel-linux-gnu" 302 373 ;; 303 374 "mips32eb") 375 prepare 304 376 build_target "mips32eb" "mips-linux-gnu" 305 377 ;; 306 378 "mips64") 379 prepare 307 380 build_target "mips64" "mips64el-linux-gnu" 308 381 ;; 309 382 "ppc32") 383 prepare 310 384 build_target "ppc32" "ppc-linux-gnu" 311 385 ;; 312 386 "ppc64") 387 prepare 313 388 build_target "ppc64" "ppc64-linux-gnu" 314 389 ;; 315 390 "sparc64") 391 prepare 316 392 build_target "sparc64" "sparc64-linux-gnu" 317 393 ;; 318 394 "all") 395 prepare 319 396 build_target "amd64" "amd64-linux-gnu" 320 397 build_target "arm32" "arm-linux-gnu" 321 398 build_target "ia32" "i686-pc-linux-gnu" 322 build_target "ia64" "ia64-pc-linux-gnu"323 399 build_target "ia64" "ia64-pc-linux-gnu" 324 400 build_target "mips32" "mipsel-linux-gnu" … … 329 405 build_target "sparc64" "sparc64-linux-gnu" 330 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 ;; 331 421 *) 332 422 show_usage
Note:
See TracChangeset
for help on using the changeset viewer.