summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorJohn Ericson <git@JohnEricson.me>2020-05-21 16:05:42 -0400
committerGitHub <noreply@github.com>2020-05-21 16:05:42 -0400
commiteae4f22176789ce3b6a66bad773a45b12e895cdf (patch)
tree24439d933bb7e86ed1e1b433758c0fbf3967d825 /pkgs/build-support
parentd87dec9f7712cd84266281d482462df809a22178 (diff)
parent7e9d807f2cfbf4645ac9dab97e895435c3f6fe7b (diff)
downloadnixpkgs-eae4f22176789ce3b6a66bad773a45b12e895cdf.tar
nixpkgs-eae4f22176789ce3b6a66bad773a45b12e895cdf.tar.gz
nixpkgs-eae4f22176789ce3b6a66bad773a45b12e895cdf.tar.bz2
nixpkgs-eae4f22176789ce3b6a66bad773a45b12e895cdf.tar.lz
nixpkgs-eae4f22176789ce3b6a66bad773a45b12e895cdf.tar.xz
nixpkgs-eae4f22176789ce3b6a66bad773a45b12e895cdf.tar.zst
nixpkgs-eae4f22176789ce3b6a66bad773a45b12e895cdf.zip
Merge pull request #88518 from Ericson2314/fix-pkg-config
pkg-config, pkgconf: Misc fixes
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/pkg-config-wrapper/default.nix49
-rw-r--r--pkgs/build-support/pkg-config-wrapper/setup-hook.sh2
2 files changed, 30 insertions, 21 deletions
diff --git a/pkgs/build-support/pkg-config-wrapper/default.nix b/pkgs/build-support/pkg-config-wrapper/default.nix
index 87efc3b18aa..e01df107dd1 100644
--- a/pkgs/build-support/pkg-config-wrapper/default.nix
+++ b/pkgs/build-support/pkg-config-wrapper/default.nix
@@ -4,6 +4,7 @@
 { stdenvNoCC
 , buildPackages
 , pkg-config
+, baseBinName ? "pkg-config"
 , propagateDoc ? pkg-config != null && pkg-config ? man
 , extraPackages ? [], extraBuildCommands ? ""
 }:
@@ -34,9 +35,9 @@ stdenv.mkDerivation {
 
   shell = getBin stdenvNoCC.shell + stdenvNoCC.shell.shellPath or "";
 
-  inherit targetPrefix suffixSalt;
+  inherit targetPrefix suffixSalt baseBinName;
 
-  outputs = [ "out" ] ++ optionals propagateDoc [ "man" ];
+  outputs = [ "out" ] ++ optionals propagateDoc ([ "man" ] ++ optional (pkg-config ? doc) "doc");
 
   passthru = {
     inherit pkg-config;
@@ -63,7 +64,16 @@ stdenv.mkDerivation {
 
       echo $pkg-config > $out/nix-support/orig-pkg-config
 
-      wrap ${targetPrefix}pkg-config ${./pkg-config-wrapper.sh} "${getBin pkg-config}/bin/pkg-config"
+      wrap ${targetPrefix}${baseBinName} ${./pkg-config-wrapper.sh} "${getBin pkg-config}/bin/${baseBinName}"
+    ''
+    # symlink in share for autoconf to find macros
+
+    # TODO(@Ericson2314): in the future just make the unwrapped pkg-config a
+    # propagated dep once we can rely on downstream deps comming first in
+    # search paths. (https://github.com/NixOS/nixpkgs/pull/31414 took a crack
+    # at this.)
+    + ''
+      ln -s ${pkg-config}/share $out/share
     '';
 
   strictDeps = true;
@@ -76,34 +86,33 @@ stdenv.mkDerivation {
   ];
 
   postFixup =
-    ''
-
-      ##
-      ## User env support
-      ##
+    ##
+    ## User env support
+    ##
 
-      # Propagate the underling unwrapped pkg-config so that if you
-      # install the wrapper, you get anything else it might provide.
+    # Propagate the underling unwrapped pkg-config so that if you
+    # install the wrapper, you get anything else it might provide.
+    ''
       printWords ${pkg-config} > $out/nix-support/propagated-user-env-packages
     ''
 
-    + optionalString propagateDoc ''
-      ##
-      ## Man page and info support
-      ##
-
+    ##
+    ## Man page and doc support
+    ##
+    + optionalString propagateDoc (''
       ln -s ${pkg-config.man} $man
-    ''
+    '' + optionalString (pkg-config ? doc) ''
+      ln -s ${pkg-config.doc} $doc
+    '')
 
     + ''
       substituteAll ${./add-flags.sh} $out/nix-support/add-flags.sh
       substituteAll ${../wrapper-common/utils.bash} $out/nix-support/utils.bash
-
-      ##
-      ## Extra custom steps
-      ##
     ''
 
+    ##
+    ## Extra custom steps
+    ##
     + extraBuildCommands;
 
   meta =
diff --git a/pkgs/build-support/pkg-config-wrapper/setup-hook.sh b/pkgs/build-support/pkg-config-wrapper/setup-hook.sh
index 12b9af5e583..34f1a999a82 100644
--- a/pkgs/build-support/pkg-config-wrapper/setup-hook.sh
+++ b/pkgs/build-support/pkg-config-wrapper/setup-hook.sh
@@ -23,7 +23,7 @@ getTargetRoleWrapper
 
 addEnvHooks "$targetOffset" pkgConfigWrapper_addPkgConfigPath
 
-export PKG_CONFIG${role_post}=@targetPrefix@pkg-config
+export PKG_CONFIG${role_post}=@targetPrefix@@baseBinName@
 
 # No local scope in sourced file
 unset -v role_post