gnu: spirv-tools: Do not build static libraries.
[jackhill/guix/guix.git] / gnu / packages / vulkan.scm
CommitLineData
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
64the 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,
68and 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")
cce94247 78 (version "2020.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
cce94247 86 (base32 "00b7xgyrcb2qq63pp3cnw5q1xqx2d9rfn65lai6n6r89s1vh3vg6"))
d7a7d255 87 (file-name (git-file-name name version))))
264c803b
RH
88 (build-system cmake-build-system)
89 (arguments
8a37a214
MB
90 `(#:configure-flags (list "-DBUILD_SHARED_LIBS=ON"
91 (string-append
92 "-DSPIRV-Headers_SOURCE_DIR="
93 (assoc-ref %build-inputs "spirv-headers")))))
264c803b 94 (inputs `(("spirv-headers" ,spirv-headers)))
9f74ec98 95 (native-inputs `(("pkg-config" ,pkg-config)
264c803b
RH
96 ("python" ,python)))
97 (home-page "https://github.com/KhronosGroup/SPIRV-Tools")
98 (synopsis "API and commands for processing SPIR-V modules")
99 (description
100 "The SPIR-V Tools project provides an API and commands for processing
101SPIR-V modules. The project includes an assembler, binary module
102parser,disassembler, validator, and optimizer for SPIR-V.")
103 (license license:asl2.0)))
6a11d5f1
RH
104
105(define-public glslang
3113ecfa
RH
106 (package
107 (name "glslang")
72110730 108 (version "7.11.3214")
3113ecfa
RH
109 (source
110 (origin
a9342820
RH
111 (method git-fetch)
112 (uri (git-reference
3113ecfa
RH
113 (url "https://github.com/KhronosGroup/glslang")
114 (commit version)))
794d740e
RH
115 (sha256
116 (base32
72110730 117 "0dqjga0lcza006fhac26zp2plbq4gx8a6nsmrwkqlzji6lw1jins"))
a9342820 118 (file-name (string-append name "-" version "-checkout"))))
3113ecfa
RH
119 (build-system cmake-build-system)
120 (arguments
121 `(#:tests? #f ;; No tests
122 ;; glslang tries to set CMAKE_INSTALL_PREFIX manually. Remove the
123 ;; offending line.
124 #:phases (modify-phases %standard-phases
125 (add-after 'patch-source-shebangs 'fix-cmakelists
126 (lambda _
127 (substitute* "CMakeLists.txt"
128 (("set.*CMAKE_INSTALL_PREFIX.*") ""))
129 #t)))))
130 (native-inputs `(("bison" ,bison)
131 ("pkg-config" ,pkg-config)))
132 (home-page "https://github.com/KhronosGroup/glslang")
133 (synopsis "OpenGL and OpenGL ES shader front end and validator")
134 (description
135 "Glslang is the official reference compiler front end for the
6a11d5f1
RH
136OpenGL@tie{}ES and OpenGL shading languages. It implements a strict
137interpretation of the specifications for these languages.")
3113ecfa
RH
138 ;; Modified BSD license. See "copyright" section of
139 ;; https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
140 (license (list license:bsd-3
141 ;; include/SPIRV/{bitutils,hex_float}.h are Apache 2.0.
142 license:asl2.0))))
9286e0ec 143
cf09bed4
RH
144(define-public vulkan-headers
145 (package
146 (name "vulkan-headers")
e01d384e 147 (version "1.1.121")
cf09bed4
RH
148 (source
149 (origin
67ff2bdf
RH
150 (method git-fetch)
151 (uri (git-reference
152 (url "https://github.com/KhronosGroup/Vulkan-Headers")
153 (commit (string-append "v" version))))
b8f9e97d 154 (file-name (git-file-name name version))
cf09bed4
RH
155 (sha256
156 (base32
e01d384e 157 "0hbgbdxj7lrm37phb0pkq5zgss3h21znj3mivnyva5f60i2wgr73"))))
cf09bed4
RH
158 (build-system cmake-build-system)
159 (arguments
67ff2bdf 160 `(#:tests? #f)) ; No tests.
cf09bed4
RH
161 (home-page
162 "https://github.com/KhronosGroup/Vulkan-Headers")
163 (synopsis "Vulkan Header files and API registry")
164 (description
165 "Vulkan-Headers contains header files and API registry for Vulkan.")
166 (license (list license:asl2.0)))) ;LICENSE.txt
167
e6fcf903 168(define-public vulkan-loader
9286e0ec 169 (package
e6fcf903 170 (name "vulkan-loader")
0eb01ff5 171 (version (package-version vulkan-headers))
9286e0ec
RH
172 (source
173 (origin
67ff2bdf
RH
174 (method git-fetch)
175 (uri (git-reference
176 (url "https://github.com/KhronosGroup/Vulkan-Loader")
177 (commit (string-append "v" version))))
b8f9e97d 178 (file-name (git-file-name name version))
9286e0ec
RH
179 (sha256
180 (base32
e01d384e 181 "1gbrppfxrncvva30fikgzm7f15xs527sb4lf1sswdyxj3h5cw741"))))
9286e0ec
RH
182 (build-system cmake-build-system)
183 (arguments
184 `(#:tests? #f ;FIXME: 23/39 tests fail. Try "tests/run_all_tests.sh".
a512246c
RH
185 #:phases
186 (modify-phases %standard-phases
187 (add-after 'unpack 'remove-spirv-tools-commit-id
188 (lambda* (#:key inputs #:allow-other-keys)
189 ;; Remove lines trying to build in a git commit id.
190 (substitute* "CMakeLists.txt" ((".*spirv_tools_commit_id.h.*") ""))
191 #t)))
192 #:configure-flags (list
076fcab1 193 "-DBUILD_TESTS=OFF" ; FIXME: Needs 'googletest' submodule.
a512246c 194 (string-append "-DCMAKE_INSTALL_LIBDIR="
67ff2bdf 195 (assoc-ref %outputs "out") "/lib"))))
ebfe592f
RH
196 (native-inputs `(("libxrandr" ,libxrandr)
197 ("pkg-config" ,pkg-config)
198 ("python" ,python)
199 ("vulkan-headers" ,vulkan-headers)
200 ("wayland" ,wayland)))
9286e0ec 201 (home-page
b1eb1ba9 202 "https://github.com/KhronosGroup/Vulkan-Loader")
9286e0ec
RH
203 (synopsis "Khronos official ICD loader and validation layers for Vulkan")
204 (description
205 "Vulkan allows multiple @dfn{Installable Client Drivers} (ICDs) each
206supporting one or more devices to be used collectively. The loader is
207responsible for discovering available Vulkan ICDs on the system and inserting
208Vulkan layer libraries, including validation layers between the application
209and the ICD.")
210 ;; This software is mainly Apache 2.0 licensed, but contains some components
211 ;; covered by other licenses. See COPYRIGHT.txt for details.
212 (license (list license:asl2.0 ;LICENSE.txt
213 (license:x11-style "file://COPYRIGHT.txt")
214 license:bsd-3))))
5b69baf0 215
bee7e46a
RH
216(define-public vulkan-tools
217 (package
218 (name "vulkan-tools")
05bb85fd 219 (version (package-version vulkan-headers))
bee7e46a
RH
220 (source
221 (origin
67ff2bdf
RH
222 (method git-fetch)
223 (uri (git-reference
224 (url "https://github.com/KhronosGroup/Vulkan-Tools")
b8f9e97d
RH
225 (commit (string-append "v" version))))
226 (file-name (git-file-name name version))
bee7e46a
RH
227 (sha256
228 (base32
e01d384e 229 "1jndlz3n35zlz44p1b4cgl2alvsmgrqnkxdn5mpahg0zb8dgwmm8"))))
bee7e46a
RH
230 (build-system cmake-build-system)
231 (inputs
232 `(("glslang" ,glslang)
233 ("libxrandr" ,libxrandr)
bee7e46a
RH
234 ("vulkan-loader" ,vulkan-loader)
235 ("wayland" ,wayland)))
236 (native-inputs
237 `(("pkg-config" ,pkg-config)
1661f09a
RH
238 ("python" ,python)
239 ("vulkan-headers" ,vulkan-headers)))
bee7e46a 240 (arguments
e21bd8df 241 `(#:tests? #f ; No tests.
97764172 242 #:configure-flags (list (string-append "-DGLSLANG_INSTALL_DIR="
e21bd8df 243 (assoc-ref %build-inputs "glslang")))))
bee7e46a
RH
244 (home-page
245 "https://github.com/KhronosGroup/Vulkan-Tools")
246 (synopsis "Tools and utilities for Vulkan")
247 (description
248 "Vulkan-Tools provides tools and utilities that can assist development by
249enabling developers to verify their applications correct use of the Vulkan
250API.")
251 (license (list license:asl2.0)))) ;LICENSE.txt
252
5b69baf0 253(define-public shaderc
d9eada79
RH
254 (package
255 (name "shaderc")
2d906800 256 (version "2019.0")
d9eada79
RH
257 (source
258 (origin
259 (method git-fetch)
260 (uri (git-reference
261 (url "https://github.com/google/shaderc")
262 (commit (string-append "v" version))))
263 (file-name (git-file-name name version))
264 (sha256
265 (base32
2d906800 266 "1l5mmyxhzsbp0a6y2d86i8jmf46c6bjgjkdgkr5l8hmhflmm7gi2"))))
d9eada79
RH
267 (build-system meson-build-system)
268 (arguments
269 `(#:tests? #f ; FIXME: Tests fail.
270 #:phases
271 (modify-phases %standard-phases
272 (replace 'configure
273 (lambda* (#:key outputs #:allow-other-keys)
274 (let ((out (assoc-ref outputs "out")))
275 ;; Remove various lines and touch build-version.inc or
276 ;; configuring won't work.
277 (invoke "touch" "glslc/src/build-version.inc")
278 (substitute* "CMakeLists.txt" (("..PYTHON_EXE..*") ""))
279 (substitute* "CMakeLists.txt"
280 ((".*update_build_version.py..*") ""))
281 (substitute* "CMakeLists.txt"
282 ((".*add_custom_target.build-version.*") ""))
283 (substitute* "CMakeLists.txt"
284 ((".*spirv-tools_SOURCE_DIR.*glslang_SOURCE_DIR.*")
285 ""))
286 (substitute* "CMakeLists.txt"
287 ((".*Update build-version.inc.*") ""))
288 (substitute* "CMakeLists.txt" ((".*--check.*") ""))
289 (substitute* "glslc/src/main.cc" ((".*build-version.inc.*")
290 "\"1\""))
291 (invoke "cmake" "-GNinja" "-DCMAKE_BUILD_TYPE=Release"
292 "-DSHADERC_SKIP_TESTS=ON"
293 "-DCMAKE_INSTALL_LIBDIR=lib"
294 (string-append "-DCMAKE_INSTALL_PREFIX="
295 out)))))
296 (add-after 'unpack 'unpack-sources
297 (lambda* (#:key inputs #:allow-other-keys)
298 (let ((spirv-tools-source (assoc-ref inputs "spirv-tools-source"))
299 (spirv-headers-source (assoc-ref inputs "spirv-headers-source"))
300 (glslang-source (assoc-ref inputs "glslang-source")))
301 (copy-recursively spirv-tools-source "third_party/spirv-tools")
302 (copy-recursively spirv-headers-source
303 (string-append "third_party/spirv-tools"
304 "/external/spirv-headers"))
305 (copy-recursively glslang-source "third_party/glslang")
306 #t))))))
307 (inputs
308 `(("googletest" ,googletest)
309 ("python" ,python)))
310 (native-inputs
c69959f0 311 `(("cmake" ,cmake-minimal)
d9eada79
RH
312 ("glslang-source" ,(package-source glslang))
313 ("pkg-config" ,pkg-config)
314 ("spirv-headers-source" ,(package-source spirv-headers))
315 ("spirv-tools-source" ,(package-source spirv-tools))))
316 (home-page "https://github.com/google/shaderc")
317 (synopsis "Tools for shader compilation")
318 (description "Shaderc is a collection of tools, libraries, and tests for
5b69baf0 319shader compilation.")
d9eada79 320 (license license:asl2.0)))
85c7f29a
RH
321
322(define-public vkd3d
006a1d59 323 (let ((commit "ecda316ef54d70bf1b3e860755241bb75873e53f")) ; Release 1.1.
85c7f29a
RH
324 (package
325 (name "vkd3d")
006a1d59 326 (version "1.1")
85c7f29a
RH
327 (source
328 (origin
329 (method git-fetch)
330 (uri (git-reference
331 (url "https://source.winehq.org/git/vkd3d.git")
332 (commit commit)))
333 (sha256
334 (base32
006a1d59 335 "05a28kspy8gzng181w28zjqdb3pj2ss83b0lwnppxbcdzsz7rvrf"))
85c7f29a
RH
336 (file-name (string-append name "-" version "-checkout"))))
337 (build-system gnu-build-system)
338 (arguments
339 `(#:configure-flags '("--with-spirv-tools")))
340 (native-inputs
341 `(("autoconf" ,autoconf)
342 ("automake" ,automake)
f2d97d57 343 ("gettext" ,gettext-minimal)
85c7f29a
RH
344 ("libtool" ,libtool)
345 ("pkg-config" ,pkg-config)))
346 (inputs
347 `(("libx11" ,libx11)
348 ("libxcb" ,libxcb)
349 ("spirv-headers" ,spirv-headers)
350 ("spirv-tools" ,spirv-tools)
4786f515 351 ("vulkan-headers" ,vulkan-headers)
85c7f29a 352 ("vulkan-loader" ,vulkan-loader)
dcf6df43 353 ("wine-minimal" ,wine-minimal) ; Needed for 'widl'.
85c7f29a
RH
354 ("xcb-util" ,xcb-util)
355 ("xcb-util-keysyms" ,xcb-util-keysyms)
356 ("xcb-util-wm" ,xcb-util-wm)))
357 (home-page "https://source.winehq.org/git/vkd3d.git/")
358 (synopsis "Direct3D 12 to Vulkan translation library")
359 (description "vkd3d is a library for translating Direct3D 12 to Vulkan.")
360 (license license:lgpl2.1))))