From 536139dc5f27f3857efca74c9181978a5b5a5d38 Mon Sep 17 00:00:00 2001 From: Yann MAGNIN Date: Sun, 14 Nov 2021 15:00:58 +0100 Subject: [PATCH] add installation/uninstallation script for GCC + fix unistallation script for binutils --- scripts/binutils/uninstall.sh | 2 +- scripts/gcc/install.sh | 77 +++++++++++++++++++++++++++++++++++ scripts/gcc/uninstall.sh | 57 ++++++++++++++++++++++++++ 3 files changed, 135 insertions(+), 1 deletion(-) create mode 100755 scripts/gcc/install.sh create mode 100755 scripts/gcc/uninstall.sh diff --git a/scripts/binutils/uninstall.sh b/scripts/binutils/uninstall.sh index fe4cf4a..28c7401 100755 --- a/scripts/binutils/uninstall.sh +++ b/scripts/binutils/uninstall.sh @@ -54,4 +54,4 @@ done # Remove local files echo "$TAG Removing installed files..." -rm -rf bin/ sh-elf-vhex/ share/ lib/ +rm -rf ../../build/binutils diff --git a/scripts/gcc/install.sh b/scripts/gcc/install.sh new file mode 100755 index 0000000..22bf2b4 --- /dev/null +++ b/scripts/gcc/install.sh @@ -0,0 +1,77 @@ +#! /usr/bin/env bash + +verbose=false +cache=false +prefix= + + +# +# Help screen +# +help() +{ + cat << OEF +Installation helper script for the configuration step of the binutils build for +the Vhex kernel project. + +Usage $0 [options...] + +Configurations: + -h, --help Display this help + --cache Keep the build and sources directory + --verbose Display extra information during the installation step + --prefix= Installation prefix +OEF + exit 0 +} + + + +# +# Parse argument +# + +[[ $# -eq 0 ]] && help + +for arg; do case "$arg" in + --help | -h) help;; + --verbose) verbose=true;; + --cache) cache=true;; + --prefix=*) prefix=${arg#*=};; + *) + echo "error: unreconized argument '$arg', giving up." >&2 + exit 1 +esac; done + + +# +# Installation step +# @note +# This part is forked from the sh-elf-binutils repository created by +# Lephenixnoir. +# + +TAG='' +PREFIX="$prefix" + +# Avoid rebuilds of the same version + +[[ ! -d ../../build/gcc ]] && exit 0 +cd ../../build/gcc + + +# Symbolic link executables to $PREFIX/bin + +echo "$TAG Symlinking binaries..." +mkdir -p $PREFIX/bin +for x in bin/*; do + ln -sf "$(pwd)/$x" "$PREFIX/$x" +done + +# Cleanup build files + +if [[ "$cache" == 'false' ]]; then + echo "$TAG Cleaning up build files..." + rm -rf gcc/ + rm -rf build/ +fi diff --git a/scripts/gcc/uninstall.sh b/scripts/gcc/uninstall.sh new file mode 100755 index 0000000..0fd10b8 --- /dev/null +++ b/scripts/gcc/uninstall.sh @@ -0,0 +1,57 @@ +#! /usr/bin/env bash + +verbose=false +prefix= + + +# +# Help screen +# +help() +{ + cat << OEF +Installation helper script for the configuration step of the binutils build for +the Vhex kernel project. + +Usage $0 [options...] + +Configurations: + -h, --help Display this help + --verbose Display extra information during the installation step + --prefix= Installation prefix +OEF + exit 0 +} + + + +# +# Parse argument +# + +for arg; do case "$arg" in + --help | -h) help;; + --verbose) verbose=true;; + --prefix=*) prefix=${arg#*=};; + *) + echo "error: unreconized argument '$arg', giving up." >&2 + exit 1 +esac; done + + +# +# Unistall step +# + +TAG='' +PREFIX="$prefix" + +# Remove symlinks +echo "$TAG Removing symlinks to binaries..." +for x in bin/*; do + rm "$PREFIX/$x" +done + +# Remove local files +echo "$TAG Removing installed files..." +rm -rf ../../build/gcc