We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5085 - pkg-config file suboptimal when SDL built with --disable-shared or -DSDL_SHARED=no
Summary: pkg-config file suboptimal when SDL built with --disable-shared or -DSDL_SHAR...
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: build (show other bugs)
Version: HG 2.1
Hardware: x86_64 Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-12 12:37 UTC by James Le Cuirot
Modified: 2020-04-13 15:11 UTC (History)
0 users

See Also:


Attachments
build: Merge pkg-config Libs.private into Libs for static-only builds (5.05 KB, patch)
2020-04-12 12:37 UTC, James Le Cuirot
Details | Diff
build: Don't duplicate Libs in Libs.private in pkg-config file (2.07 KB, patch)
2020-04-12 12:38 UTC, James Le Cuirot
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description James Le Cuirot 2020-04-12 12:37:15 UTC
Created attachment 4301 [details]
build: Merge pkg-config Libs.private into Libs for static-only builds

A project being built entirely statically will call pkg-config with --static, which utilises the Libs.private field. Conversely it will not use --static when not being built entirely statically, even if there is only a static build of SDL available. This will most likely cause the build to fail due to underlinking unless we merge the Libs fields.

This is what the Meson build system does when it generates pkg-config files. This also also follows the behaviour of sdl2-config.

At the same time, the runtime linker flags are not applicable to static-only builds so only add them for shared builds.
Comment 1 James Le Cuirot 2020-04-12 12:38:22 UTC
Created attachment 4302 [details]
build: Don't duplicate Libs in Libs.private in pkg-config file

A second closely-related patch:

pkg-config already prepends Libs to Libs.private when you specify --static so there's no need to duplicate them. Most other projects don't do this.
Comment 2 Sam Lantinga 2020-04-13 15:11:24 UTC
These patches are in, thanks!
https://hg.libsdl.org/SDL/rev/89a457159af4
https://hg.libsdl.org/SDL/rev/fc03d19926ed