Add clang 8.0.0 and Super Mario 3D World + Bowser's Fury preset (#704)

This commit is contained in:
Fruityloops
2023-03-18 14:40:31 +00:00
committed by GitHub
parent 1815458bfa
commit f13990daf2
3 changed files with 54 additions and 15 deletions

View File

@@ -19,7 +19,6 @@ from tqdm import tqdm
class OS:
name: str
system: str
clang_package_name: str
n64_gcc_os: str
ido_pkg: str
@@ -27,14 +26,12 @@ class OS:
MACOS = OS(
name="MacOS",
system="darwin",
clang_package_name="apple-darwin",
n64_gcc_os="mac",
ido_pkg="macos-latest",
)
LINUX = OS(
name="Linux",
system="linux",
clang_package_name="linux-gnu-debian8",
n64_gcc_os="linux",
ido_pkg="ubuntu-20.04",
)
@@ -280,40 +277,69 @@ def download_switch():
def dest_for_version(version: str) -> Path:
return COMPILERS_DIR / f"clang-{version}"
versions = ["4.0.1", "3.9.1"]
@dataclass
class Version:
version_str: str
clang_package_name: str
clang_package_name_macos: str
versions = [
Version(
version_str="4.0.1",
clang_package_name="linux-gnu-debian8",
clang_package_name_macos="apple-darwin",
),
Version(
version_str="3.9.1",
clang_package_name="linux-gnu-debian8",
clang_package_name_macos="none",
),
Version(
version_str="8.0.0",
clang_package_name="linux-gnu-ubuntu-18.04",
clang_package_name_macos="apple-darwin",
),
]
# 3.9.1 isn't available for mac
mac_versions = versions.copy()
mac_versions.remove("3.9.1")
mac_versions.pop(1)
botw_lib_musl_versions = ["4.0.1", "3.9.1"]
botw_lib_musl_versions = ["4.0.1", "3.9.1", "8.0.0"]
# Download and extract the compilers
for version in versions:
if host_os == MACOS and version not in mac_versions:
version_str = version.version_str
if host_os == MACOS and version_str not in mac_versions:
continue
log_name = f"clang {version}"
dest_dir = dest_for_version(version)
log_name = f"clang {version_str}"
dest_dir = dest_for_version(version_str)
if dest_dir.exists():
print(f"{log_name} already exists, skipping")
continue
package_name = f"clang+llvm-{version}-x86_64-{host_os.clang_package_name}"
url = f"https://releases.llvm.org/{version}/{package_name}.tar.xz"
clang_package_name = (
version.clang_package_name_macos
if host_os == MACOS
else version.clang_package_name
)
package_name = f"clang+llvm-{version_str}-x86_64-{clang_package_name}"
url = f"https://releases.llvm.org/{version_str}/{package_name}.tar.xz"
download_tar(url=url, mode="r:xz", log_name=log_name, create_subdir=False)
# Somehow the MacOS tar extracts to a directory with a different name, so we have to find it again
if host_os == MACOS:
package_name = next(
COMPILERS_DIR.glob(f"clang+llvm-{version}-x86_64-*" + os.path.sep)
COMPILERS_DIR.glob(f"clang+llvm-{version_str}-x86_64-*" + os.path.sep)
).name
shutil.move(COMPILERS_DIR / package_name, dest_dir)
# 3.9.1 requires ld.lld and doesn't have it, so we copy it from 4.0.1
if version == "3.9.1":
if version_str == "3.9.1":
shutil.copy(
dest_for_version("4.0.1") / "bin/ld.lld", dest_dir / "bin/ld.lld"
)
@@ -325,8 +351,8 @@ def download_switch():
)
musl_name = "botw-lib-musl-25ed8669943bee65a650700d340e451eda2a26ba"
musl_dest = COMPILERS_DIR / musl_name
for version in botw_lib_musl_versions:
ver_dest = dest_for_version(version)
for version_str in botw_lib_musl_versions:
ver_dest = dest_for_version(version_str)
if ver_dest.exists():
shutil.copytree(musl_dest, ver_dest / musl_name, dirs_exist_ok=True)
shutil.rmtree(musl_dest)

View File

@@ -275,6 +275,12 @@ CLANG_401 = ClangCompiler(
cc='TOOLROOT="$COMPILER_DIR" "$COMPILER_DIR"/bin/clang++ -target aarch64-linux-elf --sysroot="$COMPILER_DIR"/botw-lib-musl-25ed8669943bee65a650700d340e451eda2a26ba -fuse-ld=lld -mcpu=cortex-a57+fp+simd+crypto+crc -mno-implicit-float -fstandalone-debug -fPIC -Wl,-Bsymbolic-functions -shared -stdlib=libc++ -nostdlib $COMPILER_FLAGS -o "$OUTPUT" "$INPUT"',
)
CLANG_800 = ClangCompiler(
id="clang-8.0.0",
platform=SWITCH,
cc='TOOLROOT="$COMPILER_DIR" "$COMPILER_DIR"/bin/clang++ -target aarch64-linux-elf --sysroot="$COMPILER_DIR"/botw-lib-musl-25ed8669943bee65a650700d340e451eda2a26ba -fuse-ld=lld -mcpu=cortex-a57+fp+simd+crypto+crc -mno-implicit-float -fstandalone-debug -fPIC -Wl,-Bsymbolic-functions -shared -stdlib=libc++ -nostdlib $COMPILER_FLAGS -o "$OUTPUT" "$INPUT"',
)
# PS1
PSYQ_MSDOS_CC = (
'cpp -P "$INPUT" | unix2dos > object.oc && cp ${COMPILER_DIR}/* . && '
@@ -836,6 +842,7 @@ _all_compilers: List[Compiler] = [
# Switch
CLANG_391,
CLANG_401,
CLANG_800,
# PS1
PSYQ35,
PSYQ36,
@@ -992,6 +999,11 @@ _all_presets = [
CLANG_401,
"-x c++ -O3 -g2 -std=c++1z -fno-rtti -fno-exceptions -Wall -Wextra -Wdeprecated -Wno-unused-parameter -Wno-unused-private-field -fno-strict-aliasing -Wno-invalid-offsetof -D SWITCH -D NNSDK -D MATCHING_HACK_NX_CLANG",
),
Preset(
"Super Mario 3D World + Bowser's Fury",
CLANG_800,
"-x c++ -O3 -g2 -std=c++17 -fno-rtti -fno-exceptions -Wall -Wextra -Wdeprecated -Wno-unused-parameter -Wno-unused-private-field -fno-strict-aliasing -Wno-invalid-offsetof -D SWITCH -D NNSDK -D MATCHING_HACK_NX_CLANG",
),
# PS1
Preset(
"Castlevania: Symphony of the Night",

View File

@@ -13,6 +13,7 @@
"armcc_504_82": "5.04 build 82",
"clang-3.9.1": "Clang 3.9.1",
"clang-4.0.1": "Clang 4.0.1",
"clang-8.0.0": "Clang 8.0.0",
"dummy": "Dummy",
"ee-gcc2.9-990721": "EE GCC 2.9 build 990721",
"ee-gcc2.9-991111": "EE GCC 2.9 build 991111",