From cb8d5b0bfe3a91b5dd260601af1431d156ce44a0 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Wed, 14 Dec 2022 21:17:16 -0500 Subject: [PATCH] Build static libs by default; update progress.py --- configure.py | 22 +++++++++++++++------- dtk_version | 2 +- progress.py | 25 +++---------------------- 3 files changed, 19 insertions(+), 30 deletions(-) diff --git a/configure.py b/configure.py index a79d4206..eea7906d 100755 --- a/configure.py +++ b/configure.py @@ -1064,10 +1064,10 @@ if __name__ == "__main__": help="don't check hash of resulting dol", ) parser.add_argument( - "--static-libs", + "--no-static-libs", dest="static_libs", - action="store_true", - help="build and use static libs", + action="store_false", + help="don't build and use static libs", ) parser.add_argument( "--devkitppc", @@ -1202,7 +1202,9 @@ if __name__ == "__main__": n.comment("Assemble asm") n.rule( name="as", - command="$devkitppc\\bin\\powerpc-eabi-as.exe $asflags -o $out $in -MD $out.d", + command=ALLOW_CHAIN + + "$devkitppc\\bin\\powerpc-eabi-as.exe $asflags -o $out $in -MD $out.d" + + " && $dtk elf fixup $out $out", description="AS $out", depfile="$out.d", deps="gcc", @@ -1211,8 +1213,10 @@ if __name__ == "__main__": n.comment("Create static library") n.rule( name="ar", - command="$devkitppc\\bin\\powerpc-eabi-ar.exe crs $out $in", + command="$dtk ar create $out @$out.rsp", description="AR $out", + rspfile="$out.rsp", + rspfile_content="$in_newline", ) n.newline() else: @@ -1243,7 +1247,7 @@ if __name__ == "__main__": command="${wine}tools/mwcc_compiler/$mwcc_version/mwldeppc.exe $ldflags -o $out @$out.rsp", description="LINK $out", rspfile="$out.rsp", - rspfile_content="$in", + rspfile_content="$in_newline", ) n.newline() n.comment("Assemble asm") @@ -1259,8 +1263,10 @@ if __name__ == "__main__": n.comment("Create static library") n.rule( name="ar", - command="$devkitppc/bin/powerpc-eabi-ar crs $out $in", + command="$dtk ar create $out @$out.rsp", description="AR $out", + rspfile="$out.rsp", + rspfile_content="$in_newline", ) n.newline() n.comment("Host build") @@ -1394,6 +1400,7 @@ if __name__ == "__main__": outputs=f"$builddir/lib/{lib_name}.a", rule="ar", inputs=inputs, + implicit="$dtk", ) n.newline() @@ -1506,6 +1513,7 @@ if __name__ == "__main__": outputs="$builddir/main.dol.progress", rule="progress", inputs=["$builddir/main.dol", "$builddir/MetroidPrime.MAP"], + implicit="progress.py", ) n.newline() diff --git a/dtk_version b/dtk_version index 22c08f72..f0cfd3bb 100644 --- a/dtk_version +++ b/dtk_version @@ -1 +1 @@ -v0.2.1 +v0.2.2 diff --git a/progress.py b/progress.py index d90bd3f6..3d334aa8 100644 --- a/progress.py +++ b/progress.py @@ -27,8 +27,6 @@ import math import argparse import json -from configure import LIBS - ############################################### # # # Constants # @@ -45,7 +43,7 @@ r"(?P\w{8})\s+"\ r"(?P\w{8})\s+"\ r"(\w{1,2})\s+"\ r"(?P[0-9A-Za-z_<>$@.*]*)\s*"\ -r"(?P\S*)" +r"(?P[\S ]*)" MW_GC_SYMBOL_REGEX = r"^\s*"\ r"(?P\w{8})\s+"\ @@ -53,7 +51,7 @@ r"(?P\w{6})\s+"\ r"(?P\w{8})\s+"\ r"(\w{1,2})\s+"\ r"(?P[0-9A-Za-z_<>$@.*]*)\s*"\ -r"(?P\S*)" +r"(?P[\S ]*)" REGEX_TO_USE = MW_GC_SYMBOL_REGEX @@ -90,23 +88,6 @@ if __name__ == "__main__": parser.add_argument("-o", "--output", help="JSON output file") args = parser.parse_args() - # HACK: Check asm or src in configure.py - # to avoid counting .comm/.lcomm as decompiled - asm_objs = [] - for lib in LIBS: - for obj in lib["objects"]: - is_asm = False - obj_name = None - if type(obj) is list: - obj_name = obj[0] - is_asm = not obj[1] - else: - obj_name = obj - is_asm = True - if is_asm: - name = obj_name.split('/')[-1] - asm_objs.append(f"{name}.o") - # Sum up DOL section sizes dol_handle = open(args.dol, "rb") @@ -194,7 +175,7 @@ if __name__ == "__main__": # Has the object file changed? last_object = cur_object cur_object = match_obj.group("Object").strip() - if last_object != cur_object or cur_object in asm_objs: continue + if last_object != cur_object or cur_object.endswith(" (asm)"): continue # Is the symbol a file-wide section? symb = match_obj.group("Symbol") if (symb.startswith("*fill*")) or (symb.startswith(".") and symb[1:] in TEXT_SECTIONS or symb[1:] in DATA_SECTIONS): continue