gnu: openrct2: Update to 0.2.0.
[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)
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)
85c7f29a 35 #:use-module (gnu packages gettext)
9286e0ec 36 #:use-module (gnu packages gl)
794d740e 37 #:use-module (gnu packages pkg-config)
9286e0ec 38 #:use-module (gnu packages python)
85c7f29a 39 #:use-module (gnu packages wine)
9286e0ec 40 #:use-module (gnu packages xorg))
0df77274
RH
41
42(define-public spirv-headers
a4f99103
RH
43 ;; Keep updated in accordance with
44 ;; https://github.com/google/shaderc/blob/known-good/known_good.json
c7c86de6
RH
45 (let ((commit "3ce3e49d73b8abbf2ffe33f829f941fb2a40f552")
46 (revision "3"))
0df77274
RH
47 (package
48 (name "spirv-headers")
49 (version (string-append "0.0-" revision "." (string-take commit 9)))
50 (source
51 (origin
52 (method git-fetch)
53 (uri (git-reference
54 (url "https://github.com/KhronosGroup/SPIRV-Headers")
55 (commit commit)))
56 (sha256
57 (base32
c7c86de6 58 "0yk4bzqifdqpmdxkhvrxbdqhf5ngkga0ig1yyz7khr7rklqfz7wp"))
0df77274
RH
59 (file-name (string-append name "-" version "-checkout"))))
60 (build-system cmake-build-system)
61 (arguments
62 `(#:tests? #f ;; No tests
63 #:phases (modify-phases %standard-phases
64 (replace 'install
65 (lambda* (#:key outputs #:allow-other-keys)
c7c86de6 66 (invoke "cmake" "-E" "copy_directory"
0df77274
RH
67 "../source/include/spirv"
68 (string-append (assoc-ref outputs "out")
c7c86de6 69 "/include/spirv")))))))
0df77274
RH
70 (home-page "https://github.com/KhronosGroup/SPIRV-Headers")
71 (synopsis "Machine-readable files from the SPIR-V Registry")
72 (description
73 "SPIRV-Headers is a repository containing machine-readable files from
74the SPIR-V Registry. This includes:
75@itemize
76@item Header files for various languages.
77@item JSON files describing the grammar for the SPIR-V core instruction set,
78and for the GLSL.std.450 extended instruction set.
79@item The XML registry file.
80@end itemize\n")
81 (license (license:x11-style
82 (string-append "https://github.com/KhronosGroup/SPIRV-Headers/blob/"
83 commit "/LICENSE"))))))
794d740e
RH
84
85(define-public spirv-tools
a9342820
RH
86 ;; Keep updated in accordance with
87 ;; https://github.com/google/shaderc/blob/known-good/known_good.json
ba10e0b8
RH
88 (let ((commit "fe2fbee294a8ad4434f828a8b4d99eafe9aac88c")
89 (revision "2"))
a9342820
RH
90 (package
91 (name "spirv-tools")
92 (version (string-append "0.0-" revision "." (string-take commit 9)))
93 (source
94 (origin
95 (method git-fetch)
96 (uri (git-reference
97 (url "https://github.com/KhronosGroup/SPIRV-Tools")
98 (commit commit)))
794d740e
RH
99 (sha256
100 (base32
ba10e0b8 101 "03rq4ypwqnz34n8ip85n95a3b9rxb34j26azzm3b3invaqchv19x"))
a9342820
RH
102 (file-name (string-append name "-" version "-checkout"))))
103 (build-system cmake-build-system)
104 (arguments
ba10e0b8
RH
105 `(#:tests? #f ; FIXME: Tests fail.
106 #:configure-flags (list (string-append "-DSPIRV-Headers_SOURCE_DIR="
a9342820
RH
107 (assoc-ref %build-inputs
108 "spirv-headers")))))
109 (inputs `(("spirv-headers" ,spirv-headers)))
c695fb76 110 (native-inputs `(("pkg-config" ,pkg-config)
a9342820
RH
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
794d740e
RH
116SPIR-V modules. The project includes an assembler, binary module parser,
117disassembler, validator, and optimizer for SPIR-V.")
a9342820 118 (license license:asl2.0))))
6a11d5f1
RH
119
120(define-public glslang
76ef53eb
RH
121 ;; Keep updated in accordance with
122 ;; https://github.com/google/shaderc/blob/known-good/known_good.json
fcfef825
RH
123 (let ((commit "32d3ec319909fcad0b2b308fe1635198773e8316")
124 (revision "3"))
6a11d5f1
RH
125 (package
126 (name "glslang")
127 (version (string-append "3.0-" revision "." (string-take commit 9)))
128 (source
129 (origin
130 (method git-fetch)
131 (uri (git-reference
132 (url "https://github.com/KhronosGroup/glslang")
133 (commit commit)))
134 (sha256
135 (base32
fcfef825 136 "1kmgjv5kbrjy6azpgwnjcn3cj8vg5i8hnyk3m969sc0gq2j1rbjj"))
6a11d5f1
RH
137 (file-name (string-append name "-" version "-checkout"))))
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
155OpenGL@tie{}ES and OpenGL shading languages. It implements a strict
156interpretation of the specifications for these languages.")
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
e6fcf903 163(define-public vulkan-loader
9286e0ec 164 (package
e6fcf903 165 (name "vulkan-loader")
076fcab1 166 (version "1.1.73.0")
9286e0ec
RH
167 (source
168 (origin
169 (method url-fetch)
170 (uri (string-append
e6fcf903 171 "https://github.com/KhronosGroup/Vulkan-Loader/"
9286e0ec
RH
172 "archive/sdk-" version ".tar.gz"))
173 (sha256
174 (base32
e6fcf903 175 "0lvdpy6ybx5h7w15m9s2n9q3167q618clra2k7yi2cbm397ci4hn"))))
9286e0ec
RH
176 (build-system cmake-build-system)
177 (arguments
178 `(#:tests? #f ;FIXME: 23/39 tests fail. Try "tests/run_all_tests.sh".
a512246c
RH
179 #:phases
180 (modify-phases %standard-phases
181 (add-after 'unpack 'remove-spirv-tools-commit-id
182 (lambda* (#:key inputs #:allow-other-keys)
183 ;; Remove lines trying to build in a git commit id.
184 (substitute* "CMakeLists.txt" ((".*spirv_tools_commit_id.h.*") ""))
185 #t)))
186 #:configure-flags (list
187 "-DBUILD_LAYERS=OFF" ; FIXME: Fails to build.
076fcab1 188 "-DBUILD_TESTS=OFF" ; FIXME: Needs 'googletest' submodule.
a512246c 189 (string-append "-DCMAKE_INSTALL_LIBDIR="
9286e0ec
RH
190 (assoc-ref %outputs "out") "/lib"))))
191 (inputs `(("glslang" ,glslang)
192 ("libxcb" ,libxcb)
193 ("libx11" ,libx11)
194 ("libxrandr" ,libxrandr)
195 ("mesa" ,mesa)
196 ("spirv-tools" ,spirv-tools)
197 ("wayland" ,wayland)))
c695fb76 198 (native-inputs `(("pkg-config" ,pkg-config)
9286e0ec
RH
199 ("python" ,python)))
200 (home-page
201 "https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers")
202 (synopsis "Khronos official ICD loader and validation layers for Vulkan")
203 (description
204 "Vulkan allows multiple @dfn{Installable Client Drivers} (ICDs) each
205supporting one or more devices to be used collectively. The loader is
206responsible for discovering available Vulkan ICDs on the system and inserting
207Vulkan layer libraries, including validation layers between the application
208and 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
8ec91940
RH
215(define-public vulkan-icd-loader
216 (deprecated-package "vulkan-icd-loader" vulkan-loader))
217
5b69baf0 218(define-public shaderc
7f540654
RH
219 (let ((commit "be8e0879750303a1de09385465d6b20ecb8b380d")
220 (revision "2"))
5b69baf0 221 (package
49c4c4de 222 (name "shaderc")
5983b783 223 (version (git-version "0.0.0" revision commit))
49c4c4de
TGR
224 (source
225 (origin
226 (method git-fetch)
227 (uri (git-reference
228 (url "https://github.com/google/shaderc")
229 (commit commit)))
230 (file-name (string-append name "-" version ".tar.gz"))
231 (sha256
232 (base32
7f540654 233 "16p25ry2i4zrj00zihfpf210f8xd7g398ffbw25igvi9mbn4nbfd"))))
49c4c4de
TGR
234 (build-system meson-build-system)
235 (arguments
f6f0e486
RH
236 `(#:tests? #f ; FIXME: Tests fail.
237 #:phases
49c4c4de
TGR
238 (modify-phases %standard-phases
239 (replace 'configure
308b17f6 240 (lambda* (#:key outputs #:allow-other-keys)
49c4c4de
TGR
241 (let ((out (assoc-ref outputs "out")))
242 ;; Remove various lines and touch build-version.inc or
243 ;; configuring won't work.
244 (invoke "touch" "glslc/src/build-version.inc")
245 (substitute* "CMakeLists.txt" (("..PYTHON_EXE..*") ""))
246 (substitute* "CMakeLists.txt"
247 ((".*update_build_version.py..*") ""))
248 (substitute* "CMakeLists.txt"
249 ((".*add_custom_target.build-version.*") ""))
250 (substitute* "CMakeLists.txt"
251 ((".*spirv-tools_SOURCE_DIR.*glslang_SOURCE_DIR.*")
252 ""))
253 (substitute* "CMakeLists.txt"
254 ((".*Update build-version.inc.*") ""))
255 (substitute* "CMakeLists.txt" ((".*--check.*") ""))
256 (substitute* "glslc/src/main.cc" ((".*build-version.inc.*")
257 "\"1\""))
308b17f6
RH
258 (invoke "cmake" "-GNinja" "-DCMAKE_BUILD_TYPE=Release"
259 "-DSHADERC_SKIP_TESTS=ON"
260 "-DCMAKE_INSTALL_LIBDIR=lib"
261 (string-append "-DCMAKE_INSTALL_PREFIX="
262 out)))))
49c4c4de
TGR
263 (add-after 'unpack 'unpack-sources
264 (lambda* (#:key inputs #:allow-other-keys)
5983b783
EF
265 (let ((spirv-tools-source (assoc-ref inputs "spirv-tools-source"))
266 (spirv-headers-source (assoc-ref inputs "spirv-headers-source"))
267 (glslang-source (assoc-ref inputs "glslang-source")))
268 (copy-recursively spirv-tools-source "third_party/spirv-tools")
49c4c4de
TGR
269 (copy-recursively spirv-headers-source
270 (string-append "third_party/spirv-tools"
271 "/external/spirv-headers"))
5983b783 272 (copy-recursively glslang-source "third_party/glslang")
49c4c4de
TGR
273 #t))))))
274 (inputs
7f540654
RH
275 `(("googletest" ,googletest)
276 ("python" ,python)))
49c4c4de
TGR
277 (native-inputs
278 `(("cmake" ,cmake)
279 ("glslang-source" ,(package-source glslang))
280 ("pkg-config" ,pkg-config)
281 ("spirv-headers-source" ,(package-source spirv-headers))
282 ("spirv-tools-source" ,(package-source spirv-tools))))
283 (home-page "https://github.com/google/shaderc")
284 (synopsis "Tools for shader compilation")
285 (description "Shaderc is a collection of tools, libraries, and tests for
5b69baf0 286shader compilation.")
49c4c4de 287 (license license:asl2.0))))
85c7f29a
RH
288
289(define-public vkd3d
290 (let ((commit "020c119e2da0786d8be0615cff961c190b00d62d") ; Release 1.0.
291 (revision "0"))
292 (package
293 (name "vkd3d")
294 (version "1.0")
295 (source
296 (origin
297 (method git-fetch)
298 (uri (git-reference
299 (url "https://source.winehq.org/git/vkd3d.git")
300 (commit commit)))
301 (sha256
302 (base32
303 "084svxhigs8r0725jv6gs7wwrxb9x4igyg5bgvgpcfw4aq0k69gn"))
304 (file-name (string-append name "-" version "-checkout"))))
305 (build-system gnu-build-system)
306 (arguments
307 `(#:configure-flags '("--with-spirv-tools")))
308 (native-inputs
309 `(("autoconf" ,autoconf)
310 ("automake" ,automake)
311 ("gettext" ,gnu-gettext)
312 ("libtool" ,libtool)
313 ("pkg-config" ,pkg-config)))
314 (inputs
315 `(("libx11" ,libx11)
316 ("libxcb" ,libxcb)
317 ("spirv-headers" ,spirv-headers)
318 ("spirv-tools" ,spirv-tools)
319 ("vulkan-loader" ,vulkan-loader)
320 ("wine" ,wine) ; Needed for 'widl'.
321 ("xcb-util" ,xcb-util)
322 ("xcb-util-keysyms" ,xcb-util-keysyms)
323 ("xcb-util-wm" ,xcb-util-wm)))
324 (home-page "https://source.winehq.org/git/vkd3d.git/")
325 (synopsis "Direct3D 12 to Vulkan translation library")
326 (description "vkd3d is a library for translating Direct3D 12 to Vulkan.")
327 (license license:lgpl2.1))))