about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/openmpi/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/openmpi/default.nix')
-rw-r--r--nixpkgs/pkgs/development/libraries/openmpi/default.nix26
1 files changed, 25 insertions, 1 deletions
diff --git a/nixpkgs/pkgs/development/libraries/openmpi/default.nix b/nixpkgs/pkgs/development/libraries/openmpi/default.nix
index 06e4726054e9..4ab2dd418558 100644
--- a/nixpkgs/pkgs/development/libraries/openmpi/default.nix
+++ b/nixpkgs/pkgs/development/libraries/openmpi/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, fetchpatch, gfortran, perl, libnl
-, rdma-core, zlib, numactl, libevent, hwloc
+, rdma-core, zlib, numactl, libevent, hwloc, pkgsTargetTarget
 
 # Enable the Sun Grid Engine bindings
 , enableSGE ? false
@@ -30,6 +30,13 @@ in stdenv.mkDerivation rec {
 
   postPatch = ''
     patchShebangs ./
+
+    # Ensure build is reproducible
+    ts=`date -d @$SOURCE_DATE_EPOCH`
+    sed -i 's/OPAL_CONFIGURE_USER=.*/OPAL_CONFIGURE_USER="nixbld"/' configure
+    sed -i 's/OPAL_CONFIGURE_HOST=.*/OPAL_CONFIGURE_HOST="localhost"/' configure
+    sed -i "s/OPAL_CONFIGURE_DATE=.*/OPAL_CONFIGURE_DATE=\"$ts\"/" configure
+    find -name "Makefile.in" -exec sed -i "s/\`date\`/$ts/" \{} \;
   '';
 
   buildInputs = with stdenv; [ gfortran zlib ]
@@ -51,6 +58,23 @@ in stdenv.mkDerivation rec {
     rm -f $out/lib/*.la
    '';
 
+  postFixup = ''
+    # default compilers should be indentical to the
+    # compilers at build time
+
+    sed -i 's:compiler=.*:compiler=${pkgsTargetTarget.stdenv.cc}/bin/${pkgsTargetTarget.stdenv.cc.targetPrefix}cc:' \
+      $out/share/openmpi/mpicc-wrapper-data.txt
+
+    sed -i 's:compiler=.*:compiler=${pkgsTargetTarget.stdenv.cc}/bin/${pkgsTargetTarget.stdenv.cc.targetPrefix}cc:' \
+       $out/share/openmpi/ortecc-wrapper-data.txt
+
+    sed -i 's:compiler=.*:compiler=${pkgsTargetTarget.stdenv.cc}/bin/${pkgsTargetTarget.stdenv.cc.targetPrefix}c++:' \
+       $out/share/openmpi/mpic++-wrapper-data.txt
+
+    sed -i 's:compiler=.*:compiler=${pkgsTargetTarget.gfortran}/bin/${pkgsTargetTarget.gfortran.targetPrefix}gfortran:'  \
+       $out/share/openmpi/mpifort-wrapper-data.txt
+  '';
+
   doCheck = true;
 
   meta = with stdenv.lib; {