Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / vulkan.scm
CommitLineData
0df77274 1;;; GNU Guix --- Functional package management for GNU
a4f99103 2;;; Copyright © 2017, 2018 Rutger Helling <rhelling@mykolab.com>
0df77274
RH
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 vulkan)
20 #:use-module ((guix licenses) #:prefix license:)
21 #:use-module (guix packages)
794d740e 22 #:use-module (guix download)
0df77274
RH
23 #:use-module (guix git-download)
24 #:use-module (guix build-system cmake)
794d740e 25 #:use-module (gnu packages)
6a11d5f1 26 #:use-module (gnu packages bison)
9286e0ec
RH
27 #:use-module (gnu packages freedesktop)
28 #:use-module (gnu packages gl)
794d740e 29 #:use-module (gnu packages pkg-config)
9286e0ec
RH
30 #:use-module (gnu packages python)
31 #:use-module (gnu packages xorg))
0df77274
RH
32
33(define-public spirv-headers
a4f99103
RH
34 ;; Keep updated in accordance with
35 ;; https://github.com/google/shaderc/blob/known-good/known_good.json
36 (let ((commit "061097878467b8e040fbf153a837d844ef9f9f96")
37 (revision "2"))
0df77274
RH
38 (package
39 (name "spirv-headers")
40 (version (string-append "0.0-" revision "." (string-take commit 9)))
41 (source
42 (origin
43 (method git-fetch)
44 (uri (git-reference
45 (url "https://github.com/KhronosGroup/SPIRV-Headers")
46 (commit commit)))
47 (sha256
48 (base32
a4f99103 49 "0bf9h6xc5fkncxnadwmqvpsjh7sdgns6is8prv1gvlfzrkvpjj17"))
0df77274
RH
50 (file-name (string-append name "-" version "-checkout"))))
51 (build-system cmake-build-system)
52 (arguments
53 `(#:tests? #f ;; No tests
54 #:phases (modify-phases %standard-phases
55 (replace 'install
56 (lambda* (#:key outputs #:allow-other-keys)
57 (zero? (system* "cmake" "-E" "copy_directory"
58 "../source/include/spirv"
59 (string-append (assoc-ref outputs "out")
60 "/include/spirv"))))))))
61 (home-page "https://github.com/KhronosGroup/SPIRV-Headers")
62 (synopsis "Machine-readable files from the SPIR-V Registry")
63 (description
64 "SPIRV-Headers is a repository containing machine-readable files from
65the SPIR-V Registry. This includes:
66@itemize
67@item Header files for various languages.
68@item JSON files describing the grammar for the SPIR-V core instruction set,
69and for the GLSL.std.450 extended instruction set.
70@item The XML registry file.
71@end itemize\n")
72 (license (license:x11-style
73 (string-append "https://github.com/KhronosGroup/SPIRV-Headers/blob/"
74 commit "/LICENSE"))))))
794d740e
RH
75
76(define-public spirv-tools
a9342820
RH
77 ;; Keep updated in accordance with
78 ;; https://github.com/google/shaderc/blob/known-good/known_good.json
79 (let ((commit "90862fe4b1c6763b32ce683d2d32c2f281f577cf")
80 (revision "1"))
81 (package
82 (name "spirv-tools")
83 (version (string-append "0.0-" revision "." (string-take commit 9)))
84 (source
85 (origin
86 (method git-fetch)
87 (uri (git-reference
88 (url "https://github.com/KhronosGroup/SPIRV-Tools")
89 (commit commit)))
794d740e
RH
90 (sha256
91 (base32
a9342820
RH
92 "1yq8ab6f52wcxm2azzmx70nqz8l35izd45830aikjkk1jfzmzabb"))
93 (file-name (string-append name "-" version "-checkout"))))
94 (build-system cmake-build-system)
95 (arguments
96 `(#:configure-flags (list (string-append "-DCMAKE_INSTALL_LIBDIR="
97 (assoc-ref %outputs "out")
98 "/lib")
99 (string-append "-DSPIRV-Headers_SOURCE_DIR="
100 (assoc-ref %build-inputs
101 "spirv-headers")))))
102 (inputs `(("spirv-headers" ,spirv-headers)))
103 (native-inputs `(("pkg-config", pkg-config)
104 ("python" ,python)))
105 (home-page "https://github.com/KhronosGroup/SPIRV-Tools")
106 (synopsis "API and commands for processing SPIR-V modules")
107 (description
108 "The SPIR-V Tools project provides an API and commands for processing
794d740e
RH
109SPIR-V modules. The project includes an assembler, binary module parser,
110disassembler, validator, and optimizer for SPIR-V.")
a9342820 111 (license license:asl2.0))))
6a11d5f1
RH
112
113(define-public glslang
76ef53eb
RH
114 ;; Keep updated in accordance with
115 ;; https://github.com/google/shaderc/blob/known-good/known_good.json
116 (let ((commit "b5b08462442239e6537315ea1405b6afcd53043e")
117 (revision "2"))
6a11d5f1
RH
118 (package
119 (name "glslang")
120 (version (string-append "3.0-" revision "." (string-take commit 9)))
121 (source
122 (origin
123 (method git-fetch)
124 (uri (git-reference
125 (url "https://github.com/KhronosGroup/glslang")
126 (commit commit)))
127 (sha256
128 (base32
76ef53eb 129 "08imby3hciisshzacrkx8s56lx4fxm7dad06xxaxxcapinmqrvwk"))
6a11d5f1
RH
130 (file-name (string-append name "-" version "-checkout"))))
131 (build-system cmake-build-system)
132 (arguments
133 `(#:tests? #f ;; No tests
134 ;; glslang tries to set CMAKE_INSTALL_PREFIX manually. Remove the
135 ;; offending line.
136 #:phases (modify-phases %standard-phases
137 (add-after 'patch-source-shebangs 'fix-cmakelists
138 (lambda _
139 (substitute* "CMakeLists.txt"
140 (("set.*CMAKE_INSTALL_PREFIX.*") ""))
141 #t)))))
142 (native-inputs `(("bison" ,bison)
143 ("pkg-config" ,pkg-config)))
144 (home-page "https://github.com/KhronosGroup/glslang")
145 (synopsis "OpenGL and OpenGL ES shader front end and validator")
146 (description
147 "Glslang is the official reference compiler front end for the
148OpenGL@tie{}ES and OpenGL shading languages. It implements a strict
149interpretation of the specifications for these languages.")
150 ;; Modified BSD license. See "copyright" section of
151 ;; https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
152 (license (list license:bsd-3
153 ;; include/SPIRV/{bitutils,hex_float}.h are Apache 2.0.
154 license:asl2.0)))))
9286e0ec
RH
155
156(define-public vulkan-icd-loader
157 (package
158 (name "vulkan-icd-loader")
8b9dbdf3 159 (version "1.0.65.2")
9286e0ec
RH
160 (source
161 (origin
162 (method url-fetch)
163 (uri (string-append
164 "https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/"
165 "archive/sdk-" version ".tar.gz"))
166 (sha256
167 (base32
8b9dbdf3 168 "1ivvmb977n2xp95v3sryhflvryy3mxrcwrd1hnr2dmri40vg1sl8"))))
9286e0ec
RH
169 (build-system cmake-build-system)
170 (arguments
171 `(#:tests? #f ;FIXME: 23/39 tests fail. Try "tests/run_all_tests.sh".
172 #:configure-flags (list (string-append "-DCMAKE_INSTALL_LIBDIR="
173 (assoc-ref %outputs "out") "/lib"))))
174 (inputs `(("glslang" ,glslang)
175 ("libxcb" ,libxcb)
176 ("libx11" ,libx11)
177 ("libxrandr" ,libxrandr)
178 ("mesa" ,mesa)
179 ("spirv-tools" ,spirv-tools)
180 ("wayland" ,wayland)))
181 (native-inputs `(("pkg-config", pkg-config)
182 ("python" ,python)))
183 (home-page
184 "https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers")
185 (synopsis "Khronos official ICD loader and validation layers for Vulkan")
186 (description
187 "Vulkan allows multiple @dfn{Installable Client Drivers} (ICDs) each
188supporting one or more devices to be used collectively. The loader is
189responsible for discovering available Vulkan ICDs on the system and inserting
190Vulkan layer libraries, including validation layers between the application
191and the ICD.")
192 ;; This software is mainly Apache 2.0 licensed, but contains some components
193 ;; covered by other licenses. See COPYRIGHT.txt for details.
194 (license (list license:asl2.0 ;LICENSE.txt
195 (license:x11-style "file://COPYRIGHT.txt")
196 license:bsd-3))))