unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Milkey Mouse <milkeymouse@meme.institute>
To: 48525@debbugs.gnu.org
Subject: [bug#48525] [PATCH core-updates 2/2] gnu: rust: Add profiling support.
Date: Tue, 25 May 2021 16:03:50 -0700	[thread overview]
Message-ID: <20210525230350.542603-2-milkeymouse@meme.institute> (raw)
In-Reply-To: <20210525230350.542603-1-milkeymouse@meme.institute>

* gnu/packages/rust.scm (rust-1.52)
[phases]{unpack-profiler-rt, enable-profiling}: New phases.
[native-inputs]{compiler-rt-source}: New input.
---
 gnu/packages/rust.scm | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index 6b769bfab2..7b77d791d1 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -853,7 +853,29 @@ safety and thread safety guarantees.")
       (inherit base-rust)
       (inputs
         (alist-replace "llvm" (list llvm-12)
-                       (package-inputs base-rust))))))
+                       (package-inputs base-rust)))
+      ;; Add compiler-rt-source for libprofiler_builtins (needed for profiling
+      ;; support), which normally vendors its own copy of compiler-rt.
+      (native-inputs (cons*
+                      `("compiler-rt-source" ,(package-source clang-runtime-12))
+                      (package-native-inputs base-rust)))
+      (arguments
+       (substitute-keyword-arguments (package-arguments base-rust)
+         ((#:phases phases)
+          `(modify-phases ,phases
+             (add-after 'unpack 'unpack-profiler-rt
+               ;; Copy compiler-rt sources to where libprofiler_builtins
+               ;; looks for its vendored copy.
+               (lambda* (#:key inputs #:allow-other-keys)
+                 (mkdir-p "src/llvm-project/compiler-rt")
+                 (invoke "tar" "-xf" (assoc-ref inputs "compiler-rt-source")
+                   "-C" "src/llvm-project/compiler-rt" "--strip-components=1")
+                   #t))
+             (add-after 'enable-codegen-tests 'enable-profiling
+               (lambda _
+                 (substitute* "config.toml"
+                   (("^profiler =.*$") "")
+                   (("[[]build[]]") "\n[build]\nprofiler = true\n")))))))))))
 
 ;;; Note: Only the latest versions of Rust are supported and tested.  The
 ;;; intermediate rusts are built for bootstrapping purposes and should not
-- 
2.31.1





  reply	other threads:[~2021-05-25 23:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-19 18:37 [bug#48525] [PATCH core-updates] gnu: rust: Add profiling support Milkey Mouse
2021-05-23 14:20 ` Marius Bakke
2021-05-25  1:13   ` Milkey Mouse
2021-05-25 20:35     ` Marius Bakke
2021-05-25 23:03 ` [bug#48525] [PATCH core-updates 1/2] gnu: rust: Update to 1.52 Milkey Mouse
2021-05-25 23:03   ` Milkey Mouse [this message]
2024-01-20 22:42     ` bug#48525: [PATCH core-updates] gnu: rust: Add profiling support Maxim Cournoyer

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=20210525230350.542603-2-milkeymouse@meme.institute \
    --to=milkeymouse@meme.institute \
    --cc=48525@debbugs.gnu.org \
    /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).