(zilch lang rust cargo): workaround non-VFS'd crates

This will be unhacked once a (vfs-from-store) exists.
This commit is contained in:
puck 2024-11-27 14:20:55 +00:00
parent d1800e8a9d
commit a5a59ea9e8

View file

@ -5,7 +5,7 @@
(zilch nixpkgs) (zilch zexpr) (zilch semver)
json
(chicken process)
(chicken base) (chicken format)
(chicken base) (chicken format) (chicken file)
(chicken foreign)
(srfi 4) (srfi 128) (srfi 146) (srfi 152) (srfi 207)
(zilch lang rust registry) (zilch lang rust) (zilch lang rust cfg)
@ -334,6 +334,8 @@
(define package-links (and-cdr (assoc "links" package)))
(define package-edition (or (and-cdr (assoc "edition" package)) "2015"))
(define has-build (and (zexp? vfs) (file-exists? (string-append (zexp-unquote vfs) "/build.rs"))))
(unless (and vfs (vfs? vfs))
(set! vfs #f))
@ -347,7 +349,10 @@
(set! other-targets (cons (cargo-target-from-toml (vector (cons "name" package-name) (cons "path" "src/main.rs")) package-name 'bin package-edition) other-targets)))
(define build-file-path (and-cdr (assoc "build" package)))
(when (and vfs (vfs-file-ref vfs "" "build.rs")))
(when
(or
(and has-build (not build-file-path))
(and vfs (vfs-file-ref vfs "" "build.rs")))
(set! build-file-path "build.rs"))
(define build-script-target #f)
(when build-file-path