build.sh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #!/bin/sh
  2. #
  3. set -e
  4. : ${MACHINE:=mips-elf}
  5. b_prefix="--prefix=${INSTALL}"
  6. machine="--target ${MACHINE}"
  7. # build dependencies
  8. gmp="--with-gmp=${INSTALL}"
  9. mfr="--with-mpfr=${INSTALL}"
  10. mpc="--with-mpc=${INSTALL}"
  11. # gcc
  12. #
  13. newlib="--with-newlib --without-headers"
  14. extra="--disable-lto --disable-nls --disable-libgomp --disable-libquadmath --disable-decimal-float --disable-libitm --without-isl --disable-plugin"
  15. sde="--with-arm=mips32r2"
  16. sde_extra="--with-mips-plt --with-llsc --with-synci"
  17. binutils="${mpc} ${gmp} ${mpfr} --with-gnu-as --with-gnu-ld"
  18. hier_dirs ()
  19. {
  20. cd ${BUILDDIR}
  21. mkdir -p "${1}"
  22. cd "${1}"
  23. }
  24. prebuild()
  25. {
  26. cd "${BUILDDIR}"
  27. hier_dirs gmp
  28. ${START}/${GMP}/configure ${b_prefix} -q --disable-shared
  29. make && make install
  30. hier_dirs mpfr
  31. ${START}/${MPFR}/configure ${b_prefix} -q --disable-shared --disable-lto --disable-decimal-float
  32. make && make install
  33. hier_dirs mpc
  34. ${START}/${MPC}/configure ${b_prefix} -q --disable-shared
  35. make && make install
  36. }
  37. binutils()
  38. {
  39. hier_dirs binutils
  40. ${START}/${BINUTILS}/configure -q ${b_prefix} ${machine} ${mpc} ${gmp} ${mpfr} \
  41. --disable-debug --disable-lto --disable-nls --disable-multilib \
  42. --disable-gdb --disable-gdb-server --disable-libdecnumber \
  43. --disable-readline --disable-sim --disable-gold
  44. make && make install
  45. }
  46. phase_1()
  47. {
  48. hier_dirs gcc0
  49. ${START}/${GCC}/configure -q ${b_prefix} ${machine} --enable-languages=c ${binutils} \
  50. ${sde} ${newlib} ${sde_extra}
  51. make all-gcc && make install-gcc
  52. make all-target-libgcc && make install-target-libgcc
  53. }
  54. newlib()
  55. {
  56. hier_dirs newlib
  57. ${START}/${NEWLIB}/configure -q ${b_prefix} ${machine} --disable-newlib-supplied-syscalls
  58. make && make install
  59. }
  60. phase_2()
  61. {
  62. hier_dirs gcc1
  63. ${START}/${GCC}/configure -q ${b_prefix} ${machine} --enable-languages=c ${binutils} ${sde} ${newlib} ${sde_extra}
  64. }
  65. test -z "${BUILDDIR}" -o -z "${PREFIX}" -o -z "${START}" -o -z "${MACHINE}" && 2>& echo "Environment not set." && exit
  66. test -r "./versions.env" && . "./versions.env"
  67. prebuild
  68. binutils
  69. phase_1
  70. newlib
  71. phase_2