From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id MOmlBB753mFkFQAAgWs5BA (envelope-from ) for ; Wed, 12 Jan 2022 16:51:58 +0100 Received: from aspmx2.migadu.com ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id UFXgOB353mEVSgAAG6o9tA (envelope-from ) for ; Wed, 12 Jan 2022 16:51:57 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx2.migadu.com (Postfix) with ESMTPS id 80BFB3B0E4 for ; Wed, 12 Jan 2022 16:51:57 +0100 (CET) Received: from localhost ([::1]:49070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n7fum-0001t7-LD for larch@yhetil.org; Wed, 12 Jan 2022 10:51:56 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59820) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n7fYq-0000pq-LW for guix-patches@gnu.org; Wed, 12 Jan 2022 10:29:16 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:37571) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n7fYq-0002ao-88 for guix-patches@gnu.org; Wed, 12 Jan 2022 10:29:16 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n7fYq-0002Ls-6D for guix-patches@gnu.org; Wed, 12 Jan 2022 10:29:16 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53208] [PATCH 39/39] gnu: rust-analyzer: Make it out of box. Resent-From: Z572 <873216071@qq.com> Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 12 Jan 2022 15:29:16 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53208 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 53208@debbugs.gnu.org Received: via spool by 53208-submit@debbugs.gnu.org id=B53208.16420013308734 (code B ref 53208); Wed, 12 Jan 2022 15:29:16 +0000 Received: (at 53208) by debbugs.gnu.org; 12 Jan 2022 15:28:50 +0000 Received: from localhost ([127.0.0.1]:58666 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n7fYP-0002Gh-PX for submit@debbugs.gnu.org; Wed, 12 Jan 2022 10:28:50 -0500 Received: from out203-205-251-88.mail.qq.com ([203.205.251.88]:46338) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <873216071@qq.com>) id 1n7fY5-0002Bz-2Y for 53208@debbugs.gnu.org; Wed, 12 Jan 2022 10:28:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1642001302; bh=/lbo33s0y6AFq/KUvAR+TamqIgFWvNsvUXw1LfseZN0=; h=From:To:Subject:Date:In-Reply-To:References; b=uDmtpRuLCdFQQOFEQIW7vXGvukZv6BagqF6YPDyHPK9j8VGwI1Hlo+S561l7Mt2ne lk5grJ75Ystv20rHb/fi10/z0ttyhHkGx1F/6rrvBhd2awidBeaLKvXJlYCyqrj0W2 tMPHdFJ//SyTgrTW5o8a8m+BKr0RhsXbXbYTfT8c= Received: from localhost.localdomain ([112.10.216.34]) by newxmesmtplogicsvrsza5.qq.com (NewEsmtp) with SMTP id 6FB19A7A; Wed, 12 Jan 2022 23:27:59 +0800 X-QQ-mid: xmsmtpt1642001301tb4mgwvcp Message-ID: X-QQ-XMAILINFO: NO3HR8m27uattQSPI+7PZRS2MLeSrduFI5dwPxsNxd1pT7ZwARe1vsDxjdaCHH TbuNbtX9ivpevcbutJFL0gLXM79NJnySK8SSF/ddI0MsBwpd/VxA9F7a8gs77Mq0ciNARyGDuk7i jmvVoboeS26Sv5mRqD6ZXI5Q/KTYqHhhGpYzIkkoYokBCti2O8sgTQW00EkUp+zuxs5gonOj66rC XHO2HC9yj1XgQ3GDuXm9fKL/Azlmz8o6b85weBajnnHrYpnnX2LkeyJvpRhCJ0E62WpzbdnCrXWh 0sAPDQRshtA8J6cqH5i6Z5rkfnxfLUnmbt6vvIYwCLXjNoSj1NqBxOIwX7yErBBoM2qUsexIoRLv WoXWV3xnvotK/cI96SYV3Vi1gAVRMEFRQyU4NOH10ud4YA/HELSC7xQe6MCHhOlrGumBrDzuDuYv QA1Nl/cUMVxNxY94rFL1SRu6XY7HemcgyTuW4oEw/Brval+iYdOyhnHgaau8fUbVflJNPjIdfRqa CrH8odDnC906OhNRVqYRjzBwnaWl8IPxXFQdTl7QUninYudCvmva9jPpSCh4T1X/QtXQ8XYEdAtx hLF6NkpucZBQHW6jhZB8b1bhJc0Pii9a4qzB1NDTfU8rCpQ2I8yTW2J3+DqItGWHeG9z6LWEvK30 8RE2C1WnORIfd1pDfExKtwKw7aG3TLM4LY6z0w1wLUXNKl15IumymWPnptS7WB7oQbQZ8GFFkmmL l73gp0tHsP8lARViurilRyTbF7fyetVaADVQwQkeExrCGBtEnamXGkY3Ar6qqkRszVePc4kCpPUR 52mtb9hv7wnz9ZuN0Z7NOwGHggcgxYgorb4guhNDkUkOawJLMEOWxaGvkskstThIG1NPcM7xyV+g == X-QQ-SPAM: true Date: Wed, 12 Jan 2022 23:27:59 +0800 X-OQ-MSGID: X-Mailer: git-send-email 2.34.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" Reply-to: Z572 <873216071@qq.com> X-ACL-Warn: , Z572 via Guix-patches From: Z572 via Guix-patches via X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1642002717; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=/lbo33s0y6AFq/KUvAR+TamqIgFWvNsvUXw1LfseZN0=; b=e7Ph9IhvWzG/4DgzrNphkM4yVlO5l+YVeOd/jfzSCjpkFjgNf1lEuF7wiHXmNED/eBbROV u5C4ZipKdNh+2MuZV/KqYQBxzl96xodxcgmIJ9AIVhoOEtYtuk19XpMPL80CHoZxH5nPPw +ZuxhmkbfGl++RDef/vn/Wt7JhD378JuDiuMptFlkcTZ/vRAJWySfflFn5syTGe1HXvaQU rFF3CWB5D5ezxXzpyKE7IRNyp8lEO9nPgG0C+BvNc70IVpSxXy+/j0Hg1U9Rq9J73otn0q e2FkmQjVbOmjiFsgnIUtnyVm8E4zjtEqa5+xcA+whW3SX13waICanN6v/SWddw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1642002717; a=rsa-sha256; cv=none; b=NjS4GCY4hTOQghFOnTDouGZZn6BUq/oLTGgqnvIlNvSZRxd37kFKedAVs/dVeCB5SPAxis EJ8CGtT+UjGQYGT4djsup0xyNpdg97JOa5kcohI3udNzJyoaCXQk0S9vToXoHO3oFAo4dz 71eUQcgGVFCeC7zMVcpK4YYaV6L6cZyzzLquvnemuuFXYNGpvxG2uhDw4TgXKR9fqfbnWl sjHoYzE2zEBr90K/GmfHRUrG47yuw8SA6PxOQnzv5MJEPMHYhg6YdA/3PcrtS781cihGrG +wlzvPFEGesujn3cMPaACSLPuLlfrk/PxjQGTI4sRhIrnkjdgz+JMOANI1zXFw== ARC-Authentication-Results: i=1; aspmx2.migadu.com; dkim=fail ("headers rsa verify failed") header.d=qq.com header.s=s201512 header.b=uDmtpRuL; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx2.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.12 Authentication-Results: aspmx2.migadu.com; dkim=fail ("headers rsa verify failed") header.d=qq.com header.s=s201512 header.b=uDmtpRuL; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx2.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 80BFB3B0E4 X-Spam-Score: -3.12 X-Migadu-Scanner: scn0.migadu.com X-TUID: XOGPoB0N6CsF * 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