aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/rust.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/rust.scm')
-rw-r--r--gnu/packages/rust.scm73
1 files changed, 43 insertions, 30 deletions
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index cec565bbc8..8bed56ff72 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -91,7 +91,7 @@
(let ((rustc-version "1.19.0"))
(package
(name "mrustc")
- (version "0.8.0")
+ (version "0.9")
(source (origin
(method git-fetch)
(uri (git-reference
@@ -100,57 +100,61 @@
(file-name (git-file-name name version))
(sha256
(base32
- "0a7v8ccyzp1sdkwni8h1698hxpfz2sxhcpx42n6l2pbm0rbjp08i"))
- (patches
- (search-patches "mrustc-0.8.0-fix-variable-length-integer-receiving.patch"))))
+ "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" ,(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"))
@@ -160,11 +164,13 @@
(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)
@@ -172,6 +178,9 @@
;; 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
@@ -289,8 +298,12 @@ test = { path = \"../libtest\" }
(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"