libsdl-org / sdl2-compat

An SDL2 compatibility layer that uses SDL3 behind the scenes.
zlib License
77 stars 17 forks source link

Generate or provide a non-minimal SDL_config.h for Unix platforms #229

Open smcv opened 2 days ago

smcv commented 2 days ago

If we want OS distributions (mostly Linux, but also *BSD, Hurd, Haiku, etc.) to eventually replace their SDL2 packages with sdl2-compat, then sdl2-compat's development headers should be as close as is feasible to being a drop-in replacement for "real" SDL2.

Unfortunately, SDL 2 has SDL_config.h as part of its API, defining various symbols that are really implementation details of SDL rather than anything that an application should be relying on, such as HAVE_MEMSET and SDL_AUDIO_DRIVER_ALSA. https://github.com/libsdl-org/sdl12-compat/pull/302, https://github.com/libsdl-org/sdl12-compat/issues/299, https://github.com/libsdl-org/sdl12-compat/issues/297 are examples of places where we needed to make sdl12-compat bug-for-bug compatible with "real" SDL 1.2. I expect that for SDL 2, there should hopefully be less need to do that, but some of it will probably be necessary.

At the moment, in Debian I'm ignoring the SDL_config.h that ships with sdl2-compat, and instead providing a hand-edited header based on the one that Debian's "real SDL2" packaging generates at build-time, which makes some reasonable assumptions about Debian's toolchain, such as:

Can we perhaps generalize that into a SDL_config_unix.h that is analogous to SDL_config_windows.h, but with more #ifdef?

slouken commented 2 days ago

Sure! Feel free to make a PR for this.