diff options
| author | Michael Williamson <mike@zwobble.org> | 2024-03-19 16:56:46 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2024-03-19 17:05:57 +0000 |
| commit | 0908a609fc1ad35308796b0bad1e05d37bfdb331 (patch) | |
| tree | b949dd00ee0e2228862fce6fd3aacaa35be2a858 /runtime | |
| parent | 1807d79af7cc070212d1cb307454bbcc6e132905 (diff) | |
Use Python script to build runtime
Diffstat (limited to 'runtime')
| -rw-r--r-- | runtime/build.py | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/runtime/build.py b/runtime/build.py new file mode 100644 index 00000000..bd55dbf4 --- /dev/null +++ b/runtime/build.py @@ -0,0 +1,57 @@ +import dataclasses +import os +from pathlib import Path +import subprocess + + +@dataclasses.dataclass(frozen=True) +class Target: + name: str + requires_sizeof_jmp_buf: bool + + +targets = [ + Target( + name="amd64", + requires_sizeof_jmp_buf=True, + ), + Target( + name="i686", + requires_sizeof_jmp_buf=True, + ), + Target( + name="wasm32", + requires_sizeof_jmp_buf=False, + ), + Target( + name="wasm64", + requires_sizeof_jmp_buf=False, + ), +] + + +gcs = ["mark-and-sweep"] + + +def main(): + os.chdir(Path(__file__).parent) + + for target in targets: + for gc in gcs: + target_dir = Path("target") / target.name / gc + + setup_command = ["meson", "setup", target_dir, "--werror", f"-Dgc={gc}"] + if target.name != "amd64": + setup_command += ["--cross-file", f"{target.name}.meson"] + subprocess.check_call(setup_command) + + subprocess.check_call(["meson", "compile", "--verbose"], cwd=target_dir) + + if target.requires_sizeof_jmp_buf: + sizeof_jmp_buf = subprocess.check_output([Path("target") / target.name / gcs[0] / "sizeof_jmp_buf"]) + with open(Path("target") / target.name / "sizeof_jmp_buf.txt", "wb") as fileobj: + fileobj.write(sizeof_jmp_buf) + + +if __name__ == "__main__": + main() |
