From 14681708d1e6c665e1e6456e46016eaf7a6d4870 Mon Sep 17 00:00:00 2001 From: Yann MAGNIN Date: Tue, 25 Jan 2022 10:44:34 +0100 Subject: [PATCH] fix re-install --- giteapc.make | 18 ++++++++++-------- scripts/binutils/build.sh | 12 +++++++++++- scripts/binutils/configure.sh | 7 ++----- scripts/binutils/install.sh | 10 ++++++---- scripts/gcc/build.sh | 26 +++++++++++++++++++++----- scripts/gcc/configure.sh | 7 +++---- scripts/gcc/install.sh | 10 ++++++---- vxsdk.toml | 10 ++++++++++ 8 files changed, 69 insertions(+), 31 deletions(-) create mode 100644 vxsdk.toml diff --git a/giteapc.make b/giteapc.make index df2fd19..ad0f804 100644 --- a/giteapc.make +++ b/giteapc.make @@ -7,19 +7,21 @@ VERSION_GCC := 11.2.0 -include giteapc-config.make configure: - @ cd ./scripts/binutils && ./configure.sh --version=$(VERSION_BINUTILS) - @ cd ./scripts/gcc && ./configure.sh --version=$(VERSION_GCC) + @ cd ./scripts/binutils \ + && ./configure.sh --version="$(VERSION_BINUTILS)" \ + && cd ../gcc && ./configure.sh --version="$(VERSION_GCC)" build: - @ cd ./scripts/binutils && ./build.sh - @ cd ./scripts/gcc && ./build.sh + @ cd ./scripts/binutils && ./build.sh && cd ../gcc && ./build.sh install: - @ cd ./scripts/binutils && ./install.sh --prefix="$(PREFIX)" - @ cd ./scripts/gcc && ./install.sh --prefix="$(PREFIX)" + @ cd ./scripts/binutils \ + && ./install.sh --prefix="$(PREFIX)" \ + && cd ../gcc && ./install.sh --prefix="$(PREFIX)" uninstall: - @ cd ./scripts/binutils && ./uninstall.sh --prefix="$(PREFIX)" - @ cd ./scripts/gcc && ./uninstall.sh --prefix="$(PREFIX)" + @ cd ./scripts/binutils \ + && ./uninstall.sh --prefix="$(PREFIX)" \ + && cd ../gcc && ./uninstall.sh --prefix="$(PREFIX)" .PHONY: configure build install uninstall diff --git a/scripts/binutils/build.sh b/scripts/binutils/build.sh index a67b88a..ecd3fed 100755 --- a/scripts/binutils/build.sh +++ b/scripts/binutils/build.sh @@ -40,13 +40,19 @@ esac; done TAG='' -# Check that the configuration step has been effectuated +# Avoid rebuilds and error + +if [[ -f ../../build/binutils/.fini ]]; then + echo "$TAG already build, skipping rebuild" + exit 0 +fi if [[ ! -d ../../build/binutils/build ]]; then echo "error: Are you sure to have configured binutils ? it seems that" >&2 echo " the build directory is missing..." >&2 exit 1 fi + cd ../../build/binutils/build @@ -64,4 +70,8 @@ $quiet $make_cmd -j"$cores" echo "$TAG Installing to local folder..." $quiet $make_cmd install-strip + +# Indicate that the build is finished + +touch ../.fini exit 0 diff --git a/scripts/binutils/configure.sh b/scripts/binutils/configure.sh index b9ff514..af3669e 100755 --- a/scripts/binutils/configure.sh +++ b/scripts/binutils/configure.sh @@ -50,8 +50,6 @@ esac; done # check version -echo "$(pwd)" - list_version=$(basename $(ls -d ../../patchs/binutils/*)) if [[ "$version" == '?' ]]; then echo "$list_version" @@ -82,11 +80,10 @@ 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" - if [[ -e build ]]; then - rm -rf build - fi exit 0 fi + [[ -d ../../build/binutils/build ]] && rm -rf ../../build/binutils/build + [[ -f ../../build/binutils/.fini ]] && rm -f ../../build/binutils/.fini fi # Check dependencies for binutils and GCC diff --git a/scripts/binutils/install.sh b/scripts/binutils/install.sh index 4c978ff..81a78b4 100755 --- a/scripts/binutils/install.sh +++ b/scripts/binutils/install.sh @@ -49,11 +49,13 @@ esac; done TAG='' PREFIX="$prefix" -# Check that the configuration step has been effectuated +# Check that all tools has been generated -if [[ ! -d ../../build/binutils/build ]]; then - echo "error: Are you sure to have configured binutils ? it seems that" >&2 - echo " the build directory is missing..." >&2 +existing_as="../../build/binutils/bin/sh-elf-vhex-as" + +if [[ ! -f "$existing_as" ]]; then + echo "error: Are you sure to have built binutils ? it seems that" >&2 + echo " the 'as' tool is missing..." >&2 exit 1 fi cd ../../build/binutils diff --git a/scripts/gcc/build.sh b/scripts/gcc/build.sh index cc41378..c3bbb59 100755 --- a/scripts/gcc/build.sh +++ b/scripts/gcc/build.sh @@ -54,6 +54,22 @@ TAG='' source ../utils.sh + +# Avoid rebuilds and error + +if [[ -f ../../build/gcc/.fini ]]; then + echo "$TAG already build, skipping rebuild" + exit 0 +fi + +if [[ ! -d ../../build/gcc/build ]]; then + echo "error: Are you sure to have built GCC ? it seems that" >&2 + echo " the build directory is missing..." >&2 + exit 1 +fi + +cd ../../build/gcc/build + # OpenBSD apparently installs these in /usr/local extra_args= @@ -61,10 +77,7 @@ if [[ $(uname) == "OpenBSD" ]]; then extra_args='--with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local' fi -# Create the build directory -mkdir -p ../../build/gcc/build -cd ../../build/gcc/build @@ -146,9 +159,8 @@ cd .. # Build Vhex custom C standard library rm -rf fxlibc -$quiet git clone https://gitea.planet-casio.com/Vhex-Kernel-Core/fxlibc.git +$quiet git clone https://gitea.planet-casio.com/Vhex-Kernel-Core/fxlibc.git --branch dev cd fxlibc -$quiet git checkout dev $quiet cmake -DFXLIBC_TARGET=vhex-sh -B build-vhex \ -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-vhex.cmake \ @@ -230,4 +242,8 @@ $quiet $make_cmd -j"$cores" all-target-libgcc echo "$TAG Install libgcc (stage 2)..." $quiet $make_cmd -j"$cores" install-strip-target-libgcc + +# Indicate that the build is finished + +touch ../.fini exit 0 diff --git a/scripts/gcc/configure.sh b/scripts/gcc/configure.sh index 26eb500..eb239ea 100755 --- a/scripts/gcc/configure.sh +++ b/scripts/gcc/configure.sh @@ -79,11 +79,10 @@ if [[ -f "$existing_gcc" ]]; then existing_version=$($existing_gcc --version | head -n 1 | grep -Eo '[0-9.]+$') if [[ $existing_version == $VERSION ]]; then echo "$TAG Version $VERSION already installed, skipping rebuild" - if [[ -e ../../build/gcc/build ]]; then - rm -rf ../../build/gcc/build - fi exit 0 fi + [[ -d ../../build/gcc/build ]] && rm -rf ../../build/gcc/build + [[ -f ../../build/gcc/.fini ]] && rm -f ../../build/gcc/.fini fi # Download archive @@ -106,7 +105,7 @@ fi echo "$TAG Extracting $ARCHIVE..." -mkdir -p ../../build/gcc/ +mkdir -p ../../build/gcc/build cd ../../build/gcc unxz -c < $ARCHIVE | tar -xf - diff --git a/scripts/gcc/install.sh b/scripts/gcc/install.sh index 22f6dd4..1f1c68b 100755 --- a/scripts/gcc/install.sh +++ b/scripts/gcc/install.sh @@ -49,11 +49,13 @@ esac; done TAG='' PREFIX="$prefix" -# Check that the configuration step has been effectuated +# Check that all tools has been generated -if [[ ! -d ../../build/gcc/build ]]; then - echo "error: Are you sure to have configured GCC ? it seems that" >&2 - echo " the build directory is missing..." >&2 +existing_gcc="../../build/gcc/bin/sh-elf-vhex-gcc" + +if [[ ! -f "$existing_gcc" ]]; then + echo "error: Are you sure to have built GCC ? it seems that" >&2 + echo " the tool is missing..." >&2 exit 1 fi cd ../../build/gcc diff --git a/vxsdk.toml b/vxsdk.toml new file mode 100644 index 0000000..a3140e3 --- /dev/null +++ b/vxsdk.toml @@ -0,0 +1,10 @@ +[package] +name = 'sh-elf-vhex' +version = '1.0.1' +type = 'app' + +[build] +configure = 'make -f giteapc.make configure' +build = 'make -f giteapc.make build' +install = 'PREFIX=$VXSDK_INSTALL_PREFIX make -f giteapc.make install' +uninstall = 'PREFIX=$VXSDK_INSTALL_PREFIX make -f giteapc.make uninstall'