From fc81c4a0af763477fa485e2648cc47ffd5ed703d Mon Sep 17 00:00:00 2001 From: Dsaster <78389441+dsastr@users.noreply.github.com> Date: Sat, 6 Feb 2021 01:16:47 +0100 Subject: add macOS support --- INSTALL.md | 29 +++++++++++++++++++++++++++++ Makefile | 4 ++++ arm7/Makefile | 5 +++++ arm9/Makefile | 7 ++++++- tools/knarc/Makefile | 2 +- tools/mwasmarm_patcher/Makefile | 5 +++++ 6 files changed, 50 insertions(+), 2 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 35eb054d..5a6ecd09 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -48,6 +48,35 @@ Install them using either the Cygwin package manager or using pacman on Msys2. **NOTE FOR MSYS2:** You will need to compile and install [libpng](https://www.libpng.org/pub/png/libpng.html) from source. +#### macOS + +**macOS 10.14 Mojave or older is required**. macOS 10.15 Catalina is not supported due to missing support for 32-bit binaries (thus making wine emulation unfeasible). You will also require the following packages: + +* GNU make +* LLVM 8 clang compiler +* gcc@5 (for mwasmarm_patcher) +* arm-gcc-bin +* git +* libpng +* wine-stable and xquartz dependency + +They can be installed with the following commands: + +```console +$ brew tap osx-cross/homebrew-arm +$ brew tap homebrew/cask-versions +$ brew install make llvm@8 gcc@5 arm-gcc-bin libpng git +$ brew install --cask xquartz +$ brew install --cask --no-quarantine wine-stable +``` + +To build the project, run the below commands: + +```console +$ export PATH=/usr/local/opt/llvm@8/bin:$PATH SHA1SUM=shasum CC=clang CXX=clang++ +$ gmake +``` + ### 4. Build ROM Run `make` to build the ROM. The ROM will be output as `build/diamond.us/pokediamond.us.nds` diff --git a/Makefile b/Makefile index 5189c062..4467d8ac 100644 --- a/Makefile +++ b/Makefile @@ -109,7 +109,11 @@ LDFLAGS = -map -nodead -w off -proc v5te -interworking -map -symtab -m _start # DS TOOLS TOOLS_DIR = tools +ifeq ($(UNAME_S),Darwin) +SHA1SUM = shasum +else SHA1SUM = sha1sum +endif CSV2BIN = $(TOOLS_DIR)/csv2bin/csv2bin$(EXE) JSONPROC = $(TOOLS_DIR)/jsonproc/jsonproc$(EXE) O2NARC = $(TOOLS_DIR)/o2narc/o2narc$(EXE) diff --git a/arm7/Makefile b/arm7/Makefile index f983c654..d142c079 100644 --- a/arm7/Makefile +++ b/arm7/Makefile @@ -96,7 +96,12 @@ LDFLAGS = -map -nodead -w off -proc v4t -interworking -map -symtab -m _start ####################### Other Tools ######################### # DS TOOLS +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Darwin) +SHA1SUM = shasum +else SHA1SUM = sha1sum +endif JSONPROC = $(TOOLS_DIR)/jsonproc/jsonproc GFX = $(TOOLS_DIR)/nitrogfx/nitrogfx SCANINC = $(TOOLS_DIR)/scaninc/scaninc$(EXE) diff --git a/arm9/Makefile b/arm9/Makefile index 05e78524..ea391eea 100644 --- a/arm9/Makefile +++ b/arm9/Makefile @@ -120,11 +120,16 @@ STATIC_LIBS := $(addprefix $(BUILD_DIR)/lib/,libsyscall.a) ####################### Other Tools ######################### # DS TOOLS -ifndef BUSYBOX +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Darwin) +SHA1SUM = shasum +else +ifdef BUSYBOX SHA1SUM = sha1sum --quiet else SHA1SUM = sha1sum endif +endif JSONPROC = $(TOOLS_DIR)/jsonproc/jsonproc$(EXE) GFX = $(TOOLS_DIR)/nitrogfx/nitrogfx$(EXE) SCANINC = $(TOOLS_DIR)/scaninc/scaninc$(EXE) diff --git a/tools/knarc/Makefile b/tools/knarc/Makefile index 7dc8bd24..62abc062 100644 --- a/tools/knarc/Makefile +++ b/tools/knarc/Makefile @@ -8,7 +8,7 @@ else C_SRCS := UNAME_S := $(shell uname -s) ifeq ($(UNAME_S),Darwin) -LDFLAGS += -lstdc++ -lc++ -lc +LDFLAGS += -lstdc++ -lc++ -lc /usr/local/opt/llvm@8/lib/libc++fs.a -O2 -Wall -Wno-switch else LDFLAGS += -lstdc++fs endif diff --git a/tools/mwasmarm_patcher/Makefile b/tools/mwasmarm_patcher/Makefile index 9765f713..26df548c 100644 --- a/tools/mwasmarm_patcher/Makefile +++ b/tools/mwasmarm_patcher/Makefile @@ -1,6 +1,11 @@ .PHONY: all clean +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Darwin) +CC := gcc-5 +else CC := gcc +endif CFLAGS := -O3 .PHONY: all clean -- cgit v1.2.3 From 95c06516c1190a610385ce2a865115730ee76671 Mon Sep 17 00:00:00 2001 From: Dsaster <78389441+dsastr@users.noreply.github.com> Date: Sat, 6 Feb 2021 01:27:39 +0100 Subject: fix build section --- INSTALL.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 5a6ecd09..65dead6e 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -70,19 +70,21 @@ $ brew install --cask xquartz $ brew install --cask --no-quarantine wine-stable ``` -To build the project, run the below commands: - -```console -$ export PATH=/usr/local/opt/llvm@8/bin:$PATH SHA1SUM=shasum CC=clang CXX=clang++ -$ gmake -``` - ### 4. Build ROM Run `make` to build the ROM. The ROM will be output as `build/diamond.us/pokediamond.us.nds` To build Pokemon Pearl, run `make pearl`. You do not need to clean your working tree in between compiling. Pokemon Pearl will be built as `build/pearl.us/pokepearl.us.nds`. -Windows Users: +#### Windows If you get an error in saving configuration settings when specifying the license file, you need to add a system environment variable called LM_LICENSE_FILE and point it to the license.dat file. Alternatively, run mwccarm.exe from an Administrator command prompt, PowerShell, or WSL session. + +#### macOS + +To avoid issues run the build as shown below. This avoids issues with missing features (i.e. "introduced in macOS 10.15" errors) and Apple's make not following standards. + +```console +$ export PATH=/usr/local/opt/llvm@8/bin:$PATH CC=clang CXX=clang++ +$ gmake +``` -- cgit v1.2.3 From a2f2340c2bda2dae406ffaa1935d28cb740c2e39 Mon Sep 17 00:00:00 2001 From: Dsaster <78389441+dsastr@users.noreply.github.com> Date: Sat, 6 Feb 2021 02:16:48 +0100 Subject: fix ifdef -> ifndef typo --- arm9/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arm9/Makefile b/arm9/Makefile index ea391eea..8b84a135 100644 --- a/arm9/Makefile +++ b/arm9/Makefile @@ -124,7 +124,7 @@ UNAME_S := $(shell uname -s) ifeq ($(UNAME_S),Darwin) SHA1SUM = shasum else -ifdef BUSYBOX +ifndef BUSYBOX SHA1SUM = sha1sum --quiet else SHA1SUM = sha1sum -- cgit v1.2.3 From 904d950a9ed1876554557cba5a2e627d46c139cb Mon Sep 17 00:00:00 2001 From: Dsaster <78389441+dsastr@users.noreply.github.com> Date: Sat, 6 Feb 2021 02:21:45 +0100 Subject: Remove duplicated flags --- tools/knarc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/knarc/Makefile b/tools/knarc/Makefile index 62abc062..0e0a0920 100644 --- a/tools/knarc/Makefile +++ b/tools/knarc/Makefile @@ -8,7 +8,7 @@ else C_SRCS := UNAME_S := $(shell uname -s) ifeq ($(UNAME_S),Darwin) -LDFLAGS += -lstdc++ -lc++ -lc /usr/local/opt/llvm@8/lib/libc++fs.a -O2 -Wall -Wno-switch +LDFLAGS += -lstdc++ -lc++ -lc /usr/local/opt/llvm@8/lib/libc++fs.a else LDFLAGS += -lstdc++fs endif -- cgit v1.2.3