Subject: [PATCH 2/3] gnu: Add clinfo.

From: Fis Trivial <[email-masked]>
Date: Tue, 26 Jun 2018 19:39:42 +0000

* gnu/packages/opencl.scm (clinfo): New variable.
---
 gnu/packages/opencl.scm | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/gnu/packages/opencl.scm b/gnu/packages/opencl.scm
index b9cca3406..0c2f7d147 100644
--- a/gnu/packages/opencl.scm
+++ b/gnu/packages/opencl.scm
@@ -155,3 +155,46 @@ Driver)")
 Driver).  An OpenCL program can use several ICD thanks to the use of an ICD
 Loader as provided by this project.  This free ICD Loader can load any ICD.")
     (license (list license:gpl2 license:ruby))))
+
+(define-public clinfo
+  (package
+    (name "clinfo")
+    (version "2.2.18.04.06")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://github.com/Oblomov/clinfo/archive/"
+                    version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "0v7cy01irwdgns6lzaprkmm0502pp5a24zhhffydxz1sgfjj2w7p"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("opencl-headers" ,opencl-headers)))
+    (inputs
+     `(("ocl-icd" ,ocl-icd)))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (replace 'build
+           (lambda _
+             (let ((cores (number->string (parallel-job-count))))
+               (setenv "CC" "gcc")
+               (invoke "make" "-j" cores))))
+         (delete 'install)
+         (add-after 'build 'make-install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (invoke "make" "install" (string-append
+                                       "PREFIX="
+                                       (assoc-ref outputs "out"))))))
+       #:tests? #f))
+    (home-page "https://github.com/Oblomov/clinfo")
+    (synopsis "Print all known information about all available OpenCL platforms
+and devices in the system")
+    ;; Only the implementation installed via guix will be detected.
+    (description "This package is a simple command-line application that
+enumerates all possible (known) properties of the OpenCL platform and devices
+available on the Guix.")
+    (license license:non-copyleft)))
--
2.14.4