Add gcc-mipsel for PS1 (try 2) (#792)

* Revert "Revert "Add gcc-mipsel for PS1" (#790)"

This reverts commit 4e73916f50.

* Update maspsx version in download.py

* Update download.py

---------

Co-authored-by: Mark Street <22226349+mkst@users.noreply.github.com>
This commit is contained in:
Ethan Roseman
2023-07-02 02:29:21 +09:00
committed by GitHub
parent a7ea1dfe23
commit cdf63d3f73
4 changed files with 142 additions and 17 deletions

View File

@@ -161,7 +161,7 @@ def download_zip(
def set_x(file: Path) -> None:
file.chmod(file.stat().st_mode | stat.S_IEXEC)
file.chmod(file.stat().st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
def download_ppc_darwin():
@@ -458,11 +458,7 @@ def download_n64():
dest_path=dest / "psyq-obj-parser",
)
# TODO: upload +x'd version of this
psyq_obj_parser = dest / "psyq-obj-parser"
psyq_obj_parser.chmod(
psyq_obj_parser.stat().st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH
)
set_x(psyq_obj_parser)
set_x(dest / "psyq-obj-parser")
# SN
dest = COMPILERS_DIR / "gcc2.7.2snew"
@@ -507,10 +503,7 @@ def download_n64():
dest_path=dest / "psyq-obj-parser",
)
# NOTE: github strips the +x flag
psyq_obj_parser = dest / "psyq-obj-parser"
psyq_obj_parser.chmod(
psyq_obj_parser.stat().st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH
)
set_x(dest / "psyq-obj-parser")
# iQue
dest = COMPILERS_DIR / "egcs_1.1.2-4"
@@ -590,9 +583,6 @@ def download_ps1():
compilers_path / "psyq",
psyq_obj_parser,
)
psyq_obj_parser.chmod(
psyq_obj_parser.stat().st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH
)
set_x(psyq_obj_parser)
# +x exes
@@ -601,6 +591,76 @@ def download_ps1():
for file in dest.glob("*.EXE"):
set_x(file)
# vanilla gcc + maspsx patch
old_gcc_urls = {
"gcc2.6.3-psx": "https://github.com/decompals/old-gcc/releases/download/0.1/gcc-2.6.3-psx.tar.gz",
"gcc2.6.3": "https://github.com/decompals/old-gcc/releases/download/0.1/gcc-2.6.3.tar.gz",
"gcc2.7.1": "https://github.com/decompals/old-gcc/releases/download/0.1/gcc-2.7.1.tar.gz",
"gcc2.7.2": "https://github.com/decompals/old-gcc/releases/download/0.1/gcc-2.7.2.tar.gz",
"gcc2.7.2.1": "https://github.com/decompals/old-gcc/releases/download/0.1/gcc-2.7.2.1.tar.gz",
"gcc2.7.2.3": "https://github.com/decompals/old-gcc/releases/download/0.1/gcc-2.7.2.3.tar.gz",
"gcc2.8.1": "https://github.com/decompals/old-gcc/releases/download/0.1/gcc-2.8.1.tar.gz",
"gcc2.95.2": "https://github.com/decompals/old-gcc/releases/download/0.1/gcc-2.95.2.tar.gz",
}
old_gcc_ids = {
"gcc2.6.3-psx": "gcc2.6.3-psx",
"gcc2.6.3": "gcc2.6.3-mipsel",
"gcc2.7.1": "gcc2.7.1-mipsel",
"gcc2.7.2": "gcc2.7.2-mipsel",
"gcc2.7.2.1": "gcc2.7.2.1-mipsel",
"gcc2.7.2.3": "gcc2.7.2.3-mipsel",
"gcc2.8.1": "gcc2.8.1-mipsel",
"gcc2.95.2": "gcc2.95.2-mipsel",
}
maspsx_hash = "521eb3a512106a5643f768039da6db9f2a768fa7"
download_zip(
url=f"https://github.com/mkst/maspsx/archive/{maspsx_hash}.zip",
dl_name="maspsx",
dest_name=compilers_path,
create_subdir=True,
)
download_file(
url="https://raw.githubusercontent.com/Decompollaborate/rabbitizer/3d0221687b587497ed60b1cf1f207a873ade7cf9/docs/r3000gte/gte_macros.s",
dest_path=compilers_path / "gte_macros.s",
log_name="gte_macros.s",
)
for gcc_name, url in old_gcc_urls.items():
gcc_id = old_gcc_ids[gcc_name]
gcc_dir = COMPILERS_DIR / f"{gcc_id}"
if gcc_dir.exists():
print(f"{gcc_dir} already exists, skipping download.")
else:
download_tar(
url=url,
dl_name=f"{gcc_name}.tar.gz",
dest_name=f"{gcc_id}",
)
# always copy in maspsx
shutil.copytree(
compilers_path / f"maspsx-{maspsx_hash}",
gcc_dir / "maspsx",
dirs_exist_ok=True,
)
with open(gcc_dir / "as", "w") as f:
f.write("#!/bin/bash\n")
f.write(
"python3 $(dirname -- $0)/maspsx/maspsx.py --run-assembler -I${COMPILER_DIR} $@\n"
)
set_x(gcc_dir / "as")
# always copy in macros
shutil.copy(
compilers_path / "gte_macros.s",
gcc_dir,
)
with open(gcc_dir / "macro.inc", "w") as f:
f.write('.include "gte_macros.s"\n')
shutil.rmtree(compilers_path)
@@ -823,7 +883,7 @@ def download_3ds():
# Set +x to allow WSL without wine
exe_path = compiler_dir / "bin/armcc.exe"
exe_path.chmod(exe_path.stat().st_mode | stat.S_IEXEC)
set_x(exe_path)
shutil.rmtree(COMPILERS_DIR / group_id)

