1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2017, 2018 Rutger Helling <rhelling@mykolab.com>
4 ;;; This file is part of GNU Guix.
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19 (define-module (gnu packages vulkan)
20 #:use-module ((guix licenses) #:prefix license:)
21 #:use-module (guix packages)
22 #:use-module (guix download)
23 #:use-module (guix git-download)
24 #:use-module (guix build-system cmake)
25 #:use-module (gnu packages)
26 #:use-module (gnu packages bison)
27 #:use-module (gnu packages freedesktop)
28 #:use-module (gnu packages gl)
29 #:use-module (gnu packages pkg-config)
30 #:use-module (gnu packages python)
31 #:use-module (gnu packages xorg))
33 (define-public spirv-headers
34 ;; Keep updated in accordance with
35 ;; https://github.com/google/shaderc/blob/known-good/known_good.json
36 (let ((commit "061097878467b8e040fbf153a837d844ef9f9f96")
39 (name "spirv-headers")
40 (version (string-append "0.0-" revision "." (string-take commit 9)))
45 (url "https://github.com/KhronosGroup/SPIRV-Headers")
49 "0bf9h6xc5fkncxnadwmqvpsjh7sdgns6is8prv1gvlfzrkvpjj17"))
50 (file-name (string-append name "-" version "-checkout"))))
51 (build-system cmake-build-system)
53 `(#:tests? #f ;; No tests
54 #:phases (modify-phases %standard-phases
56 (lambda* (#:key outputs #:allow-other-keys)
57 (zero? (system* "cmake" "-E" "copy_directory"
58 "../source/include/spirv"
59 (string-append (assoc-ref outputs "out")
60 "/include/spirv"))))))))
61 (home-page "https://github.com/KhronosGroup/SPIRV-Headers")
62 (synopsis "Machine-readable files from the SPIR-V Registry")
64 "SPIRV-Headers is a repository containing machine-readable files from
65 the SPIR-V Registry. This includes:
67 @item Header files for various languages.
68 @item JSON files describing the grammar for the SPIR-V core instruction set,
69 and for the GLSL.std.450 extended instruction set.
70 @item The XML registry file.
72 (license (license:x11-style
73 (string-append "https://github.com/KhronosGroup/SPIRV-Headers/blob/"
74 commit "/LICENSE"))))))
76 (define-public spirv-tools
77 ;; Keep updated in accordance with
78 ;; https://github.com/google/shaderc/blob/known-good/known_good.json
79 (let ((commit "90862fe4b1c6763b32ce683d2d32c2f281f577cf")
83 (version (string-append "0.0-" revision "." (string-take commit 9)))
88 (url "https://github.com/KhronosGroup/SPIRV-Tools")
92 "1yq8ab6f52wcxm2azzmx70nqz8l35izd45830aikjkk1jfzmzabb"))
93 (file-name (string-append name "-" version "-checkout"))))
94 (build-system cmake-build-system)
96 `(#:configure-flags (list (string-append "-DCMAKE_INSTALL_LIBDIR="
97 (assoc-ref %outputs "out")
99 (string-append "-DSPIRV-Headers_SOURCE_DIR="
100 (assoc-ref %build-inputs
102 (inputs `(("spirv-headers" ,spirv-headers)))
103 (native-inputs `(("pkg-config", pkg-config)
105 (home-page "https://github.com/KhronosGroup/SPIRV-Tools")
106 (synopsis "API and commands for processing SPIR-V modules")
108 "The SPIR-V Tools project provides an API and commands for processing
109 SPIR-V modules. The project includes an assembler, binary module parser,
110 disassembler, validator, and optimizer for SPIR-V.")
111 (license license:asl2.0))))
113 (define-public glslang
114 ;; Keep updated in accordance with
115 ;; https://github.com/google/shaderc/blob/known-good/known_good.json
116 (let ((commit "b5b08462442239e6537315ea1405b6afcd53043e")
120 (version (string-append "3.0-" revision "." (string-take commit 9)))
125 (url "https://github.com/KhronosGroup/glslang")
129 "08imby3hciisshzacrkx8s56lx4fxm7dad06xxaxxcapinmqrvwk"))
130 (file-name (string-append name "-" version "-checkout"))))
131 (build-system cmake-build-system)
133 `(#:tests? #f ;; No tests
134 ;; glslang tries to set CMAKE_INSTALL_PREFIX manually. Remove the
136 #:phases (modify-phases %standard-phases
137 (add-after 'patch-source-shebangs 'fix-cmakelists
139 (substitute* "CMakeLists.txt"
140 (("set.*CMAKE_INSTALL_PREFIX.*") ""))
142 (native-inputs `(("bison" ,bison)
143 ("pkg-config" ,pkg-config)))
144 (home-page "https://github.com/KhronosGroup/glslang")
145 (synopsis "OpenGL and OpenGL ES shader front end and validator")
147 "Glslang is the official reference compiler front end for the
148 OpenGL@tie{}ES and OpenGL shading languages. It implements a strict
149 interpretation of the specifications for these languages.")
150 ;; Modified BSD license. See "copyright" section of
151 ;; https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
152 (license (list license:bsd-3
153 ;; include/SPIRV/{bitutils,hex_float}.h are Apache 2.0.
156 (define-public vulkan-icd-loader
158 (name "vulkan-icd-loader")
164 "https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/"
165 "archive/sdk-" version ".tar.gz"))
168 "1ivvmb977n2xp95v3sryhflvryy3mxrcwrd1hnr2dmri40vg1sl8"))))
169 (build-system cmake-build-system)
171 `(#:tests? #f ;FIXME: 23/39 tests fail. Try "tests/run_all_tests.sh".
172 #:configure-flags (list (string-append "-DCMAKE_INSTALL_LIBDIR="
173 (assoc-ref %outputs "out") "/lib"))))
174 (inputs `(("glslang" ,glslang)
177 ("libxrandr" ,libxrandr)
179 ("spirv-tools" ,spirv-tools)
180 ("wayland" ,wayland)))
181 (native-inputs `(("pkg-config", pkg-config)
184 "https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers")
185 (synopsis "Khronos official ICD loader and validation layers for Vulkan")
187 "Vulkan allows multiple @dfn{Installable Client Drivers} (ICDs) each
188 supporting one or more devices to be used collectively. The loader is
189 responsible for discovering available Vulkan ICDs on the system and inserting
190 Vulkan layer libraries, including validation layers between the application
192 ;; This software is mainly Apache 2.0 licensed, but contains some components
193 ;; covered by other licenses. See COPYRIGHT.txt for details.
194 (license (list license:asl2.0 ;LICENSE.txt
195 (license:x11-style "file://COPYRIGHT.txt")