Skip to content

Commit

Permalink
rust: move releaseDir to target/release in the buildPhase
Browse files Browse the repository at this point in the history
  • Loading branch information
illegalprime authored and Ericson2314 committed Mar 29, 2019
1 parent 912dca1 commit 60761e6
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pkgs/build-support/rust/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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}" \
Expand All @@ -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
'';

Expand Down

0 comments on commit 60761e6

Please sign in to comment.