From db607561c076971bcdc807acc3bce4162e48b6b3 Mon Sep 17 00:00:00 2001 From: "J.W. Jagersma" Date: Mon, 10 Jul 2023 20:13:50 +0200 Subject: [PATCH] ensure old specs file is removed before build --- build-djgpp.sh | 3 --- script/download.sh | 13 +++++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/build-djgpp.sh b/build-djgpp.sh index d9d1556..080608a 100755 --- a/build-djgpp.sh +++ b/build-djgpp.sh @@ -62,9 +62,6 @@ fi cd ${BASE}/build/ || exit 1 -echo "Removing old specs file" -${SUDO} rm -f ${PREFIX}/lib/gcc/${TARGET}/$(get_version gcc)/specs - if [ ! -z ${WATT32_VERSION} ]; then export WATT_ROOT=${BASE}/build/Watt-32 cd ${WATT_ROOT} || exit 1 diff --git a/script/download.sh b/script/download.sh index d2ba63e..059dcd9 100644 --- a/script/download.sh +++ b/script/download.sh @@ -125,5 +125,18 @@ echo "Creating install directory: ${DST}" export PATH="${DST}/bin:${PREFIX}/bin:$PATH" +remove_if_exists() +{ + if [ -e $1 ]; then + ${SUDO} rm -f $1 || exit 1 + fi +} + +if which ${TARGET}-gcc 2>&1 > /dev/null; then + echo "Removing previously-installed specs file" + remove_if_exists "${DST}/lib/gcc/${TARGET}/$(${TARGET}-gcc -dumpversion)/specs" + remove_if_exists "${PREFIX}/lib/gcc/${TARGET}/$(${TARGET}-gcc -dumpversion)/specs" +fi + rm -rf ${BASE}/tests mkdir -p ${BASE}/tests