Hacker News new | ask | show | jobs
by aepiepaey 2392 days ago
Instead of patching the source, the Makefile should be patched to use sdl2-config to set LDFLAGS and CFLAGS (instead of hard-coding them), i.e:

    CFLAGS := [other flags...] $(shell sdl2-config --cflags)
    LDFLAGS := [other flags...] $(shell sdl2-config --libs)
That will set the correct compiler and linker flags for you installation, and you can leave the include as just "SDL.h".
1 comments

Clever, I didn't know that sdl2-config was a thing.
It may be clever, but short-sighted. It creates complexity for distro builds. sdl2-config has to be compiled for the host machine, and get installed in a build-time toolchain sysroot, and when invoked produce parameters for compiling for the target machine/sysroot. The correct sdl2-config built by the distro build has to be invoked; it must not be one that is locally installed in the build machine's /usr/bin.

Imagine if every package with headers and libs had its' own "<package>-config" program! That would be a huge problem, which is why there is one program called package-config, to which packages or build systems just contribute blurbs of info in .pc files.

Agreed, but still, it is something I didn't know about and I'm always impressed by the encyclopedic knowledge of HN about such arcane subjects. For similar reasons I listed a bunch of 'mv' commands because they will always work rather than the optional 'rename' package which would make it a one liner but less universal.