BuildSystem: Fix temporary sysroot creation in toolchain compilation

This commit is contained in:
Bananymous 2023-11-07 14:01:42 +02:00
parent 613d6640fe
commit a8ffe6b3a6
1 changed files with 16 additions and 10 deletions

View File

@ -74,7 +74,7 @@ build_binutils () {
--disable-nls \ --disable-nls \
--disable-werror --disable-werror
make -j $(nproc) make
make install make install
} }
@ -100,8 +100,8 @@ build_gcc () {
--disable-nls \ --disable-nls \
--enable-languages=c,c++ --enable-languages=c,c++
make -j $(nproc) all-gcc make all-gcc
make -j $(nproc) all-target-libgcc CFLAGS_FOR_TARGET='-g -O2 -mcmodel=large -mno-red-zone' make all-target-libgcc CFLAGS_FOR_TARGET='-g -O2 -mcmodel=large -mno-red-zone'
make install-gcc install-target-libgcc make install-gcc install-target-libgcc
} }
@ -127,7 +127,7 @@ build_grub () {
--with-platform="efi" \ --with-platform="efi" \
--disable-werror --disable-werror
make -j $(nproc) make
make install make install
} }
@ -138,7 +138,7 @@ build_libstdcpp () {
fi fi
cd $BANAN_BUILD_DIR/toolchain/$GCC_VERSION/build cd $BANAN_BUILD_DIR/toolchain/$GCC_VERSION/build
make -j $(nproc) all-target-libstdc++-v3 make all-target-libstdc++-v3
make install-target-libstdc++-v3 make install-target-libstdc++-v3
} }
@ -154,16 +154,22 @@ fi
# NOTE: we have to manually create initial sysroot with libc headers # NOTE: we have to manually create initial sysroot with libc headers
# since cmake cannot be invoked yet # since cmake cannot be invoked yet
echo "Syncing sysroot headers" echo "Creating dummy sysroot"
mkdir -p $BANAN_SYSROOT rm -rf $BANAN_SYSROOT
sudo mkdir -p $BANAN_SYSROOT/usr/include mkdir -p $BANAN_SYSROOT/usr
sudo rsync -a $BANAN_ROOT_DIR/libc/include/ $BANAN_SYSROOT/usr/include/ cp -r $BANAN_ROOT_DIR/libc/include $BANAN_SYSROOT/usr/include
mkdir -p $BANAN_BUILD_DIR/toolchain
# Cleanup all old files from toolchain prefix # Cleanup all old files from toolchain prefix
rm -rf $BANAN_TOOLCHAIN_PREFIX rm -rf $BANAN_TOOLCHAIN_PREFIX
if [[ -z ${MAKEFLAGS:x} ]]; then
export MAKEFLAGS="-j$(proc)"
fi
mkdir -p $BANAN_BUILD_DIR/toolchain
build_binutils build_binutils
build_gcc build_gcc
build_grub build_grub
rm -rf $BANAN_SYSROOT