SDL2 Porting guide?

But, out of curiosity: What would I need to do to port SDL2 to other platforms? For instance, take the PS3:

I could have sworn someone did a homebrew PS3 port at some point, but I could be wrong.

I wrote this about porting SDL to new platforms: Port SDL 2.0 to BIOS - #2 by icculus

and, making sure that it does not interfere with the mainstream builds too much?

So we do this for the official console ports: we forked SDL into separate (private) repositories, did the various console ports there, and then as new SDL releases are done, we merge the main repo into the private ones. Since it’s git, it’s a literal merge: the two branches become one until more development is done instead of us manually gluing everything back together.

People with NDAs in place with the various console makers can be given access to the specific repositories they need. Each console port is in a separate repo, so if you just need, say, Switch and Stadia, you can get it without having to worry if you have a Sony NDA in place.

There are usually a handful of small places we have to resolve conflicts (there’s a list of #ifdefs for various audio drivers, inevitably one gets added in the new release to the same place the console’s driver is listed, etc), but overall, the merge isn’t difficult. At that point, we just have to implement new APIs that were added since the last merge, if it makes sense to do so.

And for the most part we try to keep the headers portable, so a project that has to target multiple consoles can just use the same public headers across all of them, even if they might need to build SDL from different forks for different targets, so they can theoretically compile for all their targets with the same headers and link a different, prebuilt SDL library for each platform.