From 6a3ad3fbc0bff47ec4252eb00fb4c8b2adc2c0d1 Mon Sep 17 00:00:00 2001 From: cadmic Date: Wed, 4 Sep 2024 12:40:24 -0700 Subject: [PATCH] Pass binutils path to compile.sh --- configure.py | 2 +- tools/asm_processor/compile.sh | 2 +- tools/project.py | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/configure.py b/configure.py index 9b9a6544..1a84a420 100755 --- a/configure.py +++ b/configure.py @@ -49,7 +49,7 @@ ) parser.add_argument( "--binutils", - metavar="BINARY", + metavar="DIR", type=Path, help="path to binutils (optional)", ) diff --git a/tools/asm_processor/compile.sh b/tools/asm_processor/compile.sh index 5af66087..1517ca1e 100755 --- a/tools/asm_processor/compile.sh +++ b/tools/asm_processor/compile.sh @@ -29,6 +29,6 @@ $PYTHON tools/asm_processor/asm_processor.py "$IN" > "$TEMP/$STEM.c" $CC "$TEMP/$STEM.c" -c -o "$TEMP" $PYTHON tools/asm_processor/asm_processor.py "$IN" --post-process "$TEMP/$STEM.o" --assembler "$AS" --asm-prelude include/macros.inc # Remove sections that don't work with our reloc hacks -build/binutils/powerpc-eabi-objcopy --remove-section .mwcats.text --remove-section .comment "$TEMP/$STEM.o" "$OUT" +${BINUTILS_PATH:-build/binutils}/powerpc-eabi-objcopy --remove-section .mwcats.text --remove-section .comment "$TEMP/$STEM.o" "$OUT" # Copy depfile, replacing the first line with the correct input/output files ( echo "$OUT: $IN \\"; tail -n +2 "$TEMP/$STEM.d" ) > "${OUT%.*}.d" diff --git a/tools/project.py b/tools/project.py index 2f0cde32..bd030e89 100644 --- a/tools/project.py +++ b/tools/project.py @@ -548,9 +548,12 @@ def write_cargo_rule(): mwcc_sjis_implicit.append(transform_dep) mwcc_asm_processor_implicit.append(transform_dep) mwcc_asm_processor_sjis_implicit.append(transform_dep) + + mwcc_asm_processor_cmd = f'env "BINUTILS_PATH={binutils}" ' + mwcc_asm_processor_cmd + mwcc_asm_processor_sjis_cmd = f'env "BINUTILS_PATH={binutils}" ' + mwcc_asm_processor_sjis_cmd else: - mwcc_asm_processor_cmd = "sh " + mwcc_asm_processor_cmd - mwcc_asm_processor_sjis_cmd = "sh " + mwcc_asm_processor_sjis_cmd + mwcc_asm_processor_cmd = f'set "BINUTILS_PATH={binutils}" && sh ' + mwcc_asm_processor_cmd + mwcc_asm_processor_sjis_cmd = f'set "BINUTILS_PATH={binutils}" && sh ' + mwcc_asm_processor_sjis_cmd n.comment("Link ELF file") n.rule(