-
-
Notifications
You must be signed in to change notification settings - Fork 198
Description
Issue №3429 opened by smcv at 2022-08-26 08:34:53
I see that config_unix.py
uses sdl2-config
to detect SDL 2.
Using package-specific -config
programs on Unix is increasingly discouraged, because they're difficult to deal with when cross-compiling, and tend to be inconsistent between libraries. The replacement is to use pkg-config or a reimplementation of the same interface (like pkgconf). pygame already does this for freetype, with a fallback to freetype-config.
In SDL's case, the direct equivalent of sdl2-config --cflags --libs
is pkg-config sdl2 --cflags --libs
, which reads information from sdl2.pc
. SDL 3 will probably remove sdl*-config
, so that pkg-config sdl3
will be the only way to get this information.
If the PKG_CONFIG
environment variable is set, please use that in preference to hard-coding pkg-config
, something like this:
os.getenv('PKG_CONFIG', 'pkg-config') + ' sdl2'
(This is because people who use a reimplementation of the reference pkg-config or a cross-compiler often rely on being able to set $PKG_CONFIG
to point to it.)
Comments
# # smcv commented at 2022-08-26 08:36:32
SDL 2.0.0 already had sdl2.pc
, so a fallback to sdl2-config
is probably not necessary.
# # robertpfeiffer commented at 2022-08-26 13:10:17
We can do this. We should probably keep sdl2-config in as a fallback until it's no longer shipped by SDL though.
# # smcv commented at 2022-08-26 13:59:15
We should probably keep sdl2-config in as a fallback until it's no longer shipped by SDL though
I don't think that's necessary, but if you want to, the same logic as for freetype looks reasonable.