pkg-config: always pass --static in static builds
By default, pkg-config output will not include Requires.private dependencies (which specify dependencies that only apply when building statically). It will only do this when passed --static. In pkgsStatic, let's ensure pkg-config is always operating in static mode, because pkgsStatic will ensure that any libraries pkg-config might find will always be static, and so will always need their Requires.private dependencies. This is very useful for Meson builds, because otherwise Meson will only pass --static to pkg-config if the dependency was explicitly "static : true", which is not likely to be the case for most stuff we're building. An alternative proposal was to patch Meson to add a special environment variable to force dependencies to be "static : true". I feel that the approach I've taken here is less invasive.
This commit is contained in:
parent
2e6fadac4e
commit
801078806b
2 changed files with 5 additions and 0 deletions
|
@ -47,6 +47,9 @@ stdenv.mkDerivation {
|
|||
dontBuild = true;
|
||||
dontConfigure = true;
|
||||
|
||||
# Additional flags passed to pkg-config.
|
||||
addFlags = lib.optional stdenv.targetPlatform.isStatic "--static";
|
||||
|
||||
unpackPhase = ''
|
||||
src=$PWD
|
||||
'';
|
||||
|
|
|
@ -12,6 +12,8 @@ if [ -z "${NIX_PKG_CONFIG_WRAPPER_FLAGS_SET_@suffixSalt@:-}" ]; then
|
|||
source @out@/nix-support/add-flags.sh
|
||||
fi
|
||||
|
||||
set -- "$@" @addFlags@
|
||||
|
||||
if (( ${#role_suffixes[@]} > 0 )); then
|
||||
# replace env var with nix-modified one
|
||||
PKG_CONFIG_PATH=$PKG_CONFIG_PATH_@suffixSalt@ exec @prog@ "$@"
|
||||
|
|
Loading…
Reference in a new issue