Bug#909778: libsdl2-dev: SDL_config.h no longer in cflags provided by pkg-config/sdl2-config

Simon McVittie smcv at debian.org
Sat Sep 29 16:25:26 BST 2018


On Sat, 29 Sep 2018 at 14:50:09 +0000, Hugh McMaster wrote:
> > The minimal fix for that problem would be to add a dependency on 
> > pkg-config to libsdl2-dev, and then do
> >     --cflags)
> > -      echo -I at includedir@/SDL2 @SDL_CFLAGS@
> > +      pkg-config --cflags sdl2
> >       ;;
> 
> I’m not able to check right now, but I believe this will cause
> problems when libsdl2-dev is installed for a foreign architecture,
> because sdl2-config will call pkg-config for the native architecture
> instead. It would need to be qualified with the GNU triplet.

Yes, that's why I didn't suggest this. For packages that (at least
sometimes) use a foo-config script found in PATH, there's no general
way to make the foo-config script produce different output for each
architecture, other than perhaps something like Hugh's trick with $CC.
As a result, I was looking for ways to make that constant output work
with multiarch.

I think the constraints are:

* /usr/bin/sdl2-config must contain the same bytes on all architectures
  (because if it didn't, libsdl2-dev couldn't be Multi-Arch: foreign)

* some header (the "config header") must contain everything that's in
  upstream's SDL_config.h, which varies by architecture (because other
  SDL headers need that)

* when compiling with `sdl2-config --cflags` or `pkg-config --cflags SDL2`,
  #include "SDL_config.h" from a different SDL2 header must result in
  the config header being included (because they do this)

* (maybe) when compiling with `sdl2-config --cflags` or
  `pkg-config --cflags SDL2`, #include <SDL_config.h> must result in the
   config header being included (because apps/games might do this)

* when *not* compiling with `sdl2-config --cflags` or
  `pkg-config --cflags SDL2`, #include <SDL_config.h> should not find the
  config header (because if it did, we would break SDL 1)

* when cross-compiling, either `sdl2-config --cflags` or
  `pkg-config --cflags SDL2` must result in us finding the config header
  for the host architecture, not the build architecture
  (I'm using Autotools/Meson terminology here)

Are there others?

On Fri, 28 Sep 2018 at 12:47:28 +0000, Hugh McMaster wrote:
> On Friday, 28 September 2018 5:09 PM, Simon McVittie wrote:
> > Here is a possible solution that I think respects all the constraints,
> > although I have not tested it:
> > 
> > * move SDL_config.h to /usr/include/<triplet>/SDL2/_real_SDL_config.h
> >   or similar (so that it has the same level of parallel-installability
> >   as SDL2 itself, and is clearly not part of the SDL API)
> >
> > * create /usr/include/SDL2/SDL_config.h containing:
> >
> >  /* Debian-specific, for multiarch support */
> >  #include <SDL2/_real_sdl_config.h>
> 
> This is a interesting idea, but sounds messy due to the long list of 
> #defines I expect it may need. Still, I'd like to see this to learn more.

I don't mean that /usr/include/SDL2/SDL_config.h would contain any
#defines at all; I mean that it would be literally one comment and one
#include (of a file that cpp will find in an architecture-dependent
location on its default include path, which can therefore have
architecture-dependent contents).

    smcv



More information about the Pkg-sdl-maintainers mailing list