~ruther/guix-local

b733de0dce34399596e1e89fd58e28fed9f5d5da — Maxim Cournoyer 7 months ago e2f6d4f
gnu: mesa-opencl-icd: Deprecate in favor of mesa-opencl.

The previously used Clover backend has been removed.

* gnu/packages/gl.scm (mesa-opencl-icd): Define as deprecated, using as
replacement...
(mesa-opencl): ... this, absorbing its icd file adjusting phase.
[#:modules]: New field.
[#:phases] {use-absolute-file-name-in-rusticl}: New phase.

Change-Id: If7ff766557dd37928e70d8e3ae03d7f1f467ab8a
1 files changed, 22 insertions(+), 23 deletions(-)

M gnu/packages/gl.scm
M gnu/packages/gl.scm => gnu/packages/gl.scm +22 -23
@@ 655,37 655,36 @@ from software emulation to complete hardware acceleration for modern GPUs.")
              (inherit (package-source mesa))))
    (arguments
     (substitute-keyword-arguments (package-arguments mesa)
       ((#:modules modules)
        (cons '(ice-9 textual-ports) modules))
       ((#:configure-flags flags)
        #~(cons* "-Dgallium-rusticl=true"
                 ;; Enable all drivers by default.
                 (string-append "-Dgallium-rusticl-enable-drivers="
                                "iris,llvmpipe,nouveau,panfrost,radeonsi,r600")
                 #$flags))))))

(define-public mesa-opencl-icd
  (package/inherit mesa-opencl
    (name "mesa-opencl-icd")
    (arguments
      (substitute-keyword-arguments (package-arguments mesa)
        ((#:configure-flags flags)
         #~(cons "-Dgallium-opencl=icd"
                (delete "-Dgallium-opencl=standalone" #$flags)))
        ((#:phases phases)
         #~(modify-phases #$phases
            (add-after 'install 'mesa-icd-absolute-path
                 #$flags))
       ((#:phases phases)
        #~(modify-phases #$phases
            (add-after 'install 'use-absolute-file-name-in-rusticl.icd
              (lambda _
                ;; Use absolute path for OpenCL platform library.
                ;; Otherwise we would have to set LD_LIBRARY_PATH=LIBRARY_PATH
                ;; for ICD in our applications to find OpenCL platform.
                (use-modules (guix build utils)
                             (ice-9 textual-ports))
                ;; Use absolute path for OpenCL platform library.  Otherwise
                ;; we would have to set LD_LIBRARY_PATH=LIBRARY_PATH for
                ;; Rusticl in our applications to find the OpenCL platform.
                (let* ((out #$output)
                       (mesa-icd (string-append out "/etc/OpenCL/vendors/mesa.icd"))
                       (old-path (call-with-input-file mesa-icd get-string-all))
                       (new-path (string-append out "/lib/" (string-trim-both old-path))))
                       (rusticl.icd (string-append
                                     out "/etc/OpenCL/vendors/rusticl.icd"))
                       (old-path (call-with-input-file rusticl.icd
                                   get-string-all))
                       (new-path (string-append out "/lib/"
                                                (string-trim-both old-path))))
                  (if (file-exists? new-path)
                    (call-with-output-file mesa-icd
                      (lambda (port) (format port "~a\n" new-path)))))))))))))
                      (call-with-output-file rusticl.icd
                        (lambda (port) (format port "~a\n" new-path)))))))))))))

;;; ICD was part of the Gallium (Clover) OpenCL driver, which was replaced
;;; with Rusticl.
(define-public mesa-opencl-icd
  (deprecated-package "mesa-opencl-icd" mesa-opencl))

(define-public mesa-headers
  (package/inherit mesa