This repository provides a guide and automated scripts to install an SH3/SH4-compatible [binutils](https://www.gnu.org/software/binutils/) suite. binutils is a collection of tools to assemble, edit and link binary programs, mainly object files. It is the main dependency for GCC, which compiles C down to assembler and relies on binutils to assemble and link this assembler output.
This will take care of all the steps and install binutils in the fxSDK's SuperH system root.
A `:any` configuration is provided in case you already have another version of binutils installed in the fxSDK sysroot and want to keep using it (ie. skip a version upgrade). This will mark this repository as installed, so other repositories depending on it can build, without actually compiling binutils. Having binutils installed outside the fxSDK sysroot is not sufficient for some libraries.
A `:clean` configuration is also provided if you want to clean up the source and build files automatically after installing. This frees up some disk space.
You can run `fxsdk path sysroot` to show the SuperH sysroot where binutils will be installed. You will need to specify a PATH-reachable `PREFIX` where the binaries of the toolchain will be symlinked. (The `PREFIX` is *only* for symlinks to executables, the toolchain will always be installed in the fxSDK's sysroot.) Once you're ready, run the main scripts with `make`:
Get your version of choice from [ftp.gnu.org](https://ftp.gnu.org/gnu/binutils/) and extract the archive. Touch `binutils-$VERSION/intl/plural.c` to avoid autotools rebuilding it with bison, which no longer works ([[1]](https://sourceware.org/bugzilla/show_bug.cgi?id=22941),[[2]](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92008)).
If you want to use the fxSDK, you must install in the SDK's SuperH sysroot and set the `PREFIX` to `$(fxsdk path sysroot)`. Otherwise, anything that properly isolates the cross-compiler from the host is fine.
You should add the SuperH sysroot's `bin` to your PATH, or symlink them somewhere else in the PATH. You can then remove the build folder, source folder, and source archive if you need to free up disk space.