gnu: Add python-keras-preprocessing.
[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 Tobias Geerinckx-Rice <me@tobias.gr>
4 ;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
5 ;;;
6 ;;; This file is part of GNU Guix.
7 ;;;
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
12 ;;;
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
17 ;;;
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21 (define-module (gnu packages vulkan)
22 #:use-module ((guix licenses) #:prefix license:)
23 #:use-module (guix packages)
24 #:use-module (guix download)
25 #:use-module (guix git-download)
26 #:use-module (guix build-system cmake)
27 #:use-module (guix build-system gnu)
28 #:use-module (guix build-system meson)
29 #:use-module (gnu packages)
30 #:use-module (gnu packages autotools)
31 #:use-module (gnu packages bison)
32 #:use-module (gnu packages check)
33 #:use-module (gnu packages cmake)
34 #:use-module (gnu packages freedesktop)
35 #:use-module (gnu packages gcc)
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.3.7")
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 "0m56smanfcczjfif4yfcqhjj4d4sc088kwg6dgia8fwdsjavdm4d"))
56 (file-name (string-append name "-" version "-checkout"))))
57 (build-system cmake-build-system)
58 (arguments
59 `(#:tests? #f ;; No tests
60 #:phases (modify-phases %standard-phases
61 (replace 'install
62 (lambda* (#:key outputs #:allow-other-keys)
63 (invoke "cmake" "-E" "copy_directory"
64 "../source/include/spirv"
65 (string-append (assoc-ref outputs "out")
66 "/include/spirv")))))))
67 (home-page "https://github.com/KhronosGroup/SPIRV-Headers")
68 (synopsis "Machine-readable files from the SPIR-V Registry")
69 (description
70 "SPIRV-Headers is a repository containing machine-readable files from
71 the SPIR-V Registry. This includes:
72 @itemize
73 @item Header files for various languages.
74 @item JSON files describing the grammar for the SPIR-V core instruction set,
75 and for the GLSL.std.450 extended instruction set.
76 @item The XML registry file.
77 @end itemize\n")
78 (license (license:x11-style
79 (string-append "https://github.com/KhronosGroup/SPIRV-Headers/blob/"
80 version "/LICENSE")))))
81
82 (define-public spirv-tools
83 (package
84 (name "spirv-tools")
85 (version "2019.1")
86 (source
87 (origin
88 (method git-fetch)
89 (uri (git-reference
90 (url "https://github.com/KhronosGroup/SPIRV-Tools")
91 (commit (string-append "v" version))))
92 (sha256
93 (base32
94 "0vddjzhkrhrm3l3i57nxmq2smv3r1s0ka5ff2kziaahr4hqb479r"))
95 (file-name (string-append name "-" version "-checkout"))))
96 (build-system cmake-build-system)
97 (arguments
98 `(#:tests? #f ; FIXME: Tests fail.
99 #:phases
100 (modify-phases %standard-phases
101 (add-before 'configure 'fixgcc7
102 (lambda _
103 (unsetenv "C_INCLUDE_PATH")
104 (unsetenv "CPLUS_INCLUDE_PATH")
105 #t)))
106 #:configure-flags (list (string-append "-DSPIRV-Headers_SOURCE_DIR="
107 (assoc-ref %build-inputs "spirv-headers")))))
108 (inputs `(("spirv-headers" ,spirv-headers)))
109 (native-inputs `(("gcc" ,gcc-7)
110 ("pkg-config" ,pkg-config)
111 ("python" ,python)))
112 (home-page "https://github.com/KhronosGroup/SPIRV-Tools")
113 (synopsis "API and commands for processing SPIR-V modules")
114 (description
115 "The SPIR-V Tools project provides an API and commands for processing
116 SPIR-V modules. The project includes an assembler, binary module
117 parser,disassembler, validator, and optimizer for SPIR-V.")
118 (license license:asl2.0)))
119
120 (define-public glslang
121 (package
122 (name "glslang")
123 (version "7.11.3214")
124 (source
125 (origin
126 (method git-fetch)
127 (uri (git-reference
128 (url "https://github.com/KhronosGroup/glslang")
129 (commit version)))
130 (sha256
131 (base32
132 "0dqjga0lcza006fhac26zp2plbq4gx8a6nsmrwkqlzji6lw1jins"))
133 (file-name (string-append name "-" version "-checkout"))))
134 (build-system cmake-build-system)
135 (arguments
136 `(#:tests? #f ;; No tests
137 ;; glslang tries to set CMAKE_INSTALL_PREFIX manually. Remove the
138 ;; offending line.
139 #:phases (modify-phases %standard-phases
140 (add-after 'patch-source-shebangs 'fix-cmakelists
141 (lambda _
142 (substitute* "CMakeLists.txt"
143 (("set.*CMAKE_INSTALL_PREFIX.*") ""))
144 #t)))))
145 (native-inputs `(("bison" ,bison)
146 ("pkg-config" ,pkg-config)))
147 (home-page "https://github.com/KhronosGroup/glslang")
148 (synopsis "OpenGL and OpenGL ES shader front end and validator")
149 (description
150 "Glslang is the official reference compiler front end for the
151 OpenGL@tie{}ES and OpenGL shading languages. It implements a strict
152 interpretation of the specifications for these languages.")
153 ;; Modified BSD license. See "copyright" section of
154 ;; https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
155 (license (list license:bsd-3
156 ;; include/SPIRV/{bitutils,hex_float}.h are Apache 2.0.
157 license:asl2.0))))
158
159 (define-public vulkan-headers
160 (package
161 (name "vulkan-headers")
162 (version "1.1.107")
163 (source
164 (origin
165 (method git-fetch)
166 (uri (git-reference
167 (url "https://github.com/KhronosGroup/Vulkan-Headers")
168 (commit (string-append "v" version))))
169 (file-name (git-file-name name version))
170 (sha256
171 (base32
172 "0kyf83n6fghqmjj5jbwhy08yq5sl598qnmw3kbavrnw9avqqm0c4"))))
173 (build-system cmake-build-system)
174 (arguments
175 `(#:tests? #f)) ; No tests.
176 (home-page
177 "https://github.com/KhronosGroup/Vulkan-Headers")
178 (synopsis "Vulkan Header files and API registry")
179 (description
180 "Vulkan-Headers contains header files and API registry for Vulkan.")
181 (license (list license:asl2.0)))) ;LICENSE.txt
182
183 (define-public vulkan-loader
184 (package
185 (name "vulkan-loader")
186 (version (package-version vulkan-headers))
187 (source
188 (origin
189 (method git-fetch)
190 (uri (git-reference
191 (url "https://github.com/KhronosGroup/Vulkan-Loader")
192 (commit (string-append "v" version))))
193 (file-name (git-file-name name version))
194 (sha256
195 (base32
196 "1p64k9x5r7nsrs0cn6d61687xbajqvsm78xk6j85w9wfin5dxs30"))))
197 (build-system cmake-build-system)
198 (arguments
199 `(#:tests? #f ;FIXME: 23/39 tests fail. Try "tests/run_all_tests.sh".
200 #:phases
201 (modify-phases %standard-phases
202 (add-after 'unpack 'remove-spirv-tools-commit-id
203 (lambda* (#:key inputs #:allow-other-keys)
204 ;; Remove lines trying to build in a git commit id.
205 (substitute* "CMakeLists.txt" ((".*spirv_tools_commit_id.h.*") ""))
206 #t)))
207 #:configure-flags (list
208 "-DBUILD_TESTS=OFF" ; FIXME: Needs 'googletest' submodule.
209 (string-append "-DCMAKE_INSTALL_LIBDIR="
210 (assoc-ref %outputs "out") "/lib"))))
211 (native-inputs `(("libxrandr" ,libxrandr)
212 ("pkg-config" ,pkg-config)
213 ("python" ,python)
214 ("vulkan-headers" ,vulkan-headers)
215 ("wayland" ,wayland)))
216 (home-page
217 "https://github.com/KhronosGroup/Vulkan-Loader")
218 (synopsis "Khronos official ICD loader and validation layers for Vulkan")
219 (description
220 "Vulkan allows multiple @dfn{Installable Client Drivers} (ICDs) each
221 supporting one or more devices to be used collectively. The loader is
222 responsible for discovering available Vulkan ICDs on the system and inserting
223 Vulkan layer libraries, including validation layers between the application
224 and the ICD.")
225 ;; This software is mainly Apache 2.0 licensed, but contains some components
226 ;; covered by other licenses. See COPYRIGHT.txt for details.
227 (license (list license:asl2.0 ;LICENSE.txt
228 (license:x11-style "file://COPYRIGHT.txt")
229 license:bsd-3))))
230
231 (define-public vulkan-icd-loader
232 (deprecated-package "vulkan-icd-loader" vulkan-loader))
233
234 (define-public vulkan-tools
235 (package
236 (name "vulkan-tools")
237 (version (package-version vulkan-headers))
238 (source
239 (origin
240 (method git-fetch)
241 (uri (git-reference
242 (url "https://github.com/KhronosGroup/Vulkan-Tools")
243 (commit (string-append "v" version))))
244 (file-name (git-file-name name version))
245 (sha256
246 (base32
247 "1mak96jdg3wv043b4jxyv1fm2cz4nnallg0yb90my3yp5q64grrw"))))
248 (build-system cmake-build-system)
249 (inputs
250 `(("glslang" ,glslang)
251 ("libxrandr" ,libxrandr)
252 ("vulkan-loader" ,vulkan-loader)
253 ("wayland" ,wayland)))
254 (native-inputs
255 `(("pkg-config" ,pkg-config)
256 ("python" ,python)
257 ("vulkan-headers" ,vulkan-headers)))
258 (arguments
259 `(#:tests? #f ; No tests.
260 #:configure-flags (list (string-append "-DGLSLANG_INSTALL_DIR="
261 (assoc-ref %build-inputs "glslang")))))
262 (home-page
263 "https://github.com/KhronosGroup/Vulkan-Tools")
264 (synopsis "Tools and utilities for Vulkan")
265 (description
266 "Vulkan-Tools provides tools and utilities that can assist development by
267 enabling developers to verify their applications correct use of the Vulkan
268 API.")
269 (license (list license:asl2.0)))) ;LICENSE.txt
270
271 (define-public shaderc
272 (package
273 (name "shaderc")
274 (version "2019.0")
275 (source
276 (origin
277 (method git-fetch)
278 (uri (git-reference
279 (url "https://github.com/google/shaderc")
280 (commit (string-append "v" version))))
281 (file-name (git-file-name name version))
282 (sha256
283 (base32
284 "1l5mmyxhzsbp0a6y2d86i8jmf46c6bjgjkdgkr5l8hmhflmm7gi2"))))
285 (build-system meson-build-system)
286 (arguments
287 `(#:tests? #f ; FIXME: Tests fail.
288 #:phases
289 (modify-phases %standard-phases
290 (replace 'configure
291 (lambda* (#:key outputs #:allow-other-keys)
292 (let ((out (assoc-ref outputs "out")))
293 ;; Remove various lines and touch build-version.inc or
294 ;; configuring won't work.
295 (invoke "touch" "glslc/src/build-version.inc")
296 (substitute* "CMakeLists.txt" (("..PYTHON_EXE..*") ""))
297 (substitute* "CMakeLists.txt"
298 ((".*update_build_version.py..*") ""))
299 (substitute* "CMakeLists.txt"
300 ((".*add_custom_target.build-version.*") ""))
301 (substitute* "CMakeLists.txt"
302 ((".*spirv-tools_SOURCE_DIR.*glslang_SOURCE_DIR.*")
303 ""))
304 (substitute* "CMakeLists.txt"
305 ((".*Update build-version.inc.*") ""))
306 (substitute* "CMakeLists.txt" ((".*--check.*") ""))
307 (substitute* "glslc/src/main.cc" ((".*build-version.inc.*")
308 "\"1\""))
309 (invoke "cmake" "-GNinja" "-DCMAKE_BUILD_TYPE=Release"
310 "-DSHADERC_SKIP_TESTS=ON"
311 "-DCMAKE_INSTALL_LIBDIR=lib"
312 (string-append "-DCMAKE_INSTALL_PREFIX="
313 out)))))
314 (add-after 'unpack 'unpack-sources
315 (lambda* (#:key inputs #:allow-other-keys)
316 (let ((spirv-tools-source (assoc-ref inputs "spirv-tools-source"))
317 (spirv-headers-source (assoc-ref inputs "spirv-headers-source"))
318 (glslang-source (assoc-ref inputs "glslang-source")))
319 (copy-recursively spirv-tools-source "third_party/spirv-tools")
320 (copy-recursively spirv-headers-source
321 (string-append "third_party/spirv-tools"
322 "/external/spirv-headers"))
323 (copy-recursively glslang-source "third_party/glslang")
324 #t))))))
325 (inputs
326 `(("googletest" ,googletest)
327 ("python" ,python)))
328 (native-inputs
329 `(("cmake" ,cmake)
330 ("glslang-source" ,(package-source glslang))
331 ("pkg-config" ,pkg-config)
332 ("spirv-headers-source" ,(package-source spirv-headers))
333 ("spirv-tools-source" ,(package-source spirv-tools))))
334 (home-page "https://github.com/google/shaderc")
335 (synopsis "Tools for shader compilation")
336 (description "Shaderc is a collection of tools, libraries, and tests for
337 shader compilation.")
338 (license license:asl2.0)))
339
340 (define-public vkd3d
341 (let ((commit "ecda316ef54d70bf1b3e860755241bb75873e53f")) ; Release 1.1.
342 (package
343 (name "vkd3d")
344 (version "1.1")
345 (source
346 (origin
347 (method git-fetch)
348 (uri (git-reference
349 (url "https://source.winehq.org/git/vkd3d.git")
350 (commit commit)))
351 (sha256
352 (base32
353 "05a28kspy8gzng181w28zjqdb3pj2ss83b0lwnppxbcdzsz7rvrf"))
354 (file-name (string-append name "-" version "-checkout"))))
355 (build-system gnu-build-system)
356 (arguments
357 `(#:configure-flags '("--with-spirv-tools")))
358 (native-inputs
359 `(("autoconf" ,autoconf)
360 ("automake" ,automake)
361 ("gettext" ,gnu-gettext)
362 ("libtool" ,libtool)
363 ("pkg-config" ,pkg-config)))
364 (inputs
365 `(("libx11" ,libx11)
366 ("libxcb" ,libxcb)
367 ("spirv-headers" ,spirv-headers)
368 ("spirv-tools" ,spirv-tools)
369 ("vulkan-headers" ,vulkan-headers)
370 ("vulkan-loader" ,vulkan-loader)
371 ("wine-minimal" ,wine-minimal) ; Needed for 'widl'.
372 ("xcb-util" ,xcb-util)
373 ("xcb-util-keysyms" ,xcb-util-keysyms)
374 ("xcb-util-wm" ,xcb-util-wm)))
375 (home-page "https://source.winehq.org/git/vkd3d.git/")
376 (synopsis "Direct3D 12 to Vulkan translation library")
377 (description "vkd3d is a library for translating Direct3D 12 to Vulkan.")
378 (license license:lgpl2.1))))