summary refs log tree commit diff
path: root/gnu/packages/rust.scm
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2018-06-03 03:21:13 -0400
committerMark H Weaver <mhw@netris.org>2018-06-03 03:36:13 -0400
commit2c790226d22f86b641191918462fa7527c8a3ac7 (patch)
tree4dd172c8b85d786e4807fdb8eadf63eac23bc5d4 /gnu/packages/rust.scm
parent0ec430f79530ee343c175347952f91a78adca5ec (diff)
downloadguix-2c790226d22f86b641191918462fa7527c8a3ac7.tar.gz
gnu: rust: Fix build for armhf and mips64el.
This is a followup to commit 514026d7de36b299238aff9dfcc2f898fb04072a.

* gnu/packages/rust.scm (nix-system->gnu-triplet-for-rust): New variable.
(rust-bootstrap, mrustc, rust-1.23): Use 'nix-system->gnu-triplet-for-rust'
instead of 'nix-system->gnu-triplet'.
Diffstat (limited to 'gnu/packages/rust.scm')
-rw-r--r--gnu/packages/rust.scm23
1 files changed, 17 insertions, 6 deletions
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index 62b5ee5ffa..7fcc795b6f 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -59,6 +59,16 @@
 (define %cargo-reference-hash
   "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")
 
+(define* (nix-system->gnu-triplet-for-rust
+          #:optional (system (%current-system)))
+  (match system
+    ("x86_64-linux"   "x86_64-unknown-linux-gnu")
+    ("i686-linux"     "i686-unknown-linux-gnu")
+    ("armhf-linux"    "armv7-unknown-linux-gnueabihf")
+    ("aarch64-linux"  "aarch64-unknown-linux-gnu")
+    ("mips64el-linux" "mips64el-unknown-linux-gnuabi64")
+    (_                (nix-system->gnu-triplet system))))
+
 (define rust-bootstrap
   (package
     (name "rust-bootstrap")
@@ -76,10 +86,11 @@
            (method url-fetch)
            (uri (string-append
                  "https://static.rust-lang.org/dist/"
-                 "rust-" version "-" (nix-system->gnu-triplet) ".tar.gz"))
+                 "rust-" version "-" (nix-system->gnu-triplet-for-rust)
+                 ".tar.gz"))
            (sha256
             (base32
-             (match (nix-system->gnu-triplet)
+             (match (nix-system->gnu-triplet-for-rust)
                ("i686-unknown-linux-gnu"
                 "15zqbx86nm13d5vq2gm69b7av4vg479f74b5by64hs3bcwwm08pr")
                ("x86_64-unknown-linux-gnu"
@@ -119,7 +130,8 @@
                (invoke "bash" "install.sh"
                         (string-append "--prefix=" out)
                         (string-append "--components=rustc,"
-                                       "rust-std-" ,(nix-system->gnu-triplet)))
+                                       "rust-std-"
+                                       ,(nix-system->gnu-triplet-for-rust)))
                ;; Instal cargo
                (invoke "bash" "install.sh"
                         (string-append "--prefix=" cargo-out)
@@ -321,8 +333,7 @@ safety and thread safety guarantees.")
                  (("^RUSTC_TARGET := x86_64-unknown-linux-gnu")
                   (string-append "RUSTC_TARGET := "
                                  ,(or (%current-target-system)
-                                      (nix-system->gnu-triplet
-                                       (%current-system))))))
+                                      (nix-system->gnu-triplet-for-rust)))))
                (invoke "tar" "xf" (assoc-ref inputs "rustc"))
                (chdir "rustc-1.19.0-src")
                (invoke "patch" "-p0" "../rust_src.patch")
@@ -445,7 +456,7 @@ rpath = true
 # codegen/mainsubprogram.rs and codegen/mainsubprogramstart.rs
 # This tests required patched LLVM
 codegen-tests = false
-[target." ,(nix-system->gnu-triplet) "]
+[target." ,(nix-system->gnu-triplet-for-rust) "]
 llvm-config = \"" llvm "/bin/llvm-config" "\"
 cc = \"" gcc "/bin/gcc" "\"
 cxx = \"" gcc "/bin/g++" "\"