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 | |
93c5c6d1 RH |
44 | (package |
45 | (name "spirv-headers") | |
46 | (version "1.3.7") | |
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 | |
55 | "0m56smanfcczjfif4yfcqhjj4d4sc088kwg6dgia8fwdsjavdm4d")) | |
56 | (file-name (string-append name "-" version "-checkout")))) | |
57 | (build-system cmake-build-system) | |
58 | (arguments | |
59 | `(#:tests? #f ;; No tests | |
60 | #:phases (modify-phases %standard-phases | |
61 | (replace 'install | |
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") | |
69 | (description | |
70 | "SPIRV-Headers is a repository containing machine-readable files from | |
0df77274 RH |
71 | the SPIR-V Registry. This includes: |
72 | @itemize | |
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. | |
77 | @end itemize\n") | |
93c5c6d1 RH |
78 | (license (license:x11-style |
79 | (string-append "https://github.com/KhronosGroup/SPIRV-Headers/blob/" | |
80 | version "/LICENSE"))))) | |
794d740e RH |
81 | |
82 | (define-public spirv-tools | |
264c803b RH |
83 | (package |
84 | (name "spirv-tools") | |
85 | (version "2019.1") | |
86 | (source | |
87 | (origin | |
88 | (method git-fetch) | |
89 | (uri (git-reference | |
90 | (url "https://github.com/KhronosGroup/SPIRV-Tools") | |
91 | (commit (string-append "v" version)))) | |
92 | (sha256 | |
93 | (base32 | |
94 | "0vddjzhkrhrm3l3i57nxmq2smv3r1s0ka5ff2kziaahr4hqb479r")) | |
95 | (file-name (string-append name "-" version "-checkout")))) | |
96 | (build-system cmake-build-system) | |
97 | (arguments | |
98 | `(#:tests? #f ; FIXME: Tests fail. | |
99 | #:phases | |
100 | (modify-phases %standard-phases | |
101 | (add-before 'configure 'fixgcc7 | |
102 | (lambda _ | |
103 | (unsetenv "C_INCLUDE_PATH") | |
104 | (unsetenv "CPLUS_INCLUDE_PATH") | |
105 | #t))) | |
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) | |
111 | ("python" ,python))) | |
112 | (home-page "https://github.com/KhronosGroup/SPIRV-Tools") | |
113 | (synopsis "API and commands for processing SPIR-V modules") | |
114 | (description | |
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))) | |
6a11d5f1 RH |
119 | |
120 | (define-public glslang | |
3113ecfa RH |
121 | (package |
122 | (name "glslang") | |
b2e417f3 | 123 | (version "7.11.3188") |
3113ecfa RH |
124 | (source |
125 | (origin | |
126 | (method git-fetch) | |
127 | (uri (git-reference | |
128 | (url "https://github.com/KhronosGroup/glslang") | |
129 | (commit version))) | |
130 | (sha256 | |
131 | (base32 | |
b2e417f3 | 132 | "04y4dd1cqdkd4qffmhgmg3agf9j07ii2w38vpp4jw53ir818bqdq")) |
3113ecfa RH |
133 | (file-name (string-append name "-" version "-checkout")))) |
134 | (build-system cmake-build-system) | |
135 | (arguments | |
136 | `(#:tests? #f ;; No tests | |
137 | ;; glslang tries to set CMAKE_INSTALL_PREFIX manually. Remove the | |
138 | ;; offending line. | |
139 | #:phases (modify-phases %standard-phases | |
140 | (add-after 'patch-source-shebangs 'fix-cmakelists | |
141 | (lambda _ | |
142 | (substitute* "CMakeLists.txt" | |
143 | (("set.*CMAKE_INSTALL_PREFIX.*") "")) | |
144 | #t))))) | |
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") | |
149 | (description | |
150 | "Glslang is the official reference compiler front end for the | |
6a11d5f1 RH |
151 | OpenGL@tie{}ES and OpenGL shading languages. It implements a strict |
152 | interpretation of the specifications for these languages.") | |
3113ecfa RH |
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. | |
157 | license:asl2.0)))) | |
9286e0ec | 158 | |
cf09bed4 RH |
159 | (define-public vulkan-headers |
160 | (package | |
161 | (name "vulkan-headers") | |
9b43a736 | 162 | (version "1.1.99") |
cf09bed4 RH |
163 | (source |
164 | (origin | |
67ff2bdf RH |
165 | (method git-fetch) |
166 | (uri (git-reference | |
167 | (url "https://github.com/KhronosGroup/Vulkan-Headers") | |
168 | (commit (string-append "v" version)))) | |
cf09bed4 RH |
169 | (sha256 |
170 | (base32 | |
9b43a736 | 171 | "166z6wn5kxnqm55zgzhmqa9hg48d11bfmi3wnf1mqhsx48xw6b8z")))) |
cf09bed4 RH |
172 | (build-system cmake-build-system) |
173 | (arguments | |
67ff2bdf | 174 | `(#:tests? #f)) ; No tests. |
cf09bed4 RH |
175 | (home-page |
176 | "https://github.com/KhronosGroup/Vulkan-Headers") | |
177 | (synopsis "Vulkan Header files and API registry") | |
178 | (description | |
179 | "Vulkan-Headers contains header files and API registry for Vulkan.") | |
180 | (license (list license:asl2.0)))) ;LICENSE.txt | |
181 | ||
e6fcf903 | 182 | (define-public vulkan-loader |
9286e0ec | 183 | (package |
e6fcf903 | 184 | (name "vulkan-loader") |
34f1838f | 185 | (version (package-version vulkan-headers)) |
9286e0ec RH |
186 | (source |
187 | (origin | |
67ff2bdf RH |
188 | (method git-fetch) |
189 | (uri (git-reference | |
190 | (url "https://github.com/KhronosGroup/Vulkan-Loader") | |
191 | (commit (string-append "v" version)))) | |
9286e0ec RH |
192 | (sha256 |
193 | (base32 | |
9b43a736 | 194 | "02m3sdcbl8s6qr1nsba5621vg3f4akkfaa7g9hi70cpvws4x0gg8")))) |
9286e0ec RH |
195 | (build-system cmake-build-system) |
196 | (arguments | |
197 | `(#:tests? #f ;FIXME: 23/39 tests fail. Try "tests/run_all_tests.sh". | |
a512246c RH |
198 | #:phases |
199 | (modify-phases %standard-phases | |
200 | (add-after 'unpack 'remove-spirv-tools-commit-id | |
201 | (lambda* (#:key inputs #:allow-other-keys) | |
202 | ;; Remove lines trying to build in a git commit id. | |
203 | (substitute* "CMakeLists.txt" ((".*spirv_tools_commit_id.h.*") "")) | |
204 | #t))) | |
205 | #:configure-flags (list | |
206 | "-DBUILD_LAYERS=OFF" ; FIXME: Fails to build. | |
076fcab1 | 207 | "-DBUILD_TESTS=OFF" ; FIXME: Needs 'googletest' submodule. |
a512246c | 208 | (string-append "-DCMAKE_INSTALL_LIBDIR=" |
67ff2bdf | 209 | (assoc-ref %outputs "out") "/lib")))) |
9286e0ec RH |
210 | (inputs `(("glslang" ,glslang) |
211 | ("libxcb" ,libxcb) | |
212 | ("libx11" ,libx11) | |
213 | ("libxrandr" ,libxrandr) | |
214 | ("mesa" ,mesa) | |
215 | ("spirv-tools" ,spirv-tools) | |
b1eb1ba9 | 216 | ("vulkan-headers" ,vulkan-headers) |
9286e0ec | 217 | ("wayland" ,wayland))) |
c695fb76 | 218 | (native-inputs `(("pkg-config" ,pkg-config) |
9286e0ec RH |
219 | ("python" ,python))) |
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") | |
9b43a736 | 241 | (version "1.1.97.0") |
bee7e46a RH |
242 | (source |
243 | (origin | |
67ff2bdf RH |
244 | (method git-fetch) |
245 | (uri (git-reference | |
246 | (url "https://github.com/KhronosGroup/Vulkan-Tools") | |
9b43a736 | 247 | (commit (string-append "sdk-" version)))) |
bee7e46a RH |
248 | (sha256 |
249 | (base32 | |
9b43a736 | 250 | "1p70wk0x546w1dlvlghrqm4l4b6ql0x08pdybyagnwwph0gdvqy3")))) |
bee7e46a RH |
251 | (build-system cmake-build-system) |
252 | (inputs | |
253 | `(("glslang" ,glslang) | |
254 | ("libxrandr" ,libxrandr) | |
255 | ("mesa" ,mesa) | |
256 | ("vulkan-headers" ,vulkan-headers) | |
257 | ("vulkan-loader" ,vulkan-loader) | |
258 | ("wayland" ,wayland))) | |
259 | (native-inputs | |
260 | `(("pkg-config" ,pkg-config) | |
261 | ("python" ,python))) | |
262 | (arguments | |
67ff2bdf | 263 | `(#:tests? #f)) ; No tests. |
bee7e46a RH |
264 | (home-page |
265 | "https://github.com/KhronosGroup/Vulkan-Tools") | |
266 | (synopsis "Tools and utilities for Vulkan") | |
267 | (description | |
268 | "Vulkan-Tools provides tools and utilities that can assist development by | |
269 | enabling developers to verify their applications correct use of the Vulkan | |
270 | API.") | |
271 | (license (list license:asl2.0)))) ;LICENSE.txt | |
272 | ||
5b69baf0 | 273 | (define-public shaderc |
d9eada79 RH |
274 | (package |
275 | (name "shaderc") | |
276 | (version "2018.0") | |
277 | (source | |
278 | (origin | |
279 | (method git-fetch) | |
280 | (uri (git-reference | |
281 | (url "https://github.com/google/shaderc") | |
282 | (commit (string-append "v" version)))) | |
283 | (file-name (git-file-name name version)) | |
284 | (sha256 | |
285 | (base32 | |
286 | "0qigmj0riw43pgjn5f6kpvk72fajssz1lc2aiqib5qvmj9rqq3hl")))) | |
287 | (build-system meson-build-system) | |
288 | (arguments | |
289 | `(#:tests? #f ; FIXME: Tests fail. | |
290 | #:phases | |
291 | (modify-phases %standard-phases | |
292 | (replace 'configure | |
293 | (lambda* (#:key outputs #:allow-other-keys) | |
294 | (let ((out (assoc-ref outputs "out"))) | |
295 | ;; Remove various lines and touch build-version.inc or | |
296 | ;; configuring won't work. | |
297 | (invoke "touch" "glslc/src/build-version.inc") | |
298 | (substitute* "CMakeLists.txt" (("..PYTHON_EXE..*") "")) | |
299 | (substitute* "CMakeLists.txt" | |
300 | ((".*update_build_version.py..*") "")) | |
301 | (substitute* "CMakeLists.txt" | |
302 | ((".*add_custom_target.build-version.*") "")) | |
303 | (substitute* "CMakeLists.txt" | |
304 | ((".*spirv-tools_SOURCE_DIR.*glslang_SOURCE_DIR.*") | |
305 | "")) | |
306 | (substitute* "CMakeLists.txt" | |
307 | ((".*Update build-version.inc.*") "")) | |
308 | (substitute* "CMakeLists.txt" ((".*--check.*") "")) | |
309 | (substitute* "glslc/src/main.cc" ((".*build-version.inc.*") | |
310 | "\"1\"")) | |
311 | (invoke "cmake" "-GNinja" "-DCMAKE_BUILD_TYPE=Release" | |
312 | "-DSHADERC_SKIP_TESTS=ON" | |
313 | "-DCMAKE_INSTALL_LIBDIR=lib" | |
314 | (string-append "-DCMAKE_INSTALL_PREFIX=" | |
315 | out))))) | |
316 | (add-after 'unpack 'unpack-sources | |
317 | (lambda* (#:key inputs #:allow-other-keys) | |
318 | (let ((spirv-tools-source (assoc-ref inputs "spirv-tools-source")) | |
319 | (spirv-headers-source (assoc-ref inputs "spirv-headers-source")) | |
320 | (glslang-source (assoc-ref inputs "glslang-source"))) | |
321 | (copy-recursively spirv-tools-source "third_party/spirv-tools") | |
322 | (copy-recursively spirv-headers-source | |
323 | (string-append "third_party/spirv-tools" | |
324 | "/external/spirv-headers")) | |
325 | (copy-recursively glslang-source "third_party/glslang") | |
326 | #t)))))) | |
327 | (inputs | |
328 | `(("googletest" ,googletest) | |
329 | ("python" ,python))) | |
330 | (native-inputs | |
331 | `(("cmake" ,cmake) | |
332 | ("glslang-source" ,(package-source glslang)) | |
333 | ("pkg-config" ,pkg-config) | |
334 | ("spirv-headers-source" ,(package-source spirv-headers)) | |
335 | ("spirv-tools-source" ,(package-source spirv-tools)))) | |
336 | (home-page "https://github.com/google/shaderc") | |
337 | (synopsis "Tools for shader compilation") | |
338 | (description "Shaderc is a collection of tools, libraries, and tests for | |
5b69baf0 | 339 | shader compilation.") |
d9eada79 | 340 | (license license:asl2.0))) |
85c7f29a RH |
341 | |
342 | (define-public vkd3d | |
006a1d59 | 343 | (let ((commit "ecda316ef54d70bf1b3e860755241bb75873e53f")) ; Release 1.1. |
85c7f29a RH |
344 | (package |
345 | (name "vkd3d") | |
006a1d59 | 346 | (version "1.1") |
85c7f29a RH |
347 | (source |
348 | (origin | |
349 | (method git-fetch) | |
350 | (uri (git-reference | |
351 | (url "https://source.winehq.org/git/vkd3d.git") | |
352 | (commit commit))) | |
353 | (sha256 | |
354 | (base32 | |
006a1d59 | 355 | "05a28kspy8gzng181w28zjqdb3pj2ss83b0lwnppxbcdzsz7rvrf")) |
85c7f29a RH |
356 | (file-name (string-append name "-" version "-checkout")))) |
357 | (build-system gnu-build-system) | |
358 | (arguments | |
359 | `(#:configure-flags '("--with-spirv-tools"))) | |
360 | (native-inputs | |
361 | `(("autoconf" ,autoconf) | |
362 | ("automake" ,automake) | |
363 | ("gettext" ,gnu-gettext) | |
364 | ("libtool" ,libtool) | |
365 | ("pkg-config" ,pkg-config))) | |
366 | (inputs | |
367 | `(("libx11" ,libx11) | |
368 | ("libxcb" ,libxcb) | |
369 | ("spirv-headers" ,spirv-headers) | |
370 | ("spirv-tools" ,spirv-tools) | |
4786f515 | 371 | ("vulkan-headers" ,vulkan-headers) |
85c7f29a | 372 | ("vulkan-loader" ,vulkan-loader) |
dcf6df43 | 373 | ("wine-minimal" ,wine-minimal) ; Needed for 'widl'. |
85c7f29a RH |
374 | ("xcb-util" ,xcb-util) |
375 | ("xcb-util-keysyms" ,xcb-util-keysyms) | |
376 | ("xcb-util-wm" ,xcb-util-wm))) | |
377 | (home-page "https://source.winehq.org/git/vkd3d.git/") | |
378 | (synopsis "Direct3D 12 to Vulkan translation library") | |
379 | (description "vkd3d is a library for translating Direct3D 12 to Vulkan.") | |
380 | (license license:lgpl2.1)))) |