From a5a59ea9e83e9310c1cfaf8fda415977cdec4ce7 Mon Sep 17 00:00:00 2001 From: Puck Meerburg Date: Wed, 27 Nov 2024 14:20:55 +0000 Subject: [PATCH] (zilch lang rust cargo): workaround non-VFS'd crates This will be unhacked once a (vfs-from-store) exists. --- lang/rust/src/cargo.sld | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lang/rust/src/cargo.sld b/lang/rust/src/cargo.sld index 00d28b8..4ea566a 100644 --- a/lang/rust/src/cargo.sld +++ b/lang/rust/src/cargo.sld @@ -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) @@ -333,7 +333,9 @@ (define package-version (cdr (assoc "version" package))) (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