mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
9ee10432a4
When cross-compiling a rust package, all we need is the std library compiled for the target. This uses the final stage compiler which was built for Build and then uses that as a stage0 compiler for target std library. It also copies the rust binary from pkgsBuildBuild so that it find the new lib/rustlib directory. We also need to create a cargo wrapper which will use the "new" rust compiler Also makes sure man pages and doc pages are propagated Co-authored-by: Alyssa Ross <hi@alyssa.is> Co-authored-by: Sandro <sandro.jaeckel@gmail.com> Co-authored-by: Rick van Schijndel <Mindavi@users.noreply.github.com>
15 lines
494 B
Nix
15 lines
494 B
Nix
{ runCommand, stdenv, lib, pkgsBuildBuild, makeShellWrapper, rustc, ... }:
|
|
|
|
runCommand "${stdenv.targetPlatform.config}-cargo-${lib.getVersion pkgsBuildBuild.cargo}" {
|
|
# Use depsBuildBuild or it tries to use target-runtimeShell
|
|
depsBuildBuild = [ makeShellWrapper ];
|
|
|
|
inherit (pkgsBuildBuild.cargo) meta;
|
|
} ''
|
|
mkdir -p $out/bin
|
|
ln -s ${pkgsBuildBuild.cargo}/share $out/share
|
|
|
|
makeWrapper "${pkgsBuildBuild.cargo}/bin/cargo" "$out/bin/cargo" \
|
|
--prefix PATH : "${rustc}/bin"
|
|
''
|