about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorVladimír Čunát <v@cunat.cz>2020-07-25 16:18:40 +0200
committerVladimír Čunát <v@cunat.cz>2020-07-25 16:18:40 +0200
commit2b7c0dcdaab946153b0eaba5f2420f15ea27b0d6 (patch)
treee31db6c54aeeef9fafd8a31f7335b9fb02dfd2ba /pkgs/build-support
parentfdbae69e8ce4cf3bfe2c39713586cbea270a608c (diff)
parent744b380a0ec4ec9c2a958e5d1c42ac5da2f9759e (diff)
Merge branch 'staging-next'
Rebuild on Hydra seems OK-ish.
mongodb.nix needed some conflict resolution (scons versions);
all four versions seem to build fine.
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/rust/default.nix13
1 files changed, 8 insertions, 5 deletions
diff --git a/pkgs/build-support/rust/default.nix b/pkgs/build-support/rust/default.nix
index 9e9f2cb4e3bc7..c292b8ea4d438 100644
--- a/pkgs/build-support/rust/default.nix
+++ b/pkgs/build-support/rust/default.nix
@@ -74,6 +74,7 @@ let
   ccForHost="${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc";
   cxxForHost="${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++";
   releaseDir = "target/${rustTarget}/${buildType}";
+  tmpDir = "${releaseDir}-tmp";
 
   # Specify the stdenv's `diff` by abspath to ensure that the user's build
   # inputs do not cause us to find the wrong `diff`.
@@ -193,13 +194,15 @@ stdenv.mkDerivation (args // {
     # This needs to be done after postBuild: packages like `cargo` do a pushd/popd in
     # the pre/postBuild-hooks that need to be taken into account before gathering
     # all binaries to install.
-    bins=$(find $releaseDir \
+    mkdir -p $tmpDir
+    cp -r $releaseDir/* $tmpDir/
+    bins=$(find $tmpDir \
       -maxdepth 1 \
       -type f \
       -executable ! \( -regex ".*\.\(so.[0-9.]+\|so\|a\|dylib\)" \))
   '';
 
-  installCheckPhase = args.checkPhase or (let
+  checkPhase = args.checkPhase or (let
     argstr = "${stdenv.lib.optionalString (checkType == "release") "--release"} --target ${rustTarget} --frozen";
   in ''
     ${stdenv.lib.optionalString (buildAndTestSubdir != null) "pushd ${buildAndTestSubdir}"}
@@ -214,13 +217,13 @@ stdenv.mkDerivation (args // {
 
   strictDeps = true;
 
-  inherit releaseDir;
+  inherit releaseDir tmpDir;
 
   installPhase = args.installPhase or ''
     runHook preInstall
 
     # rename the output dir to a architecture independent one
-    mapfile -t targets < <(find "$NIX_BUILD_TOP" -type d | grep '${releaseDir}$')
+    mapfile -t targets < <(find "$NIX_BUILD_TOP" -type d | grep '${tmpDir}$')
     for target in "''${targets[@]}"; do
       rm -rf "$target/../../${buildType}"
       ln -srf "$target" "$target/../../"
@@ -228,7 +231,7 @@ stdenv.mkDerivation (args // {
     mkdir -p $out/bin $out/lib
 
     xargs -r cp -t $out/bin <<< $bins
-    find $releaseDir \
+    find $tmpDir \
       -maxdepth 1 \
       -regex ".*\.\(so.[0-9.]+\|so\|a\|dylib\)" \
       -print0 | xargs -r -0 cp -t $out/lib