diff options
| author | pjotrp | 2026-04-15 09:52:14 +0200 |
|---|---|---|
| committer | pjotrp | 2026-04-15 09:52:14 +0200 |
| commit | 903a054c61cccb13fd37033d002755cef6367a0c (patch) | |
| tree | ac291df2681b5e6142bb77ab45e1c86b11eaae38 | |
| parent | a488ecad23ea37aae238dd6905cece16cd05e62a (diff) | |
| download | guix-bioinformatics-903a054c61cccb13fd37033d002755cef6367a0c.tar.gz | |
Allow tuning rust packages
| -rw-r--r-- | gn/packages/pangenome-rust.scm | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/gn/packages/pangenome-rust.scm b/gn/packages/pangenome-rust.scm index 966384a..91c9d6d 100644 --- a/gn/packages/pangenome-rust.scm +++ b/gn/packages/pangenome-rust.scm @@ -34,25 +34,34 @@ (crate-source "anyhow" "1.0.66" "1xj3ahmwjlbiqsajhkaa0q6hqwb4l3l5rkfxa7jk1498r3fn2qi1")) -;; Phase snippet to set RUSTFLAGS for CPU tuning. -;; Detects the tuning CPU from PATH (tuning-compiler-<cpu> directory) -;; and sets RUSTFLAGS=-C target-cpu=<cpu>. +;; Phase snippet for CPU tuning of Rust packages. +;; Removes the tuning rustc wrapper from PATH (which injects -C target_cpu +;; into ALL rustc calls including build scripts, causing SIGILL on +;; cross-tuning) and instead sets CARGO_BUILD_RUSTFLAGS which only applies +;; to target crate compilation, not build scripts. (define %rust-tuning-phase #~(add-before 'build 'set-rust-target-cpu (lambda _ - (let loop ((dirs (string-split (or (getenv "PATH") "") #\:))) + (let loop ((dirs (string-split (or (getenv "PATH") "") #\:)) + (kept '()) + (cpu #f)) (if (null? dirs) - #t + (begin + (setenv "PATH" (string-join (reverse kept) ":")) + (when cpu + (setenv "CARGO_BUILD_RUSTFLAGS" + (string-append (or (getenv "CARGO_BUILD_RUSTFLAGS") "") + " -C target-cpu=" cpu)) + (format #t " Removed tuning rustc wrapper from PATH~%") + (format #t " CARGO_BUILD_RUSTFLAGS set for CPU tuning: ~a~%" + (getenv "CARGO_BUILD_RUSTFLAGS")))) (let ((base (basename (dirname (car dirs))))) (if (string-contains base "tuning-compiler-") - (let ((cpu (substring base - (+ (string-contains base "tuning-compiler-") - (string-length "tuning-compiler-"))))) - (setenv "RUSTFLAGS" - (string-append (or (getenv "RUSTFLAGS") "") - " -C target-cpu=" cpu)) - (format #t " RUSTFLAGS set for CPU tuning: ~a~%" (getenv "RUSTFLAGS"))) - (loop (cdr dirs))))))))) + (let ((detected (substring base + (+ (string-contains base "tuning-compiler-") + (string-length "tuning-compiler-"))))) + (loop (cdr dirs) kept detected)) + (loop (cdr dirs) (cons (car dirs) kept) cpu)))))))) (define rust-autocfg-1.1.0 |
