From 454da00377952c76f8666574fc047616bd8ef73e Mon Sep 17 00:00:00 2001 From: ag-tsotetsi Date: Thu, 19 Feb 2026 22:30:56 +0200 Subject: [PATCH] added gcc bootstrap build, update some paths of binutils to be consistant --- build.sh | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 74 insertions(+), 9 deletions(-) diff --git a/build.sh b/build.sh index b7623ef..2203e2b 100755 --- a/build.sh +++ b/build.sh @@ -25,6 +25,24 @@ export CONFIG_SITE="$SYSROOT/usr/share/config.site" BINUTILS_VERSION=2.45.1 BINUTILS_URL=https://mirror.ufs.ac.za/gnu/binutils/binutils-$BINUTILS_VERSION.tar.xz +GCC_VERSION=15.2.0 +GCC_URL=https://mirror.ufs.ac.za/gnu/gcc/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.xz + +GMP_VERSION=6.3.0 +GMP_URL=https://mirror.ufs.ac.za/gnu/gmp/gmp-$GMP_VERSION.tar.xz + +MPC_VERSION=1.3.1 +MPC_URL=https://mirror.ufs.ac.za/gnu/mpc/mpc-$MPC_VERSION.tar.gz + +MPFR_VERSION=4.2.2 +MPFR_URL=https://mirror.ufs.ac.za/gnu/mpfr/mpfr-$MPFR_VERSION.tar.xz + +ISL_VERSION=0.27 +ISL_URL=https://libisl.sourceforge.io/isl-$ISL_VERSION.tar.xz + +GLIBC_VERSION=2.43 +GLIBC_URL=https://mirror.ufs.ac.za/gnu/glibc/glibc-$GLIBC_VERSION.tar.xz + if [ ! -d "$SYSROOT" ]; then mkdir -p "$SYSROOT"/{etc,cross,sources,usr,dev,proc,sys,run} @@ -43,26 +61,73 @@ fetch() { bootstrap_binutils() { fetch $BINUTILS_URL - cd "$SOURCES" - tar xf binutils-$BINUTILS_VERSION.tar.xz - cd binutils-$BINUTILS_VERSION + cd "$SOURCES" && tar xf binutils-$BINUTILS_VERSION.tar.xz && cd binutils-$BINUTILS_VERSION - mkdir -p build - cd build + mkdir -p build && cd build ../configure \ --prefix="$CROSS" \ --with-sysroot="$SYSROOT" \ - --target="$TARGET" \ + --target=$TARGET \ --disable-nls \ --enable-gprofng=no \ --disable-werror \ --enable-new-dtags \ --enable-default-hash-style=gnu - make - make install + make && make install + + cd "$SOURCES" + rm -rf binutils-$BINUTILS_VERSION } +bootstap_gcc() { + fetch $GCC_URL + fetch $GMP_URL + fetch $ISL_URL + fetch $MPC_URL + fetch $MPFR_URL -bootstrap_binutils \ No newline at end of file + cd "$SOURCES" && tar xf gcc-$GCC_VERSION.tar.xz && cd gcc-$GCC_VERSION + + tar xf ../gmp-$GMP_VERSION.tar.xz && mv gmp-$GMP_VERSION gmp + tar xf ../isl-$ISL_VERSION.tar.xz && mv isl-$ISL_VERSION isl + tar xf ../mpc-$MPC_VERSION.tar.gz && mv mpc-$MPC_VERSION mpc + tar xf ../mpfr-$MPFR_VERSION.tar.xz && mv mpfr-$MPFR_VERSION mpfr + + sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64 + + mkdir -p build && cd build + + ../configure \ + --target=$TARGET \ + --prefix="$CROSS" \ + --with-glibc-version=$GLIBC_VERSION \ + --with-sysroot="$SYSROOT" \ + --with-newlib \ + --without-headers \ + --enable-default-pie \ + --enable-default-ssp \ + --disable-nls \ + --disable-shared \ + --disable-multilib \ + --disable-threads \ + --disable-libatomic \ + --disable-libgomp \ + --disable-libquadmath \ + --disable-libssp \ + --disable-libvtv \ + --disable-libstdcxx \ + --enable-languages=c,c++ + + make && make install + + cd .. + cat gcc/limitx.h gcc/glimits.h gcc/limity.h > "`dirname $($TARGET-gcc -print-libgcc-file-name)`/include/limits.h" + + cd "$SOURCES" + rm -rf gcc-$GCC_VERSION +} + +#bootstrap_binutils +bootstap_gcc \ No newline at end of file