talimat 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. version=5.3.0
  2. source=(\
  3. http://ftp.gnu.org/gnu/gmp/gmp-6.1.0.tar.xz \
  4. http://www.mpfr.org/mpfr-current/mpfr-3.1.3.tar.xz \
  5. http://www.multiprecision.org/mpc/download/mpc-1.0.3.tar.gz \
  6. http://ftp.gnu.org/gnu/gcc/gcc-$version/gcc-$version.tar.bz2 )
  7. build()
  8. {
  9. cd gcc-$version
  10. cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \
  11. `dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/include-fixed/limits.h
  12. for file in \
  13. $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
  14. do
  15. cp -uv $file{,.orig}
  16. sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
  17. -e 's@/usr@/tools@g' $file.orig > $file
  18. echo '
  19. #undef STANDARD_STARTFILE_PREFIX_1
  20. #undef STANDARD_STARTFILE_PREFIX_2
  21. #define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
  22. #define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
  23. touch $file.orig
  24. done
  25. mv -v ../mpfr-3.1.3 mpfr
  26. mv -v ../gmp-6.1.0 gmp
  27. mv -v ../mpc-1.0.3 mpc
  28. mkdir -v build
  29. cd build
  30. CC=$LFS_TGT-gcc \
  31. CXX=$LFS_TGT-g++ \
  32. AR=$LFS_TGT-ar \
  33. RANLIB=$LFS_TGT-ranlib \
  34. ../configure \
  35. --prefix=/tools \
  36. --with-local-prefix=/tools \
  37. --with-native-system-header-dir=/tools/include \
  38. --enable-languages=c,c++ \
  39. --disable-libstdcxx-pch \
  40. --disable-multilib \
  41. --disable-bootstrap \
  42. --disable-libgomp
  43. make
  44. make install
  45. ln -sv gcc /tools/bin/cc
  46. echo 'main(){}' > dummy.c
  47. cc dummy.c
  48. readelf -l a.out | grep ': /tools'
  49. rm -v dummy.c a.out
  50. mkdir -p $LFS/usr/lib
  51. ln -sv /tools/lib/libgcc_s.so{,.1} $LFS/usr/lib
  52. ln -sv /tools/lib/libstdc++.so{,.6} $LFS/usr/lib
  53. sed 's/tools/usr/' /tools/lib/libstdc++.la > $LFS/usr/lib/libstdc++.la
  54. }