From 66db4d3971fc3bc46b6508ae08446dfb772b84b4 Mon Sep 17 00:00:00 2001 From: cadmic Date: Mon, 21 Apr 2025 17:00:24 -0700 Subject: [PATCH] Add macOS instructions for installing mips-linux-gnu-gcc --- docs/BUILDING_MACOS.md | 43 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/docs/BUILDING_MACOS.md b/docs/BUILDING_MACOS.md index d34035fcec..680ec65d40 100644 --- a/docs/BUILDING_MACOS.md +++ b/docs/BUILDING_MACOS.md @@ -60,7 +60,7 @@ Configure the build Make and install binutils ```bash -make -j +make -j$(nproc) sudo make install ``` @@ -82,3 +82,44 @@ If this worked, you can now delete the temporary directory `~/binutils-tmp`. Apple's version of `make` is very out-of-date, so you should use the brew-installed `gmake` in place of `make` in this repo from now on. You should now be able to continue from [step 2](../README.md#2-clone-the-repository) of the Linux instructions. + + +## 4. Building GCC (optional) + +If you'd like to compile with GCC instead of IDO (e.g. for modding), you can build it from source similarly to how we built binutils: + +Install dependences +```bash +brew install gcc@14 gmp isl libmpc mpfr +``` + +Create and enter local working dir +```bash +mkdir ~/gcc-tmp +cd ~/gcc-tmp +``` + +Get and extract gcc source +```bash +curl -O https://ftp.gnu.org/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.xz +tar xvf gcc-14.2.0.tar.xz +``` + +Create and enter a build directory +```bash +mkdir build-gcc +cd build-gcc +``` + +Configure the build +```bash +CC=gcc-14 CXX=g++-14 ../gcc-14.2.0/configure --target=mips-linux-gnu --prefix=/opt/cross --disable-nls --enable-languages=c --with-gmp=$(brew --prefix)/opt/gmp --with-mpfr=$(brew --prefix)/opt/mpfr --with-mpc=$(brew --prefix)/opt/libmpc --with-isl=$(brew --prefix)/opt/isl +``` + +Make and install gcc +```bash +CC=gcc-14 CXX=g++-14 make all-gcc -j$(nproc) +sudo make install-gcc +``` + +If this worked, you can now delete the temporary directory `~/gcc-tmp`.