gnu: glslang: Update to 32d3ec3.
[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)
5b69baf0 27 #:use-module (guix build-system meson)
794d740e 28 #:use-module (gnu packages)
6a11d5f1 29 #:use-module (gnu packages bison)
5b69baf0 30 #:use-module (gnu packages cmake)
9286e0ec
RH
31 #:use-module (gnu packages freedesktop)
32 #:use-module (gnu packages gl)
794d740e 33 #:use-module (gnu packages pkg-config)
9286e0ec
RH
34 #:use-module (gnu packages python)
35 #:use-module (gnu packages xorg))
0df77274
RH
36
37(define-public spirv-headers
a4f99103
RH
38 ;; Keep updated in accordance with
39 ;; https://github.com/google/shaderc/blob/known-good/known_good.json
c7c86de6
RH
40 (let ((commit "3ce3e49d73b8abbf2ffe33f829f941fb2a40f552")
41 (revision "3"))
0df77274
RH
42 (package
43 (name "spirv-headers")
44 (version (string-append "0.0-" revision "." (string-take commit 9)))
45 (source
46 (origin
47 (method git-fetch)
48 (uri (git-reference
49 (url "https://github.com/KhronosGroup/SPIRV-Headers")
50 (commit commit)))
51 (sha256
52 (base32
c7c86de6 53 "0yk4bzqifdqpmdxkhvrxbdqhf5ngkga0ig1yyz7khr7rklqfz7wp"))
0df77274
RH
54 (file-name (string-append name "-" version "-checkout"))))
55 (build-system cmake-build-system)
56 (arguments
57 `(#:tests? #f ;; No tests
58 #:phases (modify-phases %standard-phases
59 (replace 'install
60 (lambda* (#:key outputs #:allow-other-keys)
c7c86de6 61 (invoke "cmake" "-E" "copy_directory"
0df77274
RH
62 "../source/include/spirv"
63 (string-append (assoc-ref outputs "out")
c7c86de6 64 "/include/spirv")))))))
0df77274
RH
65 (home-page "https://github.com/KhronosGroup/SPIRV-Headers")
66 (synopsis "Machine-readable files from the SPIR-V Registry")
67 (description
68 "SPIRV-Headers is a repository containing machine-readable files from
69the SPIR-V Registry. This includes:
70@itemize
71@item Header files for various languages.
72@item JSON files describing the grammar for the SPIR-V core instruction set,
73and for the GLSL.std.450 extended instruction set.
74@item The XML registry file.
75@end itemize\n")
76 (license (license:x11-style
77 (string-append "https://github.com/KhronosGroup/SPIRV-Headers/blob/"
78 commit "/LICENSE"))))))
794d740e
RH
79
80(define-public spirv-tools
a9342820
RH
81 ;; Keep updated in accordance with
82 ;; https://github.com/google/shaderc/blob/known-good/known_good.json
ba10e0b8
RH
83 (let ((commit "fe2fbee294a8ad4434f828a8b4d99eafe9aac88c")
84 (revision "2"))
a9342820
RH
85 (package
86 (name "spirv-tools")
87 (version (string-append "0.0-" revision "." (string-take commit 9)))
88 (source
89 (origin
90 (method git-fetch)
91 (uri (git-reference
92 (url "https://github.com/KhronosGroup/SPIRV-Tools")
93 (commit commit)))
794d740e
RH
94 (sha256
95 (base32
ba10e0b8 96 "03rq4ypwqnz34n8ip85n95a3b9rxb34j26azzm3b3invaqchv19x"))
a9342820
RH
97 (file-name (string-append name "-" version "-checkout"))))
98 (build-system cmake-build-system)
99 (arguments
ba10e0b8
RH
100 `(#:tests? #f ; FIXME: Tests fail.
101 #:configure-flags (list (string-append "-DSPIRV-Headers_SOURCE_DIR="
a9342820
RH
102 (assoc-ref %build-inputs
103 "spirv-headers")))))
104 (inputs `(("spirv-headers" ,spirv-headers)))
c695fb76 105 (native-inputs `(("pkg-config" ,pkg-config)
a9342820
RH
106 ("python" ,python)))
107 (home-page "https://github.com/KhronosGroup/SPIRV-Tools")
108 (synopsis "API and commands for processing SPIR-V modules")
109 (description
110 "The SPIR-V Tools project provides an API and commands for processing
794d740e
RH
111SPIR-V modules. The project includes an assembler, binary module parser,
112disassembler, validator, and optimizer for SPIR-V.")
a9342820 113 (license license:asl2.0))))
6a11d5f1
RH
114
115(define-public glslang
76ef53eb
RH
116 ;; Keep updated in accordance with
117 ;; https://github.com/google/shaderc/blob/known-good/known_good.json
fcfef825
RH
118 (let ((commit "32d3ec319909fcad0b2b308fe1635198773e8316")
119 (revision "3"))
6a11d5f1
RH
120 (package
121 (name "glslang")
122 (version (string-append "3.0-" revision "." (string-take commit 9)))
123 (source
124 (origin
125 (method git-fetch)
126 (uri (git-reference
127 (url "https://github.com/KhronosGroup/glslang")
128 (commit commit)))
129 (sha256
130 (base32
fcfef825 131 "1kmgjv5kbrjy6azpgwnjcn3cj8vg5i8hnyk3m969sc0gq2j1rbjj"))
6a11d5f1
RH
132 (file-name (string-append name "-" version "-checkout"))))
133 (build-system cmake-build-system)
134 (arguments
135 `(#:tests? #f ;; No tests
136 ;; glslang tries to set CMAKE_INSTALL_PREFIX manually. Remove the
137 ;; offending line.
138 #:phases (modify-phases %standard-phases
139 (add-after 'patch-source-shebangs 'fix-cmakelists
140 (lambda _
141 (substitute* "CMakeLists.txt"
142 (("set.*CMAKE_INSTALL_PREFIX.*") ""))
143 #t)))))
144 (native-inputs `(("bison" ,bison)
145 ("pkg-config" ,pkg-config)))
146 (home-page "https://github.com/KhronosGroup/glslang")
147 (synopsis "OpenGL and OpenGL ES shader front end and validator")
148 (description
149 "Glslang is the official reference compiler front end for the
150OpenGL@tie{}ES and OpenGL shading languages. It implements a strict
151interpretation of the specifications for these languages.")
152 ;; Modified BSD license. See "copyright" section of
153 ;; https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
154 (license (list license:bsd-3
155 ;; include/SPIRV/{bitutils,hex_float}.h are Apache 2.0.
156 license:asl2.0)))))
9286e0ec 157
e6fcf903 158(define-public vulkan-loader
9286e0ec 159 (package
e6fcf903 160 (name "vulkan-loader")
076fcab1 161 (version "1.1.73.0")
9286e0ec
RH
162 (source
163 (origin
164 (method url-fetch)
165 (uri (string-append
e6fcf903 166 "https://github.com/KhronosGroup/Vulkan-Loader/"
9286e0ec
RH
167 "archive/sdk-" version ".tar.gz"))
168 (sha256
169 (base32
e6fcf903 170 "0lvdpy6ybx5h7w15m9s2n9q3167q618clra2k7yi2cbm397ci4hn"))))
9286e0ec
RH
171 (build-system cmake-build-system)
172 (arguments
173 `(#:tests? #f ;FIXME: 23/39 tests fail. Try "tests/run_all_tests.sh".
a512246c
RH
174 #:phases
175 (modify-phases %standard-phases
176 (add-after 'unpack 'remove-spirv-tools-commit-id
177 (lambda* (#:key inputs #:allow-other-keys)
178 ;; Remove lines trying to build in a git commit id.
179 (substitute* "CMakeLists.txt" ((".*spirv_tools_commit_id.h.*") ""))
180 #t)))
181 #:configure-flags (list
182 "-DBUILD_LAYERS=OFF" ; FIXME: Fails to build.
076fcab1 183 "-DBUILD_TESTS=OFF" ; FIXME: Needs 'googletest' submodule.
a512246c 184 (string-append "-DCMAKE_INSTALL_LIBDIR="
9286e0ec
RH
185 (assoc-ref %outputs "out") "/lib"))))
186 (inputs `(("glslang" ,glslang)
187 ("libxcb" ,libxcb)
188 ("libx11" ,libx11)
189 ("libxrandr" ,libxrandr)
190 ("mesa" ,mesa)
191 ("spirv-tools" ,spirv-tools)
192 ("wayland" ,wayland)))
c695fb76 193 (native-inputs `(("pkg-config" ,pkg-config)
9286e0ec
RH
194 ("python" ,python)))
195 (home-page
196 "https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers")
197 (synopsis "Khronos official ICD loader and validation layers for Vulkan")
198 (description
199 "Vulkan allows multiple @dfn{Installable Client Drivers} (ICDs) each
200supporting one or more devices to be used collectively. The loader is
201responsible for discovering available Vulkan ICDs on the system and inserting
202Vulkan layer libraries, including validation layers between the application
203and the ICD.")
204 ;; This software is mainly Apache 2.0 licensed, but contains some components
205 ;; covered by other licenses. See COPYRIGHT.txt for details.
206 (license (list license:asl2.0 ;LICENSE.txt
207 (license:x11-style "file://COPYRIGHT.txt")
208 license:bsd-3))))
5b69baf0 209
8ec91940
RH
210(define-public vulkan-icd-loader
211 (deprecated-package "vulkan-icd-loader" vulkan-loader))
212
5b69baf0
RH
213(define-public shaderc
214 (let ((commit "773ec22d49f40b7161820f29d953be4a7e40190d")
215 (revision "1"))
216 (package
49c4c4de 217 (name "shaderc")
5983b783 218 (version (git-version "0.0.0" revision commit))
49c4c4de
TGR
219 (source
220 (origin
221 (method git-fetch)
222 (uri (git-reference
223 (url "https://github.com/google/shaderc")
224 (commit commit)))
225 (file-name (string-append name "-" version ".tar.gz"))
226 (sha256
227 (base32
228 "0b41inb1czxv3mciip0lfdxv19ccx2ys31fivfywjn2q8va1gd1f"))))
229 (build-system meson-build-system)
230 (arguments
308b17f6 231 `(#:tests? #f ; tests don't work yet.
49c4c4de
TGR
232 #:phases
233 (modify-phases %standard-phases
234 (replace 'configure
308b17f6 235 (lambda* (#:key outputs #:allow-other-keys)
49c4c4de
TGR
236 (let ((out (assoc-ref outputs "out")))
237 ;; Remove various lines and touch build-version.inc or
238 ;; configuring won't work.
239 (invoke "touch" "glslc/src/build-version.inc")
240 (substitute* "CMakeLists.txt" (("..PYTHON_EXE..*") ""))
241 (substitute* "CMakeLists.txt"
242 ((".*update_build_version.py..*") ""))
243 (substitute* "CMakeLists.txt"
244 ((".*add_custom_target.build-version.*") ""))
245 (substitute* "CMakeLists.txt"
246 ((".*spirv-tools_SOURCE_DIR.*glslang_SOURCE_DIR.*")
247 ""))
248 (substitute* "CMakeLists.txt"
249 ((".*Update build-version.inc.*") ""))
250 (substitute* "CMakeLists.txt" ((".*--check.*") ""))
251 (substitute* "glslc/src/main.cc" ((".*build-version.inc.*")
252 "\"1\""))
308b17f6
RH
253 (invoke "cmake" "-GNinja" "-DCMAKE_BUILD_TYPE=Release"
254 "-DSHADERC_SKIP_TESTS=ON"
255 "-DCMAKE_INSTALL_LIBDIR=lib"
256 (string-append "-DCMAKE_INSTALL_PREFIX="
257 out)))))
49c4c4de
TGR
258 (add-after 'unpack 'unpack-sources
259 (lambda* (#:key inputs #:allow-other-keys)
5983b783
EF
260 (let ((spirv-tools-source (assoc-ref inputs "spirv-tools-source"))
261 (spirv-headers-source (assoc-ref inputs "spirv-headers-source"))
262 (glslang-source (assoc-ref inputs "glslang-source")))
263 (copy-recursively spirv-tools-source "third_party/spirv-tools")
49c4c4de
TGR
264 (copy-recursively spirv-headers-source
265 (string-append "third_party/spirv-tools"
266 "/external/spirv-headers"))
5983b783 267 (copy-recursively glslang-source "third_party/glslang")
49c4c4de
TGR
268 #t))))))
269 (inputs
270 `(("python" ,python)))
271 (native-inputs
272 `(("cmake" ,cmake)
273 ("glslang-source" ,(package-source glslang))
274 ("pkg-config" ,pkg-config)
275 ("spirv-headers-source" ,(package-source spirv-headers))
276 ("spirv-tools-source" ,(package-source spirv-tools))))
277 (home-page "https://github.com/google/shaderc")
278 (synopsis "Tools for shader compilation")
279 (description "Shaderc is a collection of tools, libraries, and tests for
5b69baf0 280shader compilation.")
49c4c4de 281 (license license:asl2.0))))