From 3f985b15572453eb5d629391f58c53282b8540b6 Mon Sep 17 00:00:00 2001 From: Lephenixnoir Date: Thu, 7 Jan 2021 18:31:52 +0100 Subject: [PATCH] avoid rebuilds during updates --- build.sh | 3 +++ configure.sh | 13 +++++++++++++ giteapc.make | 2 +- install.sh | 3 +++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index efe64e5..acc2395 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,8 @@ #! /usr/bin/env bash +# Avoid rebuilds of the same version +[[ ! -d build ]] && exit 0 + source util.sh cd build diff --git a/configure.sh b/configure.sh index 97b4bb4..85cf175 100755 --- a/configure.sh +++ b/configure.sh @@ -3,9 +3,22 @@ source util.sh VERSION=$1 +PREFIX="$2" URL="https://ftp.gnu.org/gnu/binutils/binutils-$VERSION.tar.xz" ARCHIVE=$(basename "$URL") +# Avoid rebuilds of the same version + +existing_as="$PREFIX/bin/sh-elf-as" + +if [[ -f "$existing_as" ]]; then + existing_version=$($existing_as --version | head -n 1 | grep -Eo '[0-9.]+$') + if [[ $existing_version == $VERSION ]]; then + echo "$TAG Version $VERSION already installed, skipping rebuild" + exit 0 + fi +fi + # Check dependencies for binutils and GCC if command -v apt >/dev/null 2>&1; then diff --git a/giteapc.make b/giteapc.make index 935f916..e6f10f8 100644 --- a/giteapc.make +++ b/giteapc.make @@ -8,7 +8,7 @@ include giteapc-config-$(GITEAPC_CONFIG).make endif configure: - @ ./configure.sh $(VERSION) + @ ./configure.sh $(VERSION) "$(PREFIX)" build: @ ./build.sh diff --git a/install.sh b/install.sh index b5cab80..887ff58 100755 --- a/install.sh +++ b/install.sh @@ -1,5 +1,8 @@ #! /usr/bin/env bash +# Avoid rebuilds of the same version +[[ ! -d build ]] && exit 0 + source util.sh PREFIX="$1"