;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 David Craven <david@craven.ch>
;;; Copyright © 2016 Eric Le Bihan <eric.le.bihan.dev@free.fr>
-;;; Copyright © 2016 Nils Gillmann <ng0@n0.is>
+;;; Copyright © 2016 ng0 <ng0@n0.is>
;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
;;; Copyright © 2017, 2018 Nikolai Merinov <nikolai.merinov@member.fsf.org>
-;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
-;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2017, 2019 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018 Danny Milosavljevic <dannym+a@scratchpost.org>
+;;; Copyright © 2019 Ivan Petkov <ivanppetkov@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
#:use-module (ice-9 match)
#:use-module (srfi srfi-26))
-(define %cargo-reference-project-file "/dev/null")
(define %cargo-reference-hash
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")
("mips64el-linux" "mips64el-unknown-linux-gnuabi64")
(_ (nix-system->gnu-triplet system))))
-\f
-(define* (rust-source version hash #:key (patches '()))
- (origin
- (method url-fetch)
- (uri (string-append "https://static.rust-lang.org/dist/"
- "rustc-" version "-src.tar.gz"))
- (sha256 (base32 hash))
- (modules '((guix build utils)))
- (snippet '(begin (delete-file-recursively "src/llvm") #t))
- (patches (map search-patch patches))))
-
-(define* (rust-bootstrapped-package base-rust version checksum
- #:key (patches '()))
- "Bootstrap rust VERSION with source checksum CHECKSUM patched with PATCHES using BASE-RUST."
+(define* (rust-uri version #:key (dist "static"))
+ (string-append "https://" dist ".rust-lang.org/dist/"
+ "rustc-" version "-src.tar.gz"))
+
+(define* (rust-bootstrapped-package base-rust version checksum)
+ "Bootstrap rust VERSION with source checksum CHECKSUM using BASE-RUST."
(package
(inherit base-rust)
(version version)
(source
- (rust-source version checksum #:patches patches))
+ (origin
+ (inherit (package-source base-rust))
+ (uri (rust-uri version))
+ (sha256 (base32 checksum))))
(native-inputs
(alist-replace "cargo-bootstrap" (list base-rust "cargo")
(alist-replace "rustc-bootstrap" (list base-rust)
(let ((rustc-version "1.19.0"))
(package
(name "mrustc")
- (version "0.8.0")
+ (version "0.9")
(source (origin
(method git-fetch)
(uri (git-reference
(file-name (git-file-name name version))
(sha256
(base32
- "0a7v8ccyzp1sdkwni8h1698hxpfz2sxhcpx42n6l2pbm0rbjp08i"))))
+ "194ny7vsks5ygiw7d8yxjmp1qwigd71ilchis6xjl6bb2sj97rd2"))))
(outputs '("out" "cargo"))
(build-system gnu-build-system)
(inputs
- `(("llvm" ,llvm-3.9.1)))
+ `(("zlib" ,zlib)))
(native-inputs
`(("bison" ,bison)
("flex" ,flex)
;; Required for the libstd sources.
- ("rustc"
- ,(rust-source "1.19.0" "0l8c14qsf42rmkqy92ahij4vf356dbyspxcips1aswpvad81y8qm"))))
+ ("rustc" ,(package-source rust-1.19))))
(arguments
- `(#:test-target "local_tests"
- #:make-flags (list (string-append "LLVM_CONFIG="
- (assoc-ref %build-inputs "llvm")
- "/bin/llvm-config"))
+ `(#:test-target "test"
+ #:make-flags
+ (list ,(string-append "RUSTC_TARGET="
+ (or (%current-target-system)
+ (nix-system->gnu-triplet-for-rust))))
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'patch-date
(lambda _
(substitute* "Makefile"
(("shell date") "shell date -d @1"))
+ (substitute* "run_rustc/Makefile"
+ (("[$]Vtime ") "$V "))
#t))
(add-after 'patch-date 'unpack-target-compiler
(lambda* (#:key inputs outputs #:allow-other-keys)
- (substitute* "minicargo.mk"
- ;; Don't try to build LLVM.
- (("^[$][(]LLVM_CONFIG[)]:") "xxx:")
- ;; Build for the correct target architecture.
- (("^RUSTC_TARGET := x86_64-unknown-linux-gnu")
- (string-append "RUSTC_TARGET := "
- ,(or (%current-target-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")
+ (chdir ,(string-append "rustc-" rustc-version "-src"))
+ (invoke "patch" "-p0" ,(string-append "../rustc-" rustc-version
+ "-src.patch"))
(chdir "..")
+ (setenv "RUSTC_VERSION" ,rustc-version)
+ (setenv "MRUSTC_TARGET_VER"
+ ,(version-major+minor rustc-version))
+ (setenv "OUTDIR_SUF" "")
#t))
(replace 'configure
(lambda* (#:key inputs #:allow-other-keys)
- (setenv "CC" (string-append (assoc-ref inputs "gcc") "/bin/gcc"))
+ (setenv "CC" (string-append (assoc-ref inputs "gcc")
+ "/bin/gcc"))
+ (setenv "CXX" (string-append (assoc-ref inputs "gcc")
+ "/bin/g++"))
#t))
(add-after 'build 'build-minicargo
- (lambda _
- (for-each (lambda (target)
- (invoke "make" "-f" "minicargo.mk" target))
- '("output/libstd.hir" "output/libpanic_unwind.hir"
- "output/libproc_macro.hir" "output/libtest.hir"))
- ;; Technically the above already does it - but we want to be clear.
- (invoke "make" "-C" "tools/minicargo")))
+ (lambda* (#:key make-flags #:allow-other-keys)
+ ;; TODO: minicargo.mk: RUSTC_VERSION=$(RUSTC_VERSION) RUSTC_CHANNEL=$(RUSTC_SRC_TY) OUTDIR_SUF=$(OUTDIR_SUF)
+ (apply invoke "make" "-f" "minicargo.mk" "LIBS" make-flags)
+ (apply invoke "make" "-C" "tools/minicargo" make-flags)))
+ ;(add-after 'check 'check-locally
+ ; (lambda* (#:key make-flags #:allow-other-keys)
+ ; ;; The enum test wouldn't work otherwise.
+ ; ;; See <https://github.com/thepowersgang/mrustc/issues/137>.
+ ; (setenv "MRUSTC_TARGET_VER" ,(version-major+minor rustc-version))
+ ; (apply invoke "make" "local_tests" make-flags)))
(replace 'install
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(cargo-bin (string-append cargo-out "/bin"))
(lib (string-append out "/lib"))
(lib/rust (string-append lib "/mrust"))
- (gcc (assoc-ref inputs "gcc")))
+ (gcc (assoc-ref inputs "gcc"))
+ (run_rustc (string-append out
+ "/share/mrustc/run_rustc")))
;; These files are not reproducible.
(for-each delete-file (find-files "output" "\\.txt$"))
- (delete-file-recursively "output/local_tests")
- (mkdir-p lib)
+ ;(delete-file-recursively "output/local_tests")
+ (mkdir-p (dirname lib/rust))
(copy-recursively "output" lib/rust)
(mkdir-p bin)
(mkdir-p tools-bin)
;; minicargo uses relative paths to resolve mrustc.
(install-file "tools/bin/minicargo" tools-bin)
(install-file "tools/bin/minicargo" cargo-bin)
+ (mkdir-p run_rustc)
+ (copy-file "run_rustc/Makefile"
+ (string-append run_rustc "/Makefile"))
#t))))))
(synopsis "Compiler for the Rust progamming language")
(description "Rust is a systems programming language that provides memory
(package
(name "rust")
(version "1.19.0")
- (source (rust-source version "0l8c14qsf42rmkqy92ahij4vf356dbyspxcips1aswpvad81y8qm"
- #:patches '("rust-1.19-mrustc.patch")))
+ (source
+ (origin
+ (method url-fetch)
+ (uri (rust-uri "1.19.0"))
+ (sha256 (base32 "0l8c14qsf42rmkqy92ahij4vf356dbyspxcips1aswpvad81y8qm"))
+ (modules '((guix build utils)))
+ (snippet '(begin (delete-file-recursively "src/llvm") #t))
+ (patches (map search-patch '("rust-1.19-mrustc.patch")))))
(outputs '("out" "cargo"))
+ (properties '((timeout . 72000) ;20 hours
+ (max-silent-time . 18000))) ;5 hours (for armel)
(arguments
- `(#:imported-modules ,%cargo-build-system-modules ;for `generate-checksums'
+ `(#:imported-modules ,%cargo-utils-modules ;for `generate-all-checksums'
#:modules ((guix build utils) (ice-9 match) (guix build gnu-build-system))
#:phases
(modify-phases %standard-phases
#t))
(add-after 'patch-source-shebangs 'patch-cargo-checksums
(lambda* _
+ (use-modules (guix build cargo-utils))
(substitute* "src/Cargo.lock"
(("(\"checksum .* = )\".*\"" all name)
(string-append name "\"" ,%cargo-reference-hash "\"")))
- (for-each
- (lambda (filename)
- (use-modules (guix build cargo-build-system))
- (delete-file filename)
- (let* ((dir (dirname filename)))
- (display (string-append
- "patch-cargo-checksums: generate-checksums for "
- dir "\n"))
- (generate-checksums dir ,%cargo-reference-project-file)))
- (find-files "src/vendor" ".cargo-checksum.json"))
+ (generate-all-checksums "src/vendor")
#t))
;; This phase is overridden by newer versions.
(replace 'configure
(setenv "CFG_RELEASE_CHANNEL" "stable")
(setenv "CFG_LIBDIR_RELATIVE" "lib")
(setenv "CFG_VERSION" "1.19.0-stable-mrustc")
+ (setenv "MRUSTC_TARGET_VER" ,(version-major+minor version))
; bad: (setenv "CFG_PREFIX" "mrustc") ; FIXME output path.
(mkdir-p "output")
+ ;; mrustc 0.9 doesn't check the search paths for crates anymore.
+ (copy-recursively (string-append rustc-bootstrap "/lib/mrust")
+ "output")
(invoke (string-append rustc-bootstrap "/tools/bin/minicargo")
"src/rustc" "--vendor-dir" "src/vendor"
"--output-dir" "output/rustc-build"
(build-system gnu-build-system)
(native-inputs
`(("bison" ,bison) ; For the tests
- ("cmake" ,cmake)
+ ("cmake" ,cmake-minimal)
("flex" ,flex) ; For the tests
("gdb" ,gdb) ; For the tests
("procps" ,procps) ; For the tests
(inputs
`(("jemalloc" ,jemalloc-4.5.0)
("llvm" ,llvm-3.9.1)
- ("openssl" ,openssl)
+ ("openssl" ,openssl-1.0)
("libssh2" ,libssh2) ; For "cargo"
("libcurl" ,curl))) ; For "cargo"
;; modules (see <https://bugs.gnu.org/31392>).
(native-search-paths
(list (search-path-specification
- (variable "C_INCLUDE_PATH")
- (files '("include")))
- (search-path-specification
- (variable "CPLUS_INCLUDE_PATH")
+ (variable "CPATH")
(files '("include")))
(search-path-specification
(variable "LIBRARY_PATH")
"0542y4rnzlsrricai130mqyxl8r6rd991frb4qsnwb27yigqg91a")))
(package
(inherit base-rust)
+ (source
+ (origin
+ (inherit (package-source base-rust))
+ (snippet '(begin
+ (delete-file-recursively "src/jemalloc")
+ (delete-file-recursively "src/llvm")
+ #t))
+ (patches '())))
(outputs '("out" "doc" "cargo"))
+ ;; Since rust-1.19 is local, it's quite probable that Hydra
+ ;; will build rust-1.19 only as a dependency of rust-1.20.
+ ;; But then Hydra will use the wrong properties, the ones here,
+ ;; for rust-1.19. Therefore, we copied the properties of
+ ;; rust-1.19 here.
+ (properties '((timeout . 72000) ;20 hours
+ (max-silent-time . 18000))) ;5 hours (for armel)
(arguments
(substitute-keyword-arguments (package-arguments rust-1.19)
((#:phases phases)
(("prefix = \"[^\"]*\"")
(string-append "prefix = \"" (assoc-ref outputs "cargo") "\"")))
(invoke "./x.py" "install" "cargo")))
+ (add-after 'install 'delete-install-logs
+ (lambda* (#:key outputs #:allow-other-keys)
+ (define (delete-manifest-file out-path file)
+ (delete-file (string-append out-path "/lib/rustlib/" file)))
+
+ (let ((out (assoc-ref outputs "out"))
+ (cargo-out (assoc-ref outputs "cargo")))
+ (for-each
+ (lambda (file) (delete-manifest-file out file))
+ '("install.log"
+ "manifest-rust-docs"
+ "manifest-rust-std-x86_64-unknown-linux-gnu"
+ "manifest-rustc"))
+ (for-each
+ (lambda (file) (delete-manifest-file cargo-out file))
+ '("install.log"
+ "manifest-cargo"))
+ #t)))
(add-after 'install 'wrap-rustc
(lambda* (#:key inputs outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out"))
#t)))))))))
(define-public rust-1.22
- (rust-bootstrapped-package rust-1.21 "1.22.1"
- "1lrzzp0nh7s61wgfs2h6ilaqi6iq89f1pd1yaf65l87bssyl4ylb"))
+ (let ((base-rust (rust-bootstrapped-package rust-1.21 "1.22.1"
+ "1lrzzp0nh7s61wgfs2h6ilaqi6iq89f1pd1yaf65l87bssyl4ylb")))
+ (package
+ (inherit base-rust)
+ (arguments
+ (substitute-keyword-arguments (package-arguments base-rust)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-after 'unpack 'remove-flaky-test
+ (lambda _
+ ;; See <https://github.com/rust-lang/rust/issues/43402>.
+ (when (file-exists? "src/test/run-make/issue-26092")
+ (delete-file-recursively "src/test/run-make/issue-26092"))
+ #t)))))))))
(define-public rust-1.23
(let ((base-rust (rust-bootstrapped-package rust-1.22 "1.23.0"
(define-public rust-1.24
(let ((base-rust
(rust-bootstrapped-package rust-1.23 "1.24.1"
- "1vv10x2h9kq7fxh2v01damdq8pvlp5acyh1kzcda9sfjx12kv99y")))
+ "1vv10x2h9kq7fxh2v01damdq8pvlp5acyh1kzcda9sfjx12kv99y")))
(package
(inherit base-rust)
(arguments
(define-public rust-1.25
(let ((base-rust
(rust-bootstrapped-package rust-1.24 "1.25.0"
- "0baxjr99311lvwdq0s38bipbnj72pn6fgbk6lcq7j555xq53mxpf"
- #:patches '("rust-1.25-accept-more-detailed-gdb-lines.patch"))))
+ "0baxjr99311lvwdq0s38bipbnj72pn6fgbk6lcq7j555xq53mxpf")))
(package
(inherit base-rust)
+ (source
+ (origin
+ (inherit (package-source base-rust))
+ (snippet '(begin
+ (delete-file-recursively "src/jemalloc")
+ (delete-file-recursively "src/llvm")
+ (delete-file-recursively "src/llvm-emscripten")
+ #t))
+ (patches (map search-patch
+ '("rust-1.25-accept-more-detailed-gdb-lines.patch")))))
(arguments
(substitute-keyword-arguments (package-arguments base-rust)
((#:phases phases)
(define-public rust-1.26
(let ((base-rust
(rust-bootstrapped-package rust-1.25 "1.26.2"
- "0047ais0fvmqvngqkdsxgrzhb0kljg8wy85b01kbbjc88hqcz7pv"
- #:patches '("rust-coresimd-doctest.patch"
- "rust-1.25-accept-more-detailed-gdb-lines.patch"))))
+ "0047ais0fvmqvngqkdsxgrzhb0kljg8wy85b01kbbjc88hqcz7pv")))
(package
(inherit base-rust)
+ (source
+ (origin
+ (inherit (package-source base-rust))
+ (patches (map search-patch
+ '("rust-coresimd-doctest.patch"
+ "rust-1.25-accept-more-detailed-gdb-lines.patch")))))
(arguments
(substitute-keyword-arguments (package-arguments base-rust)
((#:phases phases)
`(modify-phases ,phases
;; binaryen was replaced with LLD project from LLVM
(delete 'dont-build-native)
+ (replace 'check
+ (lambda* _
+ ;; Enable parallel execution.
+ (let ((parallel-job-spec
+ (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"
+ "src/tools/cargo"))))
(replace 'remove-unsupported-tests
(lambda* _
;; Our ld-wrapper cannot process non-UTF8 bytes in LIBRARY_PATH.
(define-public rust-1.27
(let ((base-rust
(rust-bootstrapped-package rust-1.26 "1.27.2"
- "0pg1s37bhx9zqbynxyydq5j6q7kij9vxkcv8maz0m25prm88r0cs"
- #:patches
- '("rust-coresimd-doctest.patch"
- "rust-bootstrap-stage0-test.patch"
- "rust-1.25-accept-more-detailed-gdb-lines.patch"
- "rust-reproducible-builds.patch"))))
+ "0pg1s37bhx9zqbynxyydq5j6q7kij9vxkcv8maz0m25prm88r0cs")))
(package
(inherit base-rust)
+ (source
+ (origin
+ (inherit (package-source base-rust))
+ (patches (map search-patch '("rust-coresimd-doctest.patch"
+ "rust-bootstrap-stage0-test.patch"
+ "rust-1.25-accept-more-detailed-gdb-lines.patch"
+ "rust-reproducible-builds.patch")))))
+ (native-inputs
+ ;; FIXME: Rust 1.27 and some later versions require GDB 8.2 specifically.
+ ;; See <https://bugs.gnu.org/37810>.
+ (alist-replace "gdb" (list gdb-8.2)
+ (package-native-inputs base-rust)))
(arguments
(substitute-keyword-arguments (package-arguments base-rust)
((#:phases phases)
(("fn thin_lto_works") "#[ignore]\nfn thin_lto_works"))
#t)))))))))
-(define-public rust
+(define-public rust-1.28
(let ((base-rust
(rust-bootstrapped-package rust-1.27 "1.28.0"
- "11k4rn77bca2rikykkk9fmprrgjswd4x4kaq7fia08vgkir82nhx"
- #:patches
- '("rust-coresimd-doctest.patch"
- "rust-bootstrap-stage0-test.patch"
- "rust-1.25-accept-more-detailed-gdb-lines.patch"
- "rust-reproducible-builds.patch"))))
+ "11k4rn77bca2rikykkk9fmprrgjswd4x4kaq7fia08vgkir82nhx")))
(package
(inherit base-rust)
+ (source
+ (origin
+ (inherit (package-source base-rust))
+ (patches (map search-patch '("rust-coresimd-doctest.patch"
+ "rust-bootstrap-stage0-test.patch"
+ "rust-1.25-accept-more-detailed-gdb-lines.patch"
+ "rust-reproducible-builds.patch")))))
(inputs
;; Use LLVM 6.0
- (alist-replace "llvm" (list llvm)
+ (alist-replace "llvm" (list llvm-6)
(package-inputs base-rust)))
(arguments
(substitute-keyword-arguments (package-arguments base-rust)
#t))
;; The thinlto test should pass with llvm 6.
(delete 'disable-thinlto-test))))))))
+
+(define-public rust-1.29
+ (let ((base-rust
+ (rust-bootstrapped-package rust-1.28 "1.29.2"
+ "1jb787080z754caa2w3w1amsygs4qlzj9rs1vy64firfmabfg22h")))
+ (package
+ (inherit base-rust)
+ (source
+ (origin
+ (inherit (package-source base-rust))
+ (patches (map search-patch '("rust-1.25-accept-more-detailed-gdb-lines.patch"
+ "rust-reproducible-builds.patch"))))))))
+
+(define-public rust-1.30
+ (let ((base-rust
+ (rust-bootstrapped-package rust-1.29 "1.30.1"
+ "0aavdc1lqv0cjzbqwl5n59yd0bqdlhn0zas61ljf38yrvc18k8rn")))
+ (package
+ (inherit base-rust)
+ (source
+ (origin
+ (inherit (package-source base-rust))
+ (snippet '(begin
+ (delete-file-recursively "src/jemalloc")
+ (delete-file-recursively "src/llvm")
+ (delete-file-recursively "src/llvm-emscripten")
+ (delete-file-recursively "src/tools/clang")
+ (delete-file-recursively "src/tools/lldb")
+ #t))))
+ (arguments
+ (substitute-keyword-arguments (package-arguments base-rust)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-after 'patch-cargo-tests 'patch-cargo-env-shebang
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((coreutils (assoc-ref inputs "coreutils")))
+ (substitute* "src/tools/cargo/tests/testsuite/fix.rs"
+ ;; Cargo has a test which explicitly sets a
+ ;; RUSTC_WRAPPER environment variable which points
+ ;; to /usr/bin/env. Since it's not a shebang, it
+ ;; needs to be manually patched
+ (("\"/usr/bin/env\"")
+ (string-append "\"" coreutils "/bin/env\"")))
+ #t)))
+ (add-after 'patch-cargo-env-shebang 'ignore-cargo-package-tests
+ (lambda* _
+ (substitute* "src/tools/cargo/tests/testsuite/package.rs"
+ ;; These tests largely check that cargo outputs warning/error
+ ;; messages as expected. It seems that cargo outputs an
+ ;; absolute path to something in the store instead of the
+ ;; expected relative path (e.g. `[..]`) so we'll ignore
+ ;; these for now
+ (("fn include") "#[ignore]\nfn include")
+ (("fn exclude") "#[ignore]\nfn exclude"))
+ #t))
+ ;; The test has been moved elsewhere.
+ (replace 'disable-amd64-avx-test
+ (lambda _
+ (substitute* "src/test/ui/run-pass/issues/issue-44056.rs"
+ (("only-x86_64") "ignore-test"))
+ #t)))))))))
+
+(define-public rust-1.31
+ (let ((base-rust
+ (rust-bootstrapped-package rust-1.30 "1.31.1"
+ "0sk84ff0cklybcp0jbbxcw7lk7mrm6kb6km5nzd6m64dy0igrlli")))
+ (package
+ (inherit base-rust)
+ (arguments
+ (substitute-keyword-arguments (package-arguments base-rust)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-after 'patch-tests 'patch-command-exec-tests
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((coreutils (assoc-ref inputs "coreutils")))
+ (substitute* "src/test/run-pass/command-exec.rs"
+ ;; This test suite includes some tests that the stdlib's
+ ;; `Command` execution properly handles situations where
+ ;; the environment or PATH variable are empty, but this
+ ;; fails since we don't have `echo` available in the usual
+ ;; Linux directories.
+ ;; NB: the leading space is so we don't fail a tidy check
+ ;; for trailing whitespace, and the newlines are to ensure
+ ;; we don't exceed the 100 chars tidy check as well
+ ((" Command::new\\(\"echo\"\\)")
+ (string-append "\nCommand::new(\"" coreutils "/bin/echo\")\n")))
+ #t)))
+ ;; The test has been moved elsewhere.
+ (replace 'disable-amd64-avx-test
+ (lambda _
+ (substitute* "src/test/ui/issues/issue-44056.rs"
+ (("only-x86_64") "ignore-test"))
+ #t))
+ (add-after 'patch-tests 'patch-process-docs-rev-cmd
+ (lambda* _
+ ;; Disable some doc tests which depend on the "rev" command
+ ;; https://github.com/rust-lang/rust/pull/58746
+ (substitute* "src/libstd/process.rs"
+ (("```rust") "```rust,no_run"))
+ #t)))))))))
+
+(define-public rust-1.32
+ (let ((base-rust
+ (rust-bootstrapped-package rust-1.31 "1.32.0"
+ "0ji2l9xv53y27xy72qagggvq47gayr5lcv2jwvmfirx029vlqnac")))
+ (package
+ (inherit base-rust)
+ (source
+ (origin
+ (inherit (package-source base-rust))
+ (snippet '(begin (delete-file-recursively "src/llvm")
+ (delete-file-recursively "src/llvm-emscripten")
+ (delete-file-recursively "src/tools/clang")
+ (delete-file-recursively "src/tools/lldb")
+ (delete-file-recursively "vendor/jemalloc-sys/jemalloc")
+ #t))
+ (patches (map search-patch '("rust-reproducible-builds.patch")))
+ ;; the vendor directory has moved to the root of
+ ;; the tarball, so we have to strip an extra prefix
+ (patch-flags '("-p2"))))
+ (inputs
+ ;; Downgrade to LLVM 6, all LTO tests appear to fail with LLVM 7.0.1
+ (alist-replace "llvm" (list llvm-6)
+ (package-inputs base-rust)))
+ (arguments
+ (substitute-keyword-arguments (package-arguments base-rust)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ ;; Cargo.lock and the vendor/ directory have been moved to the
+ ;; root of the rust tarball
+ (replace 'patch-cargo-checksums
+ (lambda* _
+ (use-modules (guix build cargo-utils))
+ (substitute* "Cargo.lock"
+ (("(\"checksum .* = )\".*\"" all name)
+ (string-append name "\"" ,%cargo-reference-hash "\"")))
+ (generate-all-checksums "vendor")
+ #t))
+ (add-after 'enable-codegen-tests 'override-jemalloc
+ (lambda* (#:key inputs #:allow-other-keys)
+ ;; The compiler is no longer directly built against jemalloc,
+ ;; but rather via the jemalloc-sys crate (which vendors the
+ ;; jemalloc source). To use jemalloc we must enable linking to
+ ;; it (otherwise it would use the system allocator), and set
+ ;; an environment variable pointing to the compiled jemalloc.
+ (substitute* "config.toml"
+ (("^jemalloc =.*$") "")
+ (("[[]rust[]]") "\n[rust]\njemalloc=true\n"))
+ (setenv "JEMALLOC_OVERRIDE" (string-append (assoc-ref inputs "jemalloc")
+ "/lib/libjemalloc_pic.a"))
+ #t))
+ ;; Remove no longer relevant steps
+ (delete 'remove-flaky-test)
+ (delete 'patch-aarch64-test))))))))
+
+(define-public rust-1.33
+ (let ((base-rust
+ (rust-bootstrapped-package rust-1.32 "1.33.0"
+ "152x91mg7bz4ygligwjb05fgm1blwy2i70s2j03zc9jiwvbsh0as")))
+ (package
+ (inherit base-rust)
+ (source
+ (origin
+ (inherit (package-source base-rust))
+ (patches '())
+ (patch-flags '("-p1"))))
+ (inputs
+ ;; Upgrade to jemalloc@5.1.0
+ (alist-replace "jemalloc" (list jemalloc)
+ (package-inputs base-rust)))
+ (arguments
+ (substitute-keyword-arguments (package-arguments base-rust)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (delete 'ignore-cargo-package-tests)
+ (add-after 'configure 'configure-test-threads
+ ;; Several rustc and cargo tests will fail if run on one core
+ ;; https://github.com/rust-lang/rust/issues/59122
+ ;; https://github.com/rust-lang/cargo/issues/6746
+ ;; https://github.com/rust-lang/rust/issues/58907
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "RUST_TEST_THREADS" "2")
+ #t)))))))))
+
+(define-public rust-1.34
+ (let ((base-rust
+ (rust-bootstrapped-package rust-1.33 "1.34.1"
+ "19s09k7y5j6g3y4d2rk6kg9pvq6ml94c49w6b72dmq8p9lk8bixh")))
+ (package
+ (inherit base-rust)
+ (source
+ (origin
+ (inherit (package-source base-rust))
+ (snippet '(begin
+ (delete-file-recursively "src/llvm-emscripten")
+ (delete-file-recursively "src/llvm-project")
+ (delete-file-recursively "vendor/jemalloc-sys/jemalloc")
+ #t)))))))
+
+(define-public rust-1.35
+ (let ((base-rust
+ (rust-bootstrapped-package rust-1.34 "1.35.0"
+ "0bbizy6b7002v1rdhrxrf5gijclbyizdhkglhp81ib3bf5x66kas")))
+ (package
+ (inherit base-rust)
+ (inputs
+ (alist-replace "llvm" (list llvm-8)
+ (package-inputs base-rust)))
+ (arguments
+ (substitute-keyword-arguments (package-arguments base-rust)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ ;; The tidy test includes a pass which ensures large binaries
+ ;; don't accidentally get checked into the rust git repo.
+ ;; Unfortunately the test assumes that git is always available,
+ ;; so we'll comment out the invocation of this pass.
+ (add-after 'configure 'disable-tidy-bins-check
+ (lambda* _
+ (substitute* "src/tools/tidy/src/main.rs"
+ (("bins::check") "//bins::check"))
+ #t)))))))))
+
+(define-public rust-1.36
+ (let ((base-rust
+ (rust-bootstrapped-package rust-1.35 "1.36.0"
+ "06xv2p6zq03lidr0yaf029ii8wnjjqa894nkmrm6s0rx47by9i04")))
+ (package
+ (inherit base-rust)
+ (arguments
+ (substitute-keyword-arguments (package-arguments base-rust)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (delete 'patch-process-docs-rev-cmd))))))))
+
+(define-public rust
+ (let ((base-rust
+ (rust-bootstrapped-package rust-1.36 "1.37.0"
+ "1hrqprybhkhs6d9b5pjskfnc5z9v2l2gync7nb39qjb5s0h703hj")))
+ (package
+ (inherit base-rust)
+ (arguments
+ (substitute-keyword-arguments (package-arguments base-rust)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-before 'configure 'configure-cargo-home
+ (lambda _
+ (let ((cargo-home (string-append (getcwd) "/.cargo")))
+ (mkdir-p cargo-home)
+ (setenv "CARGO_HOME" cargo-home)
+ #t))))))))))