summaryrefslogtreecommitdiff
path: root/gnu/packages/rust.scm
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2025-02-13 11:36:10 +0200
committerHilton Chain <hako@ultrarare.space>2025-08-21 19:07:27 +0800
commit79b676ff823f55ad28486475a5bd2c27124b100b (patch)
treefdb9f6f335f9681ced6bb0ff90d1df395c91b710 /gnu/packages/rust.scm
parent8bd415b0658cc4eec32872507acdd2568481cf1c (diff)
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
Diffstat (limited to 'gnu/packages/rust.scm')
-rw-r--r--gnu/packages/rust.scm19
1 files changed, 16 insertions, 3 deletions
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index abaf7166fd5..aed77cbf240 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -4,7 +4,7 @@
4;;; Copyright © 2016 Nikita <nikita@n0.is> 4;;; Copyright © 2016 Nikita <nikita@n0.is>
5;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com> 5;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
6;;; Copyright © 2017, 2018 Nikolai Merinov <nikolai.merinov@member.fsf.org> 6;;; Copyright © 2017, 2018 Nikolai Merinov <nikolai.merinov@member.fsf.org>
7;;; Copyright © 2017, 2019-2024 Efraim Flashner <efraim@flashner.co.il> 7;;; Copyright © 2017, 2019-2025 Efraim Flashner <efraim@flashner.co.il>
8;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr> 8;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
9;;; Copyright © 2018 Danny Milosavljevic <dannym+a@scratchpost.org> 9;;; Copyright © 2018 Danny Milosavljevic <dannym+a@scratchpost.org>
10;;; Copyright © 2019 Ivan Petkov <ivanppetkov@gmail.com> 10;;; Copyright © 2019 Ivan Petkov <ivanppetkov@gmail.com>
@@ -1336,7 +1336,9 @@ safety and thread safety guarantees.")
1336 "src/tools/cargo" 1336 "src/tools/cargo"
1337 "src/tools/clippy" 1337 "src/tools/clippy"
1338 "src/tools/rust-analyzer" 1338 "src/tools/rust-analyzer"
1339 "src/tools/rustfmt")))) 1339 "src/tools/rustfmt"
1340 ;; Needed by rust-analyzer and editor plugins
1341 "src/tools/rust-analyzer/crates/proc-macro-srv-cli"))))
1340 (replace 'check 1342 (replace 'check
1341 ;; Phase overridden to also test more tools. 1343 ;; Phase overridden to also test more tools.
1342 (lambda* (#:key tests? parallel-build? #:allow-other-keys) 1344 (lambda* (#:key tests? parallel-build? #:allow-other-keys)
@@ -1355,6 +1357,15 @@ safety and thread safety guarantees.")
1355 ;; Phase overridden to also install more tools. 1357 ;; Phase overridden to also install more tools.
1356 (lambda* (#:key outputs #:allow-other-keys) 1358 (lambda* (#:key outputs #:allow-other-keys)
1357 (invoke "./x.py" "install") 1359 (invoke "./x.py" "install")
1360 ;; This one doesn't have an install target so
1361 ;; we need to install manually.
1362 (install-file (string-append
1363 "build/"
1364 ,(platform-rust-target
1365 (lookup-platform-by-system
1366 (%current-system)))
1367 "/stage1-tools-bin/rust-analyzer-proc-macro-srv")
1368 (string-append (assoc-ref outputs "out") "/libexec"))
1358 (substitute* "config.toml" 1369 (substitute* "config.toml"
1359 ;; Adjust the prefix to the 'cargo' output. 1370 ;; Adjust the prefix to the 'cargo' output.
1360 (("prefix = \"[^\"]*\"") 1371 (("prefix = \"[^\"]*\"")
@@ -1389,10 +1400,12 @@ safety and thread safety guarantees.")
1389 (lambda (port) 1400 (lambda (port)
1390 (format port "#!~a 1401 (format port "#!~a
1391if test -z \"${RUST_SRC_PATH}\";then export RUST_SRC_PATH=~S;fi; 1402if test -z \"${RUST_SRC_PATH}\";then export RUST_SRC_PATH=~S;fi;
1392exec -a \"$0\" \"~a\" \"$@\"" 1403exec -a \"$0\" \"~a\" --proc-macro-srv \"~a\" \"$@\""
1393 (which "bash") 1404 (which "bash")
1394 (string-append (assoc-ref outputs "rust-src") 1405 (string-append (assoc-ref outputs "rust-src")
1395 "/lib/rustlib/src/rust/library") 1406 "/lib/rustlib/src/rust/library")
1407 (string-append (assoc-ref outputs "out")
1408 "/libexec/rust-analyzer-proc-macro-srv")
1396 (string-append bin "/.rust-analyzer-real")))) 1409 (string-append bin "/.rust-analyzer-real"))))
1397 (chmod (string-append bin "/rust-analyzer") #o755)))))))) 1410 (chmod (string-append bin "/rust-analyzer") #o755))))))))
1398 (inputs 1411 (inputs