From: Z572 via Guix-patches via <guix-patches@gnu.org>
To: 53208@debbugs.gnu.org
Subject: [bug#53208] [PATCH 39/39] gnu: rust-analyzer: Make it out of box.
Date: Wed, 12 Jan 2022 23:27:59 +0800 [thread overview]
Message-ID: <tencent_9856C05FBECE47F96849412DCAA67FAA6F06@qq.com> (raw)
In-Reply-To: <d6f9273c440cb5f31af927622fd8ad086117859b.1641998630.git.873216071@qq.com>
* gnu/packages/rust-apps.scm (rust-src): New variable.
(rust-analyzer): [arguments]: <#:phases>: Add wrap-program phase.
[inputs]: Add rust-src.
---
gnu/packages/rust-apps.scm | 44 ++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/gnu/packages/rust-apps.scm b/gnu/packages/rust-apps.scm
index 2831b1401f..f7604ec546 100644
--- a/gnu/packages/rust-apps.scm
+++ b/gnu/packages/rust-apps.scm
@@ -33,6 +33,7 @@
(define-module (gnu packages rust-apps)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix build-system cargo)
+ #:use-module (guix build-system copy)
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (guix packages)
@@ -1158,6 +1159,24 @@ (define-public watchexec
runs a command whenever it detects modifications.")
(license license:asl2.0)))
+(define-public rust-src
+ (hidden-package
+ (package
+ (inherit rust-1.57)
+ (name "rust-src")
+ (build-system copy-build-system)
+ (native-inputs '())
+ (inputs '())
+ (native-search-paths '())
+ (outputs '("out"))
+ (arguments
+ `(#:install-plan
+ '(("library" "lib/rustlib/src/rust/library")
+ ("src" "lib/rustlib/src/rust/src"))))
+ (synopsis "Source code for the Rust standard library")
+ (description "This package provide source code for the Rust standard
+library, only use by rust-analyzer, make rust-analyzer out of box."))))
+
(define-public rust-analyzer
(package
(name "rust-analyzer")
@@ -1290,6 +1309,30 @@ (define-public rust-analyzer
(add-before 'install 'chdir
(lambda _
(chdir "crates/rust-analyzer")))
+ (add-after 'install 'wrap-program
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (bin (string-append out "/bin"))
+ (rust-src-path (search-input-directory
+ inputs "/lib/rustlib/src/rust/library")))
+ ;; if not get environment variable RUST_SRC_PATH, set it,
+ ;; make rust-analyzer out of box.
+ (with-directory-excursion bin
+ (let* ((prog "rust-analyzer")
+ (wrapped-file (string-append (dirname prog)
+ "/." (basename prog) "-real"))
+ (prog-tmp (string-append wrapped-file "-tmp")))
+ (link prog wrapped-file)
+ (call-with-output-file prog-tmp
+ (lambda (port)
+ (format port "#!~a
+if test -z \"${RUST_SRC_PATH}\";then export RUST_SRC_PATH=~S;fi;
+exec -a \"$0\" \"~a\" \"$@\""
+ (which "bash")
+ rust-src-path
+ (canonicalize-path wrapped-file))))
+ (chmod prog-tmp #o755)
+ (rename-file prog-tmp prog))))))
(replace 'install-license-files
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
@@ -1298,6 +1341,7 @@ (define-public rust-analyzer
(chdir "../..")
(install-file "LICENSE-MIT" doc)
(install-file "LICENSE-APACHE" doc)))))))
+ (inputs (list rust-src))
(home-page "https://rust-analyzer.github.io/")
(synopsis "Experimental Rust compiler front-end for IDEs")
(description "Rust-analyzer is a modular compiler frontend for the Rust
--
2.34.0
next prev parent reply other threads:[~2022-01-12 15:51 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <d6f9273c440cb5f31af927622fd8ad086117859b.1641998630.git.873216071@qq.com>
2022-01-12 15:27 ` [bug#53208] [PATCH 02/39] gnu: Add rust-matchers-0.1 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 03/39] gnu: Add rust-countme-3 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 04/39] gnu: Add rust-windows-x86-64-msvc-0.28 Z572 via Guix-patches via
2022-01-21 19:30 ` Maxime Devos
[not found] ` <87iluc4cac.fsf@qq.com>
2022-01-22 3:37 ` Z572 via Guix-patches via
2022-01-23 1:39 ` Tobias Geerinckx-Rice via Guix-patches via
2022-01-23 21:02 ` Maxime Devos
[not found] ` <87ilu9qw6h.fsf@qq.com>
2022-01-24 10:01 ` Z572 via Guix-patches via
[not found] ` <87mtjlqwq5.fsf@qq.com>
2022-01-24 9:55 ` Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 05/39] gnu: Add rust-windows-x86-64-gnu-0.28 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 06/39] gnu: Add rust-windows-i686-msvc-0.28 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 07/39] gnu: Add rust-windows-i686-gnu-0.28 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 08/39] gnu: Add rust-windows-aarch64-msvc-0.28 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 09/39] gnu: Add rust-windows-sys-0.28 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 10/39] gnu: Add rust-miow-0.4 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 11/39] gnu: rust-smol-str-0.1: Update to 0.1.21 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 12/39] gnu: rust-tracing-core-0.1: " Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 13/39] gnu: Add rust-rustc-ap-rustc-lexer-725 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 14/39] gnu: Add rust-rowan-0.15 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 15/39] gnu: Add rust-cov-mark-2 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 16/39] gnu: rust-tracing-log-0.1: Update to 0.1.2 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 17/39] gnu: Add rust-tracing-subscriber-0.3 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 18/39] gnu: rust-salsa-macros-0.17: Update to 0.17.0-pre.2 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 19/39] gnu: rust-salsa-0.17: " Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 20/39] gnu: Add rust-tracing-tree-0.2 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 21/39] gnu: rust-expat-sys-2: Update to 1.2.2 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 22/39] gnu: rust-ungrammar-1: Update to 1.14.9 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 23/39] gnu: Add rust-cargo-metadata-0.14 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 24/39] gnu: rust-synstructure-0.12: Update to 0.12.6 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 25/39] gnu: Add rust-chalk-derive-0.75 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 26/39] gnu: Add rust-chalk-ir-0.75 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 27/39] gnu: Add rust-chalk-solve-0.75 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 28/39] gnu: Add rust-chalk-recursive-0.75 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 29/39] gnu: Add rust-pulldown-cmark-to-cmark-7 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 30/39] gnu: rust-memchr-2: Update to 2.4.1 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 31/39] gnu: Add rust-object-0.28 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 32/39] gnu: Add rust-lsp-types-0.91 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 33/39] gnu: Add rust-kqueue-sys-1 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 34/39] gnu: Add rust-kqueue-1 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 35/39] gnu: Add rust-fsevent-sys-4 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 36/39] gnu: rust-normalize-line-endings-0.2: Update to 5.0.0-pre.13 Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 37/39] gnu: rust-pulldown-cmark-0.8: update #:cargo-inputs rust-bitflags Z572 via Guix-patches via
2022-01-12 15:27 ` [bug#53208] [PATCH 38/39] gnu: rust-analyzer: Update to 2022-01-10 Z572 via Guix-patches via
2022-01-23 1:00 ` Leo Famulari
2022-01-23 8:35 ` Nicolas Goaziou
2022-01-23 18:53 ` Leo Famulari
2022-01-12 15:27 ` Z572 via Guix-patches via [this message]
2022-01-20 23:23 ` [bug#53208] [PATCH 39/39] gnu: rust-analyzer: Make it out of box Nicolas Goaziou
[not found] ` <87ee504am6.fsf@qq.com>
2022-01-22 4:37 ` Z572 via Guix-patches via
2022-01-22 16:04 ` Nicolas Goaziou
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=tencent_9856C05FBECE47F96849412DCAA67FAA6F06@qq.com \
--to=guix-patches@gnu.org \
--cc=53208@debbugs.gnu.org \
--cc=873216071@qq.com \
/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).