Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / rust.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016 David Craven <david@craven.ch>
3 ;;; Copyright © 2016 Eric Le Bihan <eric.le.bihan.dev@free.fr>
4 ;;; Copyright © 2016 ng0 <ng0@n0.is>
5 ;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
6 ;;; Copyright © 2017, 2018 Nikolai Merinov <nikolai.merinov@member.fsf.org>
7 ;;; Copyright © 2017, 2019 Efraim Flashner <efraim@flashner.co.il>
8 ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
9 ;;; Copyright © 2018 Danny Milosavljevic <dannym+a@scratchpost.org>
10 ;;; Copyright © 2019 Ivan Petkov <ivanppetkov@gmail.com>
11 ;;;
12 ;;; This file is part of GNU Guix.
13 ;;;
14 ;;; GNU Guix is free software; you can redistribute it and/or modify it
15 ;;; under the terms of the GNU General Public License as published by
16 ;;; the Free Software Foundation; either version 3 of the License, or (at
17 ;;; your option) any later version.
18 ;;;
19 ;;; GNU Guix is distributed in the hope that it will be useful, but
20 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;;; GNU General Public License for more details.
23 ;;;
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26
27 (define-module (gnu packages rust)
28 #:use-module (gnu packages base)
29 #:use-module (gnu packages bison)
30 #:use-module (gnu packages bootstrap)
31 #:use-module (gnu packages cmake)
32 #:use-module (gnu packages compression)
33 #:use-module (gnu packages curl)
34 #:use-module (gnu packages elf)
35 #:use-module (gnu packages flex)
36 #:use-module (gnu packages gcc)
37 #:use-module (gnu packages gdb)
38 #:use-module (gnu packages jemalloc)
39 #:use-module (gnu packages linux)
40 #:use-module (gnu packages llvm)
41 #:use-module (gnu packages pkg-config)
42 #:use-module (gnu packages python)
43 #:use-module (gnu packages ssh)
44 #:use-module (gnu packages tls)
45 #:use-module (gnu packages)
46 #:use-module (guix build-system cargo)
47 #:use-module (guix build-system gnu)
48 #:use-module (guix build-system trivial)
49 #:use-module (guix download)
50 #:use-module (guix git-download)
51 #:use-module ((guix licenses) #:prefix license:)
52 #:use-module (guix packages)
53 #:use-module ((guix build utils) #:select (alist-replace))
54 #:use-module (guix utils)
55 #:use-module (ice-9 match)
56 #:use-module (srfi srfi-26))
57
58 (define %cargo-reference-hash
59 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")
60
61 (define* (nix-system->gnu-triplet-for-rust
62 #:optional (system (%current-system)))
63 (match system
64 ("x86_64-linux" "x86_64-unknown-linux-gnu")
65 ("i686-linux" "i686-unknown-linux-gnu")
66 ("armhf-linux" "armv7-unknown-linux-gnueabihf")
67 ("aarch64-linux" "aarch64-unknown-linux-gnu")
68 ("mips64el-linux" "mips64el-unknown-linux-gnuabi64")
69 (_ (nix-system->gnu-triplet system))))
70
71 (define* (rust-uri version #:key (dist "static"))
72 (string-append "https://" dist ".rust-lang.org/dist/"
73 "rustc-" version "-src.tar.gz"))
74
75 (define* (rust-bootstrapped-package base-rust version checksum)
76 "Bootstrap rust VERSION with source checksum CHECKSUM using BASE-RUST."
77 (package
78 (inherit base-rust)
79 (version version)
80 (source
81 (origin
82 (inherit (package-source base-rust))
83 (uri (rust-uri version))
84 (sha256 (base32 checksum))))
85 (native-inputs
86 (alist-replace "cargo-bootstrap" (list base-rust "cargo")
87 (alist-replace "rustc-bootstrap" (list base-rust)
88 (package-native-inputs base-rust))))))
89
90 (define-public mrustc
91 (let ((rustc-version "1.19.0"))
92 (package
93 (name "mrustc")
94 (version "0.9")
95 (source (origin
96 (method git-fetch)
97 (uri (git-reference
98 (url "https://github.com/thepowersgang/mrustc.git")
99 (commit (string-append "v" version))))
100 (file-name (git-file-name name version))
101 (sha256
102 (base32
103 "194ny7vsks5ygiw7d8yxjmp1qwigd71ilchis6xjl6bb2sj97rd2"))))
104 (outputs '("out" "cargo"))
105 (build-system gnu-build-system)
106 (inputs
107 `(("zlib" ,zlib)))
108 (native-inputs
109 `(("bison" ,bison)
110 ("flex" ,flex)
111 ;; Required for the libstd sources.
112 ("rustc" ,(package-source rust-1.19))))
113 (arguments
114 `(#:test-target "test"
115 #:make-flags
116 (list ,(string-append "RUSTC_TARGET="
117 (or (%current-target-system)
118 (nix-system->gnu-triplet-for-rust))))
119 #:phases
120 (modify-phases %standard-phases
121 (add-after 'unpack 'patch-date
122 (lambda _
123 (substitute* "Makefile"
124 (("shell date") "shell date -d @1"))
125 (substitute* "run_rustc/Makefile"
126 (("[$]Vtime ") "$V "))
127 #t))
128 (add-after 'patch-date 'unpack-target-compiler
129 (lambda* (#:key inputs outputs #:allow-other-keys)
130 (invoke "tar" "xf" (assoc-ref inputs "rustc"))
131 (chdir ,(string-append "rustc-" rustc-version "-src"))
132 (invoke "patch" "-p0" ,(string-append "../rustc-" rustc-version
133 "-src.patch"))
134 (chdir "..")
135 (setenv "RUSTC_VERSION" ,rustc-version)
136 (setenv "MRUSTC_TARGET_VER"
137 ,(version-major+minor rustc-version))
138 (setenv "OUTDIR_SUF" "")
139 #t))
140 (replace 'configure
141 (lambda* (#:key inputs #:allow-other-keys)
142 (setenv "CC" (string-append (assoc-ref inputs "gcc")
143 "/bin/gcc"))
144 (setenv "CXX" (string-append (assoc-ref inputs "gcc")
145 "/bin/g++"))
146 #t))
147 (add-after 'build 'build-minicargo
148 (lambda* (#:key make-flags #:allow-other-keys)
149 ;; TODO: minicargo.mk: RUSTC_VERSION=$(RUSTC_VERSION) RUSTC_CHANNEL=$(RUSTC_SRC_TY) OUTDIR_SUF=$(OUTDIR_SUF)
150 (apply invoke "make" "-f" "minicargo.mk" "LIBS" make-flags)
151 (apply invoke "make" "-C" "tools/minicargo" make-flags)))
152 ;(add-after 'check 'check-locally
153 ; (lambda* (#:key make-flags #:allow-other-keys)
154 ; ;; The enum test wouldn't work otherwise.
155 ; ;; See <https://github.com/thepowersgang/mrustc/issues/137>.
156 ; (setenv "MRUSTC_TARGET_VER" ,(version-major+minor rustc-version))
157 ; (apply invoke "make" "local_tests" make-flags)))
158 (replace 'install
159 (lambda* (#:key inputs outputs #:allow-other-keys)
160 (let* ((out (assoc-ref outputs "out"))
161 (bin (string-append out "/bin"))
162 (tools-bin (string-append out "/tools/bin"))
163 (cargo-out (assoc-ref outputs "cargo"))
164 (cargo-bin (string-append cargo-out "/bin"))
165 (lib (string-append out "/lib"))
166 (lib/rust (string-append lib "/mrust"))
167 (gcc (assoc-ref inputs "gcc"))
168 (run_rustc (string-append out
169 "/share/mrustc/run_rustc")))
170 ;; These files are not reproducible.
171 (for-each delete-file (find-files "output" "\\.txt$"))
172 ;(delete-file-recursively "output/local_tests")
173 (mkdir-p (dirname lib/rust))
174 (copy-recursively "output" lib/rust)
175 (mkdir-p bin)
176 (mkdir-p tools-bin)
177 (install-file "bin/mrustc" bin)
178 ;; minicargo uses relative paths to resolve mrustc.
179 (install-file "tools/bin/minicargo" tools-bin)
180 (install-file "tools/bin/minicargo" cargo-bin)
181 (mkdir-p run_rustc)
182 (copy-file "run_rustc/Makefile"
183 (string-append run_rustc "/Makefile"))
184 #t))))))
185 (synopsis "Compiler for the Rust programming language")
186 (description "Rust is a systems programming language that provides memory
187 safety and thread safety guarantees.")
188 (home-page "https://github.com/thepowersgang/mrustc")
189 ;; Dual licensed.
190 (license (list license:asl2.0 license:expat)))))
191
192 (define rust-1.19
193 (package
194 (name "rust")
195 (version "1.19.0")
196 (source
197 (origin
198 (method url-fetch)
199 (uri (rust-uri "1.19.0"))
200 (sha256 (base32 "0l8c14qsf42rmkqy92ahij4vf356dbyspxcips1aswpvad81y8qm"))
201 (modules '((guix build utils)))
202 (snippet '(begin (delete-file-recursively "src/llvm") #t))
203 (patches (map search-patch '("rust-1.19-mrustc.patch")))))
204 (outputs '("out" "cargo"))
205 (properties '((timeout . 72000) ;20 hours
206 (max-silent-time . 18000))) ;5 hours (for armel)
207 (arguments
208 `(#:imported-modules ,%cargo-utils-modules ;for `generate-all-checksums'
209 #:modules ((guix build utils) (ice-9 match) (guix build gnu-build-system))
210 #:phases
211 (modify-phases %standard-phases
212 (add-after 'unpack 'set-env
213 (lambda* (#:key inputs #:allow-other-keys)
214 ;; Disable test for cross compilation support.
215 (setenv "CFG_DISABLE_CROSS_TESTS" "1")
216 (setenv "SHELL" (which "sh"))
217 (setenv "CONFIG_SHELL" (which "sh"))
218 (setenv "CC" (string-append (assoc-ref inputs "gcc") "/bin/gcc"))
219 ;; guix llvm-3.9.1 package installs only shared libraries
220 (setenv "LLVM_LINK_SHARED" "1")
221 #t))
222 (add-after 'unpack 'patch-cargo-tomls
223 (lambda* (#:key inputs outputs #:allow-other-keys)
224 (substitute* "src/librustc_errors/Cargo.toml"
225 (("[[]dependencies[]]") "
226 [dependencies]
227 term = \"0.4.4\"
228 "))
229 (substitute* "src/librustc/Cargo.toml"
230 (("[[]dependencies[]]") "
231 [dependencies]
232 getopts = { path = \"../libgetopts\" }
233 "))
234 (substitute* "src/librustdoc/Cargo.toml"
235 (("[[]dependencies[]]") "
236 [dependencies]
237 test = { path = \"../libtest\" }
238 "))
239 #t))
240 (add-after 'unpack 'patch-tests
241 (lambda* (#:key inputs #:allow-other-keys)
242 (let ((bash (assoc-ref inputs "bash")))
243 (substitute* "src/libstd/process.rs"
244 ;; The newline is intentional.
245 ;; There's a line length "tidy" check in Rust which would
246 ;; fail otherwise.
247 (("\"/bin/sh\"") (string-append "\n\"" bash "/bin/sh\"")))
248 (substitute* "src/libstd/net/tcp.rs"
249 ;; There is no network in build environment
250 (("fn connect_timeout_unroutable")
251 "#[ignore]\nfn connect_timeout_unroutable"))
252 ;; <https://lists.gnu.org/archive/html/guix-devel/2017-06/msg00222.html>
253 (substitute* "src/libstd/sys/unix/process/process_common.rs"
254 (("fn test_process_mask") "#[allow(unused_attributes)]
255 #[ignore]
256 fn test_process_mask"))
257 #t)))
258 (add-after 'patch-tests 'patch-aarch64-test
259 (lambda* _
260 (substitute* "src/librustc_back/dynamic_lib.rs"
261 ;; This test is known to fail on aarch64 and powerpc64le:
262 ;; https://github.com/rust-lang/rust/issues/45410
263 (("fn test_loading_cosine") "#[ignore]\nfn test_loading_cosine"))
264 #t))
265 (add-after 'patch-tests 'use-readelf-for-tests
266 (lambda* _
267 ;; nm doesn't recognize the file format because of the
268 ;; nonstandard sections used by the Rust compiler, but readelf
269 ;; ignores them.
270 (substitute* "src/test/run-make/atomic-lock-free/Makefile"
271 (("\tnm ")
272 "\treadelf -c "))
273 #t))
274 (add-after 'patch-tests 'remove-unsupported-tests
275 (lambda* _
276 ;; Our ld-wrapper cannot process non-UTF8 bytes in LIBRARY_PATH.
277 ;; <https://lists.gnu.org/archive/html/guix-devel/2017-06/msg00193.html>
278 (delete-file-recursively "src/test/run-make/linker-output-non-utf8")
279 #t))
280 (add-after 'patch-source-shebangs 'patch-cargo-checksums
281 (lambda* _
282 (use-modules (guix build cargo-utils))
283 (substitute* "src/Cargo.lock"
284 (("(\"checksum .* = )\".*\"" all name)
285 (string-append name "\"" ,%cargo-reference-hash "\"")))
286 (generate-all-checksums "src/vendor")
287 #t))
288 ;; This phase is overridden by newer versions.
289 (replace 'configure
290 (const #t))
291 ;; This phase is overridden by newer versions.
292 (replace 'build
293 (lambda* (#:key inputs outputs #:allow-other-keys)
294 (let ((rustc-bootstrap (assoc-ref inputs "rustc-bootstrap")))
295 (setenv "CFG_COMPILER_HOST_TRIPLE"
296 ,(nix-system->gnu-triplet (%current-system)))
297 (setenv "CFG_RELEASE" "")
298 (setenv "CFG_RELEASE_CHANNEL" "stable")
299 (setenv "CFG_LIBDIR_RELATIVE" "lib")
300 (setenv "CFG_VERSION" "1.19.0-stable-mrustc")
301 (setenv "MRUSTC_TARGET_VER" ,(version-major+minor version))
302 ; bad: (setenv "CFG_PREFIX" "mrustc") ; FIXME output path.
303 (mkdir-p "output")
304 ;; mrustc 0.9 doesn't check the search paths for crates anymore.
305 (copy-recursively (string-append rustc-bootstrap "/lib/mrust")
306 "output")
307 (invoke (string-append rustc-bootstrap "/tools/bin/minicargo")
308 "src/rustc" "--vendor-dir" "src/vendor"
309 "--output-dir" "output/rustc-build"
310 "-L" (string-append rustc-bootstrap "/lib/mrust")
311 "-j" "1")
312 (setenv "CFG_COMPILER_HOST_TRIPLE" #f)
313 (setenv "CFG_RELEASE" #f)
314 (setenv "CFG_RELEASE_CHANNEL" #f)
315 (setenv "CFG_VERSION" #f)
316 (setenv "CFG_PREFIX" #f)
317 (setenv "CFG_LIBDIR_RELATIVE" #f)
318 (invoke (string-append rustc-bootstrap "/tools/bin/minicargo")
319 "src/tools/cargo" "--vendor-dir" "src/vendor"
320 "--output-dir" "output/cargo-build"
321 "-L" "output/"
322 "-L" (string-append rustc-bootstrap "/lib/mrust")
323 "-j" "1")
324 ;; Now use the newly-built rustc to build the libraries.
325 ;; One day that could be replaced by:
326 ;; (invoke "output/cargo-build/cargo" "build"
327 ;; "--manifest-path" "src/bootstrap/Cargo.toml"
328 ;; "--verbose") ; "--locked" "--frozen"
329 ;; but right now, Cargo has problems with libstd's circular
330 ;; dependencies.
331 (mkdir-p "output/target-libs")
332 (for-each (match-lambda
333 ((name . flags)
334 (write name)
335 (newline)
336 (apply invoke
337 "output/rustc-build/rustc"
338 "-C" (string-append "linker="
339 (getenv "CC"))
340 ;; Required for libterm.
341 "-Z" "force-unstable-if-unmarked"
342 "-L" "output/target-libs"
343 (string-append "src/" name "/lib.rs")
344 "-o"
345 (string-append "output/target-libs/"
346 (car (string-split name #\/))
347 ".rlib")
348 flags)))
349 '(("libcore")
350 ("libstd_unicode")
351 ("liballoc")
352 ("libcollections")
353 ("librand")
354 ("liblibc/src" "--cfg" "stdbuild")
355 ("libunwind" "-l" "gcc_s")
356 ("libcompiler_builtins")
357 ("liballoc_system")
358 ("libpanic_unwind")
359 ;; Uses "cc" to link.
360 ("libstd" "-l" "dl" "-l" "rt" "-l" "pthread")
361 ("libarena")
362
363 ;; Test dependencies:
364
365 ("libgetopts")
366 ("libterm")
367 ("libtest")))
368 #t)))
369 ;; This phase is overridden by newer versions.
370 (replace 'check
371 (const #t))
372 ;; This phase is overridden by newer versions.
373 (replace 'install
374 (lambda* (#:key inputs outputs #:allow-other-keys)
375 (let* ((out (assoc-ref outputs "out"))
376 (target-system ,(or (%current-target-system)
377 (nix-system->gnu-triplet
378 (%current-system))))
379 (out-libs (string-append out "/lib/rustlib/"
380 target-system "/lib")))
381 ;(setenv "CFG_PREFIX" out)
382 (mkdir-p out-libs)
383 (copy-recursively "output/target-libs" out-libs)
384 (install-file "output/rustc-build/rustc"
385 (string-append out "/bin"))
386 (install-file "output/rustc-build/rustdoc"
387 (string-append out "/bin"))
388 (install-file "output/cargo-build/cargo"
389 (string-append (assoc-ref outputs "cargo")
390 "/bin")))
391 #t)))))
392 (build-system gnu-build-system)
393 (native-inputs
394 `(("bison" ,bison) ; For the tests
395 ("cmake" ,cmake-minimal)
396 ("flex" ,flex) ; For the tests
397 ("gdb" ,gdb) ; For the tests
398 ("procps" ,procps) ; For the tests
399 ("python-2" ,python-2)
400 ("rustc-bootstrap" ,mrustc)
401 ("cargo-bootstrap" ,mrustc "cargo")
402 ("pkg-config" ,pkg-config) ; For "cargo"
403 ("which" ,which)))
404 (inputs
405 `(("jemalloc" ,jemalloc-4.5.0)
406 ("llvm" ,llvm-3.9.1)
407 ("openssl" ,openssl-1.0)
408 ("libssh2" ,libssh2) ; For "cargo"
409 ("libcurl" ,curl))) ; For "cargo"
410
411 ;; rustc invokes gcc, so we need to set its search paths accordingly.
412 ;; Note: duplicate its value here to cope with circular dependencies among
413 ;; modules (see <https://bugs.gnu.org/31392>).
414 (native-search-paths
415 (list (search-path-specification
416 (variable "C_INCLUDE_PATH")
417 (files '("include")))
418 (search-path-specification
419 (variable "CPLUS_INCLUDE_PATH")
420 (files '("include/c++" "include")))
421 (search-path-specification
422 (variable "LIBRARY_PATH")
423 (files '("lib" "lib64")))))
424
425 (synopsis "Compiler for the Rust progamming language")
426 (description "Rust is a systems programming language that provides memory
427 safety and thread safety guarantees.")
428 (home-page "https://www.rust-lang.org")
429 ;; Dual licensed.
430 (license (list license:asl2.0 license:expat))))
431
432 (define-public rust-1.20
433 (let ((base-rust
434 (rust-bootstrapped-package rust-1.19 "1.20.0"
435 "0542y4rnzlsrricai130mqyxl8r6rd991frb4qsnwb27yigqg91a")))
436 (package
437 (inherit base-rust)
438 (source
439 (origin
440 (inherit (package-source base-rust))
441 (snippet '(begin
442 (delete-file-recursively "src/jemalloc")
443 (delete-file-recursively "src/llvm")
444 #t))
445 (patches '())))
446 (outputs '("out" "doc" "cargo"))
447 ;; Since rust-1.19 is local, it's quite probable that Hydra
448 ;; will build rust-1.19 only as a dependency of rust-1.20.
449 ;; But then Hydra will use the wrong properties, the ones here,
450 ;; for rust-1.19. Therefore, we copied the properties of
451 ;; rust-1.19 here.
452 (properties '((timeout . 72000) ;20 hours
453 (max-silent-time . 18000))) ;5 hours (for armel)
454 (arguments
455 (substitute-keyword-arguments (package-arguments rust-1.19)
456 ((#:phases phases)
457 `(modify-phases ,phases
458 (add-after 'patch-tests 'patch-cargo-tests
459 (lambda _
460 (substitute* "src/tools/cargo/tests/build.rs"
461 (("/usr/bin/env") (which "env"))
462 ;; Guix llvm is compiled without asmjs-unknown-emscripten.
463 (("fn wasm32_final_outputs") "#[ignore]\nfn wasm32_final_outputs"))
464 (substitute* "src/tools/cargo/tests/death.rs"
465 ;; This is stuck when built in container.
466 (("fn ctrl_c_kills_everyone") "#[ignore]\nfn ctrl_c_kills_everyone"))
467 ;; Prints test output in the wrong order when built on
468 ;; i686-linux.
469 (substitute* "src/tools/cargo/tests/test.rs"
470 (("fn cargo_test_env") "#[ignore]\nfn cargo_test_env"))
471
472 ;; These tests pull in a dependency on "git", which changes
473 ;; too frequently take part in the Rust toolchain.
474 (substitute* "src/tools/cargo/tests/new.rs"
475 (("fn author_prefers_cargo") "#[ignore]\nfn author_prefers_cargo")
476 (("fn finds_author_git") "#[ignore]\nfn finds_author_git")
477 (("fn finds_local_author_git") "#[ignore]\nfn finds_local_author_git"))
478 #t))
479 (add-after 'patch-cargo-tests 'ignore-glibc-2.27-incompatible-test
480 ;; https://github.com/rust-lang/rust/issues/47863
481 (lambda _
482 (substitute* "src/test/run-pass/out-of-stack.rs"
483 (("// ignore-android") "// ignore-test\n// ignore-android"))
484 #t))
485 (replace 'configure
486 (lambda* (#:key inputs outputs #:allow-other-keys)
487 (let* ((out (assoc-ref outputs "out"))
488 (doc (assoc-ref outputs "doc"))
489 (gcc (assoc-ref inputs "gcc"))
490 (gdb (assoc-ref inputs "gdb"))
491 (binutils (assoc-ref inputs "binutils"))
492 (python (assoc-ref inputs "python-2"))
493 (rustc (assoc-ref inputs "rustc-bootstrap"))
494 (cargo (assoc-ref inputs "cargo-bootstrap"))
495 (llvm (assoc-ref inputs "llvm"))
496 (jemalloc (assoc-ref inputs "jemalloc")))
497 (call-with-output-file "config.toml"
498 (lambda (port)
499 (display (string-append "
500 [llvm]
501 [build]
502 cargo = \"" cargo "/bin/cargo" "\"
503 rustc = \"" rustc "/bin/rustc" "\"
504 docs = true
505 python = \"" python "/bin/python2" "\"
506 gdb = \"" gdb "/bin/gdb" "\"
507 vendor = true
508 submodules = false
509 [install]
510 prefix = \"" out "\"
511 docdir = \"" doc "/share/doc/rust" "\"
512 sysconfdir = \"etc\"
513 [rust]
514 default-linker = \"" gcc "/bin/gcc" "\"
515 channel = \"stable\"
516 rpath = true
517 " ;; There are 2 failed codegen tests:
518 ;; codegen/mainsubprogram.rs and codegen/mainsubprogramstart.rs
519 ;; These tests require a patched LLVM
520 "codegen-tests = false
521 [target." ,(nix-system->gnu-triplet-for-rust) "]
522 llvm-config = \"" llvm "/bin/llvm-config" "\"
523 cc = \"" gcc "/bin/gcc" "\"
524 cxx = \"" gcc "/bin/g++" "\"
525 ar = \"" binutils "/bin/ar" "\"
526 jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\"
527 [dist]
528 ") port)))
529 #t)))
530 (add-after 'configure 'provide-cc
531 (lambda* (#:key inputs #:allow-other-keys)
532 (symlink (string-append (assoc-ref inputs "gcc") "/bin/gcc")
533 "/tmp/cc")
534 (setenv "PATH" (string-append "/tmp:" (getenv "PATH")))
535 #t))
536 (add-after 'provide-cc 'configure-archiver
537 (lambda* (#:key inputs #:allow-other-keys)
538 (substitute* "src/build_helper/lib.rs"
539 ;; Make sure "ar" is always used as the archiver.
540 (("\"musl\"") "\"\"")
541 ;; Then substitute "ar" by our name.
542 (("\"ar\"") (string-append "\""
543 (assoc-ref inputs "binutils")
544 "/bin/ar\"")))
545 #t))
546 (delete 'patch-cargo-tomls)
547 (add-before 'build 'reset-timestamps-after-changes
548 (lambda* _
549 (for-each
550 (lambda (filename)
551 ;; Rust 1.20.0 treats timestamp 0 as "file doesn't exist".
552 ;; Therefore, use timestamp 1.
553 (utime filename 1 1 1 1))
554 (find-files "." #:directories? #t))
555 #t))
556 (replace 'build
557 (lambda* _
558 (invoke "./x.py" "build")
559 (invoke "./x.py" "build" "src/tools/cargo")))
560 (replace 'check
561 (lambda* _
562 ;; Disable parallel execution to prevent EAGAIN errors when
563 ;; running tests.
564 (invoke "./x.py" "-j1" "test" "-vv")
565 (invoke "./x.py" "-j1" "test" "src/tools/cargo")
566 #t))
567 (replace 'install
568 (lambda* (#:key outputs #:allow-other-keys)
569 (invoke "./x.py" "install")
570 (substitute* "config.toml"
571 ;; replace prefix to specific output
572 (("prefix = \"[^\"]*\"")
573 (string-append "prefix = \"" (assoc-ref outputs "cargo") "\"")))
574 (invoke "./x.py" "install" "cargo")))
575 (add-after 'install 'delete-install-logs
576 (lambda* (#:key outputs #:allow-other-keys)
577 (define (delete-manifest-file out-path file)
578 (delete-file (string-append out-path "/lib/rustlib/" file)))
579
580 (let ((out (assoc-ref outputs "out"))
581 (cargo-out (assoc-ref outputs "cargo")))
582 (for-each
583 (lambda (file) (delete-manifest-file out file))
584 '("install.log"
585 "manifest-rust-docs"
586 "manifest-rust-std-x86_64-unknown-linux-gnu"
587 "manifest-rustc"))
588 (for-each
589 (lambda (file) (delete-manifest-file cargo-out file))
590 '("install.log"
591 "manifest-cargo"))
592 #t)))
593 (add-after 'install 'wrap-rustc
594 (lambda* (#:key inputs outputs #:allow-other-keys)
595 (let ((out (assoc-ref outputs "out"))
596 (libc (assoc-ref inputs "libc"))
597 (ld-wrapper (assoc-ref inputs "ld-wrapper")))
598 ;; Let gcc find ld and libc startup files.
599 (wrap-program (string-append out "/bin/rustc")
600 `("PATH" ":" prefix (,(string-append ld-wrapper "/bin")))
601 `("LIBRARY_PATH" ":" suffix (,(string-append libc "/lib"))))
602 #t))))))))))
603
604 (define-public rust-1.21
605 (let ((base-rust (rust-bootstrapped-package rust-1.20 "1.21.0"
606 "1yj8lnxybjrybp00fqhxw8fpr641dh8wcn9mk44xjnsb4i1c21qp")))
607 (package
608 (inherit base-rust)
609 (arguments
610 (substitute-keyword-arguments (package-arguments base-rust)
611 ((#:phases phases)
612 `(modify-phases ,phases
613 (add-after 'configure 'remove-ar
614 (lambda* (#:key inputs #:allow-other-keys)
615 ;; Remove because toml complains about "unknown field".
616 (substitute* "config.toml"
617 (("^ar =.*") "\n"))
618 #t)))))))))
619
620 (define-public rust-1.22
621 (let ((base-rust (rust-bootstrapped-package rust-1.21 "1.22.1"
622 "1lrzzp0nh7s61wgfs2h6ilaqi6iq89f1pd1yaf65l87bssyl4ylb")))
623 (package
624 (inherit base-rust)
625 (arguments
626 (substitute-keyword-arguments (package-arguments base-rust)
627 ((#:phases phases)
628 `(modify-phases ,phases
629 (add-after 'unpack 'remove-flaky-test
630 (lambda _
631 ;; See <https://github.com/rust-lang/rust/issues/43402>.
632 (when (file-exists? "src/test/run-make/issue-26092")
633 (delete-file-recursively "src/test/run-make/issue-26092"))
634 #t)))))))))
635
636 (define-public rust-1.23
637 (let ((base-rust (rust-bootstrapped-package rust-1.22 "1.23.0"
638 "14fb8vhjzsxlbi6yrn1r6fl5dlbdd1m92dn5zj5gmzfwf4w9ar3l")))
639 (package
640 (inherit base-rust)
641 (arguments
642 (substitute-keyword-arguments (package-arguments base-rust)
643 ((#:phases phases)
644 `(modify-phases ,phases
645 (delete 'configure-archiver)
646 (delete 'remove-ar)
647 (add-after 'unpack 'dont-build-native
648 (lambda _
649 ;; XXX: Revisit this when we use gcc 6.
650 (substitute* "src/binaryen/CMakeLists.txt"
651 (("ADD_COMPILE_FLAG\\(\\\"-march=native\\\"\\)") ""))
652 #t)))))))))
653
654 (define-public rust-1.24
655 (let ((base-rust
656 (rust-bootstrapped-package rust-1.23 "1.24.1"
657 "1vv10x2h9kq7fxh2v01damdq8pvlp5acyh1kzcda9sfjx12kv99y")))
658 (package
659 (inherit base-rust)
660 (arguments
661 (substitute-keyword-arguments (package-arguments base-rust)
662 ((#:phases phases)
663 `(modify-phases ,phases
664 (delete 'use-readelf-for-tests)
665 (replace 'patch-aarch64-test
666 (lambda* _
667 (substitute* "src/librustc_metadata/dynamic_lib.rs"
668 ;; This test is known to fail on aarch64 and powerpc64le:
669 ;; https://github.com/rust-lang/rust/issues/45410
670 (("fn test_loading_cosine") "#[ignore]\nfn test_loading_cosine"))
671 #t)))))))))
672
673 ;;; Rust 1.25 release support work with llvm 6--but build with llvm 6 is
674 ;;; not determenistic due to <https://github.com/rust-lang/rust/issues/50556>.
675 ;;; Keep using llvm 3.9.1 until builds become determenistic
676 (define-public rust-1.25
677 (let ((base-rust
678 (rust-bootstrapped-package rust-1.24 "1.25.0"
679 "0baxjr99311lvwdq0s38bipbnj72pn6fgbk6lcq7j555xq53mxpf")))
680 (package
681 (inherit base-rust)
682 (source
683 (origin
684 (inherit (package-source base-rust))
685 (snippet '(begin
686 (delete-file-recursively "src/jemalloc")
687 (delete-file-recursively "src/llvm")
688 (delete-file-recursively "src/llvm-emscripten")
689 #t))
690 (patches (map search-patch
691 '("rust-1.25-accept-more-detailed-gdb-lines.patch")))))
692 (arguments
693 (substitute-keyword-arguments (package-arguments base-rust)
694 ((#:phases phases)
695 `(modify-phases ,phases
696 (add-after 'patch-cargo-tests 'patch-cargo-index-update
697 (lambda _
698 (substitute* "src/tools/cargo/tests/generate-lockfile.rs"
699 ;; This test wants to update the crate index.
700 (("fn no_index_update") "#[ignore]\nfn no_index_update"))
701 #t))
702 (replace 'patch-aarch64-test
703 (lambda _
704 (substitute* "src/librustc_metadata/dynamic_lib.rs"
705 ;; This test is known to fail on aarch64 and powerpc64le:
706 ;; https://github.com/rust-lang/rust/issues/45410
707 (("fn test_loading_cosine") "#[ignore]\nfn test_loading_cosine"))
708 ;; This test fails on aarch64 with llvm@6.0:
709 ;; https://github.com/rust-lang/rust/issues/49807
710 ;; other possible solution:
711 ;; https://github.com/rust-lang/rust/pull/47688
712 (delete-file "src/test/debuginfo/by-value-self-argument-in-trait-impl.rs")
713 #t))
714 (delete 'ignore-glibc-2.27-incompatible-test))))))))
715
716 (define-public rust-1.26
717 (let ((base-rust
718 (rust-bootstrapped-package rust-1.25 "1.26.2"
719 "0047ais0fvmqvngqkdsxgrzhb0kljg8wy85b01kbbjc88hqcz7pv")))
720 (package
721 (inherit base-rust)
722 (source
723 (origin
724 (inherit (package-source base-rust))
725 (patches (map search-patch
726 '("rust-coresimd-doctest.patch"
727 "rust-1.25-accept-more-detailed-gdb-lines.patch")))))
728 (arguments
729 (substitute-keyword-arguments (package-arguments base-rust)
730 ((#:phases phases)
731 `(modify-phases ,phases
732 ;; binaryen was replaced with LLD project from LLVM
733 (delete 'dont-build-native)
734 (replace 'check
735 (lambda* _
736 ;; Enable parallel execution.
737 (let ((parallel-job-spec
738 (string-append "-j" (number->string
739 (min 4
740 (parallel-job-count))))))
741 (invoke "./x.py" parallel-job-spec "test" "-vv")
742 (invoke "./x.py" parallel-job-spec "test"
743 "src/tools/cargo"))))
744 (replace 'remove-unsupported-tests
745 (lambda* _
746 ;; Our ld-wrapper cannot process non-UTF8 bytes in LIBRARY_PATH.
747 ;; <https://lists.gnu.org/archive/html/guix-devel/2017-06/msg00193.html>
748 (delete-file-recursively "src/test/run-make-fulldeps/linker-output-non-utf8")
749 #t))
750 (replace 'patch-cargo-tests
751 (lambda* _
752 (substitute* "src/tools/cargo/tests/testsuite/build.rs"
753 (("/usr/bin/env") (which "env"))
754 ;; Guix llvm is compiled without asmjs-unknown-emscripten.
755 (("fn wasm32_final_outputs") "#[ignore]\nfn wasm32_final_outputs"))
756 (substitute* "src/tools/cargo/tests/testsuite/death.rs"
757 ;; This is stuck when built in container.
758 (("fn ctrl_c_kills_everyone") "#[ignore]\nfn ctrl_c_kills_everyone"))
759 ;; Prints test output in the wrong order when built on
760 ;; i686-linux.
761 (substitute* "src/tools/cargo/tests/testsuite/test.rs"
762 (("fn cargo_test_env") "#[ignore]\nfn cargo_test_env"))
763
764 ;; Avoid dependency on "git".
765 (substitute* "src/tools/cargo/tests/testsuite/new.rs"
766 (("fn author_prefers_cargo") "#[ignore]\nfn author_prefers_cargo")
767 (("fn finds_author_git") "#[ignore]\nfn finds_author_git")
768 (("fn finds_local_author_git") "#[ignore]\nfn finds_local_author_git"))
769 #t))
770 (add-after 'patch-cargo-tests 'disable-cargo-test-for-nightly-channel
771 (lambda* _
772 ;; This test failed to work on "nightly" channel builds
773 ;; https://github.com/rust-lang/cargo/issues/5648
774 (substitute* "src/tools/cargo/tests/testsuite/resolve.rs"
775 (("fn test_resolving_minimum_version_with_transitive_deps")
776 "#[ignore]\nfn test_resolving_minimum_version_with_transitive_deps"))
777 #t))
778 (replace 'patch-cargo-index-update
779 (lambda* _
780 (substitute* "src/tools/cargo/tests/testsuite/generate_lockfile.rs"
781 ;; This test wants to update the crate index.
782 (("fn no_index_update") "#[ignore]\nfn no_index_update"))
783 #t)))))))))
784
785 (define-public rust-1.27
786 (let ((base-rust
787 (rust-bootstrapped-package rust-1.26 "1.27.2"
788 "0pg1s37bhx9zqbynxyydq5j6q7kij9vxkcv8maz0m25prm88r0cs")))
789 (package
790 (inherit base-rust)
791 (source
792 (origin
793 (inherit (package-source base-rust))
794 (patches (map search-patch '("rust-coresimd-doctest.patch"
795 "rust-bootstrap-stage0-test.patch"
796 "rust-1.25-accept-more-detailed-gdb-lines.patch"
797 "rust-reproducible-builds.patch")))))
798 (native-inputs
799 ;; FIXME: Rust 1.27 and some later versions require GDB 8.2 specifically.
800 ;; See <https://bugs.gnu.org/37810>.
801 (alist-replace "gdb" (list gdb-8.2)
802 (package-native-inputs base-rust)))
803 (arguments
804 (substitute-keyword-arguments (package-arguments base-rust)
805 ((#:phases phases)
806 `(modify-phases ,phases
807 (add-before 'install 'mkdir-prefix-paths
808 (lambda* (#:key outputs #:allow-other-keys)
809 ;; As result of https://github.com/rust-lang/rust/issues/36989
810 ;; `prefix' directory should exist before `install' call
811 (mkdir-p (assoc-ref outputs "out"))
812 (mkdir-p (assoc-ref outputs "cargo"))
813 #t))
814 (add-after 'patch-cargo-tests 'disable-thinlto-test
815 (lambda* _
816 ;; thinlto required llvm 6.0 for work
817 (substitute* "src/tools/cargo/tests/testsuite/path.rs"
818 (("fn thin_lto_works") "#[ignore]\nfn thin_lto_works"))
819 #t)))))))))
820
821 (define-public rust-1.28
822 (let ((base-rust
823 (rust-bootstrapped-package rust-1.27 "1.28.0"
824 "11k4rn77bca2rikykkk9fmprrgjswd4x4kaq7fia08vgkir82nhx")))
825 (package
826 (inherit base-rust)
827 (source
828 (origin
829 (inherit (package-source base-rust))
830 (patches (map search-patch '("rust-coresimd-doctest.patch"
831 "rust-bootstrap-stage0-test.patch"
832 "rust-1.25-accept-more-detailed-gdb-lines.patch"
833 "rust-reproducible-builds.patch")))))
834 (inputs
835 ;; Use LLVM 6.0
836 (alist-replace "llvm" (list llvm-6)
837 (package-inputs base-rust)))
838 (arguments
839 (substitute-keyword-arguments (package-arguments base-rust)
840 ((#:phases phases)
841 `(modify-phases ,phases
842 (add-after 'configure 'enable-codegen-tests
843 ;; Codegen tests should pass with llvm 6, so enable them.
844 (lambda* _
845 (substitute* "config.toml"
846 (("codegen-tests = false") ""))
847 #t))
848 (add-after 'patch-tests 'disable-amd64-avx-test
849 ;; That test would fail on x86_64 machines without avx.
850 (lambda* _
851 (substitute* "src/test/run-pass/issue-44056.rs"
852 (("only-x86_64") "ignore-test"))
853 #t))
854 ;; The thinlto test should pass with llvm 6.
855 (delete 'disable-thinlto-test))))))))
856
857 (define-public rust-1.29
858 (let ((base-rust
859 (rust-bootstrapped-package rust-1.28 "1.29.2"
860 "1jb787080z754caa2w3w1amsygs4qlzj9rs1vy64firfmabfg22h")))
861 (package
862 (inherit base-rust)
863 (source
864 (origin
865 (inherit (package-source base-rust))
866 (patches (map search-patch '("rust-1.25-accept-more-detailed-gdb-lines.patch"
867 "rust-reproducible-builds.patch"))))))))
868
869 (define-public rust-1.30
870 (let ((base-rust
871 (rust-bootstrapped-package rust-1.29 "1.30.1"
872 "0aavdc1lqv0cjzbqwl5n59yd0bqdlhn0zas61ljf38yrvc18k8rn")))
873 (package
874 (inherit base-rust)
875 (source
876 (origin
877 (inherit (package-source base-rust))
878 (snippet '(begin
879 (delete-file-recursively "src/jemalloc")
880 (delete-file-recursively "src/llvm")
881 (delete-file-recursively "src/llvm-emscripten")
882 (delete-file-recursively "src/tools/clang")
883 (delete-file-recursively "src/tools/lldb")
884 #t))))
885 (arguments
886 (substitute-keyword-arguments (package-arguments base-rust)
887 ((#:phases phases)
888 `(modify-phases ,phases
889 (add-after 'patch-cargo-tests 'patch-cargo-env-shebang
890 (lambda* (#:key inputs #:allow-other-keys)
891 (let ((coreutils (assoc-ref inputs "coreutils")))
892 (substitute* "src/tools/cargo/tests/testsuite/fix.rs"
893 ;; Cargo has a test which explicitly sets a
894 ;; RUSTC_WRAPPER environment variable which points
895 ;; to /usr/bin/env. Since it's not a shebang, it
896 ;; needs to be manually patched
897 (("\"/usr/bin/env\"")
898 (string-append "\"" coreutils "/bin/env\"")))
899 #t)))
900 (add-after 'patch-cargo-env-shebang 'ignore-cargo-package-tests
901 (lambda* _
902 (substitute* "src/tools/cargo/tests/testsuite/package.rs"
903 ;; These tests largely check that cargo outputs warning/error
904 ;; messages as expected. It seems that cargo outputs an
905 ;; absolute path to something in the store instead of the
906 ;; expected relative path (e.g. `[..]`) so we'll ignore
907 ;; these for now
908 (("fn include") "#[ignore]\nfn include")
909 (("fn exclude") "#[ignore]\nfn exclude"))
910 #t))
911 ;; The test has been moved elsewhere.
912 (replace 'disable-amd64-avx-test
913 (lambda _
914 (substitute* "src/test/ui/run-pass/issues/issue-44056.rs"
915 (("only-x86_64") "ignore-test"))
916 #t)))))))))
917
918 (define-public rust-1.31
919 (let ((base-rust
920 (rust-bootstrapped-package rust-1.30 "1.31.1"
921 "0sk84ff0cklybcp0jbbxcw7lk7mrm6kb6km5nzd6m64dy0igrlli")))
922 (package
923 (inherit base-rust)
924 (arguments
925 (substitute-keyword-arguments (package-arguments base-rust)
926 ((#:phases phases)
927 `(modify-phases ,phases
928 (add-after 'patch-tests 'patch-command-exec-tests
929 (lambda* (#:key inputs #:allow-other-keys)
930 (let ((coreutils (assoc-ref inputs "coreutils")))
931 (substitute* "src/test/run-pass/command-exec.rs"
932 ;; This test suite includes some tests that the stdlib's
933 ;; `Command` execution properly handles situations where
934 ;; the environment or PATH variable are empty, but this
935 ;; fails since we don't have `echo` available in the usual
936 ;; Linux directories.
937 ;; NB: the leading space is so we don't fail a tidy check
938 ;; for trailing whitespace, and the newlines are to ensure
939 ;; we don't exceed the 100 chars tidy check as well
940 ((" Command::new\\(\"echo\"\\)")
941 (string-append "\nCommand::new(\"" coreutils "/bin/echo\")\n")))
942 #t)))
943 ;; The test has been moved elsewhere.
944 (replace 'disable-amd64-avx-test
945 (lambda _
946 (substitute* "src/test/ui/issues/issue-44056.rs"
947 (("only-x86_64") "ignore-test"))
948 #t))
949 (add-after 'patch-tests 'patch-process-docs-rev-cmd
950 (lambda* _
951 ;; Disable some doc tests which depend on the "rev" command
952 ;; https://github.com/rust-lang/rust/pull/58746
953 (substitute* "src/libstd/process.rs"
954 (("```rust") "```rust,no_run"))
955 #t)))))))))
956
957 (define-public rust-1.32
958 (let ((base-rust
959 (rust-bootstrapped-package rust-1.31 "1.32.0"
960 "0ji2l9xv53y27xy72qagggvq47gayr5lcv2jwvmfirx029vlqnac")))
961 (package
962 (inherit base-rust)
963 (source
964 (origin
965 (inherit (package-source base-rust))
966 (snippet '(begin (delete-file-recursively "src/llvm")
967 (delete-file-recursively "src/llvm-emscripten")
968 (delete-file-recursively "src/tools/clang")
969 (delete-file-recursively "src/tools/lldb")
970 (delete-file-recursively "vendor/jemalloc-sys/jemalloc")
971 #t))
972 (patches (map search-patch '("rust-reproducible-builds.patch")))
973 ;; the vendor directory has moved to the root of
974 ;; the tarball, so we have to strip an extra prefix
975 (patch-flags '("-p2"))))
976 (inputs
977 ;; Downgrade to LLVM 6, all LTO tests appear to fail with LLVM 7.0.1
978 (alist-replace "llvm" (list llvm-6)
979 (package-inputs base-rust)))
980 (arguments
981 (substitute-keyword-arguments (package-arguments base-rust)
982 ((#:phases phases)
983 `(modify-phases ,phases
984 ;; Cargo.lock and the vendor/ directory have been moved to the
985 ;; root of the rust tarball
986 (replace 'patch-cargo-checksums
987 (lambda* _
988 (use-modules (guix build cargo-utils))
989 (substitute* "Cargo.lock"
990 (("(\"checksum .* = )\".*\"" all name)
991 (string-append name "\"" ,%cargo-reference-hash "\"")))
992 (generate-all-checksums "vendor")
993 #t))
994 (add-after 'enable-codegen-tests 'override-jemalloc
995 (lambda* (#:key inputs #:allow-other-keys)
996 ;; The compiler is no longer directly built against jemalloc,
997 ;; but rather via the jemalloc-sys crate (which vendors the
998 ;; jemalloc source). To use jemalloc we must enable linking to
999 ;; it (otherwise it would use the system allocator), and set
1000 ;; an environment variable pointing to the compiled jemalloc.
1001 (substitute* "config.toml"
1002 (("^jemalloc =.*$") "")
1003 (("[[]rust[]]") "\n[rust]\njemalloc=true\n"))
1004 (setenv "JEMALLOC_OVERRIDE" (string-append (assoc-ref inputs "jemalloc")
1005 "/lib/libjemalloc_pic.a"))
1006 #t))
1007 ;; Remove no longer relevant steps
1008 (delete 'remove-flaky-test)
1009 (delete 'patch-aarch64-test))))))))
1010
1011 (define-public rust-1.33
1012 (let ((base-rust
1013 (rust-bootstrapped-package rust-1.32 "1.33.0"
1014 "152x91mg7bz4ygligwjb05fgm1blwy2i70s2j03zc9jiwvbsh0as")))
1015 (package
1016 (inherit base-rust)
1017 (source
1018 (origin
1019 (inherit (package-source base-rust))
1020 (patches '())
1021 (patch-flags '("-p1"))))
1022 (inputs
1023 ;; Upgrade to jemalloc@5.1.0
1024 (alist-replace "jemalloc" (list jemalloc)
1025 (package-inputs base-rust)))
1026 (arguments
1027 (substitute-keyword-arguments (package-arguments base-rust)
1028 ((#:phases phases)
1029 `(modify-phases ,phases
1030 (delete 'ignore-cargo-package-tests)
1031 (add-after 'configure 'configure-test-threads
1032 ;; Several rustc and cargo tests will fail if run on one core
1033 ;; https://github.com/rust-lang/rust/issues/59122
1034 ;; https://github.com/rust-lang/cargo/issues/6746
1035 ;; https://github.com/rust-lang/rust/issues/58907
1036 (lambda* (#:key inputs #:allow-other-keys)
1037 (setenv "RUST_TEST_THREADS" "2")
1038 #t)))))))))
1039
1040 (define-public rust-1.34
1041 (let ((base-rust
1042 (rust-bootstrapped-package rust-1.33 "1.34.1"
1043 "19s09k7y5j6g3y4d2rk6kg9pvq6ml94c49w6b72dmq8p9lk8bixh")))
1044 (package
1045 (inherit base-rust)
1046 (source
1047 (origin
1048 (inherit (package-source base-rust))
1049 (snippet '(begin
1050 (delete-file-recursively "src/llvm-emscripten")
1051 (delete-file-recursively "src/llvm-project")
1052 (delete-file-recursively "vendor/jemalloc-sys/jemalloc")
1053 #t)))))))
1054
1055 (define-public rust-1.35
1056 (let ((base-rust
1057 (rust-bootstrapped-package rust-1.34 "1.35.0"
1058 "0bbizy6b7002v1rdhrxrf5gijclbyizdhkglhp81ib3bf5x66kas")))
1059 (package
1060 (inherit base-rust)
1061 (inputs
1062 (alist-replace "llvm" (list llvm-8)
1063 (package-inputs base-rust)))
1064 (arguments
1065 (substitute-keyword-arguments (package-arguments base-rust)
1066 ((#:phases phases)
1067 `(modify-phases ,phases
1068 ;; The tidy test includes a pass which ensures large binaries
1069 ;; don't accidentally get checked into the rust git repo.
1070 ;; Unfortunately the test assumes that git is always available,
1071 ;; so we'll comment out the invocation of this pass.
1072 (add-after 'configure 'disable-tidy-bins-check
1073 (lambda* _
1074 (substitute* "src/tools/tidy/src/main.rs"
1075 (("bins::check") "//bins::check"))
1076 #t)))))))))
1077
1078 (define-public rust-1.36
1079 (let ((base-rust
1080 (rust-bootstrapped-package rust-1.35 "1.36.0"
1081 "06xv2p6zq03lidr0yaf029ii8wnjjqa894nkmrm6s0rx47by9i04")))
1082 (package
1083 (inherit base-rust)
1084 (arguments
1085 (substitute-keyword-arguments (package-arguments base-rust)
1086 ((#:phases phases)
1087 `(modify-phases ,phases
1088 (delete 'patch-process-docs-rev-cmd))))))))
1089
1090 (define-public rust
1091 (let ((base-rust
1092 (rust-bootstrapped-package rust-1.36 "1.37.0"
1093 "1hrqprybhkhs6d9b5pjskfnc5z9v2l2gync7nb39qjb5s0h703hj")))
1094 (package
1095 (inherit base-rust)
1096 (arguments
1097 (substitute-keyword-arguments (package-arguments base-rust)
1098 ((#:phases phases)
1099 `(modify-phases ,phases
1100 (add-before 'configure 'configure-cargo-home
1101 (lambda _
1102 (let ((cargo-home (string-append (getcwd) "/.cargo")))
1103 (mkdir-p cargo-home)
1104 (setenv "CARGO_HOME" cargo-home)
1105 #t))))))))))