diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm index 0f0f0c28c9..4495e6422b 100644 --- a/gnu/packages/crates-io.scm +++ b/gnu/packages/crates-io.scm @@ -28021,7 +28021,22 @@ described in Unicode Standard Annex #15.") (build-system cargo-build-system) (arguments `(#:cargo-development-inputs - (("rust-quickcheck" ,rust-quickcheck-0.7)))) + (("rust-quickcheck" ,rust-quickcheck-0.7)) + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'copy-target-into-place + (lambda* (#:key inputs #:allow-other-keys) + (copy-recursively (string-append (assoc-ref inputs "rust-quickcheck-0.7") + "/target") + "target") + (for-each make-file-writable (find-files "target" ".")) + ;; Change from the previous build(s) to the current directory. + (substitute* (find-files "target" "\\.d$") + (("/tmp/.*/target") (string-append (getcwd) "/target"))) + #t))) + )) + (inputs + `(("rust-quickcheck-0.7" ,rust-quickcheck-0.7))) (home-page "https://github.com/unicode-rs/unicode-segmentation") (synopsis "Grapheme Cluster, Word and Sentence boundaries") (description diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm index 95e8dd772a..27c48b6c8d 100644 --- a/guix/build/cargo-build-system.scm +++ b/guix/build/cargo-build-system.scm @@ -123,6 +123,12 @@ directory = '" port) (setenv "LIBGIT2_SYS_USE_PKG_CONFIG" "1") (setenv "LIBSSH2_SYS_USE_PKG_CONFIG" "1") + ;; By setting cargo.dep-info-basedir we get relative paths for the build + ;; files in the 'target/*/dep' directory, allowing us to reuse them. + ;; https://doc.rust-lang.org/cargo/reference/config.html#builddep-info-basedir + ;; https://doc.rust-lang.org/cargo/guide/build-cache.html#dep-info-files + ;(setenv "CARGO_BUILD_DEP_INFO_BASEDIR" (getcwd)) + ;; We don't use the Cargo.lock file to determine the package versions we use ;; during building, and in any case if one is not present it is created ;; during the 'build phase by cargo. @@ -173,7 +179,9 @@ directory = '" port) (or skip-build? (not (has-executable-target?)) (invoke "cargo" "install" "--path" "." "--root" out - "--features" (string-join features))))) + "--features" (string-join features))) + (copy-recursively "./target" (string-append out "/target"))) + #t) (define %standard-phases (modify-phases gnu:%standard-phases