Compare commits

...

24 Commits

Author SHA1 Message Date
Yann MAGNIN 70d48f749f
release v2.1.0 2024-05-12 14:23:38 +02:00
Yann MAGNIN 2f95711393
sh-elf-vhex - v2.1.0-rc2 : fix `--overwrite` behaviour
*fix*
> [scripts]
  | [install] isolate overwrite operation
  | [install] request user confirmation to start the uninstall process
2024-05-12 14:22:43 +02:00
Yann MAGNIN 022ebe07a6
sh-elf-vhex - v2.1.0-rc1 : hotfix install and libgcc patches
*fix*
> [patches]
  | [gcc] hotfix host declaration
> [scripts]
  | [binutils] ignore failed `plurial.c` workaround
  | [install] hotfix cloned prefix removal handling
2024-05-12 01:08:14 +02:00
Yann MAGNIN 6bd2cde188
sh-elf-vhex - v2.1.0-dev0 : support gcc 14.1 and binutils 2.42
*add*
> [patches]
  | [gcc] support 14.1
  | [binutils] support 2.42
> [scripts]
  | [uninstall] support `--force` flag to skip user interaction

*fix*
> [scripts]
  | [install] rework broken `--overwrite`
2024-05-12 00:17:11 +02:00
Yann MAGNIN c48c4341c9
release v2.0.0 2023-12-22 14:32:55 +01:00
YannMagnin d8728e5f76
sh-elf-vhex - v2.0.0-rc20 : hotfix cache behaviour in install process
*fix*
> [scripts]
  | [install] hotfix cache behaviour
2023-12-22 13:42:44 +01:00
YannMagnin f5861b3b16
sh-elf-vhex - v2.0.0-rc19 : fix cache behaviour in install process
*fix*
> [scripts]
  | [install] fix cache behaviour
2023-12-22 13:31:33 +01:00
YannMagnin 186e0b456e
sh-elf-vhex - v2.0.0-rc18 : add cleaning logs
*update*
> [scripts]
  | [binutils/build] add cleaning logs
  | [gcc/build] add cleaning logs
2023-12-22 12:41:43 +01:00
YannMagnin 897a54b5bc
sh-elf-vhex - v2.0.0-rc17 : remove build and archive folder
*fix*
> [scripts]
  | [binutils/build] remove archive and build folder
  | [gcc/build] remove archive and build folder
2023-12-22 11:40:26 +01:00
YannMagnin e40d7f9fc6
sh-elf-vhex - v2.0.0-rc16 : hotfix typo
*fix*
> [scripts]
  | [install] fix typo
  | [uninstall] fix typo
2023-12-22 10:22:24 +01:00
YannMagnin 1b31e8aef0
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
2023-12-22 10:21:04 +01:00
YannMagnin dc219da739
sh-elf-vhex - v2.0.0-rc14 : hotfix missing newline in install + remove deprecated scripts
*update*
> [scripts]
  | [utils] check tar integrity
  | [gcc/build] update logs

*fix*
> [scripts]
  | [install] hotfix missing newline in install
  | [_uninstall] remove goofy script
2023-12-20 20:07:41 +01:00
YannMagnin 6a2443861c
sh-elf-vhex - v2.0.0-rc13 : fix typo
*fix*
> [scripts]
  | [gcc/build] fix typo in configuration logs
2023-12-20 19:21:35 +01:00
YannMagnin 1d58f26fb1
sh-elf-vhex - v2.0.0-rc12 : check install prefix instead of sysroot for rerun
*fix*
> [scripts]
  | [install] prefer check install prefix instead of sysroot prefix for rerun
2023-12-20 18:31:51 +01:00
YannMagnin 170bd7514a
sh-elf-vhex - v2.0.0-rc11 : fix MacOS support + update logs
*update*
> [scripts]
  | [install] more explicit post-install instruction

*fix*
> [scripts]
  | [utils] fix missing VERBOSE check
  | [utils] fix `nproc` check for make in Darwin OS
2023-12-20 17:48:32 +01:00
YannMagnin 7d8efc839d
sh-elf-vhex - v2.0.0-rc10 : support MacOS
*update*
> [scripts]
  | [binutils/config] support macos brew package manager

*fix*
> [project]
  | [readme] fix link
2023-12-20 15:34:53 +01:00
YannMagnin b6ce41b6b9
sh-elf-vhex - v2.0.0-rc9 : hotfix missing uninstall validation step
*fix*
> [scripts]
  | [uninstall] hotfix missing uninstall validation step
2023-12-19 19:36:56 +01:00
YannMagnin b40c63c221
sh-elf-vhex - v2.0.0-rc8 : hotfix install
*fix*
> [scripts]
  | [install] remove bootstrap dead code
  | [uninstall] hotfix utils loading
2023-12-19 19:25:58 +01:00
YannMagnin 8b7d15faf4
sh-elf-vhex - v2.0.0-rc7 : remove bootstrap script
*update*
> [project]
  | [readme] update the install curl operation information
  | [readme] add the uninstall curl operation information
  | [readme] move technical notes
> [scripts]
  | [install] merge bootstrap code
  | [uninstall] merge bootstrap code
  | [bootstrap] remove the bootstrap script
2023-12-19 19:13:36 +01:00
YannMagnin 432220b796
sh-elf-vhex - v2.0.0-rc6 : rework bootstrap preliminary checks
*update*
> [project]
  | [readme] simplify the curl operation
