gnu: leveldb: Update home page.
[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>
3b149747 3;;; Copyright © 2018, 2019 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)
85c7f29a 35 #:use-module (gnu packages gettext)
9286e0ec 36 #:use-module (gnu packages gl)
794d740e 37 #:use-module (gnu packages pkg-config)
9286e0ec 38 #:use-module (gnu packages python)
85c7f29a 39 #:use-module (gnu packages wine)
9286e0ec 40 #:use-module (gnu packages xorg))
0df77274
RH
41
42(define-public spirv-headers
93c5c6d1
RH
43 (package
44 (name "spirv-headers")
45 (version "1.3.7")
46 (source
47 (origin
48 (method git-fetch)
49 (uri (git-reference
50 (url "https://github.com/KhronosGroup/SPIRV-Headers")
51 (commit version)))
52 (sha256
53 (base32
54 "0m56smanfcczjfif4yfcqhjj4d4sc088kwg6dgia8fwdsjavdm4d"))
3b149747 55 (file-name (git-file-name name version))))
93c5c6d1
RH
56 (build-system cmake-build-system)
57 (arguments
58 `(#:tests? #f ;; No tests
59 #:phases (modify-phases %standard-phases
60 (replace 'install
61 (lambda* (#:key outputs #:allow-other-keys)
62 (invoke "cmake" "-E" "copy_directory"
63 "../source/include/spirv"
64 (string-append (assoc-ref outputs "out")
65 "/include/spirv")))))))
66 (home-page "https://github.com/KhronosGroup/SPIRV-Headers")
67 (synopsis "Machine-readable files from the SPIR-V Registry")
68 (description
69 "SPIRV-Headers is a repository containing machine-readable files from
0df77274
RH
70the SPIR-V Registry. This includes:
71@itemize
72@item Header files for various languages.
73@item JSON files describing the grammar for the SPIR-V core instruction set,
74and for the GLSL.std.450 extended instruction set.
75@item The XML registry file.
76@end itemize\n")
93c5c6d1
RH
77 (license (license:x11-style
78 (string-append "https://github.com/KhronosGroup/SPIRV-Headers/blob/"
79 version "/LICENSE")))))
794d740e
RH
80
81(define-public spirv-tools
264c803b
RH
82 (package
83 (name "spirv-tools")
aa1c7b49 84 (version "2019.2")
264c803b
RH
85 (source
86 (origin
87 (method git-fetch)
88 (uri (git-reference
89 (url "https://github.com/KhronosGroup/SPIRV-Tools")
90 (commit (string-append "v" version))))
91 (sha256
aa1c7b49 92 (base32 "0zwz6qg8g8165h7cw52agryjrdb29gbmsbziw3pwiddfkyma8vvg"))
d7a7d255 93 (file-name (git-file-name name version))))
264c803b
RH
94 (build-system cmake-build-system)
95 (arguments
96 `(#:tests? #f ; FIXME: Tests fail.
264c803b
RH
97 #:configure-flags (list (string-append "-DSPIRV-Headers_SOURCE_DIR="
98 (assoc-ref %build-inputs "spirv-headers")))))
99 (inputs `(("spirv-headers" ,spirv-headers)))
9f74ec98 100 (native-inputs `(("pkg-config" ,pkg-config)
264c803b
RH
101 ("python" ,python)))
102 (home-page "https://github.com/KhronosGroup/SPIRV-Tools")
103 (synopsis "API and commands for processing SPIR-V modules")
104 (description
105 "The SPIR-V Tools project provides an API and commands for processing
106SPIR-V modules. The project includes an assembler, binary module
107parser,disassembler, validator, and optimizer for SPIR-V.")
108 (license license:asl2.0)))
6a11d5f1
RH
109
110(define-public glslang
3113ecfa
RH
111 (package
112 (name "glslang")
72110730 113 (version "7.11.3214")
3113ecfa
RH
114 (source
115 (origin
a9342820
RH
116 (method git-fetch)
117 (uri (git-reference
3113ecfa
RH
118 (url "https://github.com/KhronosGroup/glslang")
119 (commit version)))
794d740e
RH
120 (sha256
121 (base32
72110730 122 "0dqjga0lcza006fhac26zp2plbq4gx8a6nsmrwkqlzji6lw1jins"))
a9342820 123 (file-name (string-append name "-" version "-checkout"))))
3113ecfa
RH
124 (build-system cmake-build-system)
125 (arguments
126 `(#:tests? #f ;; No tests
127 ;; glslang tries to set CMAKE_INSTALL_PREFIX manually. Remove the
128 ;; offending line.
129 #:phases (modify-phases %standard-phases
130 (add-after 'patch-source-shebangs 'fix-cmakelists
131 (lambda _
132 (substitute* "CMakeLists.txt"
133 (("set.*CMAKE_INSTALL_PREFIX.*") ""))
134 #t)))))
135 (native-inputs `(("bison" ,bison)
136 ("pkg-config" ,pkg-config)))
137 (home-page "https://github.com/KhronosGroup/glslang")
138 (synopsis "OpenGL and OpenGL ES shader front end and validator")
139 (description
140 "Glslang is the official reference compiler front end for the
6a11d5f1
RH
141OpenGL@tie{}ES and OpenGL shading languages. It implements a strict
142interpretation of the specifications for these languages.")
3113ecfa
RH
143 ;; Modified BSD license. See "copyright" section of
144 ;; https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
145 (license (list license:bsd-3
146 ;; include/SPIRV/{bitutils,hex_float}.h are Apache 2.0.
147 license:asl2.0))))
9286e0ec 148
cf09bed4
RH
149(define-public vulkan-headers
150 (package
151 (name "vulkan-headers")
fd730a8e 152 (version "1.1.114")
cf09bed4
RH
153 (source
154 (origin
67ff2bdf
RH
155 (method git-fetch)
156 (uri (git-reference
157 (url "https://github.com/KhronosGroup/Vulkan-Headers")
158 (commit (string-append "v" version))))
b8f9e97d 159 (file-name (git-file-name name version))
cf09bed4
RH
160 (sha256
161 (base32
fd730a8e 162 "0fdvh26nxibylh32lj8b62d9nf9j25xa0il9zg362wmr2zgm8gka"))))
cf09bed4
RH
163 (build-system cmake-build-system)
164 (arguments
67ff2bdf 165 `(#:tests? #f)) ; No tests.
cf09bed4
RH
166 (home-page
167 "https://github.com/KhronosGroup/Vulkan-Headers")
168 (synopsis "Vulkan Header files and API registry")
169 (description
170 "Vulkan-Headers contains header files and API registry for Vulkan.")
171 (license (list license:asl2.0)))) ;LICENSE.txt
172
e6fcf903 173(define-public vulkan-loader
9286e0ec 174 (package
e6fcf903 175 (name "vulkan-loader")
0eb01ff5 176 (version (package-version vulkan-headers))
9286e0ec
RH
177 (source
178 (origin
67ff2bdf
RH
179 (method git-fetch)
180 (uri (git-reference
181 (url "https://github.com/KhronosGroup/Vulkan-Loader")
182 (commit (string-append "v" version))))
b8f9e97d 183 (file-name (git-file-name name version))
9286e0ec
RH
184 (sha256
185 (base32
fd730a8e 186 "1rkm6dzdzxva62shscipz3kpp66x4kgmwvp1ski2fvf4jzzcbv7h"))))
9286e0ec
RH
187 (build-system cmake-build-system)
188 (arguments
189 `(#:tests? #f ;FIXME: 23/39 tests fail. Try "tests/run_all_tests.sh".
a512246c
RH
190 #:phases
191 (modify-phases %standard-phases
192 (add-after 'unpack 'remove-spirv-tools-commit-id
193 (lambda* (#:key inputs #:allow-other-keys)
194 ;; Remove lines trying to build in a git commit id.
195 (substitute* "CMakeLists.txt" ((".*spirv_tools_commit_id.h.*") ""))
6edbf8de
RH
196 #t))
197 ;; Make sure that the files needed for Mesa's Vulkan overlay are availabe.
198 (add-after 'unpack 'copy-headers1
199 (lambda* (#:key outputs #:allow-other-keys)
200 (install-file "tests/layers/vk_layer_data.h"
201 (string-append (assoc-ref %outputs "out")
202 "/include/vulkan"))
203 (install-file "tests/layers/vk_layer_extension_utils.h"
204 (string-append (assoc-ref %outputs "out")
205 "/include/vulkan"))
206 (install-file "loader/vk_loader_platform.h"
207 (string-append (assoc-ref %outputs "out")
208 "/include/vulkan"))
209 #t))
210 (add-after 'build 'copy-headers2
211 (lambda* (#:key outputs #:allow-other-keys)
212 (install-file "vk_layer_dispatch_table.h"
213 (string-append (assoc-ref %outputs "out")
214 "/include/vulkan"))
215 (install-file "vk_dispatch_table_helper.h"
216 (string-append (assoc-ref %outputs "out")
217 "/include/vulkan"))
a512246c
RH
218 #t)))
219 #:configure-flags (list
076fcab1 220 "-DBUILD_TESTS=OFF" ; FIXME: Needs 'googletest' submodule.
a512246c 221 (string-append "-DCMAKE_INSTALL_LIBDIR="
67ff2bdf 222 (assoc-ref %outputs "out") "/lib"))))
ebfe592f
RH
223 (native-inputs `(("libxrandr" ,libxrandr)
224 ("pkg-config" ,pkg-config)
225 ("python" ,python)
226 ("vulkan-headers" ,vulkan-headers)
227 ("wayland" ,wayland)))
9286e0ec 228 (home-page
b1eb1ba9 229 "https://github.com/KhronosGroup/Vulkan-Loader")
9286e0ec
RH
230 (synopsis "Khronos official ICD loader and validation layers for Vulkan")
231 (description
232 "Vulkan allows multiple @dfn{Installable Client Drivers} (ICDs) each
233supporting one or more devices to be used collectively. The loader is
234responsible for discovering available Vulkan ICDs on the system and inserting
235Vulkan layer libraries, including validation layers between the application
236and the ICD.")
237 ;; This software is mainly Apache 2.0 licensed, but contains some components
238 ;; covered by other licenses. See COPYRIGHT.txt for details.
239 (license (list license:asl2.0 ;LICENSE.txt
240 (license:x11-style "file://COPYRIGHT.txt")
241 license:bsd-3))))
5b69baf0 242
8ec91940
RH
243(define-public vulkan-icd-loader
244 (deprecated-package "vulkan-icd-loader" vulkan-loader))
245
bee7e46a
RH
246(define-public vulkan-tools
247 (package
248 (name "vulkan-tools")
05bb85fd 249 (version (package-version vulkan-headers))
bee7e46a
RH
250 (source
251 (origin
67ff2bdf
RH
252 (method git-fetch)
253 (uri (git-reference
254 (url "https://github.com/KhronosGroup/Vulkan-Tools")
b8f9e97d
RH
255 (commit (string-append "v" version))))
256 (file-name (git-file-name name version))
bee7e46a
RH
257 (sha256
258 (base32
fd730a8e 259 "1lz06mpni8ghf1xcxi4g6ck306lfaqwfi6f1w64kp9hczmvapfhf"))))
bee7e46a
RH
260 (build-system cmake-build-system)
261 (inputs
262 `(("glslang" ,glslang)
263 ("libxrandr" ,libxrandr)
bee7e46a
RH
264 ("vulkan-loader" ,vulkan-loader)
265 ("wayland" ,wayland)))
266 (native-inputs
267 `(("pkg-config" ,pkg-config)
1661f09a
RH
268 ("python" ,python)
269 ("vulkan-headers" ,vulkan-headers)))
bee7e46a 270 (arguments
e21bd8df 271 `(#:tests? #f ; No tests.
97764172 272 #:configure-flags (list (string-append "-DGLSLANG_INSTALL_DIR="
e21bd8df 273 (assoc-ref %build-inputs "glslang")))))
bee7e46a
RH
274 (home-page
275 "https://github.com/KhronosGroup/Vulkan-Tools")
276 (synopsis "Tools and utilities for Vulkan")
277 (description
278 "Vulkan-Tools provides tools and utilities that can assist development by
279enabling developers to verify their applications correct use of the Vulkan
280API.")
281 (license (list license:asl2.0)))) ;LICENSE.txt
282
5b69baf0 283(define-public shaderc
d9eada79
RH
284 (package
285 (name "shaderc")
2d906800 286 (version "2019.0")
d9eada79
RH
287 (source
288 (origin
289 (method git-fetch)
290 (uri (git-reference
291 (url "https://github.com/google/shaderc")
292 (commit (string-append "v" version))))
293 (file-name (git-file-name name version))
294 (sha256
295 (base32
2d906800 296 "1l5mmyxhzsbp0a6y2d86i8jmf46c6bjgjkdgkr5l8hmhflmm7gi2"))))
d9eada79
RH
297 (build-system meson-build-system)
298 (arguments
299 `(#:tests? #f ; FIXME: Tests fail.
300 #:phases
301 (modify-phases %standard-phases
302 (replace 'configure
303 (lambda* (#:key outputs #:allow-other-keys)
304 (let ((out (assoc-ref outputs "out")))
305 ;; Remove various lines and touch build-version.inc or
306 ;; configuring won't work.
307 (invoke "touch" "glslc/src/build-version.inc")
308 (substitute* "CMakeLists.txt" (("..PYTHON_EXE..*") ""))
309 (substitute* "CMakeLists.txt"
310 ((".*update_build_version.py..*") ""))
311 (substitute* "CMakeLists.txt"
312 ((".*add_custom_target.build-version.*") ""))
313 (substitute* "CMakeLists.txt"
314 ((".*spirv-tools_SOURCE_DIR.*glslang_SOURCE_DIR.*")
315 ""))
316 (substitute* "CMakeLists.txt"
317 ((".*Update build-version.inc.*") ""))
318 (substitute* "CMakeLists.txt" ((".*--check.*") ""))
319 (substitute* "glslc/src/main.cc" ((".*build-version.inc.*")
320 "\"1\""))
321 (invoke "cmake" "-GNinja" "-DCMAKE_BUILD_TYPE=Release"
322 "-DSHADERC_SKIP_TESTS=ON"
323 "-DCMAKE_INSTALL_LIBDIR=lib"
324 (string-append "-DCMAKE_INSTALL_PREFIX="
325 out)))))
326 (add-after 'unpack 'unpack-sources
327 (lambda* (#:key inputs #:allow-other-keys)
328 (let ((spirv-tools-source (assoc-ref inputs "spirv-tools-source"))
329 (spirv-headers-source (assoc-ref inputs "spirv-headers-source"))
330 (glslang-source (assoc-ref inputs "glslang-source")))
331 (copy-recursively spirv-tools-source "third_party/spirv-tools")
332 (copy-recursively spirv-headers-source
333 (string-append "third_party/spirv-tools"
334 "/external/spirv-headers"))
335 (copy-recursively glslang-source "third_party/glslang")
336 #t))))))
337 (inputs
338 `(("googletest" ,googletest)
339 ("python" ,python)))
340 (native-inputs
c69959f0 341 `(("cmake" ,cmake-minimal)
d9eada79
RH
342 ("glslang-source" ,(package-source glslang))
343 ("pkg-config" ,pkg-config)
344 ("spirv-headers-source" ,(package-source spirv-headers))
345 ("spirv-tools-source" ,(package-source spirv-tools))))
346 (home-page "https://github.com/google/shaderc")
347 (synopsis "Tools for shader compilation")
348 (description "Shaderc is a collection of tools, libraries, and tests for
5b69baf0 349shader compilation.")
d9eada79 350 (license license:asl2.0)))
85c7f29a
RH
351
352(define-public vkd3d
006a1d59 353 (let ((commit "ecda316ef54d70bf1b3e860755241bb75873e53f")) ; Release 1.1.
85c7f29a
RH
354 (package
355 (name "vkd3d")
006a1d59 356 (version "1.1")
85c7f29a
RH
357 (source
358 (origin
359 (method git-fetch)
360 (uri (git-reference
361 (url "https://source.winehq.org/git/vkd3d.git")
362 (commit commit)))
363 (sha256
364 (base32
006a1d59 365 "05a28kspy8gzng181w28zjqdb3pj2ss83b0lwnppxbcdzsz7rvrf"))
85c7f29a
RH
366 (file-name (string-append name "-" version "-checkout"))))
367 (build-system gnu-build-system)
368 (arguments
369 `(#:configure-flags '("--with-spirv-tools")))
370 (native-inputs
371 `(("autoconf" ,autoconf)
372 ("automake" ,automake)
373 ("gettext" ,gnu-gettext)
374 ("libtool" ,libtool)
375 ("pkg-config" ,pkg-config)))
376 (inputs
377 `(("libx11" ,libx11)
378 ("libxcb" ,libxcb)
379 ("spirv-headers" ,spirv-headers)
380 ("spirv-tools" ,spirv-tools)
4786f515 381 ("vulkan-headers" ,vulkan-headers)
85c7f29a 382 ("vulkan-loader" ,vulkan-loader)
dcf6df43 383 ("wine-minimal" ,wine-minimal) ; Needed for 'widl'.
85c7f29a
RH
384 ("xcb-util" ,xcb-util)
385 ("xcb-util-keysyms" ,xcb-util-keysyms)
386 ("xcb-util-wm" ,xcb-util-wm)))
387 (home-page "https://source.winehq.org/git/vkd3d.git/")
388 (synopsis "Direct3D 12 to Vulkan translation library")
389 (description "vkd3d is a library for translating Direct3D 12 to Vulkan.")
390 (license license:lgpl2.1))))