From: Hartmut Goebel <h.goebel@crazy-compilers.com>
To: guix-devel <guix-devel@gnu.org>
Subject: Some more rust/cargo insights
Date: Sun, 6 Jun 2021 16:15:02 +0200 [thread overview]
Message-ID: <7d180f4a-3e5f-374b-0fcd-6ae5b438a1c8@crazy-compilers.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 960 bytes --]
Hi.,
these day I had spent some more hours struggling with rust ans cargo,
trying to get "pre-built" crates.
Summery; Cargo is cruft, no solution found yet.
I tried reusing a crate from the very same place it was built (see
enclosed script). Anyhow, this does not work since cargo uses a
different "metadata" value, even if noting changed. Based in the verbose
output (cargo build -v …) I assume that some parameters of the
"destination" build get included into this value.
This meets another observation; when building the sequoia suite, several
crates are build several times - even if all builds are performed in the
same environment.
Rust's build system is such a cruft - I really would like to throw it
where it belongs: into the trash.
--
Regards
Hartmut Goebel
| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
[-- Attachment #2: rlib-test.scm --]
[-- Type: text/x-scheme, Size: 4300 bytes --]
(use-modules
(guix download)
(guix packages)
(guix build-system cargo)
(gnu packages crates-io)
(srfi srfi-1)
(srfi srfi-26)
(gnu packages crates-graphics)
(gnu packages rust-apps))
(define-public rust-pretty-assertions-0.5
(package
(inherit rust-pretty-assertions-0.6)
(name "rust-pretty-assertions")
(version "0.5.1")
(source
(origin
(method url-fetch)
(uri (crate-uri "pretty_assertions" version))
(file-name
(string-append name "-" version ".tar.gz"))
(sha256
(base32 "1ins6swkpxmrh8q5h96h8nv0497d3dclsiyx2lyvqi6py0q980is"))))
(build-system cargo-build-system)
(arguments
`(#:tests? #f
#:cargo-inputs
(("rust-ansi-term" ,rust-ansi-term-0.11)
("rust-difference" ,rust-difference-2))))))
;; /gnu/store/wknzymkfbfjbxwfd3djrn4hk9zdfgs56-rust-xmlparser-0.13.3 -- original
;;
;; libxmlparser-f82b201ea4144ed3.rlib
(define-public myrust-xmlparser
(package
(inherit rust-xmlparser-0.13)
(outputs '("out" "rlib"))
(arguments
`(#:skip-build? #f
#:tests? #f
#:cargo-build-flags (list "--release" "-vv")
#:phases
(modify-phases %standard-phases
(add-after 'install 'install-rlib
(lambda* (#:key outputs #:allow-other-keys)
(let* ((rout (assoc-ref outputs "rlib"))
(dest (string-append rout "/rlib")))
;;(mkdir dest)
;;(for-each (cut install-file <> (string-append rout "/rlib"))
(for-each (lambda (fn)
(install-file fn (string-append rout "/rlib")))
(find-files "target/release/deps" "\\.(rlib|rmeta)$"))
)))
;; (add-after 'install 'fail
;; (lambda _ #f))
)))))
(define-public myrust-roxmltree
(package
(inherit rust-roxmltree-0.14)
;;(outputs '("out" "crate"))
(inputs
`(("rust-xmlparser" ,myrust-xmlparser "rlib")))
(arguments
`(#:skip-build? #f
#:tests? #f
;;#:vendor-dir "/tmp/src"
#:cargo-build-flags (list "--release" "-vv")
#:cargo-inputs
(("rust-xmlparser:src" ,rust-xmlparser-0.13)
("rust-pretty-assertions" ,rust-pretty-assertions-0.5))
#:phases
(modify-phases %standard-phases
(add-after 'patch-cargo-checksums 'bring-in-rlib
(lambda* (#:key inputs #:allow-other-keys)
(let* ((rin (assoc-ref inputs "rust-xmlparser"))
(src (assoc-ref inputs "rust-xmlparser"))
(rlib (string-append rin "/rlib")))
(mkdir "/tmp/guix-build-rust-xmlparser-0.13.3.drv-0/")
(copy-recursively
"guix-vendor/rust-xmlparser-0.13.3.tar.gz"
"/tmp/guix-build-rust-xmlparser-0.13.3.drv-0/xmlparser-0.13.3")
(rename-file
"guix-vendor/rust-xmlparser-0.13.3.tar.gz"
"../rust-xmlparser-0.13.3.tar.gz")
(symlink
"/tmp/guix-build-rust-xmlparser-0.13.3.drv-0/xmlparser-0.13.3"
"guix-vendor/rust-xmlparser-0.13.3")
;; (let ((port (open-file ".cargo/config" "w" #:encoding "utf-8")))
;; (display "
;; #paths = [\"/tmp/guix-build-rust-xmlparser-0.13.3.drv-0/xmlparser-0.13.3\"]
;; [source.crates-io]
;; replace-with = 'vendored-sources'
;; #[patch.crates-io]
;; #xmlparser = { path = '/tmp/guix-build-rust-xmlparser-0.13.3.drv-0/xmlparser-0.13.3' }
;; [source.vendored-sources]
;; directory = '" port)
;; (display (string-append (getcwd) "/guix-vendor") port)
;; (display "'
;; " port)
;; (close-port port))
;; (substitute* ".cargo/config"
;; (("\\.vendored-sources\\]" _)
;; (string-append _ "\n[paths]"))
(for-each (lambda (fn)
(install-file fn "target/release/deps"))
(pk (find-files rlib "\\.(rlib|rmeta)$")))
#t
)))
(add-before 'install 'fail
(lambda _ #f)))
))))
;;myrust-xmlparser
myrust-roxmltree
next reply other threads:[~2021-06-06 14:15 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-06 14:15 Hartmut Goebel [this message]
[not found] ` <20210606183857.gthvipntymstivh4@thebird.nl>
2021-06-07 7:10 ` Some more rust/cargo insights Hartmut Goebel
2021-06-07 8:28 ` Pjotr Prins
2021-06-07 12:04 ` Hartmut Goebel
2021-06-07 15:13 ` John Soo
2021-06-07 15:15 ` John Soo
2021-06-07 16:26 ` Hartmut Goebel
2021-06-07 16:41 ` Hartmut Goebel
2021-06-08 9:15 ` Efraim Flashner
2021-06-08 15:38 ` Hartmut Goebel
2021-06-14 5:22 ` Maxim Cournoyer
-- strict thread matches above, loose matches on Subject: below --
2021-06-07 18:48 Leo Prikler
2021-06-08 17:01 ` Leo Famulari
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7d180f4a-3e5f-374b-0fcd-6ae5b438a1c8@crazy-compilers.com \
--to=h.goebel@crazy-compilers.com \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).