From bd75b79bc25d00a58b67d94d8e2f01b7f4b6d6b3 Mon Sep 17 00:00:00 2001 From: adakite1 Date: Sun, 27 Sep 2026 18:50:18 +0800 Subject: [PATCH] Add ability to build using wibo --- .gitignore | 3 +++ INSTALL.md | 23 +++++++++++++++++++++++ Makefile | 18 +++++++++++++++--- common.mk | 4 ++-- platform.mk | 26 ++++++++++++++++++++++++++ 5 files changed, 69 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 2ea2503c..ba441f8f 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,9 @@ tools/bin/** *.lcf.template *.response.template +# wibo +tools/wibo/** + # Build folder build/** sub/build/** diff --git a/INSTALL.md b/INSTALL.md index fe5dd65a..5b70bf9f 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -104,6 +104,29 @@ There are targets for building and testing changes to individual components with At the end of building each of these, there is a checksum verification step. This makes sure that the final product is byte-for-byte equivalent to the retail ROM. To disable this, append `COMPARE=0` to your command. +### Building with wibo instead of wine + +You can use [wibo](https://github.com/decompals/wibo) instead of wine on Linux (and x86 macOS, though untested). wibo is a minimal and faster Win32 loader for decompilation work specifically. + +```shell +make install_wibo # download wibo into tools/wibo/ +make USE_WIBO=1 # build +``` + +To use wibo already on your `PATH`, pass `WIBO=wibo`: + +```shell +make USE_WIBO=1 WIBO=wibo +``` + +Likewise, to use your own build, replace that with `WIBO=`. + +If the Nitro SDK tools (`makerom`, `makelcf`, `makebanner`) cause issues under wibo, you can use wine for those while keeping wibo on the Metrowerks binaries: + +```shell +make USE_WIBO=1 NITROWINE=wine +``` + ### 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. diff --git a/Makefile b/Makefile index 567a9a7d..707986ce 100644 --- a/Makefile +++ b/Makefile @@ -56,14 +56,14 @@ $(BUILD_DIR)/component.files: main ; $(HEADER_TEMPLATE): ; $(ROM): $(ROMSPEC) tools filesystem main sub $(BANNER) - $(WINE) $(MAKEROM) $(MAKEROM_FLAGS) -DBUILD_DIR=$(BUILD_DIR) -M$(NITROFS_FILES_FILE) -DTITLE_NAME="$(TITLE_NAME)" -DBNR="$(BANNER)" -DHEADER_TEMPLATE="$(HEADER_TEMPLATE)" $< $@ + $(NITROWINE) $(MAKEROM) $(MAKEROM_FLAGS) -DBUILD_DIR=$(BUILD_DIR) -M$(NITROFS_FILES_FILE) -DTITLE_NAME="$(TITLE_NAME)" -DBNR="$(BANNER)" -DHEADER_TEMPLATE="$(HEADER_TEMPLATE)" $< $@ $(FIXROM) $@ --secure-crc $(SECURE_CRC) --game-code $(GAME_CODE) ifeq ($(COMPARE),1) $(SHA1SUM) -c $(buildname)/rom.sha1 endif $(BANNER): $(BANNER_SPEC) $(ICON_PNG:%.png=%.nbfp) $(ICON_PNG:%.png=%.nbfc) - $(WINE) $(MAKEBNR) $< $@ + $(NITROWINE) $(MAKEBNR) $< $@ us: ; @$(MAKE) GAME_LANGUAGE=NORTH_AMERICA eu: ; @$(MAKE) GAME_LANGUAGE=EUROPE @@ -88,4 +88,16 @@ install_toolchain: mv toolchain_tmp/nitro_sdk/include/nitro/specfiles/mwldarm.response.template . rm -r toolchain_tmp -.PHONY: compare install_toolchain +WIBO_VERSION := 1.2.0 +WIBO_ARCH := $(if $(filter aarch64 arm64,$(shell uname -m)),,$(if $(filter Darwin,$(shell uname -s)),macos,x86_64)) + +install_wibo: +ifeq ($(WIBO_ARCH),) + $(error No prebuilt wibo binaries are available for $(shell uname -s)/$(shell uname -m), build it from https://github.com/decompals/wibo and install it manually) +endif + mkdir -p tools/wibo + wget -O tools/wibo/wibo https://github.com/decompals/wibo/releases/download/$(WIBO_VERSION)/wibo-$(WIBO_ARCH) + chmod +x tools/wibo/wibo + tools/wibo/wibo --version + +.PHONY: compare install_toolchain install_wibo diff --git a/common.mk b/common.mk index 79b2dff0..a2764abe 100644 --- a/common.mk +++ b/common.mk @@ -251,7 +251,7 @@ clean-tools: $(foreach tool,$(TOOLDIRS),$(MAKE) -C $(tool) clean;) $(LCF): $(LSF) $(LCF_TEMPLATE) - $(WINE) $(MAKELCF) $(MAKELCF_FLAGS) $^ $@ + $(NITROWINE) $(MAKELCF) $(MAKELCF_FLAGS) $^ $@ ifeq ($(PROC),arm946e) $(SED) -i '1i KEEP_SECTION\n{\n\t.exceptix\n}' $@ else @@ -262,7 +262,7 @@ RESPONSE_TEMPLATE := $(PROJECT_ROOT)/mwldarm.response.template RESPONSE_TEMPLATE_NT := $(PROJECT_ROOT_NT)/mwldarm.response.template $(RESPONSE): $(LSF) $(RESPONSE_TEMPLATE) - $(WINE) $(MAKELCF) $(MAKELCF_FLAGS) $< $(RESPONSE_TEMPLATE_NT) $@ + $(NITROWINE) $(MAKELCF) $(MAKELCF_FLAGS) $< $(RESPONSE_TEMPLATE_NT) $@ # Locate crt0.o CRT0_OBJ := lib/asm/crt0.o diff --git a/platform.mk b/platform.mk index 5493e631..be6d96d4 100644 --- a/platform.mk +++ b/platform.mk @@ -44,3 +44,29 @@ ifeq ($(NOWINE),1) else WINPATH := winepath endif + +# Win32 runner selection, using wibo when USE_WIBO=1 and regular wine otherwise. +# +# make install_wibo # download wibo in tools/wibo/ +# make USE_WIBO=1 # build +# +# WIBO overrides which binary is used; it defaults to tools/wibo/* when present and otherwise to `wibo` on PATH. +# +# Nitro SDK tools are run using NITROWINE. It can be set separately like so: +# +# make USE_WIBO=1 NITROWINE=wine +# +# if you find that WIBO doesn't work as well with those tools as compared to the Metrowerks compilers. + +USE_WIBO ?= 0 + +ifneq ($(USE_WIBO),0) + TOOLS_WIBO := $(TOOLSDIR)/wibo/wibo + WIBO ?= $(if $(wildcard $(TOOLS_WIBO)),$(TOOLS_WIBO),wibo) + # Make the path absolute as long as it's not just "wibo" (from PATH) + WIBO_CMD := $(if $(findstring /,$(WIBO)),$(abspath $(WIBO)),$(WIBO)) + WINE := $(WIBO_CMD) + WINPATH := $(WIBO_CMD) path # use `wibo path` under wibo instead of winepath +endif + +NITROWINE ?= $(WINE)