This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 21st, 2011  |  syntax: Bash  |  size: 3.10 KB  |  views: 642  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #Source: http://forum.chdk-treff.de/viewtopic.php?t=1829&postdays=0&postorder=asc&highlight=compilieren+linux&start=45
  2.  
  3. #!/bin/sh
  4. # Builds a arm-elf cross compiler for use on linux
  5. # host systems. This target has no file system or kernel.
  6. #
  7. TARGET="arm-elf"
  8. BUILDDIR=`pwd`
  9. BUILDDIR="${BUILDDIR}/build-dir"
  10. mkdir ${BUILDDIR}
  11. SRC="${BUILDDIR}/packages" # package directory
  12. PREFIX="${BUILDDIR}/arm/toolchain" # final toolchain directory
  13. PARALLEL="-j 4"
  14. BINUTILS=binutils-2.18
  15. GCC=gcc-4.5.2
  16. GMP=gmp-5.0.1
  17. MPFR=mpfr-3.0.0
  18. MPC=mpc-0.8.2
  19. NEWLIB=newlib-1.18.0
  20. export PATH="$PATH:$PREFIX/bin"
  21. # Before we do anything we need all the source files.
  22. # We keep them in one place and we never need to
  23. # download them twice if this build fails.
  24. mkdir $SRC
  25. cd $SRC
  26. echo "Dounloading source packages. This may take a while."
  27. echo
  28. wget -c http://ftp.gnu.org/gnu/binutils/$BINUTILS.tar.bz2
  29. wget -c ftp://ftp.gnu.org/gnu/gcc/$GCC/$GCC.tar.bz2
  30. wget -c ftp://ftp.gmplib.org/pub/$GMP/$GMP.tar.bz2
  31. wget -c http://www.mpfr.org/mpfr-current/$MPFR.tar.bz2
  32. wget -c http://www.multiprecision.org/mpc/download/$MPC.tar.gz
  33. wget -c ftp://sources.redhat.com/pub/newlib/$NEWLIB.tar.gz
  34. cd ..
  35. echo "Starting Build..."
  36. echo
  37. mkdir build
  38. echo "Building binutils"
  39. echo
  40. tar xfj $SRC/$BINUTILS.tar.bz2
  41. cd $BINUTILS
  42. ./configure --target=$TARGET --prefix=$PREFIX --disable-werror
  43. # --enable-interwork --disable-multilib --with-gnu-as
  44. # --with-gnu-ld --disable-nls --disable-werror
  45. make $PARALLEL
  46. make install
  47. cd ..
  48. rm -rf build/* $BINUTILS
  49. echo "Building GCC pass 1"
  50. tar xfj $SRC/$GCC.tar.bz2
  51. # the compiler math prereqs
  52. tar -jxf $SRC/$GMP.tar.bz2
  53. tar -jxf $SRC/$MPFR.tar.bz2
  54. tar -zxf $SRC/$MPC.tar.gz
  55. cd $GCC
  56. mv ../$GMP gmp
  57. mv ../$MPFR mpfr
  58. mv ../$MPC mpc
  59. echo ""
  60. cd ../build
  61. #
  62. echo "ed ../$GCC/gcc/config/arm/t-arm-elf"
  63. ed ../$GCC/gcc/config/arm/t-arm-elf << EOF
  64. /MULTILIB_OPTIONS/s/^M/# M/
  65. /MULTILIB_DIRNAMES/s/^M/# M/
  66. /mno-thumb-interwork/s/^# //
  67. /normal interwork/s/^# //
  68. wq
  69. EOF
  70. #
  71. ../$GCC/configure --target=$TARGET --prefix=$PREFIX --enable-interwork \
  72. --enable-multilib --enable-languages="c" --with-newlib \
  73. --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs \
  74. --without-headers --disable-shared --disable-nls --with-gnu-as --with-gnu-ld
  75. make $PARALLEL all-gcc
  76. make install-gcc
  77. cd ..
  78. rm -rf build/* # (We retain the GCC directory for pass 2)
  79. echo "Building Newlib"
  80. echo
  81. tar xfz $SRC/$NEWLIB.tar.gz
  82. cd build
  83. ../$NEWLIB/configure --target=$TARGET --prefix=$PREFIX --enable-interwork \
  84. --enable-multilib --with-gnu-as --with-gnu-ld --disable-nls
  85. make $PARALLEL
  86. make install
  87. cd ..
  88. rm -rf build/* $NEWLIB
  89. echo " Building GCC pass 2"
  90. echo
  91. cd build
  92. ../$GCC/configure --target=$TARGET --prefix=$PREFIX --enable-interwork \
  93. --enable-multilib --enable-languages="c" --with-newlib \
  94. --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs \
  95. --without-headers --disable-libssp --disable-nls --disable-zlib --disable-libc --disable-libm --disable-intl \
  96. --disable-hardfloat --disable-threads --with-gnu-as --with-gnu-ld
  97. make $PARALLEL
  98. make install
  99. cd ..
  100. rm -rf build/* $GCC
  101. echo "Compiler Finished for "$TARGET
clone this paste RAW Paste Data