sh-elf-gcc/util.sh
Lephenixnoir 26affe51cf
new build system for fxSDK sysroot and libstdc++-v3
The main change is making the scripts a two-stage process where we
first build GCC, leave the user to install the libc, and then come back
to install libstdc++-v3.

* Detect whether we are in the first or second stage
* Don't clean files after first stage install, and even then only do it
  if :clean is specified
* Update README except for the manual install tutorial
* Patch the source using a backported GCC 12.1 commit to make the
  configure script for libstdc++-v3 skip checking for dlopen, which is
  impossible is our not-really-hosted setup

Details:
* Proper .gitignore
2022-08-19 15:23:21 +02:00

39 lines
959 B
Bash

TAG="<sh-elf-gcc>"
if command -v gmake >/dev/null 2>&1; then
MAKE_COMMAND=gmake
else
MAKE_COMMAND=make
fi
if ! command -v fxsdk >/dev/null 2>&1; then
echo "$TAG error: fxSDK is not installed"
exit 1
elif ! fxsdk path sysroot >/dev/null 2>&1; then
echo "$TAG error: need fxSDK ≥ 2.9 with 'path' command"
exit 1
fi
SYSROOT="$(fxsdk path sysroot)"
run_quietly() {
out="$1"
shift 1
"$@" >$out 2>&1
if [[ "$?" != 0 ]]; then
echo "$tag error: build failed, please check $(pwd)/$out o(x_x)o"
exit 1
fi
}
# Names of binutils tools, otherwise GCC assumes sh3eb-elf-*
export AR_FOR_TARGET=sh-elf-ar
export AS_FOR_TARGET=sh-elf-as
export DLLTOOL_FOR_TARGET=sh-elf-dlltool
export LD_FOR_TARGET=sh-elf-ld
export NM_FOR_TARGET=sh-elf-nm
export OBJCOPY_FOR_TARGET=sh-elf-objcopy
export OBJDUMP_FOR_TARGET=sh-elf-objdump
export RANLIB_FOR_TARGET=sh-elf-ranlib
export READELF_FOR_TARGET=sh-elf-readelf
export STRIP_FOR_TARGET=sh-elf-strip