Add ability to build using wibo

This commit is contained in:
adakite1
2026-09-27 18:50:18 +08:00
parent c8073235b3
commit bd75b79bc2
5 changed files with 69 additions and 5 deletions

3
.gitignore vendored
View File

@@ -9,6 +9,9 @@ tools/bin/**
*.lcf.template
*.response.template
# wibo
tools/wibo/**
# Build folder
build/**
sub/build/**

View File

@@ -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=<path to your wibo binary>`.
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.

View File

@@ -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

View File

@@ -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

View File

@@ -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)