gnu: kdenlive: Add missing dependencies.
[jackhill/guix/guix.git] / gnu / packages / vulkan.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
3 ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
4 ;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
5 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
6 ;;;
7 ;;; This file is part of GNU Guix.
8 ;;;
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
13 ;;;
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
18 ;;;
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22 (define-module (gnu packages vulkan)
23 #:use-module ((guix licenses) #:prefix license:)
24 #:use-module (guix packages)
25 #:use-module (guix download)
26 #:use-module (guix git-download)
27 #:use-module (guix build-system cmake)
28 #:use-module (guix build-system gnu)
29 #:use-module (guix build-system meson)
30 #:use-module (gnu packages)
31 #:use-module (gnu packages autotools)
32 #:use-module (gnu packages bison)
33 #:use-module (gnu packages check)
34 #:use-module (gnu packages cmake)
35 #:use-module (gnu packages freedesktop)
36 #:use-module (gnu packages gettext)
37 #:use-module (gnu packages gl)
38 #:use-module (gnu packages pkg-config)
39 #:use-module (gnu packages python)
40 #:use-module (gnu packages wine)
41 #:use-module (gnu packages xorg))
42
43 (define-public spirv-headers
44 (package
45 (name "spirv-headers")
46 (version "1.5.3")
47 (source
48 (origin
49 (method git-fetch)
50 (uri (git-reference
51 (url "https://github.com/KhronosGroup/SPIRV-Headers")
52 (commit version)))
53 (sha256
54 (base32
55 "069sivqajp7z4p44lmrz23lvf237xpkjxd4lzrg27836pwqcz9bj"))
56 (file-name (git-file-name name version))))
57 (build-system cmake-build-system)
58 (arguments
59 `(#:tests? #f)) ;no tests
60 (home-page "https://github.com/KhronosGroup/SPIRV-Headers")
61 (synopsis "Machine-readable files from the SPIR-V Registry")
62 (description
63 "SPIRV-Headers is a repository containing machine-readable files from
64 the SPIR-V Registry. This includes:
65 @itemize
66 @item Header files for various languages.
67 @item JSON files describing the grammar for the SPIR-V core instruction set,
68 and for the GLSL.std.450 extended instruction set.
69 @item The XML registry file.
70 @end itemize\n")
71 (license (license:x11-style
72 (string-append "https://github.com/KhronosGroup/SPIRV-Headers/blob/"
73 version "/LICENSE")))))
74
75 (define-public spirv-tools
76 (package
77 (name "spirv-tools")
78 (version "2020.2")
79 (source
80 (origin
81 (method git-fetch)
82 (uri (git-reference
83 (url "https://github.com/KhronosGroup/SPIRV-Tools")
84 (commit (string-append "v" version))))
85 (sha256
86 (base32 "00b7xgyrcb2qq63pp3cnw5q1xqx2d9rfn65lai6n6r89s1vh3vg6"))
87 (file-name (git-file-name name version))))
88 (build-system cmake-build-system)
89 (arguments
90 `(#:configure-flags (list "-DBUILD_SHARED_LIBS=ON"
91 (string-append
92 "-DSPIRV-Headers_SOURCE_DIR="
93 (assoc-ref %build-inputs "spirv-headers")))))
94 (inputs `(("spirv-headers" ,spirv-headers)))
95 (native-inputs `(("pkg-config" ,pkg-config)
96 ("python" ,python)))
97 (home-page "https://github.com/KhronosGroup/SPIRV-Tools")
98 (synopsis "API and commands for processing SPIR-V modules")
99 (description
100 "The SPIR-V Tools project provides an API and commands for processing
101 SPIR-V modules. The project includes an assembler, binary module
102 parser,disassembler, validator, and optimizer for SPIR-V.")
103 (license license:asl2.0)))
104
105 (define-public spirv-cross
106 (package
107 (name "spirv-cross")
108 (version "2020-05-19")
109 (source
110 (origin
111 (method git-fetch)
112 (uri (git-reference
113 (url "https://github.com/KhronosGroup/SPIRV-Cross")
114 (commit version)))
115 (sha256
116 (base32 "0zyijp9zx9wbd4i5lwjap7n793iz6yjkf27la60dsffxl75yy9pd"))
117 (file-name (git-file-name name version))))
118 (build-system cmake-build-system)
119 (arguments
120 `(#:configure-flags
121 (list "-DSPIRV_CROSS_SHARED=YES")
122 ;; FIXME: The following tests fail:
123 ;; 15 - spirv-cross-test-opt
124 ;; 16 - spirv-cross-test-metal-opt
125 ;; 17 - spirv-cross-test-hlsl-opt
126 #:tests? #f
127 #:phases
128 (modify-phases %standard-phases
129 (add-after 'unpack 'fix-tests-to-find-deps
130 (lambda* (#:key inputs #:allow-other-keys)
131 (substitute* "CMakeLists.txt"
132 (("\\$\\{CMAKE_(.*)_DIR\\}/external/glslang(.*)/bin")
133 (string-append (assoc-ref inputs "glslang") "/bin")))
134 (substitute* "CMakeLists.txt"
135 (("\\$\\{CMAKE_(.*)_DIR\\}/external/spirv-tools(.*)/bin")
136 (string-append (assoc-ref inputs "spirv-tools") "/bin")))
137 #t)))))
138 (inputs
139 `(("glslang" ,glslang)
140 ("spirv-headers" ,spirv-headers)
141 ("spirv-tools" ,spirv-tools)))
142 (native-inputs `(("python" ,python)))
143 (home-page "https://github.com/KhronosGroup/SPIRV-Cross")
144 (synopsis "Parser for and converter of SPIR-V to other shader languages")
145 (description
146 "SPIRV-Cross tries hard to emit readable and clean output from the
147 SPIR-V, aiming to emit GLSL or MSL that looks like human-written code.")
148 (license license:asl2.0)))
149
150 (define-public glslang
151 (package
152 (name "glslang")
153 (version "8.13.3743")
154 (source
155 (origin
156 (method git-fetch)
157 (uri (git-reference
158 (url "https://github.com/KhronosGroup/glslang")
159 (commit version)))
160 (sha256
161 (base32
162 "0d20wfpp2fmbnz1hnsjr9xc62lxpj86ik2qyviqbni0pqj212cry"))
163 (file-name (string-append name "-" version "-checkout"))))
164 (build-system cmake-build-system)
165 (arguments
166 '(#:tests? #f ;FIXME: requires bundled SPIRV-Tools
167 #:configure-flags '("-DBUILD_SHARED_LIBS=ON")))
168 (native-inputs
169 `(("pkg-config" ,pkg-config)
170 ("python" ,python)))
171 (home-page "https://github.com/KhronosGroup/glslang")
172 (synopsis "OpenGL and OpenGL ES shader front end and validator")
173 (description
174 "Glslang is the official reference compiler front end for the
175 OpenGL@tie{}ES and OpenGL shading languages. It implements a strict
176 interpretation of the specifications for these languages.")
177 ;; Modified BSD license. See "copyright" section of
178 ;; https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
179 (license (list license:bsd-3
180 ;; include/SPIRV/{bitutils,hex_float}.h are Apache 2.0.
181 license:asl2.0))))
182
183 (define-public vulkan-headers
184 (package
185 (name "vulkan-headers")
186 (version "1.2.141")
187 (source
188 (origin
189 (method git-fetch)
190 (uri (git-reference
191 (url "https://github.com/KhronosGroup/Vulkan-Headers")
192 (commit (string-append "v" version))))
193 (file-name (git-file-name name version))
194 (sha256
195 (base32
196 "10nmx6y4llllfcczyfz76amd0vkqv09dj952d19zkzmmgcval7zq"))))
197 (build-system cmake-build-system)
198 (arguments
199 `(#:tests? #f)) ; No tests.
200 (home-page
201 "https://github.com/KhronosGroup/Vulkan-Headers")
202 (synopsis "Vulkan Header files and API registry")
203 (description
204 "Vulkan-Headers contains header files and API registry for Vulkan.")
205 (license (list license:asl2.0)))) ;LICENSE.txt
206
207 (define-public vulkan-loader
208 (package
209 (name "vulkan-loader")
210 (version "1.2.140")
211 (source
212 (origin
213 (method git-fetch)
214 (uri (git-reference
215 (url "https://github.com/KhronosGroup/Vulkan-Loader")
216 (commit (string-append "v" version))))
217 (file-name (git-file-name name version))
218 (sha256
219 (base32
220 "0rhyz0qgp0i7pcx6wlvgwy7j33d4cs0xx39f0b6igpfk0vk70r1w"))))
221 (build-system cmake-build-system)
222 (arguments
223 `(#:phases (modify-phases %standard-phases
224 (add-after 'unpack 'unpack-googletest
225 (lambda* (#:key inputs #:allow-other-keys)
226 (let ((gtest (assoc-ref inputs "googletest:source")))
227 (when gtest
228 (copy-recursively gtest "external/googletest"))
229 #t)))
230 (add-after 'unpack 'disable-loader-tests
231 (lambda _
232 ;; Many tests require a Vulkan driver. Skip those.
233 (substitute* "tests/loader_validation_tests.cpp"
234 ((".*= vkCreateInstance.*" all)
235 (string-append "GTEST_SKIP();\n" all))
236 (("TEST_F.*InstanceExtensionEnumerated.*" all)
237 (string-append all "\nGTEST_SKIP();\n")))
238 #t)))))
239 (native-inputs
240 `(("googletest:source" ,(package-source googletest))
241 ("libxrandr" ,libxrandr)
242 ("pkg-config" ,pkg-config)
243 ("python" ,python)
244 ("vulkan-headers" ,vulkan-headers)
245 ("wayland" ,wayland)))
246 (home-page
247 "https://github.com/KhronosGroup/Vulkan-Loader")
248 (synopsis "Khronos official ICD loader and validation layers for Vulkan")
249 (description
250 "Vulkan allows multiple @dfn{Installable Client Drivers} (ICDs) each
251 supporting one or more devices to be used collectively. The loader is
252 responsible for discovering available Vulkan ICDs on the system and inserting
253 Vulkan layer libraries, including validation layers between the application
254 and the ICD.")
255 ;; This software is mainly Apache 2.0 licensed, but contains some components
256 ;; covered by other licenses. See COPYRIGHT.txt for details.
257 (license (list license:asl2.0 ;LICENSE.txt
258 (license:x11-style "file://COPYRIGHT.txt")
259 license:bsd-3))))
260
261 (define-public vulkan-tools
262 (package
263 (name "vulkan-tools")
264 (version "1.2.140")
265 (source
266 (origin
267 (method git-fetch)
268 (uri (git-reference
269 (url "https://github.com/KhronosGroup/Vulkan-Tools")
270 (commit (string-append "v" version))))
271 (file-name (git-file-name name version))
272 (sha256
273 (base32
274 "08dk0q77kpycn4vv19jh3ig73gbq3psan246a7fss0nfxpiddg0j"))))
275 (build-system cmake-build-system)
276 (inputs
277 `(("glslang" ,glslang)
278 ("libxrandr" ,libxrandr)
279 ("vulkan-loader" ,vulkan-loader)
280 ("wayland" ,wayland)))
281 (native-inputs
282 `(("pkg-config" ,pkg-config)
283 ("python" ,python)
284 ("vulkan-headers" ,vulkan-headers)))
285 (arguments
286 `(#:tests? #f ;no tests
287 #:configure-flags (list (string-append "-DGLSLANG_INSTALL_DIR="
288 (assoc-ref %build-inputs "glslang")))))
289 (home-page
290 "https://github.com/KhronosGroup/Vulkan-Tools")
291 (synopsis "Tools and utilities for Vulkan")
292 (description
293 "Vulkan-Tools provides tools and utilities that can assist development by
294 enabling developers to verify their applications correct use of the Vulkan
295 API.")
296 (license (list license:asl2.0)))) ;LICENSE.txt
297
298 (define-public shaderc
299 (package
300 (name "shaderc")
301 (version "2020.0")
302 (source
303 (origin
304 (method git-fetch)
305 (uri (git-reference
306 (url "https://github.com/google/shaderc")
307 (commit (string-append "v" version))))
308 (file-name (git-file-name name version))
309 (sha256
310 (base32
311 "1kqqvsvib01bsmfbdy3fbwwpvkcdlfb6k71kjvzb3crql7w0rxff"))))
312 (build-system cmake-build-system)
313 (arguments
314 `(;; FIXME: Skip most of the tests, because enabling system gtest breaks
315 ;; the build: <https://github.com/google/shaderc/issues/470>.
316 #:configure-flags '("-DSHADERC_SKIP_TESTS=ON")
317 #:phases
318 (modify-phases %standard-phases
319 (add-after 'unpack 'do-not-look-for-bundled-sources
320 (lambda _
321 (substitute* "CMakeLists.txt"
322 (("add_subdirectory\\(third_party\\)")
323 ""))
324
325 (substitute* "glslc/test/CMakeLists.txt"
326 (("\\$<TARGET_FILE:spirv-dis>")
327 (which "spirv-dis")))
328
329 ;; Do not attempt to use git to encode version information.
330 (substitute* "glslc/CMakeLists.txt"
331 (("add_dependencies\\(glslc_exe build-version\\)")
332 ""))
333 (call-with-output-file "glslc/src/build-version.inc"
334 (lambda (port)
335 (format port "\"~a\"\n\"~a\"\n\"~a\"~%"
336 ,version
337 ,(package-version spirv-tools)
338 ,(package-version glslang))))
339 #t)))))
340 (inputs
341 `(("glslang" ,glslang)
342 ("python" ,python)
343 ("spirv-headers" ,spirv-headers)
344 ("spirv-tools" ,spirv-tools)))
345 (native-inputs
346 `(("pkg-config" ,pkg-config)))
347 (home-page "https://github.com/google/shaderc")
348 (synopsis "Tools for shader compilation")
349 (description "Shaderc is a collection of tools, libraries, and tests for
350 shader compilation.")
351 (license license:asl2.0)))
352
353 (define-public vkd3d
354 (let ((commit "ecda316ef54d70bf1b3e860755241bb75873e53f")) ; Release 1.1.
355 (package
356 (name "vkd3d")
357 (version "1.1")
358 (source
359 (origin
360 (method git-fetch)
361 (uri (git-reference
362 (url "https://source.winehq.org/git/vkd3d.git")
363 (commit commit)))
364 (sha256
365 (base32
366 "05a28kspy8gzng181w28zjqdb3pj2ss83b0lwnppxbcdzsz7rvrf"))
367 (file-name (string-append name "-" version "-checkout"))))
368 (build-system gnu-build-system)
369 (arguments
370 `(#:configure-flags '("--with-spirv-tools")
371 #:phases (modify-phases %standard-phases
372 (add-after 'unpack 'patch-for-new-vulkan
373 (lambda _
374 ;; Mimic upstream commit 8e7bf8a5c3e0047 for
375 ;; compatibility with newer vulkan-headers.
376 (substitute* "libs/vkd3d/vkd3d_private.h"
377 (("VK_PIPELINE_BIND_POINT_RANGE_SIZE")
378 "2u"))
379 #t)))))
380 (native-inputs
381 `(("autoconf" ,autoconf)
382 ("automake" ,automake)
383 ("gettext" ,gettext-minimal)
384 ("libtool" ,libtool)
385 ("pkg-config" ,pkg-config)))
386 (inputs
387 `(("libx11" ,libx11)
388 ("libxcb" ,libxcb)
389 ("spirv-headers" ,spirv-headers)
390 ("spirv-tools" ,spirv-tools)
391 ("vulkan-headers" ,vulkan-headers)
392 ("vulkan-loader" ,vulkan-loader)
393 ("wine-minimal" ,wine-minimal) ; Needed for 'widl'.
394 ("xcb-util" ,xcb-util)
395 ("xcb-util-keysyms" ,xcb-util-keysyms)
396 ("xcb-util-wm" ,xcb-util-wm)))
397 (home-page "https://source.winehq.org/git/vkd3d.git/")
398 (synopsis "Direct3D 12 to Vulkan translation library")
399 (description "vkd3d is a library for translating Direct3D 12 to Vulkan.")
400 (license license:lgpl2.1))))