> [scripts]
  | [bootstrap] allow cloned folder if install aborted
  | [bootstrap] proper check if the project already installed

*fix*
> [scripts]
  | [bootstrap] avoid cloning if uninstall operation
  | [_uninstall] check for executable file instead of simple file
  | [_install]   check for executable file instead of simple file
2023-12-19 17:54:01 +01:00
YannMagnin c44e992e64
sh-elf-vhex - v2.0.0-rc5 : hotfix bad TTY path in read operation
*fix*
> [scripts]
  | [bootstrap] hotfix `read -r test < dev/tty` -> `read -r test < /dev/tty`
2023-12-18 18:56:01 +01:00
YannMagnin 85547d0fec
sh-elf-vhex - v2.0.0-rc4 : change the user input workaround
*fix*
> [scripts]
  | [bootstrap] force input validation even in curl mode
2023-12-18 17:56:20 +01:00
YannMagnin c7fefee2ed
sh-elf-vhex - v2.0.0-rc3 : fix input validation skip in curl operation
*fix*
> [scripts]
  | [bootstrap] fix check if the `stdin` is available before request user input
2023-12-18 17:18:17 +01:00
YannMagnin 5bca98ca63
sh-elf-vhex - v2.0.0-rc2 : hotfix input validation skip in curl operation
*fix*
> [scripts]
  | [bootstrap] check if the `stdin` is available before request user input
2023-12-17 17:32:32 +01:00
22 changed files with 15304 additions and 362 deletions

5
.gitignore vendored
View File

@ -1,4 +1,5 @@
build
cache
_build
_cache
_sysroot
commit.txt
.vxsdk

View File

