efraim pushed a commit to branch rust-team
in repository guix.
commit 1ede2c80766b1198f41934ff73dc825ca2c32967
Author: Efraim Flashner <[email protected]>
AuthorDate: Thu Feb 13 11:36:10 2025 +0200
gnu: rust-analyze: Link to rust-analyze-proc-macro-srv.
* gnu/packages/rust.scm (rust)[arguments]: Build proc-macro-srv-cli
during the 'build phase. Adjust the 'install phase to manually install
rust-analyzer-proc-macro-srv. Adjust the 'wrap-rust-analyzer phase to
give the path to rust-analyzer-proc-macro-srv.
Change-Id: I6b8dcdca20183551a576fe2f0f5dd50dbe99d08c
---
gnu/packages/rust.scm | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index abaf7166fd..aed77cbf24 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -4,7 +4,7 @@
;;; Copyright © 2016 Nikita <[email protected]>
;;; Copyright © 2017 Ben Woodcroft <[email protected]>
;;; Copyright © 2017, 2018 Nikolai Merinov <[email protected]>
-;;; Copyright © 2017, 2019-2024 Efraim Flashner <[email protected]>
+;;; Copyright © 2017, 2019-2025 Efraim Flashner <[email protected]>
;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <[email protected]>
;;; Copyright © 2018 Danny Milosavljevic <[email protected]>
;;; Copyright © 2019 Ivan Petkov <[email protected]>
@@ -1336,7 +1336,9 @@ safety and thread safety guarantees.")
"src/tools/cargo"
"src/tools/clippy"
"src/tools/rust-analyzer"
- "src/tools/rustfmt"))))
+ "src/tools/rustfmt"
+ ;; Needed by rust-analyzer and editor plugins
+
"src/tools/rust-analyzer/crates/proc-macro-srv-cli"))))
(replace 'check
;; Phase overridden to also test more tools.
(lambda* (#:key tests? parallel-build? #:allow-other-keys)
@@ -1355,6 +1357,15 @@ safety and thread safety guarantees.")
;; Phase overridden to also install more tools.
(lambda* (#:key outputs #:allow-other-keys)
(invoke "./x.py" "install")
+ ;; This one doesn't have an install target so
+ ;; we need to install manually.
+ (install-file (string-append
+ "build/"
+ ,(platform-rust-target
+ (lookup-platform-by-system
+ (%current-system)))
+
"/stage1-tools-bin/rust-analyzer-proc-macro-srv")
+ (string-append (assoc-ref outputs "out")
"/libexec"))
(substitute* "config.toml"
;; Adjust the prefix to the 'cargo' output.
(("prefix = \"[^\"]*\"")
@@ -1389,10 +1400,12 @@ safety and thread safety guarantees.")
(lambda (port)
(format port "#!~a
if test -z \"${RUST_SRC_PATH}\";then export RUST_SRC_PATH=~S;fi;
-exec -a \"$0\" \"~a\" \"$@\""
+exec -a \"$0\" \"~a\" --proc-macro-srv \"~a\" \"$@\""
(which "bash")
(string-append (assoc-ref outputs "rust-src")
"/lib/rustlib/src/rust/library")
+ (string-append (assoc-ref outputs "out")
+
"/libexec/rust-analyzer-proc-macro-srv")
(string-append bin "/.rust-analyzer-real"))))
(chmod (string-append bin "/rust-analyzer") #o755))))))))
(inputs