From 60761e65ba38280ce19e1d7e3c4ffd883212a96c Mon Sep 17 00:00:00 2001 From: Michael Eden Date: Fri, 22 Feb 2019 01:16:20 -0500 Subject: [PATCH] rust: move releaseDir to target/release in the buildPhase --- pkgs/build-support/rust/default.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/rust/default.nix b/pkgs/build-support/rust/default.nix index 7130dde388bc6..ad8488494e4cd 100644 --- a/pkgs/build-support/rust/default.nix +++ b/pkgs/build-support/rust/default.nix @@ -89,7 +89,9 @@ in stdenv.mkDerivation (args // { buildPhase = with builtins; args.buildPhase or '' runHook preBuild - echo "Running cargo build --target ${stdenv.hostPlatform.config} --release ${concatStringsSep " " cargoBuildFlags}" + + ( + set -x env \ "CC_${stdenv.buildPlatform.config}"="${ccForBuild}" \ "CXX_${stdenv.buildPlatform.config}"="${cxxForBuild}" \ @@ -99,6 +101,15 @@ in stdenv.mkDerivation (args // { --release \ --target ${stdenv.hostPlatform.config} \ --frozen ${concatStringsSep " " cargoBuildFlags} + ) + + # rename the output dir to a architecture independent one + mapfile -t targets < <(find "$NIX_BUILD_TOP" -type d | grep '${releaseDir}$') + for target in "''${targets[@]}"; do + rm -rf "$target/../../release" + ln -srf "$target" "$target/../../" + done + runHook postBuild '';