gnu: Add opencl-headers.
[jackhill/guix/guix.git] / gnu / packages / opencl.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2018 Fis Trivial <ybbs.daans@hotmail.com>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
10 ;;;
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19 (define-module (gnu packages opencl)
20 #:use-module (guix build-system gnu)
21 #:use-module (guix git-download)
22 #:use-module (guix packages)
23 #:use-module ((guix licenses) #:prefix license:))
24
25 ;; This file adds OpenCL implementation related packages. Due to the fact that
26 ;; OpenCL devices are not available during build (store environment), tests are
27 ;; all disabled.
28 ;; Check https://lists.gnu.org/archive/html/guix-devel/2018-04/msg00293.html
29
30 (define (make-opencl-headers major-version subversion)
31 (let ((commit "e986688daf750633898dfd3994e14a9e618f2aa5")
32 (revision "0"))
33 (package
34 (name "opencl-headers")
35 (version (git-version
36 (string-append major-version "." subversion ".0")
37 revision commit))
38 (source (origin
39 (method git-fetch)
40 (uri (git-reference
41 (url "https://github.com/KhronosGroup/OpenCL-Headers.git")
42 (commit commit)))
43 (file-name (string-append name "-" commit))
44 (sha256
45 (base32
46 "176ydpbyws5nr4av6hf8p41pkhc0rc4m4vrah9w6gp2fw2i32838"))))
47 (build-system gnu-build-system)
48 (arguments
49 `(#:phases
50 (modify-phases %standard-phases
51 (delete 'configure)
52 (delete 'build)
53 (delete 'check)
54 (replace 'install
55 (lambda* (#:key outputs #:allow-other-keys)
56 (copy-recursively (string-append "./opencl" (string-append
57 ,major-version
58 ,subversion) "/CL")
59 (string-append
60 (assoc-ref outputs "out")
61 "/include/CL")))))))
62 (synopsis "The Khronos OpenCL headers")
63 (description
64 "This package provides the C headers by Khronos for OpenCL
65 programming.")
66 (home-page "https://www.khronos.org/registry/OpenCL/")
67 (license license:expat))))
68
69 (define-public opencl-headers-2.2
70 (make-opencl-headers "2" "2"))
71 (define-public opencl-headers-2.1
72 (make-opencl-headers "2" "1"))
73 (define-public opencl-headers-2.0
74 (make-opencl-headers "2" "0"))
75 (define-public opencl-headers-1.2
76 (make-opencl-headers "1" "2"))
77 (define-public opencl-headers-1.1
78 (make-opencl-headers "1" "1"))
79 (define-public opencl-headers-1.0
80 (make-opencl-headers "1" "0"))
81
82 (define-public opencl-headers opencl-headers-2.2)