Changes in tools/toolchain.sh [603c8740:9d5bb4e] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/toolchain.sh
r603c8740 r9d5bb4e 29 29 # 30 30 31 GMP_MAIN=<<EOF32 #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 me40 #endif41 EOF42 43 MPFR_MAIN=<<EOF44 #if MPFR_VERSION < MPFR_VERSION_NUM(2, 4, 2)45 choke me46 #endif47 EOF48 49 MPC_MAIN=<<EOF50 #if MPC_VERSION < MPC_VERSION_NUM(0, 8, 1)51 choke me52 #endif53 EOF54 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 argument66 # 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" ] ; then87 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 echo92 echo " ===== Compiler output ====="93 cat "${FNAME}.log"94 echo " ==========================="95 echo96 else97 echo " ${DEPENDENCY} found"98 rm -f "${FNAME}.log" "${FNAME}.o" "${FNAME}.c"99 fi100 }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 echo108 }109 110 31 check_error() { 111 32 if [ "$1" -ne "0" ]; then … … 141 62 echo " ia32 IA-32 (x86, i386)" 142 63 echo " ia64 IA-64 (Itanium)" 143 echo " mips32 MIPS little-endian 32b" 144 echo " mips32eb MIPS big-endian 32b" 145 echo " mips64 MIPS little-endian 64b" 64 echo " mips32 MIPS little-endian" 65 echo " mips32eb MIPS big-endian" 146 66 echo " ppc32 32-bit PowerPC" 147 67 echo " ppc64 64-bit PowerPC" 148 68 echo " sparc64 SPARC V9" 149 69 echo " all build all targets" 150 echo " parallel same as 'all', but in parallel"151 echo152 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."155 70 echo 156 71 … … 202 117 echo " - native C library with headers" 203 118 echo 204 } 205 206 download_fetch() { 119 120 show_countdown 10 121 } 122 123 download_check() { 207 124 SOURCE="$1" 208 125 FILE="$2" … … 218 135 } 219 136 220 source_check() {221 FILE="$1"222 223 if [ ! -f "${FILE}" ]; then224 echo225 echo "File ${FILE} not found."226 227 exit 4228 fi229 }230 231 137 cleanup_dir() { 232 138 DIR="$1" … … 262 168 } 263 169 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" 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 276 191 } 277 192 … … 280 195 TARGET="$2" 281 196 282 WORKDIR="${BASEDIR}/${PLATFORM}" 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`" 283 209 BINUTILSDIR="${WORKDIR}/binutils-${BINUTILS_VERSION}" 284 210 GCCDIR="${WORKDIR}/gcc-${GCC_VERSION}" … … 286 212 287 213 if [ -z "${CROSS_PREFIX}" ] ; then 288 CROSS_PREFIX="/usr/local /cross"214 CROSS_PREFIX="/usr/local" 289 215 fi 290 216 … … 292 218 293 219 echo ">>> Downloading tarballs" 294 source_check "${BASEDIR}/${BINUTILS}"295 source_check "${BASEDIR}/${GCC_CORE}"296 source_check "${BASEDIR}/${GCC_OBJC}"297 source_check "${BASEDIR}/${GCC_CPP}"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" 298 224 299 225 echo ">>> Removing previous content" 300 226 cleanup_dir "${PREFIX}" 301 cleanup_dir "${WORKDIR}" 227 cleanup_dir "${OBJDIR}" 228 cleanup_dir "${BINUTILSDIR}" 229 cleanup_dir "${GCCDIR}" 302 230 303 231 create_dir "${PREFIX}" "destination directory" … … 305 233 306 234 echo ">>> Unpacking tarballs" 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++" 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++" 314 239 315 240 echo ">>> Processing binutils (${PLATFORM})" 316 241 cd "${BINUTILSDIR}" 317 242 check_error $? "Change directory failed." 243 patch_binutils "${PLATFORM}" 318 244 319 245 change_title "binutils: configure (${PLATFORM})" … … 337 263 check_error $? "Error compiling/installing GCC." 338 264 339 cd "${ BASEDIR}"265 cd "${WORKDIR}" 340 266 check_error $? "Change directory failed." 341 267 342 268 echo ">>> Cleaning up" 343 cleanup_dir "${WORKDIR}" 269 cleanup_dir "${OBJDIR}" 270 cleanup_dir "${BINUTILSDIR}" 271 cleanup_dir "${GCCDIR}" 344 272 345 273 echo … … 351 279 fi 352 280 281 show_dependencies 282 353 283 case "$1" in 354 284 "amd64") 355 prepare356 285 build_target "amd64" "amd64-linux-gnu" 357 286 ;; 358 287 "arm32") 359 prepare360 288 build_target "arm32" "arm-linux-gnu" 361 289 ;; 362 290 "ia32") 363 prepare364 291 build_target "ia32" "i686-pc-linux-gnu" 365 292 ;; 366 293 "ia64") 367 prepare368 294 build_target "ia64" "ia64-pc-linux-gnu" 369 295 ;; 296 "ia64") 297 build_target "ia64" "ia64-pc-linux-gnu" 298 ;; 370 299 "mips32") 371 prepare372 300 build_target "mips32" "mipsel-linux-gnu" 373 301 ;; 374 302 "mips32eb") 375 prepare376 303 build_target "mips32eb" "mips-linux-gnu" 377 304 ;; 378 "mips64")379 prepare380 build_target "mips64" "mips64el-linux-gnu"381 ;;382 305 "ppc32") 383 prepare384 306 build_target "ppc32" "ppc-linux-gnu" 385 307 ;; 386 308 "ppc64") 387 prepare388 309 build_target "ppc64" "ppc64-linux-gnu" 389 310 ;; 390 311 "sparc64") 391 prepare392 312 build_target "sparc64" "sparc64-linux-gnu" 393 313 ;; 394 314 "all") 395 prepare396 315 build_target "amd64" "amd64-linux-gnu" 397 316 build_target "arm32" "arm-linux-gnu" 398 317 build_target "ia32" "i686-pc-linux-gnu" 399 318 build_target "ia64" "ia64-pc-linux-gnu" 319 build_target "ia64" "ia64-pc-linux-gnu" 400 320 build_target "mips32" "mipsel-linux-gnu" 401 321 build_target "mips32eb" "mips-linux-gnu" 402 build_target "mips64" "mips64el-linux-gnu"403 322 build_target "ppc32" "ppc-linux-gnu" 404 323 build_target "ppc64" "ppc64-linux-gnu" 405 324 build_target "sparc64" "sparc64-linux-gnu" 406 325 ;; 407 "parallel")408 prepare409 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 wait420 ;;421 326 *) 422 327 show_usage
Note:
See TracChangeset
for help on using the changeset viewer.