Commit | Line | Data |
---|---|---|
0df77274 | 1 | ;;; GNU Guix --- Functional package management for GNU |
67ff2bdf | 2 | ;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com> |
3b149747 | 3 | ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr> |
5983b783 | 4 | ;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il> |
936b7906 | 5 | ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com> |
0df77274 RH |
6 | ;;; |
7 | ;;; This file is part of GNU Guix. | |
8 | ;;; | |
9 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
10 | ;;; under the terms of the GNU General Public License as published by | |
11 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
12 | ;;; your option) any later version. | |
13 | ;;; | |
14 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
15 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | ;;; GNU General Public License for more details. | |
18 | ;;; | |
19 | ;;; You should have received a copy of the GNU General Public License | |
20 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
21 | ||
22 | (define-module (gnu packages vulkan) | |
23 | #:use-module ((guix licenses) #:prefix license:) | |
24 | #:use-module (guix packages) | |
794d740e | 25 | #:use-module (guix download) |
0df77274 RH |
26 | #:use-module (guix git-download) |
27 | #:use-module (guix build-system cmake) | |
85c7f29a | 28 | #:use-module (guix build-system gnu) |
5b69baf0 | 29 | #:use-module (guix build-system meson) |
794d740e | 30 | #:use-module (gnu packages) |
85c7f29a | 31 | #:use-module (gnu packages autotools) |
6a11d5f1 | 32 | #:use-module (gnu packages bison) |
7f540654 | 33 | #:use-module (gnu packages check) |
5b69baf0 | 34 | #:use-module (gnu packages cmake) |
9286e0ec | 35 | #:use-module (gnu packages freedesktop) |
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 | |
93c5c6d1 RH |
44 | (package |
45 | (name "spirv-headers") | |
936b7906 | 46 | (version "1.5.3") |
93c5c6d1 RH |
47 | (source |
48 | (origin | |
49 | (method git-fetch) | |
50 | (uri (git-reference | |
51 | (url "https://github.com/KhronosGroup/SPIRV-Headers") | |
52 | (commit version))) | |
53 | (sha256 | |
54 | (base32 | |
936b7906 MB |
55 | "069sivqajp7z4p44lmrz23lvf237xpkjxd4lzrg27836pwqcz9bj")) |
56 | (file-name (git-file-name name version)))) | |
93c5c6d1 RH |
57 | (build-system cmake-build-system) |
58 | (arguments | |
936b7906 | 59 | `(#:tests? #f)) ;no tests |
93c5c6d1 RH |
60 | (home-page "https://github.com/KhronosGroup/SPIRV-Headers") |
61 | (synopsis "Machine-readable files from the SPIR-V Registry") | |
62 | (description | |
63 | "SPIRV-Headers is a repository containing machine-readable files from | |
0df77274 RH |
64 | the SPIR-V Registry. This includes: |
65 | @itemize | |
66 | @item Header files for various languages. | |
67 | @item JSON files describing the grammar for the SPIR-V core instruction set, | |
68 | and for the GLSL.std.450 extended instruction set. | |
69 | @item The XML registry file. | |
70 | @end itemize\n") | |
93c5c6d1 RH |
71 | (license (license:x11-style |
72 | (string-append "https://github.com/KhronosGroup/SPIRV-Headers/blob/" | |
73 | version "/LICENSE"))))) | |
794d740e RH |
74 | |
75 | (define-public spirv-tools | |
264c803b RH |
76 | (package |
77 | (name "spirv-tools") | |
aa1c7b49 | 78 | (version "2019.2") |
264c803b RH |
79 | (source |
80 | (origin | |
81 | (method git-fetch) | |
82 | (uri (git-reference | |
83 | (url "https://github.com/KhronosGroup/SPIRV-Tools") | |
84 | (commit (string-append "v" version)))) | |
85 | (sha256 | |
aa1c7b49 | 86 | (base32 "0zwz6qg8g8165h7cw52agryjrdb29gbmsbziw3pwiddfkyma8vvg")) |
d7a7d255 | 87 | (file-name (git-file-name name version)))) |
264c803b RH |
88 | (build-system cmake-build-system) |
89 | (arguments | |
90 | `(#:tests? #f ; FIXME: Tests fail. | |
264c803b RH |
91 | #:configure-flags (list (string-append "-DSPIRV-Headers_SOURCE_DIR=" |
92 | (assoc-ref %build-inputs "spirv-headers"))))) | |
93 | (inputs `(("spirv-headers" ,spirv-headers))) | |
9f74ec98 | 94 | (native-inputs `(("pkg-config" ,pkg-config) |
264c803b RH |
95 | ("python" ,python))) |
96 | (home-page "https://github.com/KhronosGroup/SPIRV-Tools") | |
97 | (synopsis "API and commands for processing SPIR-V modules") | |
98 | (description | |
99 | "The SPIR-V Tools project provides an API and commands for processing | |
100 | SPIR-V modules. The project includes an assembler, binary module | |
101 | parser,disassembler, validator, and optimizer for SPIR-V.") | |
102 | (license license:asl2.0))) | |
6a11d5f1 RH |
103 | |
104 | (define-public glslang | |
3113ecfa RH |
105 | (package |
106 | (name "glslang") | |
72110730 | 107 | (version "7.11.3214") |
3113ecfa RH |
108 | (source |
109 | (origin | |
a9342820 RH |
110 | (method git-fetch) |
111 | (uri (git-reference | |
3113ecfa RH |
112 | (url "https://github.com/KhronosGroup/glslang") |
113 | (commit version))) | |
794d740e RH |
114 | (sha256 |
115 | (base32 | |
72110730 | 116 | "0dqjga0lcza006fhac26zp2plbq4gx8a6nsmrwkqlzji6lw1jins")) |
a9342820 | 117 | (file-name (string-append name "-" version "-checkout")))) |
3113ecfa RH |
118 | (build-system cmake-build-system) |
119 | (arguments | |
120 | `(#:tests? #f ;; No tests | |
121 | ;; glslang tries to set CMAKE_INSTALL_PREFIX manually. Remove the | |
122 | ;; offending line. | |
123 | #:phases (modify-phases %standard-phases | |
124 | (add-after 'patch-source-shebangs 'fix-cmakelists | |
125 | (lambda _ | |
126 | (substitute* "CMakeLists.txt" | |
127 | (("set.*CMAKE_INSTALL_PREFIX.*") "")) | |
128 | #t))))) | |
129 | (native-inputs `(("bison" ,bison) | |
130 | ("pkg-config" ,pkg-config))) | |
131 | (home-page "https://github.com/KhronosGroup/glslang") | |
132 | (synopsis "OpenGL and OpenGL ES shader front end and validator") | |
133 | (description | |
134 | "Glslang is the official reference compiler front end for the | |
6a11d5f1 RH |
135 | OpenGL@tie{}ES and OpenGL shading languages. It implements a strict |
136 | interpretation of the specifications for these languages.") | |
3113ecfa RH |
137 | ;; Modified BSD license. See "copyright" section of |
138 | ;; https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/ | |
139 | (license (list license:bsd-3 | |
140 | ;; include/SPIRV/{bitutils,hex_float}.h are Apache 2.0. | |
141 | license:asl2.0)))) | |
9286e0ec | 142 | |
cf09bed4 RH |
143 | (define-public vulkan-headers |
144 | (package | |
145 | (name "vulkan-headers") | |
e01d384e | 146 | (version "1.1.121") |
cf09bed4 RH |
147 | (source |
148 | (origin | |
67ff2bdf RH |
149 | (method git-fetch) |
150 | (uri (git-reference | |
151 | (url "https://github.com/KhronosGroup/Vulkan-Headers") | |
152 | (commit (string-append "v" version)))) | |
b8f9e97d | 153 | (file-name (git-file-name name version)) |
cf09bed4 RH |
154 | (sha256 |
155 | (base32 | |
e01d384e | 156 | "0hbgbdxj7lrm37phb0pkq5zgss3h21znj3mivnyva5f60i2wgr73")))) |
cf09bed4 RH |
157 | (build-system cmake-build-system) |
158 | (arguments | |
67ff2bdf | 159 | `(#:tests? #f)) ; No tests. |
cf09bed4 RH |
160 | (home-page |
161 | "https://github.com/KhronosGroup/Vulkan-Headers") | |
162 | (synopsis "Vulkan Header files and API registry") | |
163 | (description | |
164 | "Vulkan-Headers contains header files and API registry for Vulkan.") | |
165 | (license (list license:asl2.0)))) ;LICENSE.txt | |
166 | ||
e6fcf903 | 167 | (define-public vulkan-loader |
9286e0ec | 168 | (package |
e6fcf903 | 169 | (name "vulkan-loader") |
0eb01ff5 | 170 | (version (package-version vulkan-headers)) |
9286e0ec RH |
171 | (source |
172 | (origin | |
67ff2bdf RH |
173 | (method git-fetch) |
174 | (uri (git-reference | |
175 | (url "https://github.com/KhronosGroup/Vulkan-Loader") | |
176 | (commit (string-append "v" version)))) | |
b8f9e97d | 177 | (file-name (git-file-name name version)) |
9286e0ec RH |
178 | (sha256 |
179 | (base32 | |
e01d384e | 180 | "1gbrppfxrncvva30fikgzm7f15xs527sb4lf1sswdyxj3h5cw741")))) |
9286e0ec RH |
181 | (build-system cmake-build-system) |
182 | (arguments | |
183 | `(#:tests? #f ;FIXME: 23/39 tests fail. Try "tests/run_all_tests.sh". | |
a512246c RH |
184 | #:phases |
185 | (modify-phases %standard-phases | |
186 | (add-after 'unpack 'remove-spirv-tools-commit-id | |
187 | (lambda* (#:key inputs #:allow-other-keys) | |
188 | ;; Remove lines trying to build in a git commit id. | |
189 | (substitute* "CMakeLists.txt" ((".*spirv_tools_commit_id.h.*") "")) | |
190 | #t))) | |
191 | #:configure-flags (list | |
076fcab1 | 192 | "-DBUILD_TESTS=OFF" ; FIXME: Needs 'googletest' submodule. |
a512246c | 193 | (string-append "-DCMAKE_INSTALL_LIBDIR=" |
67ff2bdf | 194 | (assoc-ref %outputs "out") "/lib")))) |
ebfe592f RH |
195 | (native-inputs `(("libxrandr" ,libxrandr) |
196 | ("pkg-config" ,pkg-config) | |
197 | ("python" ,python) | |
198 | ("vulkan-headers" ,vulkan-headers) | |
199 | ("wayland" ,wayland))) | |
9286e0ec | 200 | (home-page |
b1eb1ba9 | 201 | "https://github.com/KhronosGroup/Vulkan-Loader") |
9286e0ec RH |
202 | (synopsis "Khronos official ICD loader and validation layers for Vulkan") |
203 | (description | |
204 | "Vulkan allows multiple @dfn{Installable Client Drivers} (ICDs) each | |
205 | supporting one or more devices to be used collectively. The loader is | |
206 | responsible for discovering available Vulkan ICDs on the system and inserting | |
207 | Vulkan layer libraries, including validation layers between the application | |
208 | and the ICD.") | |
209 | ;; This software is mainly Apache 2.0 licensed, but contains some components | |
210 | ;; covered by other licenses. See COPYRIGHT.txt for details. | |
211 | (license (list license:asl2.0 ;LICENSE.txt | |
212 | (license:x11-style "file://COPYRIGHT.txt") | |
213 | license:bsd-3)))) | |
5b69baf0 | 214 | |
bee7e46a RH |
215 | (define-public vulkan-tools |
216 | (package | |
217 | (name "vulkan-tools") | |
05bb85fd | 218 | (version (package-version vulkan-headers)) |
bee7e46a RH |
219 | (source |
220 | (origin | |
67ff2bdf RH |
221 | (method git-fetch) |
222 | (uri (git-reference | |
223 | (url "https://github.com/KhronosGroup/Vulkan-Tools") | |
b8f9e97d RH |
224 | (commit (string-append "v" version)))) |
225 | (file-name (git-file-name name version)) | |
bee7e46a RH |
226 | (sha256 |
227 | (base32 | |
e01d384e | 228 | "1jndlz3n35zlz44p1b4cgl2alvsmgrqnkxdn5mpahg0zb8dgwmm8")))) |
bee7e46a RH |
229 | (build-system cmake-build-system) |
230 | (inputs | |
231 | `(("glslang" ,glslang) | |
232 | ("libxrandr" ,libxrandr) | |
bee7e46a RH |
233 | ("vulkan-loader" ,vulkan-loader) |
234 | ("wayland" ,wayland))) | |
235 | (native-inputs | |
236 | `(("pkg-config" ,pkg-config) | |
1661f09a RH |
237 | ("python" ,python) |
238 | ("vulkan-headers" ,vulkan-headers))) | |
bee7e46a | 239 | (arguments |
e21bd8df | 240 | `(#:tests? #f ; No tests. |
97764172 | 241 | #:configure-flags (list (string-append "-DGLSLANG_INSTALL_DIR=" |
e21bd8df | 242 | (assoc-ref %build-inputs "glslang"))))) |
bee7e46a RH |
243 | (home-page |
244 | "https://github.com/KhronosGroup/Vulkan-Tools") | |
245 | (synopsis "Tools and utilities for Vulkan") | |
246 | (description | |
247 | "Vulkan-Tools provides tools and utilities that can assist development by | |
248 | enabling developers to verify their applications correct use of the Vulkan | |
249 | API.") | |
250 | (license (list license:asl2.0)))) ;LICENSE.txt | |
251 | ||
5b69baf0 | 252 | (define-public shaderc |
d9eada79 RH |
253 | (package |
254 | (name "shaderc") | |
2d906800 | 255 | (version "2019.0") |
d9eada79 RH |
256 | (source |
257 | (origin | |
258 | (method git-fetch) | |
259 | (uri (git-reference | |
260 | (url "https://github.com/google/shaderc") | |
261 | (commit (string-append "v" version)))) | |
262 | (file-name (git-file-name name version)) | |
263 | (sha256 | |
264 | (base32 | |
2d906800 | 265 | "1l5mmyxhzsbp0a6y2d86i8jmf46c6bjgjkdgkr5l8hmhflmm7gi2")))) |
d9eada79 RH |
266 | (build-system meson-build-system) |
267 | (arguments | |
268 | `(#:tests? #f ; FIXME: Tests fail. | |
269 | #:phases | |
270 | (modify-phases %standard-phases | |
271 | (replace 'configure | |
272 | (lambda* (#:key outputs #:allow-other-keys) | |
273 | (let ((out (assoc-ref outputs "out"))) | |
274 | ;; Remove various lines and touch build-version.inc or | |
275 | ;; configuring won't work. | |
276 | (invoke "touch" "glslc/src/build-version.inc") | |
277 | (substitute* "CMakeLists.txt" (("..PYTHON_EXE..*") "")) | |
278 | (substitute* "CMakeLists.txt" | |
279 | ((".*update_build_version.py..*") "")) | |
280 | (substitute* "CMakeLists.txt" | |
281 | ((".*add_custom_target.build-version.*") "")) | |
282 | (substitute* "CMakeLists.txt" | |
283 | ((".*spirv-tools_SOURCE_DIR.*glslang_SOURCE_DIR.*") | |
284 | "")) | |
285 | (substitute* "CMakeLists.txt" | |
286 | ((".*Update build-version.inc.*") "")) | |
287 | (substitute* "CMakeLists.txt" ((".*--check.*") "")) | |
288 | (substitute* "glslc/src/main.cc" ((".*build-version.inc.*") | |
289 | "\"1\"")) | |
290 | (invoke "cmake" "-GNinja" "-DCMAKE_BUILD_TYPE=Release" | |
291 | "-DSHADERC_SKIP_TESTS=ON" | |
292 | "-DCMAKE_INSTALL_LIBDIR=lib" | |
293 | (string-append "-DCMAKE_INSTALL_PREFIX=" | |
294 | out))))) | |
295 | (add-after 'unpack 'unpack-sources | |
296 | (lambda* (#:key inputs #:allow-other-keys) | |
297 | (let ((spirv-tools-source (assoc-ref inputs "spirv-tools-source")) | |
298 | (spirv-headers-source (assoc-ref inputs "spirv-headers-source")) | |
299 | (glslang-source (assoc-ref inputs "glslang-source"))) | |
300 | (copy-recursively spirv-tools-source "third_party/spirv-tools") | |
301 | (copy-recursively spirv-headers-source | |
302 | (string-append "third_party/spirv-tools" | |
303 | "/external/spirv-headers")) | |
304 | (copy-recursively glslang-source "third_party/glslang") | |
305 | #t)))))) | |
306 | (inputs | |
307 | `(("googletest" ,googletest) | |
308 | ("python" ,python))) | |
309 | (native-inputs | |
c69959f0 | 310 | `(("cmake" ,cmake-minimal) |
d9eada79 RH |
311 | ("glslang-source" ,(package-source glslang)) |
312 | ("pkg-config" ,pkg-config) | |
313 | ("spirv-headers-source" ,(package-source spirv-headers)) | |
314 | ("spirv-tools-source" ,(package-source spirv-tools)))) | |
315 | (home-page "https://github.com/google/shaderc") | |
316 | (synopsis "Tools for shader compilation") | |
317 | (description "Shaderc is a collection of tools, libraries, and tests for | |
5b69baf0 | 318 | shader compilation.") |
d9eada79 | 319 | (license license:asl2.0))) |
85c7f29a RH |
320 | |
321 | (define-public vkd3d | |
006a1d59 | 322 | (let ((commit "ecda316ef54d70bf1b3e860755241bb75873e53f")) ; Release 1.1. |
85c7f29a RH |
323 | (package |
324 | (name "vkd3d") | |
006a1d59 | 325 | (version "1.1") |
85c7f29a RH |
326 | (source |
327 | (origin | |
328 | (method git-fetch) | |
329 | (uri (git-reference | |
330 | (url "https://source.winehq.org/git/vkd3d.git") | |
331 | (commit commit))) | |
332 | (sha256 | |
333 | (base32 | |
006a1d59 | 334 | "05a28kspy8gzng181w28zjqdb3pj2ss83b0lwnppxbcdzsz7rvrf")) |
85c7f29a RH |
335 | (file-name (string-append name "-" version "-checkout")))) |
336 | (build-system gnu-build-system) | |
337 | (arguments | |
338 | `(#:configure-flags '("--with-spirv-tools"))) | |
339 | (native-inputs | |
340 | `(("autoconf" ,autoconf) | |
341 | ("automake" ,automake) | |
f2d97d57 | 342 | ("gettext" ,gettext-minimal) |
85c7f29a RH |
343 | ("libtool" ,libtool) |
344 | ("pkg-config" ,pkg-config))) | |
345 | (inputs | |
346 | `(("libx11" ,libx11) | |
347 | ("libxcb" ,libxcb) | |
348 | ("spirv-headers" ,spirv-headers) | |
349 | ("spirv-tools" ,spirv-tools) | |
4786f515 | 350 | ("vulkan-headers" ,vulkan-headers) |
85c7f29a | 351 | ("vulkan-loader" ,vulkan-loader) |
dcf6df43 | 352 | ("wine-minimal" ,wine-minimal) ; Needed for 'widl'. |
85c7f29a RH |
353 | ("xcb-util" ,xcb-util) |
354 | ("xcb-util-keysyms" ,xcb-util-keysyms) | |
355 | ("xcb-util-wm" ,xcb-util-wm))) | |
356 | (home-page "https://source.winehq.org/git/vkd3d.git/") | |
357 | (synopsis "Direct3D 12 to Vulkan translation library") | |
358 | (description "vkd3d is a library for translating Direct3D 12 to Vulkan.") | |
359 | (license license:lgpl2.1)))) |