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