summary refs log tree commit diff
path: root/pkgs/development/compilers/rust
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/rust')
-rw-r--r--pkgs/development/compilers/rust/1_38_0.nix1
-rw-r--r--pkgs/development/compilers/rust/1_39_0.nix1
-rw-r--r--pkgs/development/compilers/rust/bootstrap.nix19
-rw-r--r--pkgs/development/compilers/rust/default.nix8
-rwxr-xr-xpkgs/development/compilers/rust/print-hashes.sh1
-rw-r--r--pkgs/development/compilers/rust/rustc.nix14
6 files changed, 21 insertions, 23 deletions
diff --git a/pkgs/development/compilers/rust/1_38_0.nix b/pkgs/development/compilers/rust/1_38_0.nix
index 5260ab20174..be43e074228 100644
--- a/pkgs/development/compilers/rust/1_38_0.nix
+++ b/pkgs/development/compilers/rust/1_38_0.nix
@@ -10,6 +10,7 @@ import ./default.nix {
   bootstrapHashes = {
     i686-unknown-linux-gnu = "74510e0e52a55e65a9f716673c2cda4d2bd427e2453541c6993c77c3ec04acf9";
     x86_64-unknown-linux-gnu = "cb573229bfd32928177c3835fdeb62d52da64806b844bc1095c6225b0665a1cb";
+    arm-unknown-linux-gnueabihf = "272739fbb23cf6c2040c1813af9c8c7f386cac37d9de638f22a1816eb96bc0ae";
     armv7-unknown-linux-gnueabihf = "5b87b877f0ed20c6a09ce26e7a15d8c61b26b62484b97e78a51099d0efefec98";
     aarch64-unknown-linux-gnu = "263ef98fa3a6b2911b56f89c06615cdebf6ef676eb9b2493ad1539602f79b6ba";
     i686-apple-darwin = "e45d0c4d882fc6c404ffa6fe790294f4ea96384a2b48804adbf723f3635477a8";
diff --git a/pkgs/development/compilers/rust/1_39_0.nix b/pkgs/development/compilers/rust/1_39_0.nix
index aa29c7a9ff7..cc07590dedc 100644
--- a/pkgs/development/compilers/rust/1_39_0.nix
+++ b/pkgs/development/compilers/rust/1_39_0.nix
@@ -10,6 +10,7 @@ import ./default.nix {
   bootstrapHashes = {
     i686-unknown-linux-gnu = "41aed8a350e24a0cac1444ed99b3dd24a90bc581dd88cb420c6e547d6b5f57af";
     x86_64-unknown-linux-gnu = "adda26b3f0609dbfbdc2019da4a20101879b9db2134fae322a4e863a069ec221";
+    arm-unknown-linux-gnueabihf = "0603a3d3d16ae8f3b3b117eb699e8f3ef7532a6f6d3c29d13e7d4614fc3c9e7a";
     armv7-unknown-linux-gnueabihf = "8b1bf1680a61a643d6b5c7a3b1a1ce88448652756395e20ba5846739cbd085c4";
     aarch64-unknown-linux-gnu = "06afd6d525326cea95c3aa658aaa8542eab26f44235565bb16913ac9d12b7bda";
     i686-apple-darwin = "cdbf2807774bed350a3af6f41d7f7dd7ceff28777cde310c3ba90033188eb2f8";
diff --git a/pkgs/development/compilers/rust/bootstrap.nix b/pkgs/development/compilers/rust/bootstrap.nix
index 54b2d3016e5..7c0b46d5593 100644
--- a/pkgs/development/compilers/rust/bootstrap.nix
+++ b/pkgs/development/compilers/rust/bootstrap.nix
@@ -1,24 +1,11 @@
-{ stdenv, fetchurl, callPackage, version, hashes }:
+{ stdenv, fetchurl, rust, callPackage, version, hashes }:
 
 let
-  platform =
-    if stdenv.hostPlatform.system == "i686-linux"
-    then "i686-unknown-linux-gnu"
-    else if stdenv.hostPlatform.system == "x86_64-linux"
-    then "x86_64-unknown-linux-gnu"
-    else if stdenv.hostPlatform.system == "armv7l-linux"
-    then "armv7-unknown-linux-gnueabihf"
-    else if stdenv.hostPlatform.system == "aarch64-linux"
-    then "aarch64-unknown-linux-gnu"
-    else if stdenv.hostPlatform.system == "i686-darwin"
-    then "i686-apple-darwin"
-    else if stdenv.hostPlatform.system == "x86_64-darwin"
-    then "x86_64-apple-darwin"
-    else throw "missing bootstrap url for platform ${stdenv.hostPlatform.system}";
+  platform = rust.toRustTarget stdenv.hostPlatform;
 
   src = fetchurl {
      url = "https://static.rust-lang.org/dist/rust-${version}-${platform}.tar.gz";
-     sha256 = hashes.${platform};
+     sha256 = hashes.${platform} or (throw "missing bootstrap url for platform ${platform}");
   };
 
 in callPackage ./binary.nix
diff --git a/pkgs/development/compilers/rust/default.nix b/pkgs/development/compilers/rust/default.nix
index efd641efb6e..75104ac7ad5 100644
--- a/pkgs/development/compilers/rust/default.nix
+++ b/pkgs/development/compilers/rust/default.nix
@@ -11,6 +11,14 @@
 , llvmPackages_5
 , pkgsBuildTarget, pkgsBuildBuild
 }: rec {
+  toRustTarget = platform: with platform.parsed; let
+    cpu_ = {
+      "armv7a" = "armv7";
+      "armv7l" = "armv7";
+      "armv6l" = "arm";
+    }.${cpu.name} or cpu.name;
+  in "${cpu_}-${vendor.name}-${kernel.name}${lib.optionalString (abi.name != "unknown") "-${abi.name}"}";
+
   makeRustPlatform = { rustc, cargo, ... }: {
     rust = {
       inherit rustc cargo;
diff --git a/pkgs/development/compilers/rust/print-hashes.sh b/pkgs/development/compilers/rust/print-hashes.sh
index 7eb00a30ad7..1d46fe376d4 100755
--- a/pkgs/development/compilers/rust/print-hashes.sh
+++ b/pkgs/development/compilers/rust/print-hashes.sh
@@ -10,6 +10,7 @@ set -euo pipefail
 PLATFORMS=(
   i686-unknown-linux-gnu
   x86_64-unknown-linux-gnu
+  arm-unknown-linux-gnueabihf
   armv7-unknown-linux-gnueabihf
   aarch64-unknown-linux-gnu
   i686-apple-darwin
diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix
index ceaf6f4c225..ca9bf05b7e7 100644
--- a/pkgs/development/compilers/rust/rustc.nix
+++ b/pkgs/development/compilers/rust/rustc.nix
@@ -1,6 +1,6 @@
 { stdenv, removeReferencesTo, pkgsBuildBuild, pkgsBuildHost, pkgsBuildTarget
 , fetchurl, file, python2
-, llvm_9, darwin, git, cmake, rustPlatform
+, llvm_9, darwin, git, cmake, rust, rustPlatform
 , pkgconfig, openssl
 , which, libffi
 , withBundledLLVM ? false
@@ -53,9 +53,9 @@ in stdenv.mkDerivation rec {
   # We need rust to build rust. If we don't provide it, configure will try to download it.
   # Reference: https://github.com/rust-lang/rust/blob/master/src/bootstrap/configure.py
   configureFlags = let
-    setBuild  = "--set=target.${stdenv.buildPlatform.config}";
-    setHost   = "--set=target.${stdenv.hostPlatform.config}";
-    setTarget = "--set=target.${stdenv.targetPlatform.config}";
+    setBuild  = "--set=target.${rust.toRustTarget stdenv.buildPlatform}";
+    setHost   = "--set=target.${rust.toRustTarget stdenv.hostPlatform}";
+    setTarget = "--set=target.${rust.toRustTarget stdenv.targetPlatform}";
     ccForBuild  = "${pkgsBuildBuild.targetPackages.stdenv.cc}/bin/${pkgsBuildBuild.targetPackages.stdenv.cc.targetPrefix}cc";
     cxxForBuild = "${pkgsBuildBuild.targetPackages.stdenv.cc}/bin/${pkgsBuildBuild.targetPackages.stdenv.cc.targetPrefix}c++";
     ccForHost  = "${pkgsBuildHost.targetPackages.stdenv.cc}/bin/${pkgsBuildHost.targetPackages.stdenv.cc.targetPrefix}cc";
@@ -68,9 +68,9 @@ in stdenv.mkDerivation rec {
     "--set=build.cargo=${rustPlatform.rust.cargo}/bin/cargo"
     "--enable-rpath"
     "--enable-vendor"
-    "--build=${stdenv.buildPlatform.config}"
-    "--host=${stdenv.hostPlatform.config}"
-    "--target=${stdenv.targetPlatform.config}"
+    "--build=${rust.toRustTarget stdenv.buildPlatform}"
+    "--host=${rust.toRustTarget stdenv.hostPlatform}"
+    "--target=${rust.toRustTarget stdenv.targetPlatform}"
 
     "${setBuild}.cc=${ccForBuild}"
     "${setHost}.cc=${ccForHost}"