gcc-pass1-cmds.sh 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #!/bin/bash
  2. set +h
  3. source "$basedir/build-helpers.sh"
  4. # In case some commands aren't available on host OS,
  5. # build and install along with GCC.
  6. add_dependency() {
  7. local pkgname="$1"
  8. local pkgversion="$2"
  9. local ext="$3"
  10. pkgsrc="$basedir"/"$pkgname"-"$pkgversion"."$ext"
  11. [[ -e "$pkgsrc" ]] || {
  12. >&2 echo $pkgsrc not found.
  13. exit 1
  14. }
  15. tar xvf "$pkgsrc" && mv -v "$pkgname"-"$pkgversion" "$pkgname"
  16. }
  17. dependencies_commands() {
  18. cd "$srcdir"
  19. for p in \
  20. "mpfr 3.1.3 tar.xz" \
  21. "mpc 1.0.3 tar.gz"; do
  22. add_dependency $p &
  23. done
  24. local pkgname="gmp"
  25. local pkgversion="6.0.0"
  26. local ext="tar.xz"
  27. pkgsrc="$basedir"/"$pkgname"-"$pkgversion"a."$ext"
  28. [[ -e "$pkgsrc" ]] || {
  29. >&2 echo $pkgsrc not found.
  30. exit 1
  31. }
  32. tar xvf "$pkgsrc" && mv -v "$pkgname"-"$pkgversion" "$pkgname"
  33. wait
  34. }
  35. fixup_commands() {
  36. cd "$srcdir"
  37. for f in \
  38. $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
  39. do
  40. cp -uv "$f"{,.orig}
  41. sed -e 's|/lib\(64\)\?\(32\)\?/ld|/tools&|g' \
  42. -e 's|/usr|/tools|g' \
  43. "$f".orig > "$f"
  44. cat >> "$f" << EOF
  45. #undef STANDARD_STARTFILE_PREFIX_1
  46. #undef STANDARD_STARTFILE_PREFIX_2
  47. #define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
  48. #define STANDARD_STARTFILE_PREFIX_2 ""
  49. EOF
  50. touch "$f".orig
  51. done
  52. }
  53. configure_commands() {
  54. cd "$builddir"
  55. "$srcdir"/configure \
  56. --target=$LFS_TGT \
  57. --prefix=/tools \
  58. --with-glibc-version=2.11 \
  59. --with-sysroot=$LFS \
  60. --with-newlib \
  61. --without-headers \
  62. --with-local-prefix=/tools \
  63. --with-native-system-header-dir=/tools/include \
  64. --disable-nls \
  65. --disable-shared \
  66. --disable-multilib \
  67. --disable-decimal-float \
  68. --disable-threads \
  69. --disable-libatomic \
  70. --disable-libgomp \
  71. --disable-libquadmath \
  72. --disable-libssp \
  73. --disable-libvtv \
  74. --disable-libstdcxx \
  75. --enable-languages=c,c++
  76. }