aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages
diff options
context:
space:
mode:
authorMilkey Mouse <milkeymouse@meme.institute>2024-01-20 17:39:53 -0500
committerLudovic Courtès <ludo@gnu.org>2024-08-31 10:44:36 +0200
commit3a930659a4958d99de5f3c647f4d8e1127b8a0ca (patch)
tree0a0e2736daeacf7816dc507fa6383da875e092a1 /gnu/packages
parentaf85c38b017be3d932d4665acd9ff4b5c56a9790 (diff)
downloadguix-3a930659a4958d99de5f3c647f4d8e1127b8a0ca.tar.gz
guix-3a930659a4958d99de5f3c647f4d8e1127b8a0ca.zip
gnu: rust: Add profiling support.
* gnu/packages/rust.scm (rust-1.52) [phases] <unpack-profiler-rt, enable-profiling>: New phases. Change-Id: Iecb4aef518e52f71ff7f539778bf0341288a3458
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/rust.scm25
1 files changed, 19 insertions, 6 deletions
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index e5e58ca8d3..344b712ff5 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -1225,11 +1225,24 @@ safety and thread safety guarantees.")
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
(substitute* "src/bootstrap/src/core/builder.rs"
- ((" = rpath.*" all)
- (string-append all
- " "
- "rustflags.arg(\"-Clink-args=-Wl,-rpath="
- out "/lib\");\n"))))))
+ ((" = rpath.*" all)
+ (string-append all
+ " "
+ "rustflags.arg(\"-Clink-args=-Wl,-rpath="
+ out "/lib\");\n"))))))
+ (add-after 'unpack 'unpack-profiler-rt
+ ;; Copy compiler-rt sources to where libprofiler_builtins looks
+ ;; for its vendored copy. Keep the clang-runtime version in
+ ;; sync with the LLVM version used to build Rust.
+ (lambda* (#:key inputs #:allow-other-keys)
+ (mkdir-p "src/llvm-project/compiler-rt")
+ (invoke "tar" "-xf" #$(package-source clang-runtime-15)
+ "-C" "src/llvm-project/compiler-rt" "--strip-components=1")))
+ (add-after 'enable-codegen-tests 'enable-profiling
+ (lambda _
+ (substitute* "config.toml"
+ (("^profiler =.*$") "")
+ (("\\[build\\]") "\n[build]\nprofiler = true\n"))))
(add-after 'configure 'add-gdb-to-config
(lambda* (#:key inputs #:allow-other-keys)
(let ((gdb (assoc-ref inputs "gdb")))
@@ -1245,7 +1258,7 @@ safety and thread safety guarantees.")
(number->string (parallel-job-count))
"1"))))
(invoke "./x.py" job-spec "build"
- "library/std" ;rustc
+ "library/std" ;rustc
"src/tools/cargo"
"src/tools/clippy"
"src/tools/rust-analyzer"