mirror of
https://github.com/zeldaret/oot.git
synced 2024-11-25 09:45:02 +00:00
Native MacOS build support (#399)
* MacOS build OK * Adding build instructions for building mips-linux-binutils on MacOS * * * Update Makefile Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com> Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com>
This commit is contained in:
parent
055d1d2bae
commit
807713a29b
17 changed files with 2604 additions and 33 deletions
27
Makefile
27
Makefile
|
@ -16,6 +16,23 @@ endif
|
|||
|
||||
PROJECT_DIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
|
||||
|
||||
MAKE = make
|
||||
CPPFLAGS = -P
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
$(error Native Windows builds not yet supported. Please use WSL, Docker or a Linux VM)
|
||||
else
|
||||
UNAME_S := $(shell uname -s)
|
||||
ifeq ($(UNAME_S),Linux)
|
||||
DETECTED_OS=linux
|
||||
endif
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
DETECTED_OS=macos
|
||||
MAKE=gmake
|
||||
CPPFLAGS += -xc++
|
||||
endif
|
||||
endif
|
||||
|
||||
#### Tools ####
|
||||
ifeq ($(shell type mips-linux-gnu-ld >/dev/null 2>/dev/null; echo $$?), 0)
|
||||
MIPS_BINUTILS_PREFIX := mips-linux-gnu-
|
||||
|
@ -23,8 +40,8 @@ else
|
|||
$(error Please install or build mips-linux-gnu)
|
||||
endif
|
||||
|
||||
CC := tools/ido_recomp/linux/7.1/cc
|
||||
CC_OLD := tools/ido_recomp/linux/5.3/cc
|
||||
CC := tools/ido_recomp/$(DETECTED_OS)/7.1/cc
|
||||
CC_OLD := tools/ido_recomp/$(DETECTED_OS)/5.3/cc
|
||||
|
||||
# if ORIG_COMPILER is 1, check that either QEMU_IRIX is set or qemu-irix package installed
|
||||
ifeq ($(ORIG_COMPILER),1)
|
||||
|
@ -159,18 +176,18 @@ $(ELF): $(TEXTURE_FILES_OUT) $(O_FILES) build/ldscript.txt build/undefined_syms.
|
|||
$(LD) -T build/undefined_syms.txt -T build/ldscript.txt --no-check-sections --accept-unknown-input-arch --emit-relocs -Map build/z64.map -o $@
|
||||
|
||||
build/ldscript.txt: $(SPEC)
|
||||
$(CPP) -P $< > build/spec
|
||||
$(CPP) $(CPPFLAGS) $< > build/spec
|
||||
$(MKLDSCRIPT) build/spec $@
|
||||
|
||||
build/undefined_syms.txt: undefined_syms.txt
|
||||
$(CPP) -P $< > build/undefined_syms.txt
|
||||
$(CPP) $(CPPFLAGS) $< > build/undefined_syms.txt
|
||||
|
||||
clean:
|
||||
$(RM) -r $(ROM) $(ELF) build
|
||||
|
||||
setup:
|
||||
git submodule update --init --recursive
|
||||
make -C tools
|
||||
$(MAKE) -C tools
|
||||
python3 fixbaserom.py
|
||||
python3 extract_baserom.py
|
||||
python3 extract_assets.py
|
||||
|
|
35
README.md
35
README.md
|
@ -35,7 +35,20 @@ For older versions of Windows, install a Linux VM or refer to [Docker](#Docker)
|
|||
|
||||
### macOS
|
||||
|
||||
For macOS, install a Linux VM or refer to [Docker](#Docker) instructions.
|
||||
For macOS, use homebrew to install the following dependencies:
|
||||
* coreutils
|
||||
* make
|
||||
* python3
|
||||
```bash
|
||||
brew update
|
||||
brew install coreutils make python3
|
||||
```
|
||||
|
||||
You'll also need to [build and install mips-linux-binutils](docs/BUILDING_BINUTILS_MACOS.md).
|
||||
|
||||
Going forward in this guide, please use `gmake` whenever you encounter a `make` command.
|
||||
The `make` that comes with MacOS behaves differently than GNU make and is incompatible with this project.
|
||||
You should now be able to continue onto step 3.
|
||||
|
||||
### Linux (Native or under WSL / VM)
|
||||
|
||||
|
@ -136,32 +149,12 @@ docker build . -t oot
|
|||
|
||||
#### 3. Start the container
|
||||
|
||||
##### Option A: With docker run
|
||||
|
||||
To start the container, you can mount your local filesystem into the docker container and run an interactive bash session.
|
||||
|
||||
```bash
|
||||
docker run -it --rm --mount type=bind,source="$(pwd)",destination=/oot oot /bin/bash
|
||||
```
|
||||
|
||||
##### Option B (only for macOS): With docker-sync
|
||||
|
||||
Prerequisite for this option: Install docker-sync with `gem install docker-sync`
|
||||
|
||||
To start docker-sync and the development container, use `docker-sync-stack start`
|
||||
|
||||
After a lot of waiting, you'll see something like "Attaching to oot_oot_1".
|
||||
This means the container is ready.
|
||||
|
||||
Then it's time to log into the container to begin working.
|
||||
Note that this will be done in another tab while you leave the docker-sync tab going.
|
||||
|
||||
To get the container id, use `docker container ls` and use the ID from the container with image oot:latest in the following command:
|
||||
|
||||
`docker exec -it <CONTAINER-ID> /bin/bash` You're in.
|
||||
|
||||
> Note: When done working, type Ctrl+c on the docker-sync tab to close the container and docker-sync.
|
||||
|
||||
#### 4. Setup and Build the ROM
|
||||
|
||||
Once inside the container, you can follow Step 6 and 7 of the Linux instructions to setup and build the ROM, or run any other command you need.
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
version: "2"
|
||||
|
||||
syncs:
|
||||
oot-sync:
|
||||
src: '.'
|
47
docs/BUILDING_BINUTILS_MACOS.md
Normal file
47
docs/BUILDING_BINUTILS_MACOS.md
Normal file
|
@ -0,0 +1,47 @@
|
|||
# Building mips-linux-binutils on MacOS
|
||||
|
||||
The following instructions are written for MacOS users but should apply to any unix-like system, with maybe some modifications at the end regarding the bash_profile.
|
||||
|
||||
Create destination dir for binutils
|
||||
```bash
|
||||
sudo mkdir -p /opt/cross
|
||||
```
|
||||
|
||||
Create and enter local working dir
|
||||
```bash
|
||||
mkdir ~/binutils-tmp
|
||||
cd ~/binutils-tmp
|
||||
```
|
||||
|
||||
Get and extract binutils source
|
||||
```bash
|
||||
wget https://ftp.gnu.org/gnu/binutils/binutils-2.35.tar.bz2
|
||||
tar xjf binutils-2.35.tar.bz2
|
||||
```
|
||||
|
||||
Create and enter build dir
|
||||
```bash
|
||||
mkdir build-binutils
|
||||
cd build-binutils
|
||||
```
|
||||
|
||||
Configure the build
|
||||
```bash
|
||||
../binutils-2.35/configure --target=mips-linux-gnu --prefix=/opt/cross --disable-gprof --disable-gdb --disable-werror
|
||||
```
|
||||
|
||||
Make and install binutils
|
||||
```bash
|
||||
make -j
|
||||
sudo make install
|
||||
```
|
||||
|
||||
Edit your ~/.bash_profile to add the new binutils binaries to the system PATH
|
||||
```bash
|
||||
echo "export PATH=$PATH:/opt/cross/bin" >> ~/.bash_profile
|
||||
```
|
||||
|
||||
Reload ~/.bash_profile (or just launch a new terminal tab)
|
||||
```bash
|
||||
source ~/.bash_profile
|
||||
```
|
3
spec
3
spec
|
@ -172,8 +172,7 @@ endseg
|
|||
beginseg
|
||||
name "icon_item_nes_static"
|
||||
romalign 0x1000
|
||||
include "build/baserom/icon_item_nes_static.o"
|
||||
//include "build/assets/textures/icon_item_nes_static/icon_item_nes_static.o"
|
||||
include "build/baserom/icon_item_nes_static.o" //include "build/assets/textures/icon_item_nes_static/icon_item_nes_static.o"
|
||||
endseg
|
||||
|
||||
beginseg
|
||||
|
|
BIN
tools/ido_recomp/macos/5.3/as1
Executable file
BIN
tools/ido_recomp/macos/5.3/as1
Executable file
Binary file not shown.
BIN
tools/ido_recomp/macos/5.3/cc
Executable file
BIN
tools/ido_recomp/macos/5.3/cc
Executable file
Binary file not shown.
BIN
tools/ido_recomp/macos/5.3/cfe
Executable file
BIN
tools/ido_recomp/macos/5.3/cfe
Executable file
Binary file not shown.
1260
tools/ido_recomp/macos/5.3/err.english.cc
Normal file
1260
tools/ido_recomp/macos/5.3/err.english.cc
Normal file
File diff suppressed because it is too large
Load diff
BIN
tools/ido_recomp/macos/5.3/ugen
Executable file
BIN
tools/ido_recomp/macos/5.3/ugen
Executable file
Binary file not shown.
BIN
tools/ido_recomp/macos/5.3/uopt
Executable file
BIN
tools/ido_recomp/macos/5.3/uopt
Executable file
Binary file not shown.
BIN
tools/ido_recomp/macos/7.1/as1
Executable file
BIN
tools/ido_recomp/macos/7.1/as1
Executable file
Binary file not shown.
BIN
tools/ido_recomp/macos/7.1/cc
Executable file
BIN
tools/ido_recomp/macos/7.1/cc
Executable file
Binary file not shown.
BIN
tools/ido_recomp/macos/7.1/cfe
Executable file
BIN
tools/ido_recomp/macos/7.1/cfe
Executable file
Binary file not shown.
1260
tools/ido_recomp/macos/7.1/err.english.cc
Normal file
1260
tools/ido_recomp/macos/7.1/err.english.cc
Normal file
File diff suppressed because it is too large
Load diff
BIN
tools/ido_recomp/macos/7.1/ugen
Executable file
BIN
tools/ido_recomp/macos/7.1/ugen
Executable file
Binary file not shown.
BIN
tools/ido_recomp/macos/7.1/uopt
Executable file
BIN
tools/ido_recomp/macos/7.1/uopt
Executable file
Binary file not shown.
Loading…
Reference in a new issue