Add 5.3 - build gcc

This commit is contained in:
Aditya 2023-01-08 14:51:58 +05:30
parent 432490c6f6
commit d40db637e1
2 changed files with 79 additions and 0 deletions

View file

@ -0,0 +1,69 @@
#!/bin/bash
# Extract and switch to the directory
cd $LFS/sources
tar xf gcc-12.2.0.tar.xz
cd $LFS/sources/gcc-12.2.0
tar -xf ../mpfr-4.1.0.tar.xz
mv -v mpfr-4.1.0 mpfr
tar -xf ../gmp-6.2.1.tar.xz
mv -v gmp-6.2.1 gmp
tar -xf ../mpc-1.2.1.tar.gz
mv -v mpc-1.2.1 mpc
case $(uname -m) in
x86_64)
sed -e '/m64=/s/lib64/lib/' \
-i.orig gcc/config/i386/t-linux64
;;
esac
mkdir -v build
cd build
../configure \
--target=$LFS_TGT \
--prefix=$LFS/tools \
--with-glibc-version=2.36 \
--with-sysroot=$LFS \
--with-newlib \
--without-headers \
--disable-nls \
--disable-shared \
--disable-multilib \
--disable-decimal-float \
--disable-threads \
--disable-libatomic \
--disable-libgomp \
--disable-libquadmath \
--disable-libssp \
--disable-libvtv \
--disable-libstdcxx \
--enable-languages=c,c++
# Exit on error
if [ $? -ne 0 ]
then
exit 1
fi
make -j5
# Exit on error
if [ $? -ne 0 ]
then
exit 1
fi
make install
if [ $? -ne 0 ]
then
exit 1
fi
cd ..
cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \
`dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/install-tools/include/limits.h

View file

@ -140,4 +140,14 @@ then
stop_script "chapter5/5.2-binutils.sh"
fi
# Chapter 5.3
# ===========
echo "Building gcc"
su - lfs -c "$PWD/chapter5/5.3-gcc.sh"
# Exit on error
check_exit_code
if [ $exit_status -ne 0 ]
then
stop_script "chapter5/5.3-gcc.sh"
fi