Commit | Line | Data |
---|---|---|
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) |
7f540654 | 30 | #:use-module (gnu packages check) |
5b69baf0 | 31 | #:use-module (gnu packages cmake) |
9286e0ec RH |
32 | #:use-module (gnu packages freedesktop) |
33 | #:use-module (gnu packages gl) | |
794d740e | 34 | #:use-module (gnu packages pkg-config) |
9286e0ec RH |
35 | #:use-module (gnu packages python) |
36 | #:use-module (gnu packages xorg)) | |
0df77274 RH |
37 | |
38 | (define-public spirv-headers | |
a4f99103 RH |
39 | ;; Keep updated in accordance with |
40 | ;; https://github.com/google/shaderc/blob/known-good/known_good.json | |
c7c86de6 RH |
41 | (let ((commit "3ce3e49d73b8abbf2ffe33f829f941fb2a40f552") |
42 | (revision "3")) | |
0df77274 RH |
43 | (package |
44 | (name "spirv-headers") | |
45 | (version (string-append "0.0-" revision "." (string-take commit 9))) | |
46 | (source | |
47 | (origin | |
48 | (method git-fetch) | |
49 | (uri (git-reference | |
50 | (url "https://github.com/KhronosGroup/SPIRV-Headers") | |
51 | (commit commit))) | |
52 | (sha256 | |
53 | (base32 | |
c7c86de6 | 54 | "0yk4bzqifdqpmdxkhvrxbdqhf5ngkga0ig1yyz7khr7rklqfz7wp")) |
0df77274 RH |
55 | (file-name (string-append name "-" version "-checkout")))) |
56 | (build-system cmake-build-system) | |
57 | (arguments | |
58 | `(#:tests? #f ;; No tests | |
59 | #:phases (modify-phases %standard-phases | |
60 | (replace 'install | |
61 | (lambda* (#:key outputs #:allow-other-keys) | |
c7c86de6 | 62 | (invoke "cmake" "-E" "copy_directory" |
0df77274 RH |
63 | "../source/include/spirv" |
64 | (string-append (assoc-ref outputs "out") | |
c7c86de6 | 65 | "/include/spirv"))))))) |
0df77274 RH |
66 | (home-page "https://github.com/KhronosGroup/SPIRV-Headers") |
67 | (synopsis "Machine-readable files from the SPIR-V Registry") | |
68 | (description | |
69 | "SPIRV-Headers is a repository containing machine-readable files from | |
70 | the SPIR-V Registry. This includes: | |
71 | @itemize | |
72 | @item Header files for various languages. | |
73 | @item JSON files describing the grammar for the SPIR-V core instruction set, | |
74 | and for the GLSL.std.450 extended instruction set. | |
75 | @item The XML registry file. | |
76 | @end itemize\n") | |
77 | (license (license:x11-style | |
78 | (string-append "https://github.com/KhronosGroup/SPIRV-Headers/blob/" | |
79 | commit "/LICENSE")))))) | |
794d740e RH |
80 | |
81 | (define-public spirv-tools | |
a9342820 RH |
82 | ;; Keep updated in accordance with |
83 | ;; https://github.com/google/shaderc/blob/known-good/known_good.json | |
ba10e0b8 RH |
84 | (let ((commit "fe2fbee294a8ad4434f828a8b4d99eafe9aac88c") |
85 | (revision "2")) | |
a9342820 RH |
86 | (package |
87 | (name "spirv-tools") | |
88 | (version (string-append "0.0-" revision "." (string-take commit 9))) | |
89 | (source | |
90 | (origin | |
91 | (method git-fetch) | |
92 | (uri (git-reference | |
93 | (url "https://github.com/KhronosGroup/SPIRV-Tools") | |
94 | (commit commit))) | |
794d740e RH |
95 | (sha256 |
96 | (base32 | |
ba10e0b8 | 97 | "03rq4ypwqnz34n8ip85n95a3b9rxb34j26azzm3b3invaqchv19x")) |
a9342820 RH |
98 | (file-name (string-append name "-" version "-checkout")))) |
99 | (build-system cmake-build-system) | |
100 | (arguments | |
ba10e0b8 RH |
101 | `(#:tests? #f ; FIXME: Tests fail. |
102 | #:configure-flags (list (string-append "-DSPIRV-Headers_SOURCE_DIR=" | |
a9342820 RH |
103 | (assoc-ref %build-inputs |
104 | "spirv-headers"))))) | |
105 | (inputs `(("spirv-headers" ,spirv-headers))) | |
c695fb76 | 106 | (native-inputs `(("pkg-config" ,pkg-config) |
a9342820 RH |
107 | ("python" ,python))) |
108 | (home-page "https://github.com/KhronosGroup/SPIRV-Tools") | |
109 | (synopsis "API and commands for processing SPIR-V modules") | |
110 | (description | |
111 | "The SPIR-V Tools project provides an API and commands for processing | |
794d740e RH |
112 | SPIR-V modules. The project includes an assembler, binary module parser, |
113 | disassembler, validator, and optimizer for SPIR-V.") | |
a9342820 | 114 | (license license:asl2.0)))) |
6a11d5f1 RH |
115 | |
116 | (define-public glslang | |
76ef53eb RH |
117 | ;; Keep updated in accordance with |
118 | ;; https://github.com/google/shaderc/blob/known-good/known_good.json | |
fcfef825 RH |
119 | (let ((commit "32d3ec319909fcad0b2b308fe1635198773e8316") |
120 | (revision "3")) | |
6a11d5f1 RH |
121 | (package |
122 | (name "glslang") | |
123 | (version (string-append "3.0-" revision "." (string-take commit 9))) | |
124 | (source | |
125 | (origin | |
126 | (method git-fetch) | |
127 | (uri (git-reference | |
128 | (url "https://github.com/KhronosGroup/glslang") | |
129 | (commit commit))) | |
130 | (sha256 | |
131 | (base32 | |
fcfef825 | 132 | "1kmgjv5kbrjy6azpgwnjcn3cj8vg5i8hnyk3m969sc0gq2j1rbjj")) |
6a11d5f1 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 | |
151 | OpenGL@tie{}ES and OpenGL shading languages. It implements a strict | |
152 | interpretation of the specifications for these languages.") | |
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 | |
e6fcf903 | 159 | (define-public vulkan-loader |
9286e0ec | 160 | (package |
e6fcf903 | 161 | (name "vulkan-loader") |
076fcab1 | 162 | (version "1.1.73.0") |
9286e0ec RH |
163 | (source |
164 | (origin | |
165 | (method url-fetch) | |
166 | (uri (string-append | |
e6fcf903 | 167 | "https://github.com/KhronosGroup/Vulkan-Loader/" |
9286e0ec RH |
168 | "archive/sdk-" version ".tar.gz")) |
169 | (sha256 | |
170 | (base32 | |
e6fcf903 | 171 | "0lvdpy6ybx5h7w15m9s2n9q3167q618clra2k7yi2cbm397ci4hn")))) |
9286e0ec RH |
172 | (build-system cmake-build-system) |
173 | (arguments | |
174 | `(#:tests? #f ;FIXME: 23/39 tests fail. Try "tests/run_all_tests.sh". | |
a512246c RH |
175 | #:phases |
176 | (modify-phases %standard-phases | |
177 | (add-after 'unpack 'remove-spirv-tools-commit-id | |
178 | (lambda* (#:key inputs #:allow-other-keys) | |
179 | ;; Remove lines trying to build in a git commit id. | |
180 | (substitute* "CMakeLists.txt" ((".*spirv_tools_commit_id.h.*") "")) | |
181 | #t))) | |
182 | #:configure-flags (list | |
183 | "-DBUILD_LAYERS=OFF" ; FIXME: Fails to build. | |
076fcab1 | 184 | "-DBUILD_TESTS=OFF" ; FIXME: Needs 'googletest' submodule. |
a512246c | 185 | (string-append "-DCMAKE_INSTALL_LIBDIR=" |
9286e0ec RH |
186 | (assoc-ref %outputs "out") "/lib")))) |
187 | (inputs `(("glslang" ,glslang) | |
188 | ("libxcb" ,libxcb) | |
189 | ("libx11" ,libx11) | |
190 | ("libxrandr" ,libxrandr) | |
191 | ("mesa" ,mesa) | |
192 | ("spirv-tools" ,spirv-tools) | |
193 | ("wayland" ,wayland))) | |
c695fb76 | 194 | (native-inputs `(("pkg-config" ,pkg-config) |
9286e0ec RH |
195 | ("python" ,python))) |
196 | (home-page | |
197 | "https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers") | |
198 | (synopsis "Khronos official ICD loader and validation layers for Vulkan") | |
199 | (description | |
200 | "Vulkan allows multiple @dfn{Installable Client Drivers} (ICDs) each | |
201 | supporting one or more devices to be used collectively. The loader is | |
202 | responsible for discovering available Vulkan ICDs on the system and inserting | |
203 | Vulkan layer libraries, including validation layers between the application | |
204 | and the ICD.") | |
205 | ;; This software is mainly Apache 2.0 licensed, but contains some components | |
206 | ;; covered by other licenses. See COPYRIGHT.txt for details. | |
207 | (license (list license:asl2.0 ;LICENSE.txt | |
208 | (license:x11-style "file://COPYRIGHT.txt") | |
209 | license:bsd-3)))) | |
5b69baf0 | 210 | |
8ec91940 RH |
211 | (define-public vulkan-icd-loader |
212 | (deprecated-package "vulkan-icd-loader" vulkan-loader)) | |
213 | ||
5b69baf0 | 214 | (define-public shaderc |
7f540654 RH |
215 | (let ((commit "be8e0879750303a1de09385465d6b20ecb8b380d") |
216 | (revision "2")) | |
5b69baf0 | 217 | (package |
49c4c4de | 218 | (name "shaderc") |
5983b783 | 219 | (version (git-version "0.0.0" revision commit)) |
49c4c4de TGR |
220 | (source |
221 | (origin | |
222 | (method git-fetch) | |
223 | (uri (git-reference | |
224 | (url "https://github.com/google/shaderc") | |
225 | (commit commit))) | |
226 | (file-name (string-append name "-" version ".tar.gz")) | |
227 | (sha256 | |
228 | (base32 | |
7f540654 | 229 | "16p25ry2i4zrj00zihfpf210f8xd7g398ffbw25igvi9mbn4nbfd")))) |
49c4c4de TGR |
230 | (build-system meson-build-system) |
231 | (arguments | |
7f540654 | 232 | `(#:phases |
49c4c4de TGR |
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 | |
7f540654 RH |
270 | `(("googletest" ,googletest) |
271 | ("python" ,python))) | |
49c4c4de TGR |
272 | (native-inputs |
273 | `(("cmake" ,cmake) | |
274 | ("glslang-source" ,(package-source glslang)) | |
275 | ("pkg-config" ,pkg-config) | |
276 | ("spirv-headers-source" ,(package-source spirv-headers)) | |
277 | ("spirv-tools-source" ,(package-source spirv-tools)))) | |
278 | (home-page "https://github.com/google/shaderc") | |
279 | (synopsis "Tools for shader compilation") | |
280 | (description "Shaderc is a collection of tools, libraries, and tests for | |
5b69baf0 | 281 | shader compilation.") |
49c4c4de | 282 | (license license:asl2.0)))) |