gnu: you-get: Update to 0.4.1077.
[jackhill/guix/guix.git] / gnu / packages / vulkan.scm
CommitLineData
0df77274 1;;; GNU Guix --- Functional package management for GNU
a4f99103 2;;; Copyright © 2017, 2018 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)
5b69baf0 27 #:use-module (guix build-system meson)
794d740e 28 #:use-module (gnu packages)
6a11d5f1 29 #:use-module (gnu packages bison)
5b69baf0 30 #:use-module (gnu packages cmake)
9286e0ec
RH
31 #:use-module (gnu packages freedesktop)
32 #:use-module (gnu packages gl)
794d740e 33 #:use-module (gnu packages pkg-config)
9286e0ec
RH
34 #:use-module (gnu packages python)
35 #:use-module (gnu packages xorg))
0df77274
RH
36
37(define-public spirv-headers
a4f99103
RH
38 ;; Keep updated in accordance with
39 ;; https://github.com/google/shaderc/blob/known-good/known_good.json
40 (let ((commit "061097878467b8e040fbf153a837d844ef9f9f96")
41 (revision "2"))
0df77274
RH
42 (package
43 (name "spirv-headers")
44 (version (string-append "0.0-" revision "." (string-take commit 9)))
45 (source
46 (origin
47 (method git-fetch)
48 (uri (git-reference
49 (url "https://github.com/KhronosGroup/SPIRV-Headers")
50 (commit commit)))
51 (sha256
52 (base32
a4f99103 53 "0bf9h6xc5fkncxnadwmqvpsjh7sdgns6is8prv1gvlfzrkvpjj17"))
0df77274
RH
54 (file-name (string-append name "-" version "-checkout"))))
55 (build-system cmake-build-system)
56 (arguments
57 `(#:tests? #f ;; No tests
58 #:phases (modify-phases %standard-phases
59 (replace 'install
60 (lambda* (#:key outputs #:allow-other-keys)
61 (zero? (system* "cmake" "-E" "copy_directory"
62 "../source/include/spirv"
63 (string-append (assoc-ref outputs "out")
64 "/include/spirv"))))))))
65 (home-page "https://github.com/KhronosGroup/SPIRV-Headers")
66 (synopsis "Machine-readable files from the SPIR-V Registry")
67 (description
68 "SPIRV-Headers is a repository containing machine-readable files from
69the SPIR-V Registry. This includes:
70@itemize
71@item Header files for various languages.
72@item JSON files describing the grammar for the SPIR-V core instruction set,
73and for the GLSL.std.450 extended instruction set.
74@item The XML registry file.
75@end itemize\n")
76 (license (license:x11-style
77 (string-append "https://github.com/KhronosGroup/SPIRV-Headers/blob/"
78 commit "/LICENSE"))))))
794d740e
RH
79
80(define-public spirv-tools
a9342820
RH
81 ;; Keep updated in accordance with
82 ;; https://github.com/google/shaderc/blob/known-good/known_good.json
83 (let ((commit "90862fe4b1c6763b32ce683d2d32c2f281f577cf")
84 (revision "1"))
85 (package
86 (name "spirv-tools")
87 (version (string-append "0.0-" revision "." (string-take commit 9)))
88 (source
89 (origin
90 (method git-fetch)
91 (uri (git-reference
92 (url "https://github.com/KhronosGroup/SPIRV-Tools")
93 (commit commit)))
794d740e
RH
94 (sha256
95 (base32
a9342820
RH
96 "1yq8ab6f52wcxm2azzmx70nqz8l35izd45830aikjkk1jfzmzabb"))
97 (file-name (string-append name "-" version "-checkout"))))
98 (build-system cmake-build-system)
99 (arguments
100 `(#:configure-flags (list (string-append "-DCMAKE_INSTALL_LIBDIR="
101 (assoc-ref %outputs "out")
102 "/lib")
103 (string-append "-DSPIRV-Headers_SOURCE_DIR="
104 (assoc-ref %build-inputs
105 "spirv-headers")))))
106 (inputs `(("spirv-headers" ,spirv-headers)))
c695fb76 107 (native-inputs `(("pkg-config" ,pkg-config)
a9342820
RH
108 ("python" ,python)))
109 (home-page "https://github.com/KhronosGroup/SPIRV-Tools")
110 (synopsis "API and commands for processing SPIR-V modules")
111 (description
112 "The SPIR-V Tools project provides an API and commands for processing
794d740e
RH
113SPIR-V modules. The project includes an assembler, binary module parser,
114disassembler, validator, and optimizer for SPIR-V.")
a9342820 115 (license license:asl2.0))))
6a11d5f1
RH
116
117(define-public glslang
76ef53eb
RH
118 ;; Keep updated in accordance with
119 ;; https://github.com/google/shaderc/blob/known-good/known_good.json
120 (let ((commit "b5b08462442239e6537315ea1405b6afcd53043e")
121 (revision "2"))
6a11d5f1
RH
122 (package
123 (name "glslang")
124 (version (string-append "3.0-" revision "." (string-take commit 9)))
125 (source
126 (origin
127 (method git-fetch)
128 (uri (git-reference
129 (url "https://github.com/KhronosGroup/glslang")
130 (commit commit)))
131 (sha256
132 (base32
76ef53eb 133 "08imby3hciisshzacrkx8s56lx4fxm7dad06xxaxxcapinmqrvwk"))
6a11d5f1
RH
134 (file-name (string-append name "-" version "-checkout"))))
135 (build-system cmake-build-system)
136 (arguments
137 `(#:tests? #f ;; No tests
138 ;; glslang tries to set CMAKE_INSTALL_PREFIX manually. Remove the
139 ;; offending line.
140 #:phases (modify-phases %standard-phases
141 (add-after 'patch-source-shebangs 'fix-cmakelists
142 (lambda _
143 (substitute* "CMakeLists.txt"
144 (("set.*CMAKE_INSTALL_PREFIX.*") ""))
145 #t)))))
146 (native-inputs `(("bison" ,bison)
147 ("pkg-config" ,pkg-config)))
148 (home-page "https://github.com/KhronosGroup/glslang")
149 (synopsis "OpenGL and OpenGL ES shader front end and validator")
150 (description
151 "Glslang is the official reference compiler front end for the
152OpenGL@tie{}ES and OpenGL shading languages. It implements a strict
153interpretation of the specifications for these languages.")
154 ;; Modified BSD license. See "copyright" section of
155 ;; https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
156 (license (list license:bsd-3
157 ;; include/SPIRV/{bitutils,hex_float}.h are Apache 2.0.
158 license:asl2.0)))))
9286e0ec
RH
159
160(define-public vulkan-icd-loader
161 (package
162 (name "vulkan-icd-loader")
076fcab1 163 (version "1.1.73.0")
9286e0ec
RH
164 (source
165 (origin
166 (method url-fetch)
167 (uri (string-append
168 "https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/"
169 "archive/sdk-" version ".tar.gz"))
170 (sha256
171 (base32
076fcab1 172 "1qb34j2zrc04fgs96m3k76vi4nx3sygbdcyg7pbwasr45cbdhsxb"))))
9286e0ec
RH
173 (build-system cmake-build-system)
174 (arguments
175 `(#:tests? #f ;FIXME: 23/39 tests fail. Try "tests/run_all_tests.sh".
a512246c
RH
176 #:phases
177 (modify-phases %standard-phases
178 (add-after 'unpack 'remove-spirv-tools-commit-id
179 (lambda* (#:key inputs #:allow-other-keys)
180 ;; Remove lines trying to build in a git commit id.
181 (substitute* "CMakeLists.txt" ((".*spirv_tools_commit_id.h.*") ""))
182 #t)))
183 #:configure-flags (list
184 "-DBUILD_LAYERS=OFF" ; FIXME: Fails to build.
076fcab1 185 "-DBUILD_TESTS=OFF" ; FIXME: Needs 'googletest' submodule.
a512246c 186 (string-append "-DCMAKE_INSTALL_LIBDIR="
9286e0ec
RH
187 (assoc-ref %outputs "out") "/lib"))))
188 (inputs `(("glslang" ,glslang)
189 ("libxcb" ,libxcb)
190 ("libx11" ,libx11)
191 ("libxrandr" ,libxrandr)
192 ("mesa" ,mesa)
193 ("spirv-tools" ,spirv-tools)
194 ("wayland" ,wayland)))
c695fb76 195 (native-inputs `(("pkg-config" ,pkg-config)
9286e0ec
RH
196 ("python" ,python)))
197 (home-page
198 "https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers")
199 (synopsis "Khronos official ICD loader and validation layers for Vulkan")
200 (description
201 "Vulkan allows multiple @dfn{Installable Client Drivers} (ICDs) each
202supporting one or more devices to be used collectively. The loader is
203responsible for discovering available Vulkan ICDs on the system and inserting
204Vulkan layer libraries, including validation layers between the application
205and the ICD.")
206 ;; This software is mainly Apache 2.0 licensed, but contains some components
207 ;; covered by other licenses. See COPYRIGHT.txt for details.
208 (license (list license:asl2.0 ;LICENSE.txt
209 (license:x11-style "file://COPYRIGHT.txt")
210 license:bsd-3))))
5b69baf0
RH
211
212(define-public shaderc
213 (let ((commit "773ec22d49f40b7161820f29d953be4a7e40190d")
214 (revision "1"))
215 (package
49c4c4de 216 (name "shaderc")
5983b783 217 (version (git-version "0.0.0" revision commit))
49c4c4de
TGR
218 (source
219 (origin
220 (method git-fetch)
221 (uri (git-reference
222 (url "https://github.com/google/shaderc")
223 (commit commit)))
224 (file-name (string-append name "-" version ".tar.gz"))
225 (sha256
226 (base32
227 "0b41inb1czxv3mciip0lfdxv19ccx2ys31fivfywjn2q8va1gd1f"))))
228 (build-system meson-build-system)
229 (arguments
308b17f6 230 `(#:tests? #f ; tests don't work yet.
49c4c4de
TGR
231 #:phases
232 (modify-phases %standard-phases
233 (replace 'configure
308b17f6 234 (lambda* (#:key outputs #:allow-other-keys)
49c4c4de
TGR
235 (let ((out (assoc-ref outputs "out")))
236 ;; Remove various lines and touch build-version.inc or
237 ;; configuring won't work.
238 (invoke "touch" "glslc/src/build-version.inc")
239 (substitute* "CMakeLists.txt" (("..PYTHON_EXE..*") ""))
240 (substitute* "CMakeLists.txt"
241 ((".*update_build_version.py..*") ""))
242 (substitute* "CMakeLists.txt"
243 ((".*add_custom_target.build-version.*") ""))
244 (substitute* "CMakeLists.txt"
245 ((".*spirv-tools_SOURCE_DIR.*glslang_SOURCE_DIR.*")
246 ""))
247 (substitute* "CMakeLists.txt"
248 ((".*Update build-version.inc.*") ""))
249 (substitute* "CMakeLists.txt" ((".*--check.*") ""))
250 (substitute* "glslc/src/main.cc" ((".*build-version.inc.*")
251 "\"1\""))
308b17f6
RH
252 (invoke "cmake" "-GNinja" "-DCMAKE_BUILD_TYPE=Release"
253 "-DSHADERC_SKIP_TESTS=ON"
254 "-DCMAKE_INSTALL_LIBDIR=lib"
255 (string-append "-DCMAKE_INSTALL_PREFIX="
256 out)))))
49c4c4de
TGR
257 (add-after 'unpack 'unpack-sources
258 (lambda* (#:key inputs #:allow-other-keys)
5983b783
EF
259 (let ((spirv-tools-source (assoc-ref inputs "spirv-tools-source"))
260 (spirv-headers-source (assoc-ref inputs "spirv-headers-source"))
261 (glslang-source (assoc-ref inputs "glslang-source")))
262 (copy-recursively spirv-tools-source "third_party/spirv-tools")
49c4c4de
TGR
263 (copy-recursively spirv-headers-source
264 (string-append "third_party/spirv-tools"
265 "/external/spirv-headers"))
5983b783 266 (copy-recursively glslang-source "third_party/glslang")
49c4c4de
TGR
267 #t))))))
268 (inputs
269 `(("python" ,python)))
270 (native-inputs
271 `(("cmake" ,cmake)
272 ("glslang-source" ,(package-source glslang))
273 ("pkg-config" ,pkg-config)
274 ("spirv-headers-source" ,(package-source spirv-headers))
275 ("spirv-tools-source" ,(package-source spirv-tools))))
276 (home-page "https://github.com/google/shaderc")
277 (synopsis "Tools for shader compilation")
278 (description "Shaderc is a collection of tools, libraries, and tests for
5b69baf0 279shader compilation.")
49c4c4de 280 (license license:asl2.0))))