summaryrefslogtreecommitdiff
path: root/gnu/packages/rust.scm
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/rust.scm
parentaf85c38b017be3d932d4665acd9ff4b5c56a9790 (diff)
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/rust.scm')
-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 e5e58ca8d30..344b712ff52 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -1225,11 +1225,24 @@ safety and thread safety guarantees.")
1225 (lambda* (#:key outputs #:allow-other-keys) 1225 (lambda* (#:key outputs #:allow-other-keys)
1226 (let ((out (assoc-ref outputs "out"))) 1226 (let ((out (assoc-ref outputs "out")))
1227 (substitute* "src/bootstrap/src/core/builder.rs" 1227 (substitute* "src/bootstrap/src/core/builder.rs"
1228 ((" = rpath.*" all) 1228 ((" = rpath.*" all)
1229 (string-append all 1229 (string-append all
1230 " " 1230 " "
1231 "rustflags.arg(\"-Clink-args=-Wl,-rpath=" 1231 "rustflags.arg(\"-Clink-args=-Wl,-rpath="
1232 out "/lib\");\n")))))) 1232 out "/lib\");\n"))))))
1233 (add-after 'unpack 'unpack-profiler-rt
1234 ;; Copy compiler-rt sources to where libprofiler_builtins looks
1235 ;; for its vendored copy. Keep the clang-runtime version in
1236 ;; sync with the LLVM version used to build Rust.
1237 (lambda* (#:key inputs #:allow-other-keys)
1238 (mkdir-p "src/llvm-project/compiler-rt")
1239 (invoke "tar" "-xf" #$(package-source clang-runtime-15)
1240 "-C" "src/llvm-project/compiler-rt" "--strip-components=1")))
1241 (add-after 'enable-codegen-tests 'enable-profiling
1242 (lambda _
1243 (substitute* "config.toml"
1244 (("^profiler =.*$") "")
1245 (("\\[build\\]") "\n[build]\nprofiler = true\n"))))
1233 (add-after 'configure 'add-gdb-to-config 1246 (add-after 'configure 'add-gdb-to-config
1234 (lambda* (#:key inputs #:allow-other-keys) 1247 (lambda* (#:key inputs #:allow-other-keys)
1235 (let ((gdb (assoc-ref inputs "gdb"))) 1248 (let ((gdb (assoc-ref inputs "gdb")))
@@ -1245,7 +1258,7 @@ safety and thread safety guarantees.")
1245 (number->string (parallel-job-count)) 1258 (number->string (parallel-job-count))
1246 "1")))) 1259 "1"))))
1247 (invoke "./x.py" job-spec "build" 1260 (invoke "./x.py" job-spec "build"
1248 "library/std" ;rustc 1261 "library/std" ;rustc
1249 "src/tools/cargo" 1262 "src/tools/cargo"
1250 "src/tools/clippy" 1263 "src/tools/clippy"
1251 "src/tools/rust-analyzer" 1264 "src/tools/rust-analyzer"