about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/pmix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/pmix')
-rw-r--r--nixpkgs/pkgs/development/libraries/pmix/default.nix29
1 files changed, 28 insertions, 1 deletions
diff --git a/nixpkgs/pkgs/development/libraries/pmix/default.nix b/nixpkgs/pkgs/development/libraries/pmix/default.nix
index f5fb65f7989b..78605179f710 100644
--- a/nixpkgs/pkgs/development/libraries/pmix/default.nix
+++ b/nixpkgs/pkgs/development/libraries/pmix/default.nix
@@ -1,5 +1,7 @@
 { lib, stdenv, fetchFromGitHub, perl, autoconf, automake
-, libtool, python3, flex, libevent, hwloc, munge, zlib, pandoc, gitMinimal
+, removeReferencesTo, libtool, python3, flex, libevent
+, targetPackages, makeWrapper
+, hwloc, munge, zlib, pandoc, gitMinimal
 } :
 
 stdenv.mkDerivation rec {
@@ -14,6 +16,8 @@ stdenv.mkDerivation rec {
     fetchSubmodules = true;
   };
 
+  outputs = [ "out" "dev" ];
+
   postPatch = ''
     patchShebangs ./autogen.pl
     patchShebangs ./config
@@ -28,6 +32,8 @@ stdenv.mkDerivation rec {
     flex
     gitMinimal
     python3
+    removeReferencesTo
+    makeWrapper
   ];
 
   buildInputs = [ libevent hwloc munge zlib ];
@@ -46,6 +52,27 @@ stdenv.mkDerivation rec {
 
   postInstall = ''
     find $out/lib/ -name "*.la" -exec rm -f \{} \;
+
+    moveToOutput "bin/pmix_info" "''${!outputDev}"
+    moveToOutput "bin/pmixcc" "''${!outputDev}"
+    moveToOutput "share/pmix/pmixcc-wrapper-data.txt" "''${!outputDev}"
+
+    # The path to the pmixcc-wrapper-data.txt is hard coded and
+    # points to $out instead of dev. Use wrapper to fix paths.
+    wrapProgram $dev/bin/pmixcc \
+      --set PMIX_INCLUDEDIR $dev/include \
+      --set PMIX_PKGDATADIR $dev/share/pmix
+  '';
+
+  postFixup = ''
+    # The build info (parameters to ./configure) are hardcoded
+    # into the library. This clears all references to $dev/include.
+    remove-references-to -t $dev $(readlink -f $out/lib/libpmix.so)
+
+    # Pin the compiler to the current version in a cross compiler friendly way.
+    # Same pattern as for openmpi (see https://github.com/NixOS/nixpkgs/pull/58964#discussion_r275059427).
+    sed -i 's:compiler=.*:compiler=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}cc:' \
+      $dev/share/pmix/pmixcc-wrapper-data.txt
   '';
 
   enableParallelBuilding = true;