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.
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:
we have libc (glibc, in Debian's case) and all Standard C and POSIX headers and functions
we have all features that are available on any reasonable Unix, like SDL_TIMER_UNIX, SDL_VIDEO_DRIVER_X11 and HAVE_DBUS_DBUS_H
we have Linux-specific functionality like ALSA if and only if defined(__linux__) (all official Debian ports are Linux, but there are kFreeBSD and Hurd versions maintained by other-kernel enthusiasts)
we have Wayland and a modern version of libdecor if and only if defined(__linux__) (in principle Wayland should be implementable anywhere, but in Debian's ports, in practice we only have it on Linux)
we have x86 intrinsics if and only if targeting x86
we have a basic set of "normal" audio, input, etc. drivers for the platform
all dlopen'd libraries have their conventional SONAME for the platform (although we could perhaps simplify this into pretending that all libraries are linked with DT_NEEDED rather than dlopen'd, even if in reality they are dlopen'd)
Can we perhaps generalize that into a SDL_config_unix.h that is analogous to SDL_config_windows.h, but with more #ifdef?
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 asHAVE_MEMSET
andSDL_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:
SDL_TIMER_UNIX
,SDL_VIDEO_DRIVER_X11
andHAVE_DBUS_DBUS_H
defined(__linux__)
(all official Debian ports are Linux, but there are kFreeBSD and Hurd versions maintained by other-kernel enthusiasts)defined(__linux__)
(in principle Wayland should be implementable anywhere, but in Debian's ports, in practice we only have it on Linux)Can we perhaps generalize that into a
SDL_config_unix.h
that is analogous toSDL_config_windows.h
, but with more#ifdef
?