From: Z572 via Guix-patches via <guix-patches@gnu.org>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: 53208@debbugs.gnu.org
Subject: [bug#53208] [PATCH 39/39] gnu: rust-analyzer: Make it out of box.
Date: Sat, 22 Jan 2022 12:37:10 +0800 [thread overview]
Message-ID: <tencent_E94BF92F5B47A5DCB144B2F6793325352305@qq.com> (raw)
Message-ID: <87ee504am6.fsf@qq.com> (raw)
In-Reply-To: <87r1928016.fsf@nicolasgoaziou.fr>
[-- Attachment #1: Type: text/plain, Size: 3198 bytes --]
looks like failed to send email yesterday
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Hello,
>
> Z572 via Guix-patches via <guix-patches@gnu.org> writes:
>
>> +(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."))))
>
> This cannot work, because, AFAIK, you can only inherit packages from the
> same module. So rust-src should be moved to rust.scm and made visible.
It can work, for example: fdik-libetpan and libetpan.
fdik-libetpan is in (gnu packages pep), libetpan is in (gnu packages
mail), fdik-libetpan inherit from libetpan, them are in different module.
>
>> + (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))))))
>
> I tried to move the rust-src in rust.scm, as explained above, but when
> I do, installation of rust-analyzer fails during the `wrap-program'
> phases.
new patch move rust-src to rust.scm, and build rust-analyzer success.
>
>> (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))
>
> Shouldn't it be a native-input?
Fix in new patch.
>
> Could you have a look at those issues? Thanks!
>
> Regards,
[-- Attachment #2: 0001-gnu-rust-analyzer-Make-it-out-of-the-box.patch --]
[-- Type: text/x-patch, Size: 4540 bytes --]
From a3ea65ba89f7f369fd6d2f8bd557dd59645ed456 Mon Sep 17 00:00:00 2001
Message-Id: <a3ea65ba89f7f369fd6d2f8bd557dd59645ed456.1642764287.git.873216071@qq.com>
From: Z572 <873216071@qq.com>
Date: Fri, 21 Jan 2022 19:06:10 +0800
Subject: [PATCH] gnu: rust-analyzer: Make it out of the box.
* gnu/packages/rust.scm (rust-src): New variable.
* gnu/packages/rust-apps.scm (rust-analyzer): [native-inputs]: Add rust-src.
[arguments]: <#:phases>: Add wrap-program phase.
---
gnu/packages/rust-apps.scm | 25 +++++++++++++++++++++++++
gnu/packages/rust.scm | 20 ++++++++++++++++++++
2 files changed, 45 insertions(+)
diff --git a/gnu/packages/rust-apps.scm b/gnu/packages/rust-apps.scm
index a31fabac36..8ffa3a9817 100644
--- a/gnu/packages/rust-apps.scm
+++ b/gnu/packages/rust-apps.scm
@@ -1408,6 +1408,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"))
@@ -1416,6 +1440,7 @@ (define-public rust-analyzer
(chdir "../..")
(install-file "LICENSE-MIT" doc)
(install-file "LICENSE-APACHE" doc)))))))
+ (native-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
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index 739ffb3192..5a6d4a5c30 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -13,6 +13,7 @@
;;; Copyright © 2020 Matthew James Kraai <kraai@ftbfs.org>
;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2021 (unmatched parenthesis <paren@disroot.org>
+;;; Copyright © 2022 Zheng Junjie <873216071@qq.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -49,6 +50,7 @@ (define-module (gnu packages rust)
#:use-module (gnu packages tls)
#:use-module (gnu packages)
#:use-module (guix build-system cargo)
+ #:use-module (guix build-system copy)
#:use-module (guix build-system gnu)
#:use-module (guix build-system trivial)
#:use-module (guix download)
@@ -787,3 +789,21 @@ (define rust-1.57
;;; be relied upon. This is to ease maintenance and reduce the time
;;; required to build the full Rust bootstrap chain.
(define-public rust rust-1.57)
+
+(define-public rust-src
+ (hidden-package
+ (package
+ (inherit rust)
+ (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 the box."))))
--
2.34.0
[-- Attachment #3: Type: text/plain, Size: 11 bytes --]
--
over
next prev parent reply other threads:[~2022-01-22 5:13 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 ` [bug#53208] [PATCH 39/39] gnu: rust-analyzer: Make it out of box Z572 via Guix-patches via
2022-01-20 23:23 ` Nicolas Goaziou
[not found] ` <87ee504am6.fsf@qq.com>
2022-01-22 4:37 ` Z572 via Guix-patches via [this message]
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_E94BF92F5B47A5DCB144B2F6793325352305@qq.com \
--to=guix-patches@gnu.org \
--cc=53208@debbugs.gnu.org \
--cc=873216071@qq.com \
--cc=mail@nicolasgoaziou.fr \
/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).