@ -1,10 +1,12 @@
# sh-elf-vhex - modified GCC for the Vhex kernel projet
# sh-elf-vhex - v2.1.0
Modified GCC for the Vhex kernel projet
## Context
This project was born following the discovery of a limitation with GCC on the
SuperH architecture
[see on this subject from 2 years ago](
[see on this subject from few years ago](
https://gcc.gnu.org/legacy-ml/gcc-help/current/000075.html
):
@ -43,6 +45,56 @@ particular GCC.
* compilation of the libgcc in PIC (`t-libgcc-pic`)
* compilation of the library for emulated floating point numbers (`t-fdpbit`)
## Installing
The build is relatively simple and can be done in two different ways:
Using `curl`:
```bash
curl -fsSL https://raw.githubusercontent.com/YannMagnin/sh-elf-vhex/HEAD/scripts/install.sh | bash
```
Note that you can do the uninstallation using `curl` too:
```bash
curl -fsSL https://raw.githubusercontent.com/YannMagnin/sh-elf-vhex/HEAD/scripts/uninstall.sh | bash
```
Or by cloning the project and using the `install.sh` script, see
`./scripts/install.sh --help` for more information about possible operations
you can do with it
```bash
cd /tmp/
git clone 'https://github.com/YannMagnin/sh-elf-vhex.git' --depth=1
cd /tmp/sh-elf-vhex || exit 1
./script/install.sh
```
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
found for the superh backend
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106609)
- GCC `13.2.0` and binutils `2.41`
- GCC `11.2.0` and binutils `2.31`
## Technical notes
The bootstrap process will clone this repository at
@ -56,36 +108,7 @@ The project also automatically installs
[vxOpenLibm](https://github.com/YannMagnin/vxOpenLibm)
and [vxLibc](https://github.com/YannMagnin/vxLibc)
## Installing
The build is relatively simple and can be done in two different ways:
Using `curl` and `jq`:
```bash
curl 'https://api.github.com/repos/YannMagnin/sh-elf-vhex/contents/scripts/bootstrap.sh' | jq -r '.content' | base64 --decode | bash
```
Or by cloning the project and using the `bootstrap.sh` script, see
`./scripts/bootstrap.sh --help` for more information about possible operations
you can do with it (like uninstalling the compiler)
```bash
cd /tmp/
git clone 'https://github.com/YannMagnin/sh-elf-vhex.git' --depth=1
cd /tmp/sh-elf-vhex || exit 1
./script/bootstrap.sh
```
It takes about twenty minutes for the build.
## Supported version list
Note that GCC `12.x` will never be supported since many critical bugs have been
found for the superh backend
(https://gcc.gnu.org/bugzilla/show\_bug.cgi?id=106609)
- GCC `13.2.0` and binutils `2.41`
- GCC `11.2.0` and binutils `2.31`
## Special thanks

File diff suppressed because it is too large Load Diff

1960
patches/binutils/2.42/config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,479 @@
# gas target specific configuration file. This is a -*- sh -*- file.
#
# Copyright (C) 2012-2024 Free Software Foundation, Inc.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
#
# This is invoked by configure. Putting it in a separate shell file
# lets us skip running autoconf when modifying target specific
# information.
# Input shell variables:
# targ a configuration target name, such as i686-pc-linux-gnu.
# Output shell variables:
# cpu_type canonical gas cpu type; identifies the config/tc-* files
# fmt output format; identifies the config/obj-* files
# em emulation; identifies the config/te-* files
# Optional output shell variables; these are not always set:
# arch the default architecture; sets DEFAULT_ARCH on some systems
# endian "big" or "little"; used on bi-endian systems
cpu_type=
fmt=
em=generic
bfd_gas=no
arch=
endian=
eval `echo $targ | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/cpu=\1 vendor=\2 os=\3/'`
# Check for architecture variants. Set cpu_type and, optionally,
# endian and arch.
# Note: This table is alpha-sorted, please try to keep it that way.
case ${cpu} in
aarch64) cpu_type=aarch64 endian=little arch=aarch64;;
aarch64_be) cpu_type=aarch64 endian=big arch=aarch64;;
alpha*) cpu_type=alpha ;;
am33_2.0) cpu_type=mn10300 endian=little ;;
arc*eb) cpu_type=arc endian=big ;;
arm*be|arm*b) cpu_type=arm endian=big ;;
arm*) cpu_type=arm endian=little ;;
bfin*) cpu_type=bfin endian=little ;;
c4x*) cpu_type=tic4x ;;
cr16*) cpu_type=cr16 endian=little ;;
crisv32) cpu_type=cris arch=crisv32 ;;
crx*) cpu_type=crx endian=little ;;
epiphany*) cpu_type=epiphany endian=little ;;
fido) cpu_type=m68k ;;
hppa*) cpu_type=hppa ;;
i[3-7]86) cpu_type=i386 arch=i386;;
ia16) cpu_type=i386 arch=i386;;
ia64) cpu_type=ia64 ;;
ip2k) cpu_type=ip2k endian=big ;;
iq2000) cpu_type=iq2000 endian=big ;;
kvx) cpu_type=kvx endian=little ;;
lm32) cpu_type=lm32 ;;
loongarch32) cpu_type=loongarch arch=loongarch32;;
loongarch64) cpu_type=loongarch arch=loongarch64;;
m32c) cpu_type=m32c endian=little ;;
m32r) cpu_type=m32r endian=big ;;
m32rle) cpu_type=m32r endian=little ;;
m5200) cpu_type=m68k ;;
m68008) cpu_type=m68k ;;
m680[012346]0) cpu_type=m68k ;;
m6811|m6812|m68hc12) cpu_type=m68hc11 ;;
m683??) cpu_type=m68k ;;
s12z) cpu_type=s12z ;;
mep) cpu_type=mep endian=little ;;
microblazeel*) cpu_type=microblaze endian=little;;
microblaze*) cpu_type=microblaze endian=big;;
mips*el) cpu_type=mips endian=little ;;
mips*) cpu_type=mips endian=big ;;
mt) cpu_type=mt endian=big ;;
nds32be) cpu_type=nds32 endian=big ;;
nds32le) cpu_type=nds32 endian=little ;;
or1k* | or1knd*) cpu_type=or1k endian=big ;;
pjl*) cpu_type=pj endian=little ;;
pj*) cpu_type=pj endian=big ;;
powerpc*le*) cpu_type=ppc endian=little ;;
powerpc*) cpu_type=ppc endian=big ;;
riscv64be*) cpu_type=riscv endian=big arch=riscv64 ;;
riscv64*) cpu_type=riscv endian=little arch=riscv64 ;;
riscv32be*|riscvbe*) cpu_type=riscv endian=big arch=riscv32 ;;
riscv32* | riscv*) cpu_type=riscv endian=little arch=riscv32 ;;
rs6000*) cpu_type=ppc ;;
rl78*) cpu_type=rl78 ;;
rx) cpu_type=rx ;;
s390x*) cpu_type=s390 arch=s390x ;;
s390*) cpu_type=s390 arch=s390 ;;
score*l) cpu_type=score endian=little ;;
score*) cpu_type=score endian=big ;;
sh*le) cpu_type=sh endian=little ;;
sh*) cpu_type=sh endian=big ;;
sparc64* | sparcv9*) cpu_type=sparc arch=v9-64 ;;
sparc86x*) cpu_type=sparc arch=sparc86x ;;
sparclet*) cpu_type=sparc arch=sparclet ;;
sparclite*) cpu_type=sparc arch=sparclite ;;
sparc*) cpu_type=sparc arch=sparclite ;; # ??? See tc-sparc.c.
tilegx*be) cpu_type=tilegx endian=big ;;
tilegx*) cpu_type=tilegx endian=little ;;
v850*) cpu_type=v850 ;;
visium) cpu_type=visium endian=big ;;
wasm32) cpu_type=wasm32 endian=little ;;
x86_64*) cpu_type=i386 arch=x86_64;;
xgate) cpu_type=xgate ;;
xtensa*) cpu_type=xtensa arch=xtensa ;;
*) cpu_type=${cpu} ;;
esac
# Assign object format. Set fmt, em, and bfd_gas.
generic_target=${cpu_type}-$vendor-$os
# Note: This table is alpha-sorted, please try to keep it that way.
case ${generic_target} in
aarch64*-*-elf*) fmt=elf;;
aarch64*-*-fuchsia*) fmt=elf;;
aarch64*-*-haiku*) fmt=elf em=haiku ;;
aarch64*-*-genode*) fmt=elf;;
aarch64*-*-linux*) fmt=elf em=linux
case ${cpu}-${os} in
aarch64*-linux-gnu_ilp32) arch=aarch64:32 ;;
esac ;;
aarch64*-*-gnu*) fmt=elf em=gnu ;;
aarch64*-*-netbsd*) fmt=elf em=nbsd;;
aarch64*-*-nto*) fmt=elf;;
aarch64*-*-openbsd*) fmt=elf;;
aarch64*-*-pe* | aarch64*-*-mingw*) fmt=coff em=pepaarch64 ;;
alpha-*-*vms*) fmt=evax ;;
alpha-*-osf*) fmt=ecoff ;;
alpha-*-linux*ecoff*) fmt=ecoff ;;
alpha-*-linux-*) fmt=elf em=linux ;;
alpha-*-netbsd* | alpha-*-openbsd*) fmt=elf em=nbsd ;;
arc-*-elf*) fmt=elf ;;
arc*-*-linux*) fmt=elf bfd_gas=yes ;;
arm-*-phoenix*) fmt=elf ;;
arm-*-elf) fmt=elf ;;
arm-*-eabi* | arm-*-rtems* | arm-*-genode*) fmt=elf em=armeabi ;;
arm-*-kaos*) fmt=elf ;;
arm-*-conix*) fmt=elf ;;
arm-*-freebsd[89].* | armeb-*-freebsd[89].*)
fmt=elf em=freebsd ;;
arm-*-freebsd* | armeb-*-freebsd*) fmt=elf em=armfbsdeabi ;;
arm*-*-freebsd*) fmt=elf em=armfbsdvfp ;;
arm-*-linux-*eabi*) fmt=elf em=armlinuxeabi ;;
arm-*-linux-*) fmt=elf em=linux ;;
arm-*-uclinux*eabi*) fmt=elf em=armlinuxeabi ;;
arm-*-uclinux*) fmt=elf em=linux ;;
arm-*-nacl*) fmt=elf em=nacl ;;
arm-*-netbsd* | arm-*-openbsd*) fmt=elf em=nbsd ;;
arm-*-nto*) fmt=elf ;;
arm-wince-pe | arm-*-wince | arm*-*-mingw32ce* | arm*-*-cegcc*)
fmt=coff em=wince-pe ;;
arm-*-pe) fmt=coff em=pe ;;
arm-*-fuchsia*) fmt=elf ;;
arm-*-haiku*) fmt=elf em=haiku ;;
avr-*-*) fmt=elf bfd_gas=yes ;;
bfin-*-linux-uclibc) fmt=fdpicelf em=linux ;;
bfin-*-uclinux*) fmt=elf em=linux ;;
bfin-*elf) fmt=elf ;;
cr16-*-elf*) fmt=elf ;;
cris-*-linux-* | crisv32-*-linux-*)
fmt=multi em=linux ;;
cris-*-* | crisv32-*-*) fmt=multi ;;
crx-*-elf*) fmt=elf ;;
csky-*-elf*abiv1) fmt=elf em=csky_abiv1 ;;
csky-*-elf*) fmt=elf em=csky_abiv2 ;;
csky-*-linux*abiv1) fmt=elf em=csky_abiv1_linux ;;
csky-*-linux*) fmt=elf em=csky_abiv2_linux ;;
d10v-*-*) fmt=elf ;;
d30v-*-*) fmt=elf ;;
dlx-*-*) fmt=elf ;;
bpf-*-*) fmt=elf ;;
epiphany-*-*) fmt=elf ;;
fr30-*-*) fmt=elf ;;
frv-*-*linux*) fmt=elf em=linux;;
frv-*-*) fmt=elf ;;
ft32-*-*) fmt=elf ;;
hppa-*-linux*)
case ${cpu} in
hppa*64*) fmt=elf em=hppalinux64 ;;
hppa*) fmt=elf em=linux ;;
esac ;;
hppa-*-*elf*) fmt=elf em=hppa ;;
hppa-*-lites*) fmt=elf em=hppa ;;
hppa-*-netbsd*) fmt=elf em=nbsd ;;
hppa-*-openbsd*) fmt=elf em=hppa ;;
hppa-*-osf*) fmt=som em=hppa ;;
hppa-*-hpux11*)
case ${cpu} in
hppa*64*) fmt=elf em=hppa64 ;;
hppa*) fmt=som em=hppa ;;
esac ;;
hppa-*-hpux*) fmt=som em=hppa ;;
hppa-*-mpeix*) fmt=som em=hppa ;;
hppa-*-bsd*) fmt=som em=hppa ;;
hppa-*-hiux*) fmt=som em=hppa ;;
h8300-*-elf) fmt=elf ;;
h8300-*-linux*) fmt=elf em=linux ;;
i386-*-beospe*) fmt=coff em=pe ;;
i386-*-beos*) fmt=elf ;;
i386-*-elfiamcu) fmt=elf arch=iamcu ;;
i386-*-elf*) fmt=elf ;;
i386-*-fuchsia*) fmt=elf ;;
i386-*-haiku*) fmt=elf em=haiku ;;
i386-*-genode*) fmt=elf ;;
i386-*-bsd*) fmt=aout em=386bsd ;;
i386-*-netbsd*-gnu* | \
i386-*-knetbsd*-gnu | \
i386-*-netbsd* | \
i386-*-openbsd*) fmt=elf em=nbsd ;;
i386-*-linux-*) fmt=elf em=linux
case ${cpu}-${os} in
x86_64*-linux-gnux32) arch=x86_64:32 ;;
esac ;;
i386-*-lynxos*) fmt=elf em=lynx ;;
i386-*-redox*) fmt=elf ;;
i386-*-solaris*) fmt=elf em=solaris ;;
i386-*-freebsd* \
| i386-*-kfreebsd*-gnu) fmt=elf em=freebsd ;;
i386-*-msdosdjgpp* \
| i386-*-go32*) fmt=coff em=go32 ;;
i386-*-gnu*) fmt=elf em=gnu ;;
i386-*-msdos*) fmt=aout ;;
i386-*-moss*) fmt=elf ;;
i386-*-pe) fmt=coff em=pe ;;
i386-*-cygwin*)
case ${cpu} in
x86_64*) fmt=coff em=pep ;;
i*) fmt=coff em=pe ;;
esac ;;
i386-*-interix*) fmt=coff em=interix ;;
i386-*-mingw*)
case ${cpu} in
x86_64*) fmt=coff em=pep ;;
i*) fmt=coff em=pe ;;
esac ;;
i386-*-nto-qnx*) fmt=elf ;;
i386-*-*nt*) fmt=coff em=pe ;;
i386-*-rdos*) fmt=elf ;;
i386-*-darwin*) fmt=macho ;;
ia16-*-elf*) fmt=elf ;;
ia64-*-elf*) fmt=elf ;;
ia64-*-*vms*) fmt=elf em=vms ;;
ia64-*-aix*) fmt=elf em=ia64aix ;;
ia64-*-linux-*) fmt=elf em=linux ;;
ia64-*-hpux*) fmt=elf em=hpux ;;
ia64-*-netbsd*) fmt=elf em=nbsd ;;
ip2k-*-*) fmt=elf ;;
iq2000-*-elf) fmt=elf ;;
kvx-*-*) fmt=elf ;;
kvx-*-linux*) fmt=elf em=linux ;;
lm32-*-*) fmt=elf ;;
loongarch*) fmt=elf ;;
m32c-*-elf) fmt=elf ;;
m32r-*-elf*) fmt=elf ;;
m32r-*-linux*) fmt=elf em=linux;;
m68hc11-*-* | m6811-*-*) fmt=elf ;;
m68hc12-*-* | m6812-*-*) fmt=elf ;;
m68k-*-elf*) fmt=elf ;;
m68k-*-linux-*) fmt=elf em=linux ;;
m68k-*-uclinux*) fmt=elf em=uclinux ;;
m68k-*-gnu*) fmt=elf ;;
m68k-*-netbsd*) fmt=elf em=nbsd ;;
m68k-*-haiku*) fmt=elf em=haiku ;;
s12z-*-*) fmt=elf ;;
mep-*-elf) fmt=elf ;;
metag-*-elf) fmt=elf ;;
metag-*-linux*) fmt=elf em=linux ;;
mcore-*-elf) fmt=elf ;;
mcore-*-pe) fmt=coff em=pe bfd_gas=yes ;;
microblaze-*-*) fmt=elf ;;
mips-*-irix6*) fmt=elf em=irix ;;
mips-*-irix5*) fmt=elf em=irix ;;
mips*-*-linux*) fmt=elf em=tmips ;;
mips*-*-freebsd* | mips*-*-kfreebsd*-gnu)
fmt=elf em=freebsd ;;
mips-*-sysv4* | mips-*-gnu*) fmt=elf em=tmips ;;
mips*-sde-elf* | mips*-mti-elf* | mips*-img-elf*)
fmt=elf em=tmips ;;
mips-*-haiku*) fmt=elf em=haiku ;;
mips-*-elf*) fmt=elf ;;
mips-*-netbsd*) fmt=elf em=tmips ;;
mips-*-openbsd*) fmt=elf em=tmips ;;
mips-*-windiss) fmt=elf ;;
mmix-*-*) fmt=elf ;;
mn10200-*-*) fmt=elf ;;
# cpu_type for am33_2.0 is set to mn10300
mn10300-*-linux*) fmt=elf em=linux ;;
mn10300-*-*) fmt=elf ;;
moxie-*-uclinux) fmt=elf em=linux ;;
moxie-*-moxiebox*) fmt=elf endian=little ;;
moxie-*-*) fmt=elf ;;
mt-*-elf) fmt=elf bfd_gas=yes ;;
msp430-*-*) fmt=elf ;;
nds32-*-elf*) fmt=elf ;;
nds32-*-linux*) fmt=elf em=linux ;;
nios2*-linux*) fmt=elf em=linux ;;
ns32k-pc532-mach*) fmt=aout em=pc532mach ;;
ns32k-pc532-ux*) fmt=aout em=pc532mach ;;
ns32k-pc532-lites*) fmt=aout em=nbsd532 ;;
ns32k-*-*n*bsd*) fmt=aout em=nbsd532 ;;
or1k*-*-elf | or1k*-*-rtems*) fmt=elf endian=big ;;
or1k*-*-linux*) fmt=elf em=linux endian=big ;;
pj*) fmt=elf ;;
ppc-*-aix5.[01]) fmt=coff em=aix5 ;;
ppc-*-aix[5-9].*) fmt=coff em=aix5 ;;
ppc-*-aix*) fmt=coff em=aix ;;
ppc-*-beos*) fmt=coff ;;
ppc-*-*n*bsd* | ppc-*-elf*) fmt=elf ;;
ppc-*-eabi* | ppc-*-sysv4*) fmt=elf ;;
ppc-*-haiku*) fmt=elf em=haiku ;;
ppc-*-linux-*) fmt=elf em=linux ;;
ppc-*-solaris*) fmt=elf em=solaris ;;
ppc-*-macos*) fmt=coff em=macos ;;
ppc-*-nto*) fmt=elf ;;
ppc-*-kaos*) fmt=elf ;;
pru-*-*) fmt=elf ;;
riscv*-*-haiku*) fmt=elf endian=little em=haiku ;;
riscv*-*-*) fmt=elf ;;
rx-*-linux*) fmt=elf em=linux ;;
s390-*-linux-*) fmt=elf em=linux ;;
s390-*-tpf*) fmt=elf ;;
score-*-elf) fmt=elf ;;
sh*-*-linux*) fmt=elf em=linux
case ${cpu} in
sh*eb) endian=big ;;
*) endian=little ;;
esac ;;
sh*-*-netbsd*) fmt=elf em=nbsd
case ${cpu} in
sh*l*) endian=little ;;
*) endian=big ;;
esac ;;
sh-*-elf*) fmt=elf ;;
sh-*-uclinux* | sh[12]-*-uclinux*) fmt=elf em=uclinux ;;
sh-*-coff*) fmt=coff ;;
sh-*-nto*) fmt=elf ;;
sh-*-pe*) fmt=coff em=pe endian=little ;;
sh-*-kaos*) fmt=elf ;;
shle*-*-kaos*) fmt=elf ;;
sh*-*-vhex*) fmt=elf ;;
sparc-*-haiku*) fmt=elf em=haiku ;;
sparc-*-linux-*) fmt=elf em=linux ;;
sparc-*-solaris*) fmt=elf em=solaris ;;
sparc-*-freebsd*) fmt=elf em=freebsd ;;
sparc-*-*bsd*) fmt=elf em=nbsd ;;
spu-*-elf) fmt=elf ;;
tic30-*-*coff*) fmt=coff bfd_gas=yes ;;
tic4x-*-* | c4x-*-*) fmt=coff bfd_gas=yes ;;
tic54x-*-* | c54x*-*-*) fmt=coff bfd_gas=yes need_libm=yes;;
tic6x-*-*) fmt=elf ;;
tilepro-*-* | tilegx*-*-*) fmt=elf ;;
v850*-*-*) fmt=elf ;;
vax-*-netbsdaout) fmt=aout em=nbsd ;;
vax-*-netbsd*) fmt=elf em=nbsd ;;
vax-*-linux-*) fmt=elf em=linux ;;
visium-*-elf) fmt=elf ;;
wasm32-*-*) fmt=elf ;;
xstormy16-*-*) fmt=elf ;;
xgate-*-*) fmt=elf ;;
xtensa*-*-*) fmt=elf ;;
z80-*-coff) fmt=coff ;;
z8k-*-coff | z8k-*-sim) fmt=coff ;;
*-*-aout | *-*-scout) fmt=aout ;;
*-*-cloudabi*) fmt=elf em=cloudabi ;;
*-*-dragonfly*) fmt=elf em=dragonfly ;;
*-*-freebsd* | *-*-kfreebsd*-gnu) fmt=elf em=freebsd ;;
*-*-generic) fmt=generic ;;
*-*-xray | *-*-hms) fmt=coff ;;
*-*-sim) fmt=coff ;;
*-*-elf | *-*-rtems* | *-*-sysv4*) fmt=elf ;;
*-*-solaris*) fmt=elf em=solaris ;;
*-*-aros*) fmt=elf em=linux ;;
*-*-vxworks* | *-*-windiss) fmt=elf em=vxworks ;;
esac
case ${cpu_type} in
aarch64 | alpha | arm | csky | i386 | ia64 | kvx | microblaze | mips | ns32k | \
or1k | or1knd | pdp11 | ppc | riscv | sh | sparc | z80 | z8k | loongarch)
bfd_gas=yes
;;
esac
case ${fmt} in
elf | ecoff | fdpicelf | multi | som)
bfd_gas=yes
;;
esac
if test $bfd_gas != yes; then
echo This target is no longer supported in gas
exit 1
fi
case ${cpu_type}-${fmt}-${os} in
i386-elf-linux*)
# Default to compress DWARF debug sections for Linux/x86.
if test ${ac_default_compressed_debug_sections} = unset; then
ac_default_compressed_debug_sections=yes
fi
;;
esac

