Add dep tracking & use WiBo in CI (#47)

* Add dep tracking & use WiBo in CI

* Create empty tools/mwcc_compiler

* Disable UPDATE_README in CI
This commit is contained in:
Luke Street 2022-09-08 13:22:44 -04:00 committed by GitHub
parent 12e701cb09
commit 97c07eda27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 105 additions and 17 deletions

View File

@ -11,17 +11,30 @@ jobs:
env:
WINEPREFIX: ${{github.workspace}}/.wine
steps:
- name: Install devkitPro
- name: Checkout
uses: actions/checkout@v3
- name: Checkout WiBo
uses: actions/checkout@v3
with:
repository: decompals/WiBo
path: tools/WiBo
- name: Install dependencies
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get -y install build-essential wine32
sudo chown $(whoami) "$GITHUB_WORKSPACE"
- uses: actions/checkout@v3
- name: Download compilers
run: |
sudo apt-get -y install build-essential gcc-multilib g++-multilib libc6:i386
curl -L https://cdn.discordapp.com/attachments/727918646525165659/917185027656286218/GC_WII_COMPILERS.zip \
| bsdtar -xvf- -C tools --exclude Wii
mv tools/GC tools/mwcc_compiler
- name: make
run: MAPGENFLAG=1 UPDATE_README=0 make -j$(nproc)
mv tools/GC/* tools/mwcc_compiler/
- name: Build WiBo
working-directory: tools/WiBo
run: |
cmake -B build
cmake --build build
- name: Build
run: make -j$(nproc) WINE=./tools/WiBo/build/wibo MAPGENFLAG=1 UPDATE_README=0
- name: Upload map
uses: actions/upload-artifact@v2
with:
name: pikmin2UP.MAP
path: build/*/pikmin2UP.MAP

3
.gitignore vendored
View File

@ -26,7 +26,8 @@
include/*.s
build/
tools/mwcc_compiler/
tools/mwcc_compiler/*
!tools/mwcc_compiler/.gitkeep
decomp/
errors.txt
output.asm

View File

@ -70,6 +70,11 @@ O_FILES := $(GROUP_0_FILES) $(JSYSTEM) $(DOLPHIN)\
ifeq ($(EPILOGUE_PROCESS),1)
E_FILES := $(EPILOGUE_UNSCHEDULED)
endif
DEPENDS := $(O_FILES:.o=.d)
DEPENDS += $(E_FILES:.o=.d)
# If a specific .o file is passed as a target, also process its deps
DEPENDS += $(MAKECMDGOALS:.o=.d)
#-------------------------------------------------------------------------------
# Tools
#-------------------------------------------------------------------------------
@ -88,11 +93,17 @@ ifeq ($(WINDOWS),1)
CPP := $(DEVKITPPC)/bin/powerpc-eabi-cpp.exe -P
PYTHON := python
else
WINE ?= wine
WIBO := $(shell command -v wibo 2> /dev/null)
ifdef WIBO
WINE ?= wibo
else
WINE ?= wine
endif
# Disable wine debug output for cleanliness
export WINEDEBUG ?= -all
# Default devkitPPC path
DEVKITPPC ?= /opt/devkitpro/devkitPPC
DEPENDS := $(DEPENDS:.d=.d.unix)
AS := $(DEVKITPPC)/bin/powerpc-eabi-as
CPP := $(DEVKITPPC)/bin/powerpc-eabi-cpp -P
PYTHON := python3
@ -105,6 +116,7 @@ LD := $(WINE) tools/mwcc_compiler/$(MWLD_VERSION)/mwldeppc.exe
ELF2DOL := tools/elf2dol
SHA1SUM := sha1sum
TRANSFORM_DEP := tools/transform-dep.py
FRANK := tools/franklite.py
# Options
@ -120,7 +132,7 @@ ifeq ($(VERBOSE),0)
# this set of LDFLAGS generates no warnings.
LDFLAGS := $(MAPGEN) -fp hard -nodefaults -w off
endif
CFLAGS := -Cpp_exceptions off -enum int -inline auto -proc gekko -RTTI off -fp hard -fp_contract on -rostr -O4,p -use_lmw_stmw on -common on -sdata 8 -sdata2 8 -nodefaults -DVERNUM=$(VERNUM) $(INCLUDES)
CFLAGS := -Cpp_exceptions off -enum int -inline auto -proc gekko -RTTI off -fp hard -fp_contract on -rostr -O4,p -use_lmw_stmw on -common on -sdata 8 -sdata2 8 -nodefaults -MMD -DVERNUM=$(VERNUM) $(INCLUDES)
ifeq ($(VERBOSE),0)
# this set of ASFLAGS generates no warnings.
@ -163,7 +175,7 @@ $(BUILD_DIR)/src/Dolphin/OSCache.o: CFLAGS += -str noreadonly
$(BUILD_DIR)/src/Dolphin/GBA.o: CFLAGS += -str noreadonly
# This is inline-deferred for some reason
$(BUILD_DIR)/src/Dolphin/mbstring.o: CFLAGS := -Cpp_exceptions off -enum int -inline deferred -proc gekko -RTTI off -fp hard -fp_contract on -rostr -O4,p -use_lmw_stmw on -common on -sdata 8 -sdata2 8 -nodefaults -DVERNUM=$(VERNUM) $(INCLUDES)
$(BUILD_DIR)/src/Dolphin/mbstring.o: CFLAGS := -Cpp_exceptions off -enum int -inline deferred -proc gekko -RTTI off -fp hard -fp_contract on -rostr -O4,p -use_lmw_stmw on -common on -sdata 8 -sdata2 8 -nodefaults -MMD -DVERNUM=$(VERNUM) $(INCLUDES)
# Disable common BSS pool
$(DOLPHIN): CFLAGS += -common off
@ -232,21 +244,27 @@ $(ELF): $(O_FILES) $(LDSCRIPT)
$(QUIET) $(LD) $(LDFLAGS) -o $@ -lcf $(LDSCRIPT) @build/o_files
endif
%.d.unix: %.d $(TRANSFORM_DEP)
@echo Processing $<
$(QUIET) $(PYTHON) $(TRANSFORM_DEP) $< $@
-include $(DEPENDS)
$(BUILD_DIR)/%.o: %.s
@echo Assembling $<
$(QUIET) $(AS) $(ASFLAGS) -o $@ $<
$(BUILD_DIR)/%.o: %.c
@echo "Compiling " $<
$(QUIET) $(CC) $(CFLAGS) -c -o $@ $<
$(QUIET) $(CC) $(CFLAGS) -c -o $(dir $@) $<
$(BUILD_DIR)/%.o: %.cp
@echo "Compiling " $<
$(QUIET) $(CC) $(CFLAGS) -c -o $@ $<
$(QUIET) $(CC) $(CFLAGS) -c -o $(dir $@) $<
$(BUILD_DIR)/%.o: %.cpp
@echo "Compiling " $<
$(QUIET) $(CC) $(CFLAGS) -c -o $@ $<
$(QUIET) $(CC) $(CFLAGS) -c -o $(dir $@) $<
ifeq ($(EPILOGUE_PROCESS),1)
$(EPILOGUE_DIR)/%.o: %.c $(BUILD_DIR)/%.o

View File

56
tools/transform-dep.py Executable file
View File

@ -0,0 +1,56 @@
#!/usr/bin/env python3
import argparse
import os
wineprefix = os.path.join(os.environ['HOME'], '.wine')
if 'WINEPREFIX' in os.environ:
wineprefix = os.environ['WINEPREFIX']
winedevices = os.path.join(wineprefix, 'dosdevices')
def import_d_file(in_file) -> str:
out_text = ''
with open(in_file) as file:
for idx, line in enumerate(file):
if idx == 0:
if line.endswith(' \\\n'):
out_text += line[:-3].replace('\\', '/') + " \\\n"
else:
out_text += line.replace('\\', '/')
else:
suffix = ''
if line.endswith(' \\\n'):
suffix = ' \\'
path = line.lstrip()[:-3]
else:
path = line.strip()
# lowercase drive letter
path = path[0].lower() + path[1:]
# use $WINEPREFIX/dosdevices to resolve path
path = os.path.realpath(os.path.join(winedevices, path.replace('\\', '/')))
out_text += "\t" + path + suffix + "\n"
return out_text
def main():
parser = argparse.ArgumentParser(
description="""Transform a .d file from Wine paths to normal paths"""
)
parser.add_argument(
"d_file",
help="""Dependency file in""",
)
parser.add_argument(
"d_file_out",
help="""Dependency file out""",
)
args = parser.parse_args()
output = import_d_file(args.d_file)
with open(args.d_file_out, "w", encoding="UTF-8") as f:
f.write(output)
if __name__ == "__main__":
main()