Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / vulkan.scm
CommitLineData
0df77274 1;;; GNU Guix --- Functional package management for GNU
67ff2bdf 2;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
8696fbba 3;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
5983b783 4;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
0df77274
RH
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)
794d740e 24 #:use-module (guix download)
0df77274
RH
25 #:use-module (guix git-download)
26 #:use-module (guix build-system cmake)
85c7f29a 27 #:use-module (guix build-system gnu)
5b69baf0 28 #:use-module (guix build-system meson)
794d740e 29 #:use-module (gnu packages)
85c7f29a 30 #:use-module (gnu packages autotools)
6a11d5f1 31 #:use-module (gnu packages bison)
7f540654 32 #:use-module (gnu packages check)
5b69baf0 33 #:use-module (gnu packages cmake)
9286e0ec 34 #:use-module (gnu packages freedesktop)
264c803b 35 #:use-module (gnu packages gcc)
85c7f29a 36 #:use-module (gnu packages gettext)
9286e0ec 37 #:use-module (gnu packages gl)
794d740e 38 #:use-module (gnu packages pkg-config)
9286e0ec 39 #:use-module (gnu packages python)
85c7f29a 40 #:use-module (gnu packages wine)
9286e0ec 41 #:use-module (gnu packages xorg))
0df77274
RH
42
43(define-public spirv-headers
93c5c6d1
RH
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
0df77274
RH
71the 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,
75and for the GLSL.std.450 extended instruction set.
76@item The XML registry file.
77@end itemize\n")
93c5c6d1
RH
78 (license (license:x11-style
79 (string-append "https://github.com/KhronosGroup/SPIRV-Headers/blob/"
80 version "/LICENSE")))))
794d740e
RH
81
82(define-public spirv-tools
264c803b
RH
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
116SPIR-V modules. The project includes an assembler, binary module
117parser,disassembler, validator, and optimizer for SPIR-V.")
118 (license license:asl2.0)))
6a11d5f1
RH
119
120(define-public glslang
3113ecfa
RH
121 (package
122 (name "glslang")
72110730 123 (version "7.11.3214")
3113ecfa
RH
124 (source
125 (origin
a9342820
RH
126 (method git-fetch)
127 (uri (git-reference
3113ecfa
RH
128 (url "https://github.com/KhronosGroup/glslang")
129 (commit version)))
794d740e
RH
130 (sha256
131 (base32
72110730 132 "0dqjga0lcza006fhac26zp2plbq4gx8a6nsmrwkqlzji6lw1jins"))
a9342820 133 (file-name (string-append name "-" version "-checkout"))))
3113ecfa
RH
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
6a11d5f1
RH
151OpenGL@tie{}ES and OpenGL shading languages. It implements a strict
152interpretation of the specifications for these languages.")
3113ecfa
RH
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))))
9286e0ec 158
cf09bed4
RH
159(define-public vulkan-headers
160 (package
161 (name "vulkan-headers")
239baad9 162 (version "1.1.107")
cf09bed4
RH
163 (source
164 (origin
67ff2bdf
RH
165 (method git-fetch)
166 (uri (git-reference
167 (url "https://github.com/KhronosGroup/Vulkan-Headers")
168 (commit (string-append "v" version))))
b8f9e97d 169 (file-name (git-file-name name version))
cf09bed4
RH
170 (sha256
171 (base32
239baad9 172 "0kyf83n6fghqmjj5jbwhy08yq5sl598qnmw3kbavrnw9avqqm0c4"))))
cf09bed4
RH
173 (build-system cmake-build-system)
174 (arguments
67ff2bdf 175 `(#:tests? #f)) ; No tests.
cf09bed4
RH
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
e6fcf903 183(define-public vulkan-loader
9286e0ec 184 (package
e6fcf903 185 (name "vulkan-loader")
0eb01ff5 186 (version (package-version vulkan-headers))
9286e0ec
RH
187 (source
188 (origin
67ff2bdf
RH
189 (method git-fetch)
190 (uri (git-reference
191 (url "https://github.com/KhronosGroup/Vulkan-Loader")
192 (commit (string-append "v" version))))
b8f9e97d 193 (file-name (git-file-name name version))
9286e0ec
RH
194 (sha256
195 (base32
239baad9 196 "1p64k9x5r7nsrs0cn6d61687xbajqvsm78xk6j85w9wfin5dxs30"))))
9286e0ec
RH
197 (build-system cmake-build-system)
198 (arguments
199 `(#:tests? #f ;FIXME: 23/39 tests fail. Try "tests/run_all_tests.sh".
a512246c
RH
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
076fcab1 208 "-DBUILD_TESTS=OFF" ; FIXME: Needs 'googletest' submodule.
a512246c 209 (string-append "-DCMAKE_INSTALL_LIBDIR="
67ff2bdf 210 (assoc-ref %outputs "out") "/lib"))))
ebfe592f
RH
211 (native-inputs `(("libxrandr" ,libxrandr)
212 ("pkg-config" ,pkg-config)
213 ("python" ,python)
214 ("vulkan-headers" ,vulkan-headers)
215 ("wayland" ,wayland)))
9286e0ec 216 (home-page
b1eb1ba9 217 "https://github.com/KhronosGroup/Vulkan-Loader")
9286e0ec
RH
218 (synopsis "Khronos official ICD loader and validation layers for Vulkan")
219 (description
220 "Vulkan allows multiple @dfn{Installable Client Drivers} (ICDs) each
221supporting one or more devices to be used collectively. The loader is
222responsible for discovering available Vulkan ICDs on the system and inserting
223Vulkan layer libraries, including validation layers between the application
224and 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))))
5b69baf0 230
8ec91940
RH
231(define-public vulkan-icd-loader
232 (deprecated-package "vulkan-icd-loader" vulkan-loader))
233
bee7e46a
RH
234(define-public vulkan-tools
235 (package
236 (name "vulkan-tools")
05bb85fd 237 (version (package-version vulkan-headers))
bee7e46a
RH
238 (source
239 (origin
67ff2bdf
RH
240 (method git-fetch)
241 (uri (git-reference
242 (url "https://github.com/KhronosGroup/Vulkan-Tools")
b8f9e97d
RH
243 (commit (string-append "v" version))))
244 (file-name (git-file-name name version))
bee7e46a
RH
245 (sha256
246 (base32
239baad9 247 "1mak96jdg3wv043b4jxyv1fm2cz4nnallg0yb90my3yp5q64grrw"))))
bee7e46a
RH
248 (build-system cmake-build-system)
249 (inputs
250 `(("glslang" ,glslang)
251 ("libxrandr" ,libxrandr)
bee7e46a
RH
252 ("vulkan-loader" ,vulkan-loader)
253 ("wayland" ,wayland)))
254 (native-inputs
255 `(("pkg-config" ,pkg-config)
1661f09a
RH
256 ("python" ,python)
257 ("vulkan-headers" ,vulkan-headers)))
bee7e46a 258 (arguments
e21bd8df 259 `(#:tests? #f ; No tests.
97764172 260 #:configure-flags (list (string-append "-DGLSLANG_INSTALL_DIR="
e21bd8df 261 (assoc-ref %build-inputs "glslang")))))
bee7e46a
RH
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
267enabling developers to verify their applications correct use of the Vulkan
268API.")
269 (license (list license:asl2.0)))) ;LICENSE.txt
270
5b69baf0 271(define-public shaderc
d9eada79
RH
272 (package
273 (name "shaderc")
2d906800 274 (version "2019.0")
d9eada79
RH
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
2d906800 284 "1l5mmyxhzsbp0a6y2d86i8jmf46c6bjgjkdgkr5l8hmhflmm7gi2"))))
d9eada79
RH
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
5b69baf0 337shader compilation.")
d9eada79 338 (license license:asl2.0)))
85c7f29a
RH
339
340(define-public vkd3d
006a1d59 341 (let ((commit "ecda316ef54d70bf1b3e860755241bb75873e53f")) ; Release 1.1.
85c7f29a
RH
342 (package
343 (name "vkd3d")
006a1d59 344 (version "1.1")
85c7f29a
RH
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
006a1d59 353 "05a28kspy8gzng181w28zjqdb3pj2ss83b0lwnppxbcdzsz7rvrf"))
85c7f29a
RH
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)
4786f515 369 ("vulkan-headers" ,vulkan-headers)
85c7f29a 370 ("vulkan-loader" ,vulkan-loader)
dcf6df43 371 ("wine-minimal" ,wine-minimal) ; Needed for 'widl'.
85c7f29a
RH
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))))