View File

@@ -332,6 +332,59 @@ PSYQ46 = GCCPS1Compiler(
cc=PSYQ_CC,
)
PS1_GCC = (
'cpp -E -lang-c -nostdinc "${INPUT}" -o "${INPUT}".i && '
'${COMPILER_DIR}/gcc -c -pipe -B${COMPILER_DIR}/ ${COMPILER_FLAGS} -o "${OUTPUT}" "${INPUT}.i"'
)
GCC263_PSX = GCCPS1Compiler(
id="gcc2.6.3-psx",
platform=PS1,
cc=PS1_GCC,
)
GCC263_MIPSEL = GCCPS1Compiler(
id="gcc2.6.3-mipsel",
platform=PS1,
cc=PS1_GCC,
)
GCC271_MIPSEL = GCCPS1Compiler(
id="gcc2.7.1-mipsel",
platform=PS1,
cc=PS1_GCC,
)
GCC2672MIPSEL = GCCPS1Compiler(
id="gcc2.7.2-mipsel",
platform=PS1,
cc=PS1_GCC,
)
GCC2721_MIPSEL = GCCPS1Compiler(
id="gcc2.7.2.1-mipsel",
platform=PS1,
cc=PS1_GCC,
)
GCC2723_MIPSEL = GCCPS1Compiler(
id="gcc2.7.2.3-mipsel",
platform=PS1,
cc=PS1_GCC,
)
GCC281_MIPSEL = GCCPS1Compiler(
id="gcc2.8.1-mipsel",
platform=PS1,
cc=PS1_GCC,
)
GCC2952_MIPSEL = GCCPS1Compiler(
id="gcc2.95.2-mipsel",
platform=PS1,
cc=PS1_GCC,
)
# Saturn
SATURN_CC = (
'cat "$INPUT" | unix2dos > dos_src.c && '
@@ -925,6 +978,14 @@ _all_compilers: List[Compiler] = [
PSYQ43,
PSYQ45,
PSYQ46,
GCC263_PSX,
GCC263_MIPSEL,
GCC271_MIPSEL,
GCC2672MIPSEL,
GCC2721_MIPSEL,
GCC2723_MIPSEL,
GCC281_MIPSEL,
GCC2952_MIPSEL,
# Saturn
CYGNUS_2_7_96Q3,
# PS2
@@ -1096,8 +1157,8 @@ _all_presets = [
),
Preset(
"Evo's Space Adventures",
PSYQ46,
"-O2",
GCC2952_MIPSEL,
"-mel -mgpopt -mgpOPT -msoft-float -msplit-addresses -mno-abicalls -fno-builtin -fsigned-char -gcoff -O2 -G8",
),
Preset(
"Legacy of Kain: Soul Reaver",

View File

@@ -226,6 +226,10 @@ PS1 = Platform(
\label:
.endm
.macro move a, b
addu \\a, \\b, $zero
.endm
.set noat
.set noreorder

View File

@@ -1,4 +1,4 @@
FROM node:16 AS build
FROM node:16
WORKDIR /frontend