(address . guix-patches@gnu.org)
Hi Guix!
Recently I had to work with some webassembly and rust and our current
compiler did not support the target. This patch adds wasm32 support.
Kindly,
John
From ab40dbfd2db1a06939c353d7cb0cb64841dbaa35 Mon Sep 17 00:00:00 2001
From: John Soo <jsoo1@asu.edu>
Date: Sat, 23 Jan 2021 08:43:52 -0800
Subject: [PATCH] gnu: Add wasm32 target to rust@1.46.
* gnu/packages/rust.scm (rust-1.46): [arguments] Add wasm32 to target
configuration, [native-inputs] Add node for tests.
---
gnu/packages/rust.scm | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
Toggle diff (40 lines)
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index 98ae770745..7b40372cb2 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -1349,7 +1349,21 @@ move around."
(generate-all-checksums "vendor")
#t))
(replace 'build
- (lambda* _
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* "config.toml"
+ (("\\[build\\]" all)
+ (string-append all "
+target = [\"" ,(nix-system->gnu-triplet-for-rust) "\", \"wasm32-unknown-unknown\"]
+"))
+ (("\\[dist\\]" all)
+ (string-append "
+[target.wasm32-unknown-unknown]
+llvm-config = \"" (assoc-ref inputs "llvm") "/bin/llvm-config\"
+cc = \"" (assoc-ref inputs "gcc") "/bin/gcc\"
+cxx = \"" (assoc-ref inputs "gcc") "/bin/g++\"
+ar = \"" (assoc-ref inputs "binutils") "/bin/ar\"
+"
+all)))
(invoke "./x.py" "build")
(invoke "./x.py" "build" "src/tools/cargo")
(invoke "./x.py" "build" "src/tools/rustfmt")
@@ -1364,7 +1378,9 @@ move around."
(string-append "-j" (number->string
(min 4
(parallel-job-count))))))
- (invoke "./x.py" parallel-job-spec "test" "-vv")
+ (invoke "./x.py" parallel-job-spec "test"
+ (string-append "--target=" ,(nix-system->gnu-triplet-for-rust))
+ "-vv")
(invoke "./x.py" parallel-job-spec "test"
"src/tools/cargo")
(invoke "./x.py" parallel-job-spec "test"
--
2.30.0
-----BEGIN PGP SIGNATURE-----
iQJCBAEBCAAsFiEEWhWPr0BqdIqBqdxOT0N6drRIojsFAmATNMwOHGpzb28xQGFz
dS5lZHUACgkQT0N6drRIojsVHA//fBuXoEe8/4vTa8URvnxxe4QIFh7s1QNFOTU8
DKWIBzsRdY/TKnnt0VpPeJoVIjLXkQdSyLjiEmcag9aO/nLsjeD12Z5Tv3X+OoEH
H+nDY6u/ERfTAmsW1XFT7az9PGD+DeRWX4nKSYr+beuWlL+1Snn9KEZy3CcRPy0u
Lh+lgFdDyGfl28W/Z7LaJMbrsUJBgKbh0EqoUdyqJFAmpUL4kb7GXOfquGIvILvp
vLmRO5CVuMpWe/08DrRRtwSnCo5dnUKVA7Nvhwlqg83iP9hvSDbBhLH9tj28qCnM
KUrH8l1FhmsR2LiKtICM3G18xi8bFykNZgJmTLDMXs3YpB0/aqqTxfV/zikyESRi
jfewA0RlfefIuxdSgYaUZEs35E4VOpkmUciyQqzjczUkI+en5AvqTTUpHN2h0ITO
nxpS4izA4MQWJDWGyC0dQGGmS6sLxc+OW2VODg7Kmio6fP3+Gm2Re07HM0mrZoz5
Nr7v/hdR/dw5oEeRp/Rh7VDSTO/boGz4gegdlA+XJi1oL5ljVZV48PwvekARSzmR
3gPeYc5ZpBBdxd5Pc2sVN48tR2ycKVgeXZFmam9ALXvwV94RMZMzlz5v/ekUBVnD
bEG7XQ3xx6iPEXqtxmyqUt7gCB/MxKSXuzPaxapH6CWlKhZP6JLDjx30WXrMrLBG
1NaM70M=
=5UTx
-----END PGP SIGNATURE-----