File diff suppressed because it is too large Load Diff

View File

@ -1749,7 +1749,7 @@ case $os in
| onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
| midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
| nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
| fiwix* | vhex*)
| fiwix* | vhex* )
;;
# This one is extra strict with allowed versions
sco3.2v2 | sco3.2v[4-9]* | sco5v6*)

1885
patches/gcc/14.1.0/config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,34 @@
#! /bin/sh
if [ $# -ne 1 ]
then
echo "Usage: $0 <target-mach-triplet>"
exit 1
fi
machine=$1
target=fixinc.sh
# Check for special fix rules for particular targets
case $machine in
i?86-*-cygwin* | \
i?86-*-mingw32* | \
x86_64-*-mingw32* | \
powerpc-*-eabisim* | \
powerpc-*-eabi* | \
powerpc-*-rtems* | \
powerpcle-*-eabisim* | \
powerpcle-*-eabi* | \
*-*-vxworks7* | \
*-musl* | \
sh*-*-vhex* )
# IF there is no include fixing,
# THEN create a no-op fixer and exit
(echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
;;
*)
cat < ${srcdir}/fixinc.in > ${target} || exit 1
;;
esac
chmod 755 ${target}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,16 @@
#undef STARTFILE_SPEC
#define STARTFILE_SPEC \
""
#undef ENDFILE_SPEC
#define ENDFILE_SPEC \
""
#undef LIB_SPEC
#define LIB_SPEC "-lc"
#undef USER_LABEL_PREFIX
#define USER_LABEL_PREFIX "_"
#undef LINK_SPEC
#define LINK_SPEC SH_LINK_SPEC "%{shared:-shared} %{static:-static} %{!shared: %{!static: %{rdynamic:-export-dynamic}}}"

