Build static libs by default; update progress.py

This commit is contained in:
Luke Street 2022-12-14 21:17:16 -05:00
parent 6fc09e2bb9
commit cb8d5b0bfe
3 changed files with 19 additions and 30 deletions

View File

@ -1064,10 +1064,10 @@ if __name__ == "__main__":
help="don't check hash of resulting dol", help="don't check hash of resulting dol",
) )
parser.add_argument( parser.add_argument(
"--static-libs", "--no-static-libs",
dest="static_libs", dest="static_libs",
action="store_true", action="store_false",
help="build and use static libs", help="don't build and use static libs",
) )
parser.add_argument( parser.add_argument(
"--devkitppc", "--devkitppc",
@ -1202,7 +1202,9 @@ if __name__ == "__main__":
n.comment("Assemble asm") n.comment("Assemble asm")
n.rule( n.rule(
name="as", 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", description="AS $out",
depfile="$out.d", depfile="$out.d",
deps="gcc", deps="gcc",
@ -1211,8 +1213,10 @@ if __name__ == "__main__":
n.comment("Create static library") n.comment("Create static library")
n.rule( n.rule(
name="ar", name="ar",
command="$devkitppc\\bin\\powerpc-eabi-ar.exe crs $out $in", command="$dtk ar create $out @$out.rsp",
description="AR $out", description="AR $out",
rspfile="$out.rsp",
rspfile_content="$in_newline",
) )
n.newline() n.newline()
else: else:
@ -1243,7 +1247,7 @@ if __name__ == "__main__":
command="${wine}tools/mwcc_compiler/$mwcc_version/mwldeppc.exe $ldflags -o $out @$out.rsp", command="${wine}tools/mwcc_compiler/$mwcc_version/mwldeppc.exe $ldflags -o $out @$out.rsp",
description="LINK $out", description="LINK $out",
rspfile="$out.rsp", rspfile="$out.rsp",
rspfile_content="$in", rspfile_content="$in_newline",
) )
n.newline() n.newline()
n.comment("Assemble asm") n.comment("Assemble asm")
@ -1259,8 +1263,10 @@ if __name__ == "__main__":
n.comment("Create static library") n.comment("Create static library")
n.rule( n.rule(
name="ar", name="ar",
command="$devkitppc/bin/powerpc-eabi-ar crs $out $in", command="$dtk ar create $out @$out.rsp",
description="AR $out", description="AR $out",
rspfile="$out.rsp",
rspfile_content="$in_newline",
) )
n.newline() n.newline()
n.comment("Host build") n.comment("Host build")
@ -1394,6 +1400,7 @@ if __name__ == "__main__":
outputs=f"$builddir/lib/{lib_name}.a", outputs=f"$builddir/lib/{lib_name}.a",
rule="ar", rule="ar",
inputs=inputs, inputs=inputs,
implicit="$dtk",
) )
n.newline() n.newline()
@ -1506,6 +1513,7 @@ if __name__ == "__main__":
outputs="$builddir/main.dol.progress", outputs="$builddir/main.dol.progress",
rule="progress", rule="progress",
inputs=["$builddir/main.dol", "$builddir/MetroidPrime.MAP"], inputs=["$builddir/main.dol", "$builddir/MetroidPrime.MAP"],
implicit="progress.py",
) )
n.newline() n.newline()

View File

@ -1 +1 @@
v0.2.1 v0.2.2

View File

@ -27,8 +27,6 @@ import math
import argparse import argparse
import json import json
from configure import LIBS
############################################### ###############################################
# # # #
# Constants # # Constants #
@ -45,7 +43,7 @@ r"(?P<VirtOfs>\w{8})\s+"\
r"(?P<FileOfs>\w{8})\s+"\ r"(?P<FileOfs>\w{8})\s+"\
r"(\w{1,2})\s+"\ r"(\w{1,2})\s+"\
r"(?P<Symbol>[0-9A-Za-z_<>$@.*]*)\s*"\ r"(?P<Symbol>[0-9A-Za-z_<>$@.*]*)\s*"\
r"(?P<Object>\S*)" r"(?P<Object>[\S ]*)"
MW_GC_SYMBOL_REGEX = r"^\s*"\ MW_GC_SYMBOL_REGEX = r"^\s*"\
r"(?P<SectOfs>\w{8})\s+"\ r"(?P<SectOfs>\w{8})\s+"\
@ -53,7 +51,7 @@ r"(?P<Size>\w{6})\s+"\
r"(?P<VirtOfs>\w{8})\s+"\ r"(?P<VirtOfs>\w{8})\s+"\
r"(\w{1,2})\s+"\ r"(\w{1,2})\s+"\
r"(?P<Symbol>[0-9A-Za-z_<>$@.*]*)\s*"\ r"(?P<Symbol>[0-9A-Za-z_<>$@.*]*)\s*"\
r"(?P<Object>\S*)" r"(?P<Object>[\S ]*)"
REGEX_TO_USE = MW_GC_SYMBOL_REGEX REGEX_TO_USE = MW_GC_SYMBOL_REGEX
@ -90,23 +88,6 @@ if __name__ == "__main__":
parser.add_argument("-o", "--output", help="JSON output file") parser.add_argument("-o", "--output", help="JSON output file")
args = parser.parse_args() 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 # Sum up DOL section sizes
dol_handle = open(args.dol, "rb") dol_handle = open(args.dol, "rb")
@ -194,7 +175,7 @@ if __name__ == "__main__":
# Has the object file changed? # Has the object file changed?
last_object = cur_object last_object = cur_object
cur_object = match_obj.group("Object").strip() 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? # Is the symbol a file-wide section?
symb = match_obj.group("Symbol") 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 if (symb.startswith("*fill*")) or (symb.startswith(".") and symb[1:] in TEXT_SECTIONS or symb[1:] in DATA_SECTIONS): continue