guix_mirror_bot pushed a commit to branch master
in repository guix.

commit 51de2c41ca7957c075413f2bd2c347a497fb8705
Author: Sergio Pastor Pérez <[email protected]>
AuthorDate: Fri Jun 5 16:14:54 2026 +0200

    gnu: rocm-toolchain: Wrap programs.
    
    * gnu/packages/llvm.scm (rocm-toolchain): Wrap programs.
    
    Change-Id: I79ddbc1ca13e84a2814748dcffe1ae0799a86cf9
    Signed-off-by: Ludovic Courtès <[email protected]>
---
 gnu/packages/llvm.scm | 42 +++++++++++++++++++++++++++++++++++++-----
 1 file changed, 37 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index e7d9b18ea9..fc10b32bc1 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -2215,26 +2215,58 @@ the host.")
     (name "rocm-toolchain")
     (inputs
      (modify-inputs inputs
-       (append lld-wrapper-rocm
+       (append bash-minimal
+               lld-wrapper-rocm
                offload-rocm
                rocr-runtime
                rocm-hipcc
                rocm-device-libs)))
     (arguments
      (substitute-keyword-arguments arguments
+       ((#:modules modules)
+        `(,@modules
+          (guix build utils)))
        ((#:builder _)
         #~(begin
             (use-modules (ice-9 match)
-                         (guix build union))
+                         (guix build union)
+                         (guix build utils))
+
+            ;; Required for `wrap-program'.
+            (setenv "PATH" #$(file-append (this-package-input "bash-minimal")
+                                          "/bin"))
 
             (match %build-inputs
               (((names . directories) ...)
-               (union-build #$output directories)))
+               (union-build #$output directories
+                            #:symlink (lambda (old new)
+                                        (unless (wrapped-program? old)
+                                          (symlink old new)))
+                            #:create-all-directories? #t)))
 
             (union-build #$output:debug
-                         (list #$(this-package-input "libc-debug")))
+                         (list #$(this-package-input "libc-debug"))
+                         #:symlink (lambda (old new)
+                                     (unless (wrapped-program? old)
+                                       (symlink old new)))
+                         #:create-all-directories? #t)
             (union-build #$output:static
-                         (list #$(this-package-input "libc-static")))))))
+                         (list #$(this-package-input "libc-static"))
+                         #:symlink (lambda (old new)
+                                     (unless (wrapped-program? old)
+                                       (symlink old new)))
+                         #:create-all-directories? #t)
+
+            ;; Wrap-programs.
+            (let ((output-bindir (string-append #$output "/bin")))
+              (for-each
+               (lambda (file)
+                 (wrap-program file
+                   `("HIP_PATH" = ,(list #$output))
+                   `("HIP_CLANG_PATH" = ,(list output-bindir))))
+               (find-files output-bindir
+                           (lambda (file stat)
+                             (not (string-prefix? "." (basename file)))))))))))
     (native-search-paths
      (append (package-native-search-paths clang-rocm-toolchain)
              (list (search-path-specification

Reply via email to