summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/build-support/pkg-config-wrapper/default.nix3
-rw-r--r--pkgs/build-support/pkg-config-wrapper/pkg-config-wrapper.sh2
2 files changed, 5 insertions, 0 deletions
diff --git a/pkgs/build-support/pkg-config-wrapper/default.nix b/pkgs/build-support/pkg-config-wrapper/default.nix
index bbc49d6728c..aa8f57ffb04 100644
--- a/pkgs/build-support/pkg-config-wrapper/default.nix
+++ b/pkgs/build-support/pkg-config-wrapper/default.nix
@@ -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
   '';
diff --git a/pkgs/build-support/pkg-config-wrapper/pkg-config-wrapper.sh b/pkgs/build-support/pkg-config-wrapper/pkg-config-wrapper.sh
index a5a44271668..9d0f7b028d8 100644
--- a/pkgs/build-support/pkg-config-wrapper/pkg-config-wrapper.sh
+++ b/pkgs/build-support/pkg-config-wrapper/pkg-config-wrapper.sh
@@ -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@ "$@"