diff options
author | Ben Wolsieffer <benwolsieffer@gmail.com> | 2020-09-29 01:15:06 -0400 |
---|---|---|
committer | Ben Wolsieffer <benwolsieffer@gmail.com> | 2020-09-29 01:40:06 -0400 |
commit | f0fdecfbb45c74bfb6f46017563e7ec941b604e9 (patch) | |
tree | 58a70a1af4d9650c6d58883725a9997d2e9f8c29 /pkgs/build-support/rust | |
parent | b3f8642587eee9027321ff8c6edc4a4444e51173 (diff) | |
download | nixpkgs-f0fdecfbb45c74bfb6f46017563e7ec941b604e9.tar nixpkgs-f0fdecfbb45c74bfb6f46017563e7ec941b604e9.tar.gz nixpkgs-f0fdecfbb45c74bfb6f46017563e7ec941b604e9.tar.bz2 nixpkgs-f0fdecfbb45c74bfb6f46017563e7ec941b604e9.tar.lz nixpkgs-f0fdecfbb45c74bfb6f46017563e7ec941b604e9.tar.xz nixpkgs-f0fdecfbb45c74bfb6f46017563e7ec941b604e9.tar.zst nixpkgs-f0fdecfbb45c74bfb6f46017563e7ec941b604e9.zip |
buildRustCrate: fix target config environment variables on 32-bit ARM
Diffstat (limited to 'pkgs/build-support/rust')
-rw-r--r-- | pkgs/build-support/rust/build-rust-crate/configure-crate.nix | 11 | ||||
-rw-r--r-- | pkgs/build-support/rust/build-rust-crate/default.nix | 10 |
2 files changed, 7 insertions, 14 deletions
diff --git a/pkgs/build-support/rust/build-rust-crate/configure-crate.nix b/pkgs/build-support/rust/build-rust-crate/configure-crate.nix index a95b356646e..18587f7047c 100644 --- a/pkgs/build-support/rust/build-rust-crate/configure-crate.nix +++ b/pkgs/build-support/rust/build-rust-crate/configure-crate.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, echo_colored, noisily, mkRustcDepArgs, mkRustcFeatureArgs }: +{ lib, stdenv, rust, echo_colored, noisily, mkRustcDepArgs, mkRustcFeatureArgs }: { build , buildDependencies @@ -17,7 +17,6 @@ , libName , libPath , release -, target_os , verbose , workspace_member }: let version_ = lib.splitString "-" crateVersion; @@ -124,8 +123,8 @@ in '' export CARGO_PKG_AUTHORS="${authors}" export CARGO_PKG_DESCRIPTION="${crateDescription}" - export CARGO_CFG_TARGET_ARCH=${stdenv.hostPlatform.parsed.cpu.name} - export CARGO_CFG_TARGET_OS=${target_os} + export CARGO_CFG_TARGET_ARCH=${rust.toTargetArch stdenv.hostPlatform} + export CARGO_CFG_TARGET_OS=${rust.toTargetOs stdenv.hostPlatform} export CARGO_CFG_TARGET_FAMILY="unix" export CARGO_CFG_UNIX=1 export CARGO_CFG_TARGET_ENV="gnu" @@ -136,8 +135,8 @@ in '' export CARGO_MANIFEST_DIR=$(pwd) export DEBUG="${toString (!release)}" export OPT_LEVEL="${toString optLevel}" - export TARGET="${stdenv.hostPlatform.config}" - export HOST="${stdenv.hostPlatform.config}" + export TARGET="${rust.toRustTarget stdenv.hostPlatform}" + export HOST="${rust.toRustTarget stdenv.buildPlatform}" export PROFILE=${if release then "release" else "debug"} export OUT_DIR=$(pwd)/target/build/${crateName}.out export CARGO_PKG_VERSION_MAJOR=${lib.elemAt version 0} diff --git a/pkgs/build-support/rust/build-rust-crate/default.nix b/pkgs/build-support/rust/build-rust-crate/default.nix index 0e06f5f89ab..9d98e085178 100644 --- a/pkgs/build-support/rust/build-rust-crate/default.nix +++ b/pkgs/build-support/rust/build-rust-crate/default.nix @@ -8,12 +8,6 @@ , cargo, jq }: let - # This doesn't appear to be officially documented anywhere yet. - # See https://github.com/rust-lang-nursery/rust-forge/issues/101. - target_os = if stdenv.hostPlatform.isDarwin - then "macos" - else stdenv.hostPlatform.parsed.kernel.name; - # Create rustc arguments to link against the given list of dependencies # and renames. # @@ -52,7 +46,7 @@ let inherit (import ./log.nix { inherit lib; }) noisily echo_colored; configureCrate = import ./configure-crate.nix { - inherit lib stdenv echo_colored noisily mkRustcDepArgs mkRustcFeatureArgs; + inherit lib stdenv rust echo_colored noisily mkRustcDepArgs mkRustcFeatureArgs; }; buildCrate = import ./build-crate.nix { @@ -284,7 +278,7 @@ stdenv.mkDerivation (rec { inherit crateName buildDependencies completeDeps completeBuildDeps crateDescription crateFeatures crateRenames libName build workspace_member release libPath crateVersion extraLinkFlags extraRustcOpts - crateAuthors crateHomepage verbose colors target_os; + crateAuthors crateHomepage verbose colors; }; buildPhase = buildCrate { inherit crateName dependencies |