From c4d05049c478980e3087c4043ec36ec315ee0f71 Mon Sep 17 00:00:00 2001 From: Devashish Date: Mon, 27 Apr 2020 13:33:27 +0530 Subject: [PATCH] Toolchain: Don't create repository for patches if not necessary The toolchain builds just fine without the git repository (tested on windows and linux). We can skip setting up the repo and apply the patches directly when we aren't working on the toolchain itself. A flag `--dev` has been added for cases when git repo is needed. Without the flag, regular patch is applied. This significantly improves build times for first time builds. --- Toolchain/BuildIt.sh | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/Toolchain/BuildIt.sh b/Toolchain/BuildIt.sh index 8bccabfd0b..c54e1cd1b1 100755 --- a/Toolchain/BuildIt.sh +++ b/Toolchain/BuildIt.sh @@ -32,6 +32,15 @@ elif [ "$(uname -s)" = "FreeBSD" ]; then NPROC="sysctl -n hw.ncpu" fi +git_patch= +while [ "$1" != "" ]; do + case $1 in + --dev ) git_patch=1 + ;; + esac + shift +done + echo PREFIX is "$PREFIX" echo SYSROOT is "$SYSROOT" @@ -111,10 +120,14 @@ pushd "$DIR/Tarballs" tar -xzf ${BINUTILS_PKG} pushd ${BINUTILS_NAME} - git init >/dev/null - git add . >/dev/null - git commit -am "BASE" >/dev/null - git apply "$DIR"/Patches/binutils.patch >/dev/null + if [ "$git_patch" = "1" ]; then + git init > /dev/null + git add . > /dev/null + git commit -am "BASE" > /dev/null + git apply "$DIR"/Patches/binutils.patch > /dev/null + else + patch -p1 < "$DIR"/Patches/binutils.patch > /dev/null + fi popd else echo "Skipped extracting binutils" @@ -125,10 +138,14 @@ pushd "$DIR/Tarballs" tar -xzf $GCC_PKG pushd $GCC_NAME - git init >/dev/null - git add . >/dev/null - git commit -am "BASE" >/dev/null - git apply "$DIR"/Patches/gcc.patch >/dev/null + if [ "$git_patch" = "1" ]; then + git init > /dev/null + git add . > /dev/null + git commit -am "BASE" > /dev/null + git apply "$DIR"/Patches/gcc.patch > /dev/null + else + patch -p1 < "$DIR"/Patches/gcc.patch > /dev/null + fi popd else echo "Skipped extracting gcc"