summary refs log tree commit diff
path: root/gnu/packages/rust.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/rust.scm')
-rw-r--r--gnu/packages/rust.scm57
1 files changed, 24 insertions, 33 deletions
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index 74de6f3ae1..40633854ae 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -514,6 +514,26 @@ safety and thread safety guarantees.")
        (substitute-keyword-arguments (package-arguments rust-1.19)
          ((#:phases phases)
           `(modify-phases ,phases
+             (add-after 'patch-tests 'patch-cargo-tests
+               (lambda _
+                 (substitute* "src/tools/cargo/tests/build.rs"
+                  (("/usr/bin/env") (which "env"))
+                  ;; Guix llvm is compiled without asmjs-unknown-emscripten.
+                  (("fn wasm32_final_outputs") "#[ignore]\nfn wasm32_final_outputs"))
+                 (substitute* "src/tools/cargo/tests/death.rs"
+                  ;; This is stuck when built in container.
+                  (("fn ctrl_c_kills_everyone") "#[ignore]\nfn ctrl_c_kills_everyone"))
+                 ;; Prints test output in the wrong order when built on
+                 ;; i686-linux.
+                 (substitute* "src/tools/cargo/tests/test.rs"
+                   (("fn cargo_test_env") "#[ignore]\nfn cargo_test_env"))
+                 #t))
+             (add-after 'patch-cargo-tests 'ignore-glibc-2.27-incompatible-test
+               ;; https://github.com/rust-lang/rust/issues/47863
+               (lambda _
+                 (substitute* "src/test/run-pass/out-of-stack.rs"
+                   (("// ignore-android") "// ignore-test\n// ignore-android"))
+                 #t))
              (replace 'configure
                (lambda* (#:key inputs outputs #:allow-other-keys)
                  (let* ((out (assoc-ref outputs "out"))
@@ -542,7 +562,6 @@ submodules = false
 prefix = \"" out "\"
 docdir = \"" doc "/share/doc/rust" "\"
 sysconfdir = \"etc\"
-localstatedir = \"var/lib\"
 [rust]
 default-linker = \"" gcc "/bin/gcc" "\"
 channel = \"stable\"
@@ -579,10 +598,11 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\"
              (delete 'patch-cargo-tomls)
              (add-before 'build 'reset-timestamps-after-changes
                (lambda* _
-                 (define ref (stat "README.md"))
                  (for-each
                   (lambda (filename)
-                    (set-file-time filename ref))
+                    ;; Rust 1.20.0 treats timestamp 0 as "file doesn't exist".
+                    ;; Therefore, use timestamp 1.
+                    (utime filename 1 1 1 1))
                   (find-files "." #:directories? #t))
                  #t))
              (replace 'build
@@ -651,34 +671,6 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\"
                ;; XXX: Revisit this when we use gcc 6.
                (substitute* "src/binaryen/CMakeLists.txt"
                  (("ADD_COMPILE_FLAG\\(\\\"-march=native\\\"\\)") ""))
-               #t))
-           (add-after 'patch-tests 'patch-cargo-tests
-             (lambda _
-               (substitute* "src/tools/cargo/tests/build.rs"
-                (("/usr/bin/env") (which "env"))
-                ;; Guix llvm is compiled without asmjs-unknown-emscripten.
-                (("fn wasm32_final_outputs") "#[ignore]\nfn wasm32_final_outputs"))
-               (substitute* "src/tools/cargo/tests/death.rs"
-                ;; This is stuck when built in container.
-                (("fn ctrl_c_kills_everyone") "#[ignore]\nfn ctrl_c_kills_everyone"))
-               ;; Prints test output in the wrong order when built on
-               ;; i686-linux.
-               (substitute* "src/tools/cargo/tests/test.rs"
-                 (("fn cargo_test_env") "#[ignore]\nfn cargo_test_env"))
-               #t))
-           (add-after 'patch-cargo-tests 'ignore-glibc-2.27-incompatible-test
-             ;; https://github.com/rust-lang/rust/issues/47863
-             (lambda _
-               (substitute* "src/test/run-pass/out-of-stack.rs"
-                 (("// ignore-android") "// ignore-test\n// ignore-android"))))
-           (add-after 'ignore-glibc-2.27-incompatible-test 'fix-mtime-bug
-             (lambda* _
-               (substitute* "src/build_helper/lib.rs"
-                 ;; Bug in Rust code.
-                 ;; Current implementation assume that if dst not exist then it's mtime
-                 ;; is 0, but in same time "src" have 0 mtime in guix build!
-                 (("let threshold = mtime\\(dst\\);")
-                  "if !dst.exists() {\nreturn false\n}\n let threshold = mtime(dst);"))
                #t))))))))
 
 (define-public rust-1.24
@@ -698,8 +690,7 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\"
                    ;; This test is known to fail on aarch64 and powerpc64le:
                    ;; https://github.com/rust-lang/rust/issues/45410
                    (("fn test_loading_cosine") "#[ignore]\nfn test_loading_cosine"))
-                 #t))
-             (delete 'fix-mtime-bug))))))))
+                 #t)))))))))
 
 (define-public rust-1.25
   (let ((base-rust