sh-elf-vhex - v2.0.0-rc15 : fix typo
*fix* > [project] | [gitignore] ignore generated folders | [readme] add PATH export information > [scripts] | [install] fix typo | [uninstall] fix typo
This commit is contained in:
parent
dc219da739
commit
1b31e8aef0
|
@ -1,4 +1,5 @@
|
|||
build
|
||||
cache
|
||||
_build
|
||||
_cache
|
||||
_sysroot
|
||||
commit.txt
|
||||
.vxsdk
|
||||
|
|
14
README.md
14
README.md
|
@ -70,6 +70,20 @@ cd /tmp/sh-elf-vhex || exit 1
|
|||
|
||||
It takes about twenty minutes for the build.
|
||||
|
||||
Do not forget to add the install prefix (`~/.local/bin`) path to your `PATH`
|
||||
environment variable:
|
||||
|
||||
> [!WARNING]
|
||||
> You must add the absolute path to your PATH environment variable
|
||||
|
||||
```bash
|
||||
# *unix-like
|
||||
export PATH="$PATH:/home/<your_login>/.local/bin"
|
||||
|
||||
# macos (darwin-like)
|
||||
export PATH="$PATH:/Users/<your_login>/.local/bin"
|
||||
```
|
||||
|
||||
## Supported version list
|
||||
|
||||
Note that GCC `12.x` will never be supported since many critical bugs have been
|
||||
|
|
|
@ -0,0 +1,164 @@
|
|||
#! /usr/bin/env bash
|
||||
|
||||
#---
|
||||
# Help screen
|
||||
#---
|
||||
|
||||
function help() {
|
||||
cat << EOF
|
||||
Script for the installation step of binutils/GCC tools for the Vhex project.
|
||||
|
||||
Usage $0 [options...]
|
||||
|
||||
Configurations:
|
||||
-h, --help Display this help
|
||||
-v, --verbose Display extra information during operation
|
||||
--prefix-install Installation (bin) prefix
|
||||
--prefix-sysroot Sysroot (lib, header, ...) prefix
|
||||
--prefix-clone Clone prefix
|
||||
--overwrite Remove the cloned version if exists and install
|
||||
--cache Keep the build and the sources directory
|
||||
|
||||
Notes:
|
||||
This project will automatically install the vxLibc. You can use the
|
||||
VERBOSE env var to enable the verbose mode without explicit use of the
|
||||
'--verbose' option.
|
||||
EOF
|
||||
exit 0
|
||||
}
|
||||
|
||||
#---
|
||||
# Parse arguments
|
||||
#---
|
||||
|
||||
cache='false'
|
||||
verbose='false'
|
||||
overwrite='false'
|
||||
prefix_install=~/.local/bin
|
||||
prefix_sysroot=~/.local/share/sh-elf-vhex/_sysroot
|
||||
prefix_clone=~/.local/share/sh-elf-vhex
|
||||
|
||||
for arg; do
|
||||
case "$arg" in
|
||||
--help | -h) help;;
|
||||
--verbose | -v) verbose=true;;
|
||||
--cache) cache=true;;
|
||||
--prefix-sysroot=*) prefix_sysroot=${arg#*=};;
|
||||
--prefix-install=*) prefix_install=${arg#*=};;
|
||||
--prefix-clone=*) prefix_clone=${arg#*=};;
|
||||
--overwrite) overwrite='true';;
|
||||
*)
|
||||
echo "error: unrecognized argument '$arg', giving up." >&2
|
||||
exit 1
|
||||
esac
|
||||
done
|
||||
|
||||
#---
|
||||
# Handle bootstraping
|
||||
#---
|
||||
|
||||
_src=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
|
||||
cd "$_src" || exit 1
|
||||
|
||||
has_been_cloned='false'
|
||||
if [[ "$prefix_clone/scripts" != "$_src" ]]
|
||||
then
|
||||
if [ -x "$prefix_install/sh-elf-vhex-gcc" ]
|
||||
then
|
||||
echo -e \
|
||||
'It seems that the project is already installed :pouce:\n' \
|
||||
'\rIf you really want to reinstall this project use the ' \
|
||||
'"--overwrite" option.'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "$prefix_clone" || "$overwrite" == 'true' ]]
|
||||
then
|
||||
[[ -d "$prefix_clone" ]] && rm -rf "$prefix_clone"
|
||||
echo '<sh-elf-vhex> self-clone repository...'
|
||||
{
|
||||
git \
|
||||
clone \
|
||||
--depth=1 \
|
||||
https://github.com/YannMagnin/sh-elf-vhex.git \
|
||||
"$prefix_clone"
|
||||
} || {
|
||||
exit 1
|
||||
}
|
||||
has_been_cloned='true'
|
||||
fi
|
||||
fi
|
||||
|
||||
cd "$prefix_clone/scripts" || exit 1
|
||||
source ./_utils.sh
|
||||
|
||||
#---
|
||||
# Preliminary checks
|
||||
#---
|
||||
|
||||
version_gcc=$(utils_find_last_version ../patches/gcc)
|
||||
version_binutils=$(utils_find_last_version ../patches/binutils)
|
||||
|
||||
echo 'The script will install the sh-elf-vhex compiler with:'
|
||||
echo " - GCC version: $version_gcc"
|
||||
echo " - Binutils version: $version_binutils"
|
||||
echo " - Clone directory: $prefix_clone"
|
||||
echo " - Compliler install at: $prefix_install"
|
||||
if [[ "$has_been_cloned" == 'true' ]]; then
|
||||
echo 'Note that the cloned repository will be removed if aborted'
|
||||
fi
|
||||
read -p 'Proceed ? [yN]: ' -r valid < /dev/tty
|
||||
|
||||
if [[ "$valid" != 'y' ]]; then
|
||||
if [[ "$has_been_cloned" == 'true' ]]; then
|
||||
echo 'Removing the cloned repository...'
|
||||
rm -rf "$prefix_clone"
|
||||
fi
|
||||
echo 'Operation aborted o(x_x)o'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[[ "$verbose" == 'true' ]] && export VERBOSE=1
|
||||
|
||||
#---
|
||||
# Handle GGC/Binutils build
|
||||
#---
|
||||
|
||||
{
|
||||
./binutils/configure.sh \
|
||||
--prefix-sysroot="$prefix_sysroot" \
|
||||
--version="$version_binutils" \
|
||||
&& ./binutils/build.sh \
|
||||
&& ./gcc/configure.sh \
|
||||
--prefix-sysroot="$prefix_sysroot" \
|
||||
--version="$version_gcc" \
|
||||
&& ./gcc/build.sh
|
||||
} || {
|
||||
echo 'Error during installing operations' >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
#---
|
||||
# Handle manual installation to the install path
|
||||
#---
|
||||
|
||||
echo "$TAG Symlinking binaries..."
|
||||
|
||||
mkdir -p "$prefix_install"
|
||||
for x in "$prefix_sysroot/bin"/*; do
|
||||
utils_callcmd ln -sf "$x" "$prefix_install/$(basename "$x")"
|
||||
done
|
||||
|
||||
#---
|
||||
# Cleaning and exit
|
||||
#---
|
||||
|
||||
if [[ "$cache" == 'false' ]]
|
||||
then
|
||||
echo "$TAG Cleaning up built files..."
|
||||
rm -rf ../../build
|
||||
fi
|
||||
|
||||
echo -e \
|
||||
'Successfully installed sh-elf-vhex !\n' \
|
||||
'\rDo not forget to export the binary path' \
|
||||
"'export PATH=\"\$PATH:$prefix_install\"'"
|
|
@ -0,0 +1,114 @@
|
|||
#! /usr/bin/env bash
|
||||
|
||||
#---
|
||||
# Help screen
|
||||
#---
|
||||
|
||||
function help()
|
||||
{
|
||||
cat << EOF
|
||||
Script for the uninstallation of sh-elf-vhex
|
||||
|
||||
Usage $0 [options...]
|
||||
|
||||
Configurations:
|
||||
-h, --help Display this help
|
||||
--prefix-install Installation (bin) prefix
|
||||
--prefix-sysroot Sysroot (lib, header, ...) prefix
|
||||
--prefix-clone Clone prefix
|
||||
--no-purge Do not remove the cloned folder
|
||||
EOF
|
||||
exit 0
|
||||
}
|
||||
|
||||
#---
|
||||
# Parse arguments
|
||||
#---
|
||||
|
||||
purge='true'
|
||||
prefix_install=~/.local/bin
|
||||
prefix_sysroot=~/.local/share/sh-elf-vhex/_sysroot
|
||||
prefix_clone=~/.local/share/sh-elf-vhex
|
||||
for arg
|
||||
do case "$arg" in
|
||||
--help | -h) help;;
|
||||
--no-purge) purge='false';;
|
||||
--prefix-install=*) prefix_install=${arg#*=};;
|
||||
--prefix-sysroot=*) prefix_sysroot=${arg#*=};;
|
||||
--prefix-clone=*) prefix_clone=${arg#*=};;
|
||||
*)
|
||||
echo "error: unrecognized argument '$arg', giving up." >&2
|
||||
exit 1
|
||||
esac
|
||||
done
|
||||
|
||||
#---
|
||||
# Preliminary check
|
||||
#---
|
||||
|
||||
if [[ ! -d "$prefix_clone" ]]
|
||||
then
|
||||
echo -e \
|
||||
'Are you sure to have installed the project ?\n' \
|
||||
'\rIt seems that the cloned prefix does not exist' \
|
||||
>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -d "$prefix_install" ]]
|
||||
then
|
||||
echo -e \
|
||||
'WARNING: It seems that the install prefix does not exist\n' \
|
||||
'WARNING: if you continue, the install prefix will be ignore and' \
|
||||
'nothing will be removed' \
|
||||
>&2
|
||||
read -p 'Proceed anyway ? [yN]' -r valid < /dev/tty
|
||||
if [[ "$valid" != 'y' ]]; then
|
||||
echo 'Operation aborted o(x_x)o' >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ! -x "$prefix_sysroot/bin/sh-elf-vhex-as" ]]
|
||||
then
|
||||
echo -e \
|
||||
'ERROR: Are you sure to have built sh-elf-vhex ? It Seems that the' \
|
||||
'sh-elf-vhex-as cannot be found in the sysroot prefix' \
|
||||
>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 'The script will uninstall the sh-elf-vhex compiler with:'
|
||||
echo " - Clone directory: $prefix_clone"
|
||||
echo " - Install directory: $prefix_install"
|
||||
echo " - Sysroot directory: $prefix_sysroot"
|
||||
read -p 'Proceed ? [yN]: ' -r valid < /dev/tty
|
||||
if [[ "$valid" != 'y' ]]
|
||||
then
|
||||
echo 'Operation aborted o(x_x)o'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#---
|
||||
# Unistall step
|
||||
#---
|
||||
|
||||
cd "$prefix_clone/scripts" || exit 1
|
||||
source ./_utils.sh
|
||||
|
||||
echo "$TAG removing symlinks to binaries..."
|
||||
for x in "$prefix_sysroot"/bin/*; do
|
||||
utils_callcmd unlink "$x"
|
||||
if [[ -L "$prefix_install/$(basename "$x")" ]]; then
|
||||
utils_callcmd unlink "$prefix_install/$(basename "$x")"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "$TAG removing sysroot..."
|
||||
rm -rf "$prefix_sysroot"
|
||||
|
||||
if [[ "$purge" == 'true' ]]
|
||||
then
|
||||
echo "$TAG removing cloned folder..."
|
||||
rm -rf "$prefix_clone"
|
||||
fi
|
Loading…
Reference in New Issue