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>
6 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
43 (define-public spirv-headers
44 ;; Keep updated in accordance with
45 ;; https://github.com/google/shaderc/blob/known-good/known_good.json
46 (let ((commit "8bea0a266ac9b718aa0818d9e3a47c0b77c2cb23")
49 (name "spirv-headers")
50 (version (string-append "0.0-" revision "." (string-take commit 9)))
55 (url "https://github.com/KhronosGroup/SPIRV-Headers")
59 "01qyjghjz42hmyw9111zz20a1paf37ps39p4xbj8abjba65d8lqx"))
60 (file-name (string-append name "-" version "-checkout"))))
61 (build-system cmake-build-system)
63 `(#:tests? #f ;; No tests
64 #:phases (modify-phases %standard-phases
66 (lambda* (#:key outputs #:allow-other-keys)
67 (invoke "cmake" "-E" "copy_directory"
68 "../source/include/spirv"
69 (string-append (assoc-ref outputs "out")
70 "/include/spirv")))))))
71 (home-page "https://github.com/KhronosGroup/SPIRV-Headers")
72 (synopsis "Machine-readable files from the SPIR-V Registry")
74 "SPIRV-Headers is a repository containing machine-readable files from
75 the SPIR-V Registry. This includes:
77 @item Header files for various languages.
78 @item JSON files describing the grammar for the SPIR-V core instruction set,
79 and for the GLSL.std.450 extended instruction set.
80 @item The XML registry file.
82 (license (license:x11-style
83 (string-append "https://github.com/KhronosGroup/SPIRV-Headers/blob/"
84 commit "/LICENSE"))))))
86 (define-public spirv-tools
94 (url "https://github.com/KhronosGroup/SPIRV-Tools")
95 (commit (string-append "v" version))))
98 "0vddjzhkrhrm3l3i57nxmq2smv3r1s0ka5ff2kziaahr4hqb479r"))
99 (file-name (string-append name "-" version "-checkout"))))
100 (build-system cmake-build-system)
102 `(#:tests? #f ; FIXME: Tests fail.
104 (modify-phases %standard-phases
105 (add-before 'configure 'fixgcc7
107 (unsetenv "C_INCLUDE_PATH")
108 (unsetenv "CPLUS_INCLUDE_PATH")
110 #:configure-flags (list (string-append "-DSPIRV-Headers_SOURCE_DIR="
111 (assoc-ref %build-inputs "spirv-headers")))))
112 (inputs `(("spirv-headers" ,spirv-headers)))
113 (native-inputs `(("gcc" ,gcc-7)
114 ("pkg-config" ,pkg-config)
116 (home-page "https://github.com/KhronosGroup/SPIRV-Tools")
117 (synopsis "API and commands for processing SPIR-V modules")
119 "The SPIR-V Tools project provides an API and commands for processing
120 SPIR-V modules. The project includes an assembler, binary module
121 parser,disassembler, validator, and optimizer for SPIR-V.")
122 (license license:asl2.0)))
124 (define-public glslang
127 (version "7.11.3113")
132 (url "https://github.com/KhronosGroup/glslang")
136 "1kzv2b4q1fddxd7c0hc754nd6rw6y9vijb9fsi13xzzq9dficgb6"))
137 (file-name (string-append name "-" version "-checkout"))))
138 (build-system cmake-build-system)
140 `(#:tests? #f ;; No tests
141 ;; glslang tries to set CMAKE_INSTALL_PREFIX manually. Remove the
143 #:phases (modify-phases %standard-phases
144 (add-after 'patch-source-shebangs 'fix-cmakelists
146 (substitute* "CMakeLists.txt"
147 (("set.*CMAKE_INSTALL_PREFIX.*") ""))
149 (native-inputs `(("bison" ,bison)
150 ("pkg-config" ,pkg-config)))
151 (home-page "https://github.com/KhronosGroup/glslang")
152 (synopsis "OpenGL and OpenGL ES shader front end and validator")
154 "Glslang is the official reference compiler front end for the
155 OpenGL@tie{}ES and OpenGL shading languages. It implements a strict
156 interpretation of the specifications for these languages.")
157 ;; Modified BSD license. See "copyright" section of
158 ;; https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
159 (license (list license:bsd-3
160 ;; include/SPIRV/{bitutils,hex_float}.h are Apache 2.0.
163 (define-public vulkan-headers
165 (name "vulkan-headers")
171 (url "https://github.com/KhronosGroup/Vulkan-Headers")
172 (commit (string-append "v" version))))
173 (file-name (git-file-name name version))
176 "1q3c79rf3mma0vqmwnxwps588pnyzap4nn49hk41m39k79vniaz8"))))
177 (build-system cmake-build-system)
179 `(#:tests? #f)) ; No tests.
181 "https://github.com/KhronosGroup/Vulkan-Headers")
182 (synopsis "Vulkan Header files and API registry")
184 "Vulkan-Headers contains header files and API registry for Vulkan.")
185 (license (list license:asl2.0)))) ;LICENSE.txt
187 (define-public vulkan-loader
189 (name "vulkan-loader")
195 (url "https://github.com/KhronosGroup/Vulkan-Loader")
196 (commit (string-append "v" version))))
197 (file-name (git-file-name name version))
200 "0ccpklv251jcz2lxvd5ix5i3cg4wb7qq5xi6cwvniy1rw52z7h00"))))
201 (build-system cmake-build-system)
203 `(#:tests? #f ;FIXME: 23/39 tests fail. Try "tests/run_all_tests.sh".
205 (modify-phases %standard-phases
206 (add-after 'unpack 'remove-spirv-tools-commit-id
207 (lambda* (#:key inputs #:allow-other-keys)
208 ;; Remove lines trying to build in a git commit id.
209 (substitute* "CMakeLists.txt" ((".*spirv_tools_commit_id.h.*") ""))
211 #:configure-flags (list
212 "-DBUILD_LAYERS=OFF" ; FIXME: Fails to build.
213 "-DBUILD_TESTS=OFF" ; FIXME: Needs 'googletest' submodule.
214 (string-append "-DCMAKE_INSTALL_LIBDIR="
215 (assoc-ref %outputs "out") "/lib"))))
216 (inputs `(("glslang" ,glslang)
219 ("libxrandr" ,libxrandr)
221 ("spirv-tools" ,spirv-tools)
222 ("vulkan-headers" ,vulkan-headers)
223 ("wayland" ,wayland)))
224 (native-inputs `(("pkg-config" ,pkg-config)
227 "https://github.com/KhronosGroup/Vulkan-Loader")
228 (synopsis "Khronos official ICD loader and validation layers for Vulkan")
230 "Vulkan allows multiple @dfn{Installable Client Drivers} (ICDs) each
231 supporting one or more devices to be used collectively. The loader is
232 responsible for discovering available Vulkan ICDs on the system and inserting
233 Vulkan layer libraries, including validation layers between the application
235 ;; This software is mainly Apache 2.0 licensed, but contains some components
236 ;; covered by other licenses. See COPYRIGHT.txt for details.
237 (license (list license:asl2.0 ;LICENSE.txt
238 (license:x11-style "file://COPYRIGHT.txt")
241 (define-public vulkan-icd-loader
242 (deprecated-package "vulkan-icd-loader" vulkan-loader))
244 (define-public vulkan-tools
246 (name "vulkan-tools")
252 (url "https://github.com/KhronosGroup/Vulkan-Tools")
253 (commit (string-append "v" version))))
254 (file-name (git-file-name name version))
257 "0a8vmgyn7an21bb9vxba9laf9ghvk905vn7rm8frdl8qr2b7vyw3"))))
258 (build-system cmake-build-system)
260 `(("glslang" ,glslang)
261 ("libxrandr" ,libxrandr)
263 ("vulkan-headers" ,vulkan-headers)
264 ("vulkan-loader" ,vulkan-loader)
265 ("wayland" ,wayland)))
267 `(("pkg-config" ,pkg-config)
270 `(#:tests? #f ; No tests.
271 #:configure-flags (list (string-append "-DGLSLANG_INSTALL_DIR="
272 (assoc-ref %build-inputs "glslang")))))
274 "https://github.com/KhronosGroup/Vulkan-Tools")
275 (synopsis "Tools and utilities for Vulkan")
277 "Vulkan-Tools provides tools and utilities that can assist development by
278 enabling developers to verify their applications correct use of the Vulkan
280 (license (list license:asl2.0)))) ;LICENSE.txt
282 (define-public shaderc
290 (url "https://github.com/google/shaderc")
291 (commit (string-append "v" version))))
292 (file-name (git-file-name name version))
295 "0qigmj0riw43pgjn5f6kpvk72fajssz1lc2aiqib5qvmj9rqq3hl"))))
296 (build-system meson-build-system)
298 `(#:tests? #f ; FIXME: Tests fail.
300 (modify-phases %standard-phases
302 (lambda* (#:key outputs #:allow-other-keys)
303 (let ((out (assoc-ref outputs "out")))
304 ;; Remove various lines and touch build-version.inc or
305 ;; configuring won't work.
306 (invoke "touch" "glslc/src/build-version.inc")
307 (substitute* "CMakeLists.txt" (("..PYTHON_EXE..*") ""))
308 (substitute* "CMakeLists.txt"
309 ((".*update_build_version.py..*") ""))
310 (substitute* "CMakeLists.txt"
311 ((".*add_custom_target.build-version.*") ""))
312 (substitute* "CMakeLists.txt"
313 ((".*spirv-tools_SOURCE_DIR.*glslang_SOURCE_DIR.*")
315 (substitute* "CMakeLists.txt"
316 ((".*Update build-version.inc.*") ""))
317 (substitute* "CMakeLists.txt" ((".*--check.*") ""))
318 (substitute* "glslc/src/main.cc" ((".*build-version.inc.*")
320 (invoke "cmake" "-GNinja" "-DCMAKE_BUILD_TYPE=Release"
321 "-DSHADERC_SKIP_TESTS=ON"
322 "-DCMAKE_INSTALL_LIBDIR=lib"
323 (string-append "-DCMAKE_INSTALL_PREFIX="
325 (add-after 'unpack 'unpack-sources
326 (lambda* (#:key inputs #:allow-other-keys)
327 (let ((spirv-tools-source (assoc-ref inputs "spirv-tools-source"))
328 (spirv-headers-source (assoc-ref inputs "spirv-headers-source"))
329 (glslang-source (assoc-ref inputs "glslang-source")))
330 (copy-recursively spirv-tools-source "third_party/spirv-tools")
331 (copy-recursively spirv-headers-source
332 (string-append "third_party/spirv-tools"
333 "/external/spirv-headers"))
334 (copy-recursively glslang-source "third_party/glslang")
337 `(("googletest" ,googletest)
341 ("glslang-source" ,(package-source glslang))
342 ("pkg-config" ,pkg-config)
343 ("spirv-headers-source" ,(package-source spirv-headers))
344 ("spirv-tools-source" ,(package-source spirv-tools))))
345 (home-page "https://github.com/google/shaderc")
346 (synopsis "Tools for shader compilation")
347 (description "Shaderc is a collection of tools, libraries, and tests for
348 shader compilation.")
349 (license license:asl2.0)))
352 (let ((commit "ecda316ef54d70bf1b3e860755241bb75873e53f")) ; Release 1.1.
360 (url "https://source.winehq.org/git/vkd3d.git")
364 "05a28kspy8gzng181w28zjqdb3pj2ss83b0lwnppxbcdzsz7rvrf"))
365 (file-name (string-append name "-" version "-checkout"))))
366 (build-system gnu-build-system)
368 `(#:configure-flags '("--with-spirv-tools")))
370 `(("autoconf" ,autoconf)
371 ("automake" ,automake)
372 ("gettext" ,gnu-gettext)
374 ("pkg-config" ,pkg-config)))
378 ("spirv-headers" ,spirv-headers)
379 ("spirv-tools" ,spirv-tools)
380 ("vulkan-headers" ,vulkan-headers)
381 ("vulkan-loader" ,vulkan-loader)
382 ("wine-minimal" ,wine-minimal) ; Needed for 'widl'.
383 ("xcb-util" ,xcb-util)
384 ("xcb-util-keysyms" ,xcb-util-keysyms)
385 ("xcb-util-wm" ,xcb-util-wm)))
386 (home-page "https://source.winehq.org/git/vkd3d.git/")
387 (synopsis "Direct3D 12 to Vulkan translation library")
388 (description "vkd3d is a library for translating Direct3D 12 to Vulkan.")
389 (license license:lgpl2.1))))