From 01e0770bbb12897cf8e1e9510b2dbae3e6a2b453 Mon Sep 17 00:00:00 2001 From: Aditya Date: Mon, 9 Jan 2023 15:43:43 +0530 Subject: [PATCH] Add 6.18 - Build gcc --- scripts/chapter6/6.18-gcc.sh | 61 ++++++++++++++++++++++++++++++++++++ scripts/main.sh | 16 ++++++++-- 2 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 scripts/chapter6/6.18-gcc.sh diff --git a/scripts/chapter6/6.18-gcc.sh b/scripts/chapter6/6.18-gcc.sh new file mode 100644 index 0000000..2798724 --- /dev/null +++ b/scripts/chapter6/6.18-gcc.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +cd $LFS/sources +tar xf gcc-12.2.0.tar.xz +cd 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 + +sed '/thread_header =/s/@.*@/gthr-posix.h/' \ + -i libgcc/Makefile.in libstdc++-v3/include/Makefile.in + +mkdir -v build +cd build + +../configure \ + --build=$(../config.guess) \ + --host=$LFS_TGT \ + --target=$LFS_TGT \ + LDFLAGS_FOR_TARGET=-L$PWD/$LFS_TGT/libgcc \ + --prefix=/usr \ + --with-build-sysroot=$LFS \ + --enable-initfini-array \ + --disable-nls \ + --disable-multilib \ + --disable-decimal-float \ + --disable-libatomic \ + --disable-libgomp \ + --disable-libquadmath \ + --disable-libssp \ + --disable-libvtv \ + --enable-languages=c,c++ + +if [ $? -ne 0 ] +then + exit 1 +fi + +make -j5 + +if [ $? -ne 0 ] +then + exit 1 +fi + +make DESTDIR=$LFS install + +ln -sv gcc $LFS/usr/bin/cc + +cd $LFS/sources +rm -rf gcc-12.2.0 diff --git a/scripts/main.sh b/scripts/main.sh index e7e2472..2edd80d 100644 --- a/scripts/main.sh +++ b/scripts/main.sh @@ -373,8 +373,8 @@ fi # Chapter 6.17 # ============ -echo "Building 6.18" -su - lfs -c "$PWD/chapter6/6.17-binutils.sh" +echo "Building binutils pass 2" +su - lfs -c "bash $PWD/chapter6/6.17-binutils.sh" # Exit on error check_exit_code @@ -383,3 +383,15 @@ then stop_script "chapter6/6.17-binutils.sh" fi +# Chapter 6.18 +# ============ +echo "Building gcc pass 2" +su - lfs -c "bash $PWD/chapter6/6.18-gcc.sh" + +# Exit on error +check_exit_code +if [ $exit_status -ne 0 ] +then + stop_script "chapter6/6.18-gcc.sh" +fi +