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
45 (name "spirv-headers")
51 (url "https://github.com/KhronosGroup/SPIRV-Headers")
55 "0m56smanfcczjfif4yfcqhjj4d4sc088kwg6dgia8fwdsjavdm4d"))
56 (file-name (string-append name "-" version "-checkout"))))
57 (build-system cmake-build-system)
59 `(#:tests? #f ;; No tests
60 #:phases (modify-phases %standard-phases
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")
70 "SPIRV-Headers is a repository containing machine-readable files from
71 the SPIR-V Registry. This includes:
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.
78 (license (license:x11-style
79 (string-append "https://github.com/KhronosGroup/SPIRV-Headers/blob/"
80 version "/LICENSE")))))
82 (define-public spirv-tools
90 (url "https://github.com/KhronosGroup/SPIRV-Tools")
91 (commit (string-append "v" version))))
94 "0vddjzhkrhrm3l3i57nxmq2smv3r1s0ka5ff2kziaahr4hqb479r"))
95 (file-name (string-append name "-" version "-checkout"))))
96 (build-system cmake-build-system)
98 `(#:tests? #f ; FIXME: Tests fail.
100 (modify-phases %standard-phases
101 (add-before 'configure 'fixgcc7
103 (unsetenv "C_INCLUDE_PATH")
104 (unsetenv "CPLUS_INCLUDE_PATH")
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)
112 (home-page "https://github.com/KhronosGroup/SPIRV-Tools")
113 (synopsis "API and commands for processing SPIR-V modules")
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)))
120 (define-public glslang
123 (version "7.11.3214")
128 (url "https://github.com/KhronosGroup/glslang")
132 "0dqjga0lcza006fhac26zp2plbq4gx8a6nsmrwkqlzji6lw1jins"))
133 (file-name (string-append name "-" version "-checkout"))))
134 (build-system cmake-build-system)
136 `(#:tests? #f ;; No tests
137 ;; glslang tries to set CMAKE_INSTALL_PREFIX manually. Remove the
139 #:phases (modify-phases %standard-phases
140 (add-after 'patch-source-shebangs 'fix-cmakelists
142 (substitute* "CMakeLists.txt"
143 (("set.*CMAKE_INSTALL_PREFIX.*") ""))
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")
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.
159 (define-public vulkan-headers
161 (name "vulkan-headers")
167 (url "https://github.com/KhronosGroup/Vulkan-Headers")
168 (commit (string-append "v" version))))
169 (file-name (git-file-name name version))
172 "0kyf83n6fghqmjj5jbwhy08yq5sl598qnmw3kbavrnw9avqqm0c4"))))
173 (build-system cmake-build-system)
175 `(#:tests? #f)) ; No tests.
177 "https://github.com/KhronosGroup/Vulkan-Headers")
178 (synopsis "Vulkan Header files and API registry")
180 "Vulkan-Headers contains header files and API registry for Vulkan.")
181 (license (list license:asl2.0)))) ;LICENSE.txt
183 (define-public vulkan-loader
185 (name "vulkan-loader")
186 (version (package-version vulkan-headers))
191 (url "https://github.com/KhronosGroup/Vulkan-Loader")
192 (commit (string-append "v" version))))
193 (file-name (git-file-name name version))
196 "1p64k9x5r7nsrs0cn6d61687xbajqvsm78xk6j85w9wfin5dxs30"))))
197 (build-system cmake-build-system)
199 `(#:tests? #f ;FIXME: 23/39 tests fail. Try "tests/run_all_tests.sh".
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.*") ""))
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)
214 ("vulkan-headers" ,vulkan-headers)
215 ("wayland" ,wayland)))
217 "https://github.com/KhronosGroup/Vulkan-Loader")
218 (synopsis "Khronos official ICD loader and validation layers for Vulkan")
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
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")
231 (define-public vulkan-icd-loader
232 (deprecated-package "vulkan-icd-loader" vulkan-loader))
234 (define-public vulkan-tools
236 (name "vulkan-tools")
237 (version (package-version vulkan-headers))
242 (url "https://github.com/KhronosGroup/Vulkan-Tools")
243 (commit (string-append "v" version))))
244 (file-name (git-file-name name version))
247 "1mak96jdg3wv043b4jxyv1fm2cz4nnallg0yb90my3yp5q64grrw"))))
248 (build-system cmake-build-system)
250 `(("glslang" ,glslang)
251 ("libxrandr" ,libxrandr)
252 ("vulkan-loader" ,vulkan-loader)
253 ("wayland" ,wayland)))
255 `(("pkg-config" ,pkg-config)
257 ("vulkan-headers" ,vulkan-headers)))
259 `(#:tests? #f ; No tests.
260 #:configure-flags (list (string-append "-DGLSLANG_INSTALL_DIR="
261 (assoc-ref %build-inputs "glslang")))))
263 "https://github.com/KhronosGroup/Vulkan-Tools")
264 (synopsis "Tools and utilities for Vulkan")
266 "Vulkan-Tools provides tools and utilities that can assist development by
267 enabling developers to verify their applications correct use of the Vulkan
269 (license (list license:asl2.0)))) ;LICENSE.txt
271 (define-public shaderc
279 (url "https://github.com/google/shaderc")
280 (commit (string-append "v" version))))
281 (file-name (git-file-name name version))
284 "1l5mmyxhzsbp0a6y2d86i8jmf46c6bjgjkdgkr5l8hmhflmm7gi2"))))
285 (build-system meson-build-system)
287 `(#:tests? #f ; FIXME: Tests fail.
289 (modify-phases %standard-phases
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.*")
304 (substitute* "CMakeLists.txt"
305 ((".*Update build-version.inc.*") ""))
306 (substitute* "CMakeLists.txt" ((".*--check.*") ""))
307 (substitute* "glslc/src/main.cc" ((".*build-version.inc.*")
309 (invoke "cmake" "-GNinja" "-DCMAKE_BUILD_TYPE=Release"
310 "-DSHADERC_SKIP_TESTS=ON"
311 "-DCMAKE_INSTALL_LIBDIR=lib"
312 (string-append "-DCMAKE_INSTALL_PREFIX="
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")
326 `(("googletest" ,googletest)
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)))
341 (let ((commit "ecda316ef54d70bf1b3e860755241bb75873e53f")) ; Release 1.1.
349 (url "https://source.winehq.org/git/vkd3d.git")
353 "05a28kspy8gzng181w28zjqdb3pj2ss83b0lwnppxbcdzsz7rvrf"))
354 (file-name (string-append name "-" version "-checkout"))))
355 (build-system gnu-build-system)
357 `(#:configure-flags '("--with-spirv-tools")))
359 `(("autoconf" ,autoconf)
360 ("automake" ,automake)
361 ("gettext" ,gnu-gettext)
363 ("pkg-config" ,pkg-config)))
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))))