File diff suppressed because it is too large Load Diff

View File

@ -1,74 +0,0 @@
#! /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
--cache Keep the build and the sources directory
EOF
exit 0
}
#---
# Parse arguments
#---
cache=false
verbose=false
prefix_install=
prefix_sysroot=
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#*=};;
*)
echo "error: unrecognized argument '$arg', giving up." >&2
exit 1
esac
done
#---
# Installation step
#---
_src=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
cd "$_src" || exit 1
source ./_utils.sh
if [[ ! -f "$prefix_sysroot/bin/sh-elf-vhex-gcc" ]]
then
echo "error: Are you sure to have built sh-elf-vhex ? it seems that" >&2
echo " the 'sh-elf-vhex-gcc' tool is missing..." >&2
exit 1
fi
if [[ "$cache" == 'false' ]]
then
echo "$TAG Cleaning up built files..."
rm -rf ../../build
fi
[[ "$verbose" == 'true' ]] && export VERBOSE=1
#---
# Symbolic link executables to $PREFIX
#---
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

View File

@ -1,83 +0,0 @@
#! /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
--purge Remove the cloned folder
EOF
exit 0
}
#---
# Parse arguments
#---
prefix_install=''
prefix_sysroot=''
prefix_clone=''
purge='false'
for arg
do case "$arg" in
--help | -h) help;;
--purge) purge='true';;
--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 [[ -z "$prefix_install" || -z "$prefix_sysroot" || -z "$prefix_clone" ]]
then
echo 'Missing prefix information, abort' >&2
exit 1
fi
if [[ ! -f "$prefix_sysroot/bin/sh-elf-vhex-as" ]]
then
echo 'error: Are you sure to have built sh-elf-vhex ?' >&2
echo ' Missing '\''sh-elf-vhex-as'\'' tool' >&2
exit 1
fi
#---
# Unistall step
#---
_src=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
cd "$_src" || exit 1
source ./_utils.sh
echo "$TAG Removing symlinks to binaries..."
for x in "$prefix_sysroot"/bin/*; do
utils_callcmd unlink "$x"
utils_callcmd unlink "$prefix_install/$(basename "$x")"
done
echo "$TAG Removing sysroot..."
rm -rf "$prefix_sysroot"
if [[ "$purge" == 'true' ]]
then
echo "$TAG removing cloned folder..."
rm -rf "$prefix_clone"
fi

View File

@ -29,7 +29,7 @@ function utils_find_last_version()
function utils_callcmd()
{
if [[ -v 'VERBOSE' && "$VERBOSE" == '1' ]]
if [[ "$VERBOSE" == '1' ]]
then
echo "$@"
if ! "$@"; then
@ -49,7 +49,7 @@ function utils_callcmd()
function utils_warn_callcmd()
{
if [[ -v 'VERBOSE' && "$VERBOSE" == '1' ]]
if [[ "$VERBOSE" == '1' ]]
then
echo "$@"
if ! "$@"; then
@ -73,7 +73,7 @@ function utils_makecmd()
{
local cores
[[ $(uname) == "OpenBSD" ]] \
[[ "$(uname -s)" == 'OpenBSD' || "$(uname -s)" == 'Darwin' ]] \
&& cores=$(sysctl -n hw.ncpu) \
|| cores=$(nproc)
[[ $(command -v gmake >/dev/null 2>&1) ]] \
@ -102,6 +102,15 @@ function utils_archive_download()
exit 0
fi
if test -f "$archive"
then
if ! tar -tf "$archive" &> /dev/null
then
echo "WARNING: Unable to validate the archive, force re-download" >&2
rm -f "$archive"
fi
fi
if ! test -f "$archive"
then
echo "$TAG Downloading $url..."

View File

@ -68,4 +68,8 @@ utils_makecmd install-strip
# Indicate that the construction is finished
echo "$TAG Cleaning up..."
rm -rf ../build
rm -rf ../archive
touch ../.fini

View File

@ -83,7 +83,14 @@ fi
# Check dependencies for binutils and GCC and offer to install them
#---
if command -v pkg >/dev/null 2>&1
if [[ "$(uname -s)" == 'Darwin' ]]
then
deps='cmake mpfr libmpc gmp libpng ppl flex gcc git texinfo xz gcc'
pm='brew'
pm_has='brew list | grep -i'
pm_install='brew install'
fix='^'
elif command -v pkg >/dev/null 2>&1
then
deps='cmake libmpfr libmpc libgmp libpng flex clang git texinfo'
deps="$deps libisl bison xz-utils gcc"
@ -130,7 +137,7 @@ then
"$TAG Based on $pm, some dependencies are missing: $missing\n" \
"$TAG Do you want to run '$pm_install $missing' to install " \
'them [nY]? '
read -r do_install
read -r do_install < /dev/tty
if [[ "$do_install" != 'n' ]]
then
bash -c "$pm_install $missing"
@ -158,7 +165,9 @@ cd ../../_build/binutils || exit 1
# recent versions of bison, which is subject to the following known bug.
# * https://sourceware.org/bugzilla/show_bug.cgi?id=22941
# * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92008
touch ./archive/intl/plural.c
# Also note that the new 2.42 version do not have the intl folder, so we
# silently ignore error
touch ./archive/intl/plural.c > /dev/null 2>&1
# Apply binutils patches for Vhex

View File

@ -1,159 +0,0 @@
#!/usr/bin/env bash
#---
# Help screen
#---
function help() {
cat << EOF
Bootstrap script used to install or uninstall the sh-elf-vhex compiler.
Usage $0 [options...]
Options:
-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
--uninstall Uninstall operation
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
#---
action='install'
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;;
--prefix-install=*) prefix_install=${arg#*=};;
--prefix-sysroot=*) prefix_sysroot=${arg#*=};;
--prefix-clone=*) prefix_clone=${arg#*=};;
--uninstall) action='uninstall';;
--overwrite) overwrite='true';;
*)
echo "error: unrecognized argument '$arg', giving up." >&2
exit 1
esac
done
#---
# Handle self-clone if needed
#---
# export verbose now to handle the self-clone if needed
[[ "$verbose" == 'true' ]] && export VERBOSE=1
_src=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
cd "$_src" || exit 1
if [[ "$prefix_clone/scripts" != "$_src" ]]
then
if [[ -d "$prefix_clone" && "$overwrite" != 'true' ]]
then
echo -e \
"It seems that the project is already existing :pouce:\n" \
'If you really want to install this project use the "--overwrite"' \
'option.'
exit 1
fi
[[ -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"
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)
if [[ "$verbose" == 'true' ]]
then
echo "Debug fetched information:"
echo " - VHEX_VERBOSE = $verbose"
echo " - VHEX_VERSION_BINUTILS = $version_binutils"
echo " - VHEX_VERSION_GCC = $version_gcc"
echo " - VHEX_PREFIX_INSTALL = $prefix_install"
echo " - VHEX_PREFIX_SYSROOT = $prefix_sysroot"
echo " - VHEX_PREFIX_CLONE = $prefix_clone"
fi
if [[ "$action" == 'install' ]]
then
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"
read -p 'Process ? [yN]: ' -r valid
else
read -p 'Uninstall the sh-elf-vhex compiler ? [yN]: ' -r valid
fi
if [[ "$valid" != 'y' ]]; then
echo 'Operation aborted o(x_x)o'
exit 1
fi
#---
# Performs install/uninstall operation
#---
if [[ "$action" == 'install' ]]
then
{
./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 \
&& ./_install.sh \
--prefix-sysroot="$prefix_sysroot" \
--prefix-install="$prefix_install"
} || {
echo 'Error during bootstraping operations' >&2
exit 1
}
echo 'Successfully installed sh-elf-vhex !'
echo "Do not forget to export the binary path '$prefix_install'"
else
{
./_uninstall.sh \
--prefix-sysroot="$prefix_sysroot" \
--prefix-install="$prefix_install" \
--prefix-clone="$prefix_clone" \
--purge
} || {
echo 'Error during uninstallation step, abort' >&2
exit 1
}
echo 'Successfully uninstalled sh-elf-vhex'
fi

View File

@ -59,9 +59,7 @@ cd ../../_build/gcc/build || exit 1
# Build GCC stage-1
#---
echo "$TAG Configuring GCC (stage 1)..."
# Configure GCC stage-1 (minimal build as possible for library)
echo "$TAG Configuring GCC..."
utils_callcmd \
../archive/configure \
@ -83,7 +81,7 @@ echo "$TAG Compiling GCC (usually 10-20 minutes)..."
utils_makecmd all-gcc
echo "$TAG Install GCC..."
echo "$TAG Install partial GCC..."
utils_makecmd install-strip-gcc
@ -145,4 +143,8 @@ utils_makecmd install-strip-target-libsanitizer
# Indicate that the building up is finished
#---
echo "$TAG Cleaning up..."
rm -rf ../build
rm -rf ../archive
touch ../.fini

View File

@ -113,8 +113,10 @@ echo "$TAG install dependencies..."
cd ./archive || exit 1
if ! utils_warn_callcmd ./contrib/download_prerequisites
then
echo "The installation of GCC's prerequisites has failed"
read -p 'Do you want to continue the installation ? [yN]: ' -r valid
echo -en \
'The installation of GCC'\''s prerequisites has failed\n' \
'Do you want to continue the installation ? [yN]: '
read -r valid < /dev/tty
if [[ "$valid" != 'y' ]]; then
echo 'Operation aborted o(x_x)o'
exit 1

176
scripts/install.sh Executable file
View File

@ -0,0 +1,176 @@
#! /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
if [[ "$overwrite" == 'true' ]]
then
echo 'overwrite operation requested, this invoke the uninstall script'
read -p 'Proceed ? [yN]: ' -r valid < /dev/tty
if [[ "$valid" != 'y' ]]; then
echo 'Operation aborted o(x_x)o'
exit 1
fi
./uninstall.sh --force
[[ -d "$prefix_clone" ]] && rm -rf "$prefix_clone"
fi
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" ]]
then
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
rm -rf ../_cache
fi
echo -e \
'Successfully installed sh-elf-vhex !\n' \
'\rDo not forget to export the binary path' \
"'export PATH=\"\$PATH:$prefix_install\"'"

120
scripts/uninstall.sh Executable file
View File

@ -0,0 +1,120 @@
#! /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
--force Do not request user validation
EOF
exit 0
}
#---
# Parse arguments
#---
force='false'
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#*=};;
--force) force='true';;
*)
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
if [[ "$force" != 'true' ]]
then
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
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