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