Be Multi-Arch: same by asking ${PKG_CONFIG} for its CFLAGS
This is one of several possible solutions to #909740. It includes !2 (merged).
Alternatives include !3 (merged) and !4 (closed).
-
libsdl2-dev:amd64 and libsdl2-dev:i386 are co-installable -
the debian/tests/build autopkgtest passes -
the debian/tests/cmake autopkgtest passes -
x86_64-linux-gnu-pkg-config --cflags --libs sdl2 has reasonable results (-D_REENTRANT -I/usr/include/x86_64-linux-gnu/SDL2 -lSDL2) -
i686-linux-gnu-pkg-config --cflags --libs sdl2 has reasonable results (-D_REENTRANT -I/usr/include/i386-linux-gnu/SDL2 -lSDL2) -
sdl2-config --cflags --libs has reasonable results (-D_REENTRANT -I/usr/include/x86_64-linux-gnu/SDL2 -lSDL2) -
"CC=i686-linux-gnu-gcc PKG_CONFIG=i686-linux-gnu-pkg-config
sdl2-config --cflags --libs" has reasonable results (-D_REENTRANT -I/usr/include/i386-linux-gnu/SDL2 -lSDL2) -
"CC='gcc -m32' PKG_CONFIG=i686-linux-gnu-pkg-config
sdl2-config --cflags --libs" has reasonable results (-D_REENTRANT -I/usr/include/i386-linux-gnu/SDL2 -lSDL2)
Advantages:
- Follows a pattern that is familiar from other packages, with no weird forwarding header.
- sdl2-config is always consistent with pkg-config.
- no-libdir.patch can be dropped.
- Works for any compiler whose default search path works with Debian's libc6-dev.
Disadvantages:
- We still have to patch sdl2-config a bit.
- If you're using something like "meson --native-file=..." to specify your C compiler and pkg-config, you'll still have to set $PKG_CONFIG even though your build system doesn't use it.
Edited by Felix Geyer