PS2 homebrew toolchain build scripts (EE/IOP/DVP)
  • Shell 58.5%
  • PowerShell 23.7%
  • Dockerfile 15%
  • Batchfile 2.8%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Simon Hochrein 2eb5c010a5
All checks were successful
Release / build-windows-native (push) Successful in 7m35s
Build / build-windows-native (push) Successful in 7m37s
Release / build-native-linux (push) Successful in 41m30s
Build / build-native-linux (push) Successful in 41m45s
Build / sanity-check-linux (push) Successful in 11s
Release / package-linux (push) Successful in 1m4s
Release / build-windows-cross (push) Successful in 35m1s
Build / build-windows-cross (push) Successful in 35m53s
Release / package-windows (push) Successful in 1m6s
Build / sanity-check-windows-cross (push) Successful in 19s
Add native macOS support to the ee/iop/dvp toolchain builds
Skip the -static host LDFLAGS (lib/common.sh) and the CMake
-static/-static-libgcc/-static-libstdc++ linker flags (dvp's masp/
openvcl steps) on Darwin - Apple's linker has no static libSystem to
link against, and Apple Clang hard-errors on -static-libgcc alone.
Also silence a Clang-21-only -Werror=tautological-compare in
binutils' readelf.c, only reachable via EE's 64-bit ELF path.

Verified with real builds on Apple Silicon: EE (C and C++), IOP, and
DVP (masp/openvcl) all build and produce working cross-compilers/
tools. Documented the macOS build path (prerequisites, invocation,
and why these differ from Linux/Windows) in README.md.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-09-27 13:53:50 -05:00
.forgejo/workflows Drop dvp-as/binutils build step - now the Go tool in ps2/tools 2026-09-27 13:13:09 -05:00
docker Drop dvp-as/binutils build step - now the Go tool in ps2/tools 2026-09-27 13:13:09 -05:00
dvp Add native macOS support to the ee/iop/dvp toolchain builds 2026-09-27 13:53:50 -05:00
ee Add native macOS support to the ee/iop/dvp toolchain builds 2026-09-27 13:53:50 -05:00
iop Canadian-cross IOP, and restructure CI to build ee/iop/dvp-binutils on Linux 2026-09-09 16:18:49 -05:00
lib Add native macOS support to the ee/iop/dvp toolchain builds 2026-09-27 13:53:50 -05:00
.dockerignore Fix and commit the Linux (Docker) toolchain build - was uncommitted, sketchy WIP 2026-09-06 17:32:11 -05:00
.gitignore Fix and commit the Linux (Docker) toolchain build - was uncommitted, sketchy WIP 2026-09-06 17:32:11 -05:00
build-all.bat Initial commit: PS2 toolchain build scripts 2026-08-24 15:00:14 -05:00
build-dvp.bat Consolidate all build output under one gitignored build/ folder 2026-08-24 15:15:09 -05:00
build-ee.bat Consolidate all build output under one gitignored build/ folder 2026-08-24 15:15:09 -05:00
build-iop.bat Consolidate all build output under one gitignored build/ folder 2026-08-24 15:15:09 -05:00
install-msys2.ps1 Disable pacman signature verification instead of killing gpg-agent 2026-09-08 19:53:49 -05:00
LICENSE Add license 2026-08-24 15:20:15 -05:00
README.md Add native macOS support to the ee/iop/dvp toolchain builds 2026-09-27 13:53:50 -05:00
release-sdk.ps1 release-sdk.ps1: write per-target .clangd into the installed ps2sdk tree 2026-08-24 19:49:56 -05:00
release-toolchain-linux.sh Fix CI: script wasn't executable, invoke via bash regardless 2026-09-06 17:36:14 -05:00
release-toolchain.ps1 Drop dvp-as/binutils build step - now the Go tool in ps2/tools 2026-09-27 13:13:09 -05:00

ps2toolchain

Builds the PS2 homebrew toolchain (EE, IOP, and DVP cross-compilers/ binutils) on Windows, Linux, and macOS. Windows uses a portable MSYS2 install - no system installer, no manual PATH setup; Linux and macOS build natively (see "Building for Linux"/"Building for macOS" below).

Setup (Windows)

powershell -ExecutionPolicy Bypass -File install-msys2.ps1

Downloads a portable MSYS2 into .\build\msys2 inside this repo and installs the packages the build needs.

Build (Windows)

build-all.bat

Builds DVP, then IOP, then EE, into .\build\toolchain. Or build one target at a time with build-ee.bat, build-iop.bat, build-dvp.bat.

Everything the build generates - MSYS2, cloned sources, build trees, the installed toolchain itself - lives under build\ in this repo and nowhere else. It's gitignored; delete it any time to start clean.

Each target's build.sh fetches every source repo it needs up front, before building anything, so a network problem or a bad ref fails fast instead of surfacing after an earlier stage has already spent minutes compiling. It also accepts specific step numbers, to re-run just one stage without repeating the whole thing - e.g. from inside an MSYS2 shell: cd ee && ./build.sh 3 re-runs only the newlib step.

Building for Linux

./release-toolchain-linux.sh

Builds inside Docker (needs Docker installed) into build/release/ - see docker/README.md for how the image works and why the output isn't tied to a particular distro despite being built inside one.

Building for macOS

Native build, no Docker/VM - ee, iop, and dvp's own build.sh already run directly under macOS's own bash, the same way they do on Linux.

Prerequisites (Apple Silicon and Intel both work):

xcode-select --install
brew install gmp mpfr libmpc gnu-sed texinfo

gmp/mpfr/libmpc are GCC's own numeric-library build deps (Apple doesn't ship these); gnu-sed is needed because GCC's build assumes GNU sed's flags and macOS ships BSD sed under that name; texinfo provides makeinfo, which check_dependencies (lib/common.sh) requires. All four are picked up automatically once installed - macos_extra_configure_opts (lib/common.sh) finds them via brew --prefix.

Then build each target the same way as on Linux:

PS2DEV="$(pwd)/build/toolchain" bash ee/build.sh
PS2DEV="$(pwd)/build/toolchain" bash iop/build.sh
PS2DEV="$(pwd)/build/toolchain" bash dvp/build.sh

A few things behave differently on macOS than on Linux/Windows, all handled automatically:

  • The host tools this build produces are not statically linked (lib/common.sh's prepare_build_env skips -static here) - Apple's linker has no static libSystem to link a whole executable against. A macOS-built toolchain instead dynamically links against the Homebrew gmp/mpfr/libmpc installed above, so keep those installed on any machine that runs it.
  • dvp/steps/01-masp.sh/02-openvcl.sh (CMake) drop -static/-static-libgcc/-static-libstdc++ entirely on macOS - Apple Clang hard-errors on -static-libgcc alone and can't link -static at all.

Layout

lib/common.sh    - shared helpers (source fetching, host env setup)
ee/              - EE (Emotion Engine) toolchain: binutils + 2-stage GCC/newlib
iop/             - IOP (I/O Processor) toolchain: vanilla binutils + GCC
dvp/             - DVP (Vector Unit) toolchain: masp + openvcl (dvp-as is the Go tool in ps2/tools)
docker/          - Dockerfiles + design notes for the Linux build
build/           - gitignored - everything generated: msys2/, toolchain/ (install prefix), ee/, iop/, dvp/ (source + build trees), release/

Each target directory has its own config.sh (source repo/ref pins) and build.sh (orchestrates steps/*.sh in order).

License

This repo's own code is public domain (CC0 1.0 - see LICENSE) and build multiple projects. See each project's own repo for its license terms.