mirror of
https://github.com/pret/pmd-sky.git
synced 2026-09-29 05:41:47 -05:00
Add build support with metroskrew port of compilers
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -12,6 +12,9 @@ tools/bin/**
|
||||
# wibo
|
||||
tools/wibo/**
|
||||
|
||||
# metroskrew
|
||||
tools/metroskrew/**
|
||||
|
||||
# Build folder
|
||||
build/**
|
||||
sub/build/**
|
||||
|
||||
20
INSTALL.md
20
INSTALL.md
@@ -104,9 +104,9 @@ 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
|
||||
### Building with wibo and Metroskrew 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.
|
||||
**[wibo](https://github.com/decompals/wibo)** is a minimal and fast Win32 loader for decompilation work specifically. You can use it instead of wine on Linux (and x86 macOS, though untested).
|
||||
|
||||
```shell
|
||||
make install_wibo # download wibo into tools/wibo/
|
||||
@@ -127,6 +127,22 @@ If the Nitro SDK tools (`makerom`, `makelcf`, `makebanner`) cause issues under w
|
||||
make USE_WIBO=1 NITROWINE=wine
|
||||
```
|
||||
|
||||
**[Metroskrew](https://github.com/mid-kid/metroskrew)** is a port of the Metrowerks ARM compiler to Linux by relinking, which means that you can run the compilers directly as native Linux binaries using it.
|
||||
|
||||
You will still need either Wine or Wibo for the SDK tools (which are separate from the compiler).
|
||||
|
||||
In addition, Metroskrew's binaries are 32-bit x86, so you will need 32-bit glibc installed. That's:
|
||||
|
||||
* libc6-i386 on Debian/Ubuntu
|
||||
* lib32-glibc on Arch (multilib)
|
||||
* glibc.i686 on Fedora
|
||||
|
||||
```shell
|
||||
make install_metroskrew # download Metroskrew into tools/metroskrew/
|
||||
#make install_wibo # download wibo into tools/wibo/, from earlier
|
||||
make USE_WIBO=1 USE_METROSKREW=1 # build
|
||||
```
|
||||
|
||||
### 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.
|
||||
|
||||
11
Makefile
11
Makefile
@@ -95,9 +95,18 @@ 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
|
||||
rm -rf tools/wibo
|
||||
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
|
||||
METROSKREW_VER ?= 0.1.3
|
||||
METROSKREW_URL := https://github.com/mid-kid/metroskrew/releases/download/$(METROSKREW_VER)/metroskrew-linux.tar.xz
|
||||
|
||||
install_metroskrew:
|
||||
rm -rf tools/metroskrew
|
||||
mkdir -p tools/metroskrew
|
||||
wget -O- $(METROSKREW_URL) | tar -xJ -C tools/metroskrew --strip-components=1
|
||||
|
||||
.PHONY: compare install_toolchain install_wibo install_metroskrew
|
||||
|
||||
36
common.mk
36
common.mk
@@ -31,9 +31,19 @@ include $(WORK_DIR)/platform.mk
|
||||
include $(WORK_DIR)/binutils.mk
|
||||
|
||||
# NitroSDK tools
|
||||
MWCC = $(TOOLSDIR)/mwccarm/$(MWCCVER)/mwccarm.exe
|
||||
MWAS = $(TOOLSDIR)/mwccarm/$(MWCCVER)/mwasmarm.exe
|
||||
MWLD = $(BACK_REL)/$(TOOLSDIR)/mwccarm/$(MWCCVER)/mwldarm.exe
|
||||
MWAS_EXE = $(TOOLSDIR)/mwccarm/$(MWCCVER)/mwasmarm.exe
|
||||
ifneq ($(USE_METROSKREW),0)
|
||||
SKREWRAP := $(abspath $(TOOLSDIR)/metroskrew/bin/skrewrap)
|
||||
SKREW_SDK = $(TOOLSDIR)/metroskrew/share/metroskrew/sdk/ds/$(MWCCVER)
|
||||
skrew_ver = $(patsubst $(1)-%.exe,%,$(shell cat $(SKREW_SDK)/$(1).exe.txt))
|
||||
MWCC = $(SKREWRAP) mwccarm -wrap:ver $(call skrew_ver,mwccarm)
|
||||
MWAS = $(SKREWRAP) mwasmarm -wrap:ver $(call skrew_ver,mwasmarm)
|
||||
MWLD = $(SKREWRAP) mwldarm -wrap:ver $(call skrew_ver,mwldarm)
|
||||
else
|
||||
MWCC = $(WINE) $(TOOLSDIR)/mwccarm/$(MWCCVER)/mwccarm.exe
|
||||
MWAS = $(WINE) $(TOOLSDIR)/mwccarm/$(MWCCVER)/mwasmarm.exe
|
||||
MWLD = $(WINE) $(BACK_REL)/$(TOOLSDIR)/mwccarm/$(MWCCVER)/mwldarm.exe
|
||||
endif
|
||||
MAKEROM := $(TOOLSDIR)/bin/makerom.exe
|
||||
MAKELCF := $(TOOLSDIR)/bin/makelcf.exe
|
||||
MAKEBNR := $(TOOLSDIR)/bin/makebanner.exe
|
||||
@@ -146,11 +156,11 @@ LIBRARY_INCLUDE_FLAGS := -I$(WORK_DIR)/lib/msl/include/MSL_C $(foreach dname,$(L
|
||||
SRC_INCLUDE_FLAGS := -i ./include -i ./include/library -i $(WORK_DIR)/files $(LIBRARY_INCLUDE_FLAGS)
|
||||
SDK_INCLUDE_FLAGS := $(LIBRARY_INCLUDE_FLAGS)
|
||||
|
||||
MW_COMPILE_SRC = $(WINE) $(MWCC) $(OPTFLAGS) $(MWCFLAGS) $(SRC_INCLUDE_FLAGS) -i $(PRECOMPILE_OBJ_DIR) -prefix $(PRECOMPILE_OBJ_BASENAME)
|
||||
MW_COMPILE_LIB = $(WINE) $(MWCC) $(OPTFLAGS_SDK) $(MWCFLAGS_LIB) $(SRC_INCLUDE_FLAGS) -i $(PRECOMPILE_OBJ_DIR) -prefix $(PRECOMPILE_OBJ_BASENAME)
|
||||
MW_COMPILE_SRC_PRECOMPILE = $(WINE) $(MWCC) $(MWCFLAGS) $(SRC_INCLUDE_FLAGS)
|
||||
MW_COMPILE_SRC = $(MWCC) $(OPTFLAGS) $(MWCFLAGS) $(SRC_INCLUDE_FLAGS) -i $(PRECOMPILE_OBJ_DIR) -prefix $(PRECOMPILE_OBJ_BASENAME)
|
||||
MW_COMPILE_LIB = $(MWCC) $(OPTFLAGS_SDK) $(MWCFLAGS_LIB) $(SRC_INCLUDE_FLAGS) -i $(PRECOMPILE_OBJ_DIR) -prefix $(PRECOMPILE_OBJ_BASENAME)
|
||||
MW_COMPILE_SRC_PRECOMPILE = $(MWCC) $(MWCFLAGS) $(SRC_INCLUDE_FLAGS)
|
||||
|
||||
MW_ASSEMBLE = $(WINE) $(MWAS) $(MWASFLAGS)
|
||||
MW_ASSEMBLE = $(MWAS) $(MWASFLAGS)
|
||||
|
||||
export MWCIncludes := lib/include
|
||||
|
||||
@@ -171,8 +181,8 @@ DUMMY := $(shell mkdir -p $(ALL_BUILDDIRS) $(PRECOMPILE_OBJ_DIR))
|
||||
.PRECIOUS: $(SBIN)
|
||||
.NOTPARALLEL:
|
||||
|
||||
.PHONY: $(MWAS)
|
||||
$(MWAS):
|
||||
.PHONY: $(MWAS_EXE)
|
||||
$(MWAS_EXE):
|
||||
$(ASPATCH) -q $@
|
||||
|
||||
ifeq ($(NODEP),)
|
||||
@@ -224,7 +234,7 @@ $(BUILD_DIR)/lib/%.o: lib/%.c $(BUILD_DIR)/lib/%.d $(NITRO_PRECOMPILE_OBJ)
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s
|
||||
$(BUILD_DIR)/%.o: %.s $(BUILD_DIR)/%.d
|
||||
$(WINE) $(MWAS) $(MWASFLAGS) -I$(dir $<) $(DEPFLAGS) -o $@ $<
|
||||
$(MWAS) $(MWASFLAGS) -I$(dir $<) $(DEPFLAGS) -o $@ $<
|
||||
@$(call fixdep,$(BUILD_DIR)/$*.d)
|
||||
|
||||
include $(wildcard $(DEPFILES))
|
||||
@@ -237,12 +247,12 @@ $(BUILD_DIR)/%.o: %.c
|
||||
$(BUILD_C) $@ $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s
|
||||
$(WINE) $(MWAS) $(MWASFLAGS) -o $@ $<
|
||||
$(MWAS) $(MWASFLAGS) -o $@ $<
|
||||
endif
|
||||
|
||||
$(NATIVE_TOOLS): tools
|
||||
|
||||
tools: $(TOOLDIRS) $(MWAS)
|
||||
tools: $(TOOLDIRS) $(MWAS_EXE)
|
||||
|
||||
$(TOOLDIRS):
|
||||
@$(MAKE) -C $@
|
||||
@@ -268,7 +278,7 @@ $(RESPONSE): $(LSF) $(RESPONSE_TEMPLATE)
|
||||
CRT0_OBJ := lib/asm/crt0.o
|
||||
|
||||
$(NEF): $(LCF) $(RESPONSE) $(ALL_OBJS)
|
||||
cd $(BUILD_DIR) && LM_LICENSE_FILE=$(BACK_REL)/$(LM_LICENSE_FILE) $(WINE) $(MWLD) $(MWLDFLAGS) $(LIBS) -o $(BACK_REL)/$(NEF) $(LCF:$(BUILD_DIR)/%=%) @$(RESPONSE:$(BUILD_DIR)/%=%) $(CRT0_OBJ)
|
||||
cd $(BUILD_DIR) && LM_LICENSE_FILE=$(BACK_REL)/$(LM_LICENSE_FILE) $(MWLD) $(MWLDFLAGS) $(LIBS) -o $(BACK_REL)/$(NEF) $(LCF:$(BUILD_DIR)/%=%) @$(RESPONSE:$(BUILD_DIR)/%=%) $(CRT0_OBJ)
|
||||
|
||||
.INTERMEDIATE: $(BUILD_DIR)/obj.list
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ all: $(LIB)
|
||||
ASM_SRCS := asm/_secure_$(GAME_CODE).s
|
||||
|
||||
$(LIB): $(ALL_OBJS)
|
||||
cd $(BUILD_DIR) && LM_LICENSE_FILE=$(BACK_REL)/$(LM_LICENSE_FILE) $(WINE) $(MWLD) $(MWLDFLAGS) -o $(BACK_REL)/$(LIB) $(ALL_OBJS:$(BUILD_DIR)/%=%)
|
||||
cd $(BUILD_DIR) && LM_LICENSE_FILE=$(BACK_REL)/$(LM_LICENSE_FILE) $(MWLD) $(MWLDFLAGS) -o $(BACK_REL)/$(LIB) $(ALL_OBJS:$(BUILD_DIR)/%=%)
|
||||
|
||||
install: all
|
||||
$(shell mkdir -p $(INSTALL_LIBDIR))
|
||||
|
||||
@@ -70,3 +70,8 @@ ifneq ($(USE_WIBO),0)
|
||||
endif
|
||||
|
||||
NITROWINE ?= $(WINE)
|
||||
|
||||
# USE_METROSKREW overrides WINE for the Metrowerks compilers only,
|
||||
# skipping wine entirely, using the metroskrew native re-link.
|
||||
|
||||
USE_METROSKREW ?= 0
|
||||
|
||||
Reference in New Issue
Block a user