projects/guix·blob python-team · refs

1422 lines · 60.3 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013, 2015, 2024 Andreas Enge <[email protected]>
3;;; Copyright © 2013 Joshua Grant <[email protected]>
4;;; Copyright © 2014, 2016 David Thompson <[email protected]>
5;;; Copyright © 2014, 2015, 2016, 2017 Mark H Weaver <[email protected]>
6;;; Copyright © 2016 Nikita <[email protected]>
7;;; Copyright © 2016, 2017, 2018, 2020, 2021 Ricardo Wurmus <[email protected]>
8;;; Copyright © 2017-2019, 2021, 2023-2026 Efraim Flashner <[email protected]>
9;;; Copyright © 2017 Arun Isaac <[email protected]>
10;;; Copyright © 2017, 2018, 2019 Rutger Helling <[email protected]>
11;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <[email protected]>
12;;; Copyright © 2019 Pierre Neidhardt <[email protected]>
13;;; Copyright © 2020 Marius Bakke <[email protected]>
14;;; Copyright © 2020 Giacomo Leidi <[email protected]>
15;;; Copyright © 2020, 2021, 2022, 2023, 2025 Maxim Cournoyer <[email protected]>
16;;; Copyright © 2020 Kei Kebreau <[email protected]>
17;;; Copyright © 2021 Ivan Gankevich <[email protected]>
18;;; Copyright © 2021-2025 John Kehayias <[email protected]>
19;;; Copyright © 2022 Petr Hodina <[email protected]>
20;;; Copyright © 2023 Kaelyn Takata <[email protected]>
21;;; Copyright © 2023, 2024 Zheng Junjie <[email protected]>
22;;; Copyright © 2024 Liliana Marie Prikler <[email protected]>
23;;; Copyright © 2024 Artyom V. Poptsov <[email protected]>
24;;; Copyright © 2024 Arnaud Lechevallier <[email protected]>
25;;; Copyright © 2024-2025 Alvin Hsu <[email protected]>
26;;; Copyright © 2025 Sughosha <[email protected]>
27;;;
28;;; This file is part of GNU Guix.
29;;;
30;;; GNU Guix is free software; you can redistribute it and/or modify it
31;;; under the terms of the GNU General Public License as published by
32;;; the Free Software Foundation; either version 3 of the License, or (at
33;;; your option) any later version.
34;;;
35;;; GNU Guix is distributed in the hope that it will be useful, but
36;;; WITHOUT ANY WARRANTY; without even the implied warranty of
37;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
38;;; GNU General Public License for more details.
39;;;
40;;; You should have received a copy of the GNU General Public License
41;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
42
43(define-module (gnu packages gl)
44 #:use-module (gnu packages)
45 #:use-module (gnu packages autotools)
46 #:use-module (gnu packages backup)
47 #:use-module (gnu packages bison)
48 #:use-module (gnu packages build-tools)
49 #:use-module (gnu packages check)
50 #:use-module (gnu packages compression)
51 #:use-module (gnu packages documentation)
52 #:use-module (gnu packages elf)
53 #:use-module (gnu packages compiler-tools)
54 #:use-module (gnu packages fontutils)
55 #:use-module (gnu packages freedesktop)
56 #:use-module (gnu packages gettext)
57 #:use-module (gnu packages guile)
58 #:use-module (gnu packages image)
59 #:use-module (gnu packages linux)
60 #:use-module (gnu packages llvm)
61 #:use-module (gnu packages lua)
62 #:use-module (gnu packages pkg-config)
63 #:use-module (gnu packages python)
64 #:use-module (gnu packages python-build)
65 #:use-module (gnu packages python-xyz)
66 #:use-module (gnu packages rust)
67 #:use-module (gnu packages rust-apps)
68 #:use-module (gnu packages tls)
69 #:use-module (gnu packages video)
70 #:use-module (gnu packages vulkan)
71 #:use-module (gnu packages xdisorg)
72 #:use-module (gnu packages xml)
73 #:use-module (gnu packages xorg)
74 #:use-module (guix download)
75 #:use-module (guix git-download)
76 #:use-module (guix hg-download)
77 #:use-module (gnu packages cmake)
78 #:use-module (guix build-system gnu)
79 #:use-module (guix build-system cargo)
80 #:use-module (guix build-system cmake)
81 #:use-module (guix build-system meson)
82 #:use-module (guix build-system pyproject)
83 #:use-module ((guix licenses) #:prefix license:)
84 #:use-module (guix packages)
85 #:use-module (guix gexp)
86 #:use-module (guix utils)
87 #:use-module (ice-9 match)
88 #:use-module ((srfi srfi-1) #:hide (zip))
89 #:use-module (srfi srfi-26))
90
91(define-public glu
92 (package
93 (name "glu")
94 (version "9.0.2")
95 (source (origin
96 (method git-fetch)
97 (uri (git-reference
98 (url "https://gitlab.freedesktop.org/mesa/glu")
99 (commit (string-append "glu-" version))))
100 (file-name (git-file-name name version))
101 (sha256
102 (base32
103 "1khxfidyglpx4yd8f3xvrj05ah823cz1ygcszhcaa4w7h9kd1lbr"))))
104 (build-system gnu-build-system)
105 (native-inputs
106 (list pkg-config
107 autoconf
108 automake
109 libtool))
110 (propagated-inputs
111 (list mesa)) ; according to glu.pc
112 (home-page "http://www.opengl.org/archives/resources/faq/technical/glu.htm")
113 (synopsis "Mesa OpenGL Utility library")
114 (description
115 "GLU, or OpenGL Utility Library provides some higher-level functionality
116not provided by just OpenGL itself. Some of GLU's Features
117include: Scaling of 2D images and creation of mipmap pyramids,
118Transformation of object coordinates into device coordinates and
119vice versa, Support for NURBS surfaces, Support for tessellation
120of concave or bow tie polygonal primitives, Specialty transformation
121matrices for creating perspective and orthographic projections,
122positioning a camera, and selection/picking, Rendering of disk,
123cylinder, and sphere primitives, Interpreting OpenGL error values
124as ASCII text.")
125 (license (license:x11-style "http://directory.fsf.org/wiki/License:SGIFreeBv2"))))
126
127(define-public freeglut
128 (package
129 (name "freeglut")
130 (version "3.4.0")
131 (source (origin
132 (method url-fetch)
133 (uri (string-append
134 "https://github.com/FreeGLUTProject/freeglut/releases"
135 "/download/v" version "/freeglut-" version ".tar.gz"))
136 (sha256
137 (base32
138 "1v7ayg3a03mv8b6lsr1qm21lbr8xg8dh3gdfxnbhl64vbn8wn2rw"))))
139 (build-system cmake-build-system)
140 (arguments
141 '(#:tests? #f ;no test target
142 #:configure-flags '("-DFREEGLUT_BUILD_STATIC_LIBS=OFF")))
143 (inputs (list libx11 libxi libxrandr libxxf86vm))
144 (propagated-inputs
145 ;; Headers from Mesa and GLU are needed.
146 (list glu mesa))
147 (home-page "https://freeglut.sourceforge.net/")
148 (synopsis "Alternative to the OpenGL Utility Toolkit (GLUT)")
149 (description
150 "Freeglut is a completely Free/OpenSourced alternative to
151the OpenGL Utility Toolkit (GLUT) library. GLUT was originally
152written by Mark Kilgard to support the sample programs in the
153second edition OpenGL @code{RedBook}. Since then, GLUT has been used
154in a wide variety of practical applications because it is simple,
155widely available and highly portable.
156
157GLUT (and hence freeglut) allows the user to create and manage windows
158containing OpenGL contexts on a wide range of platforms and also read
159the mouse, keyboard and joystick functions. Freeglut is released under
160the X-Consortium license.")
161 (license license:x11)))
162
163(define-public ftgl
164 (package
165 (name "ftgl")
166 (version "2.4.0")
167 (home-page "https://github.com/frankheckenbach/ftgl")
168 (source (origin
169 (method git-fetch)
170 (uri (git-reference (url home-page)
171 (commit (string-append "v" version))))
172 (file-name (git-file-name name version))
173 (sha256
174 (base32
175 "0zjs1h9w30gajq9lndzvjsa26rsmr1081lb1fbpbj10yhcdcsc79"))
176 (patches (search-patches "ftgl-ftcontour-type.patch"))))
177 (build-system gnu-build-system)
178 (arguments
179 `(#:configure-flags
180 '("--disable-static"
181 ;; XXX: FTVectoriser.cpp: conversion from ‘unsigned char*’ to ‘char*’
182 "CXXFLAGS=-fpermissive")))
183 ;; The pkg-config file lists "freetype2" as Requires.private.
184 (propagated-inputs (list freetype))
185 (inputs (list libx11 mesa glu))
186 (native-inputs
187 (list pkg-config autoconf automake libtool))
188 (synopsis "Font rendering library for OpenGL applications")
189 (description
190 "FTGL is a font rendering library for OpenGL applications. Supported
191rendering modes are: Bitmaps, Anti-aliased pixmaps, Texture maps, Outlines,
192Polygon meshes, and Extruded polygon meshes.")
193 (license license:x11)))
194
195(define-public glad
196 (package
197 (name "glad")
198 (version "2.0.8")
199 (source (origin
200 (method git-fetch)
201 (uri (git-reference
202 (url "https://github.com/Dav1dde/glad")
203 (commit (string-append "v" version))))
204 (file-name (git-file-name name version))
205 (sha256
206 (base32
207 "0c9cygiq35aiq6bpdvbwqs0wxc2dvxsh4jnx50466savscxalsk9"))))
208 (build-system pyproject-build-system)
209 (arguments
210 (list
211 #:phases
212 #~(modify-phases %standard-phases
213 (add-after 'install 'install-cmakelists.txt
214 (lambda _
215 (let ((share (string-append #$output "/share/"
216 #$(package-name this-package))))
217 (install-file "cmake/CMakeLists.txt" share)
218 (install-file "cmake/GladConfig.cmake" share))))
219 (replace 'check
220 (lambda* (#:key tests? #:allow-other-keys)
221 (when tests?
222 (invoke "xvfb-run" "utility/test.sh")))))))
223 (native-inputs (list python-setuptools xvfb-run-for-tests))
224 (propagated-inputs (list python-jinja2))
225 (home-page "https://github.com/Dav1dde/glad")
226 (synopsis "Multi-language GL/GLES/EGL/GLX/WGL loader generator")
227 (description "Glad uses the official Khronos XML specifications to
228generate a GL/GLES/EGL/GLX/WGL loader tailored for specific requirements.")
229 (license license:expat)))
230
231(define-public s2tc
232 (package
233 (name "s2tc")
234 (version "1.0")
235 (source
236 (origin
237 (method git-fetch)
238 (uri (git-reference
239 (url "https://github.com/divVerent/s2tc")
240 (commit (string-append "v" version))))
241 (file-name (git-file-name name version))
242 (sha256
243 (base32 "1fg323fk7wlv2xh6lw66wswgcv6qi8aaadk7c28h2f2lj1s7njnf"))))
244 (build-system gnu-build-system)
245 (native-inputs
246 (list autoconf automake libtool))
247 (inputs
248 (list mesa-headers))
249 (home-page "https://github.com/divVerent/s2tc")
250 (synopsis "S3 Texture Compression implementation")
251 (description
252 "S2TC is a patent-free implementation of S3 Texture Compression (S3TC,
253also known as DXTn or DXTC) for Mesa.")
254 (license license:expat)))
255
256;;; Mesa needs LibVA headers to build its Gallium-based VA API implementation;
257;;; LibVA itself depends on Mesa. We use the following to solve the circular
258;;; dependency.
259(define libva-without-mesa
260 ;; Delay to work around circular import problem.
261 (delay
262 (package
263 (inherit libva)
264 (name "libva-without-mesa")
265 (inputs (fold alist-delete (package-inputs libva)
266 '("mesa" "wayland")))
267 (arguments
268 (strip-keyword-arguments
269 '(#:make-flags)
270 (substitute-keyword-arguments arguments
271 ((#:configure-flags flags)
272 '(list "--disable-glx"))))))))
273
274(define-public mesa
275 (package
276 (name "mesa")
277 (version "26.0.2")
278 (source
279 (origin
280 (method url-fetch)
281 (uri (list (string-append "https://archive.mesa3d.org/"
282 "mesa-" version ".tar.xz")
283 (string-append "ftp://ftp.freedesktop.org/pub/mesa/"
284 "mesa-" version ".tar.xz")))
285 (sha256
286 (base32 "0ikk7hb60q581i2wb1pasphv7sgqkv74qaw4cdiiq8dy45956gwp"))))
287 (build-system meson-build-system)
288 (propagated-inputs
289 ;; The following are in the Requires.private field of gl.pc.
290 (list libdrm
291 libvdpau
292 libx11
293 libxdamage
294 libxfixes
295 libxshmfence
296 libxxf86vm
297 xorgproto))
298 (inputs
299 (append
300 (list elfutils ;libelf required for r600 when using llvm
301 expat
302 (force libva-without-mesa)
303 libxml2
304 libxrandr
305 libxvmc
306 llvm-for-mesa
307 vulkan-loader
308 wayland
309 wayland-protocols
310 `(,zstd "lib"))
311 ;; The freedreno driver wants libarchive and lua.
312 (if (target-arm?)
313 (list libarchive
314 lua-5.4)
315 '())
316 ;; Rust isn't needed for all architectures.
317 (if (and (target-x86-64?) (target-linux?))
318 ;; NVK dependencies
319 (cargo-inputs 'mesa)
320 '())))
321 (native-inputs
322 (append
323 (list bison
324 clang-18 ;ensure rust-bindgen-cli uses the same
325 flex
326 gettext-minimal
327 glslang
328 libclc
329 pkg-config
330 python-mako
331 python-packaging
332 python-ply
333 python-pyyaml
334 python-wrapper
335 (@ (gnu packages base) which))
336 (if (target-arm?)
337 ;; Needed for etnaviv.
338 (list python-pycparser)
339 '())
340 (if (%current-target-system)
341 (list cmake-minimal-cross
342 pkg-config-for-build
343 wayland
344 wayland-protocols)
345 '())
346 ;; Rust isn't needed for all architectures.
347 (if (and (target-x86-64?) (target-linux?))
348 ;; NVK dependencies
349 (list rust
350 rust-bindgen-cli
351 rust-cbindgen)
352 '())))
353 (outputs '("out" "bin"))
354 (arguments
355 (list
356 #:configure-flags
357 #~(list
358 #$@(cond
359 ((target-aarch64?)
360 ;; This includes more drivers than "auto": r300, r600
361 '("-Dgallium-drivers=asahi,etnaviv,freedreno,iris,lima,nouveau,\
362panfrost,r300,r600,svga,softpipe,lima,llvmpipe,tegra,v3d,vc4,virgl,zink"))
363 ((target-arm32?)
364 ;; This includes more drivers than "auto": r300, r600
365 '("-Dgallium-drivers=etnaviv,freedreno,iris,lima,nouveau,\
366panfrost,r300,r600,svga,softpipe,lima,llvmpipe,tegra,v3d,vc4,virgl,zink"))
367 ((or (target-ppc64le?) (target-ppc32?) (target-riscv64?))
368 ;; This includes more drivers than "auto": svga
369 '("-Dgallium-drivers=nouveau,r300,r600,radeonsi,svga,softpipe,llvmpipe,virgl,zink"))
370 (else
371 '("-Dgallium-drivers=auto")))
372 ;; Enable various optional features. TODO: opencl requires libclc,
373 ;; omx requires libomxil-bellagio
374 "-Dplatforms=x11,wayland"
375 "-Dglx=dri" ;Thread Local Storage, improves performance
376 ;; "-Dopencl=true"
377 ;; "-Domx=true"
378
379 ;; features required by wayland
380 "-Dgles2=enabled"
381 "-Dgbm=enabled"
382 "--wrap-mode=nodownload" ; XXX: disable
383
384 #$@(cond
385 ;; Increase the number of vulkan drivers on each architecture:
386 ((target-x86-32?)
387 ;; TODO: Reenable nouveau/NVK when rust support lands.
388 '("-Dvulkan-drivers=amd,intel,intel_hasvk,swrast,virtio"))
389 ((target-x86-64?)
390 '("-Dvulkan-drivers=amd,intel,intel_hasvk,nouveau,swrast,virtio"))
391 ((target-arm32?)
392 '("-Dvulkan-drivers=swrast,intel,panfrost,freedreno,virtio"))
393 ((target-aarch64?)
394 ;; This includes more drivers than "auto": amd, broadcom
395 '("-Dvulkan-drivers=swrast,intel,panfrost,freedreno,asahi,amd,broadcom,virtio"))
396 ;; The default fallback seems to be amd and swrast.
397 ((target-linux?)
398 '("-Dvulkan-drivers=amd,swrast,virtio"))
399 (else
400 '("-Dvulkan-drivers=auto")))
401
402 ;; Enable the Vulkan overlay layer on all architectures.
403 "-Dvulkan-layers=device-select,overlay"
404
405 ;; Enable all the codecs that were built by default as part of the
406 ;; 21.3.x releases to avoid functionality regressions.
407 "-Dvideo-codecs=all"
408
409 ;; Enable ZSTD compression for shader cache.
410 "-Dzstd=enabled"
411
412 ;; Also enable the tests.
413 "-Dbuild-tests=true"
414
415 "-Dllvm=enabled") ; default is x86/x86_64 only
416
417 ;; XXX: 'debugoptimized' causes LTO link failures on some drivers. The
418 ;; documentation recommends using 'release' for performance anyway.
419 #:build-type "release"
420
421 #:modules '((ice-9 match)
422 (ice-9 ftw)
423 (srfi srfi-1)
424 (guix build utils)
425 ((guix build cargo-build-system) #:prefix cargo:)
426 (guix build meson-build-system))
427 #:imported-modules (append %cargo-build-system-modules
428 %meson-build-system-modules)
429 #:phases
430 #~(modify-phases %standard-phases
431 #$@(if (%current-target-system)
432 #~((add-after 'unpack 'fix-cross-compiling
433 (lambda* (#:key native-inputs #:allow-other-keys)
434 ;; When cross compiling, we use cmake to find llvm, not
435 ;; llvm-config, because llvm-config cannot be executed
436 ;; see https://github.com/llvm/llvm-project/issues/58984
437 (substitute* "meson.build"
438 (("method : host_machine\\.system.*")
439 "method : 'cmake',\n"))
440 (setenv "CMAKE"
441 (search-input-file
442 native-inputs "/bin/cmake")))))
443 #~())
444 #$@(if (this-package-native-input "rust")
445 #~((add-after 'unpack 'prepare-rust-crates
446 (lambda args
447 (apply (assoc-ref cargo:%standard-phases
448 'prepare-rust-crates)
449 args)
450 ;; Use /tmp/rust-crates as the source.
451 (substitute* (find-files "subprojects" "-rs\\.wrap$")
452 (("source_url = (.*)" _ url)
453 (let ((split-url (string-split url #\/)))
454 (string-append
455 "source_url = file:///tmp/rust-crates/rust-"
456 (string-join
457 (string-split (list-ref split-url 6) #\_) "-")
458 "-" (list-ref split-url 7) ".tar.gz\n"))))
459 ;; "Download" the packages.
460 (for-each
461 (lambda (wrapper)
462 (invoke "meson" "subprojects" "download"
463 (string-drop-right wrapper 5)))
464 (scandir "subprojects"
465 (lambda (file)
466 (string-suffix? "-rs.wrap" file)))))))
467 #~())
468 (add-after 'unpack 'disable-failing-test
469 (lambda _
470 ;; Disable the intel vulkan (anv_state_pool) tests, as they may
471 ;; fail in a nondeterministic fashion (see:
472 ;; https://gitlab.freedesktop.org/mesa/mesa/-/issues/5446).
473 (substitute* "src/intel/vulkan/meson.build"
474 (("if with_tests")
475 "if false"))
476 #$@(match (%current-system)
477 ("riscv64-linux"
478 ;; Disable some of the llvmpipe tests.
479 `((substitute* "src/gallium/drivers/llvmpipe/meson.build"
480 (("if with_tests") "if false"))))
481 ("powerpc64le-linux"
482 ;; Disable some of the llvmpipe tests.
483 `((substitute* "src/gallium/drivers/llvmpipe/lp_test_arit.c"
484 (("0\\.5, ") ""))))
485 ("powerpc-linux"
486 ;; There are some tests which fail specifically on powerpc.
487 `((substitute* '(;; LLVM ERROR: Relocation type not implemented yet!
488 "src/gallium/drivers/llvmpipe/meson.build"
489 "src/gallium/targets/osmesa/meson.build")
490 (("if with_tests") "if not with_tests"))
491 ;; This is probably a big-endian test failure.
492 (substitute* "src/amd/common/meson.build"
493 (("and not with_platform_windows")
494 "and with_platform_windows"))))
495 ("i686-linux"
496 ;; This test is known to fail on i686 (see:
497 ;; https://gitlab.freedesktop.org/mesa/mesa/-/issues/4091).
498 `((substitute* "src/util/meson.build"
499 ((".*'tests/u_debug_stack_test.cpp',.*") ""))))
500 ("aarch64-linux"
501 ;; Disable some of the llvmpipe tests.
502 `((substitute* "src/gallium/drivers/llvmpipe/meson.build"
503 (("'lp_test_format', ") ""))))
504 ("armhf-linux"
505 ;; Disable some of the llvmpipe tests.
506 `((substitute* "src/gallium/drivers/llvmpipe/meson.build"
507 (("'lp_test_arit', ") ""))))
508 (_
509 '((display "No tests to disable on this architecture.\n"))))))
510 (add-after 'unpack 'set-home-directory
511 ;; Build tries to use a shader cache (non-fatal error).
512 (lambda _ (setenv "HOME" "/tmp")))
513 (add-before 'configure 'fix-dlopen-libnames
514 (lambda* (#:key inputs #:allow-other-keys)
515 (let ((out #$output))
516 ;; Remain agnostic to .so.X.Y.Z versions while doing
517 ;; the substitutions so we're future-safe.
518 (substitute* "src/glx/meson.build"
519 (("-DGL_LIB_NAME=\"lib@0@\\.so\\.@1@\"")
520 (string-append "-DGL_LIB_NAME=\"" out
521 "/lib/lib@[email protected].@1@\"")))
522 (substitute* "src/gbm/backends/dri/gbm_dri.c"
523 (("\"libglapi\\.so")
524 (string-append "\"" out "/lib/libglapi.so")))
525 (substitute* "src/gbm/main/backend.c"
526 ;; No need to patch the gbm_gallium_drm.so reference;
527 ;; it's never installed since Mesa removed its
528 ;; egl_gallium support.
529 (("\"gbm_dri\\.so")
530 (string-append "\"" out "/lib/dri/gbm_dri.so")))
531 (substitute* "src/gallium/drivers/zink/zink_screen.c"
532 (("util_dl_open\\(VK_LIBNAME\\)")
533 (format #f "util_dl_open(\"~a\")"
534 (search-input-file inputs
535 "lib/libvulkan.so.1")))))))
536 (add-after 'install 'split-outputs
537 (lambda _
538 (let ((out #$output)
539 (bin #$output:bin))
540 ;; Not all architectures have the Vulkan overlay control script.
541 (mkdir-p (string-append out "/bin"))
542 (call-with-output-file (string-append out "/bin/.empty")
543 (const #t))
544 (copy-recursively (string-append out "/bin")
545 (string-append bin "/bin"))
546 (delete-file-recursively (string-append out "/bin")))))
547 (add-after 'install 'symlinks-instead-of-hard-links
548 (lambda _
549 ;; All the drivers and gallium targets create hard links upon
550 ;; installation (search for "hardlink each megadriver instance"
551 ;; in the makefiles). This is no good for us since we'd produce
552 ;; nars that contain several copies of these files. Thus, turn
553 ;; them into symlinks, which saves ~124 MiB.
554 (let* ((out #$output)
555 (lib (string-append out "/lib"))
556 (files (find-files lib
557 (lambda (file stat)
558 (and (string-contains file ".so")
559 (eq? 'regular
560 (stat:type stat))))))
561 (inodes (map (compose stat:ino stat) files)))
562 (for-each (lambda (inode)
563 (match (filter-map (match-lambda
564 ((file ino)
565 (and (= ino inode) file)))
566 (zip files inodes))
567 ((_)
568 #f)
569 ((reference others ..1)
570 (format #t "creating ~a symlinks to '~a'~%"
571 (length others) reference)
572 (for-each delete-file others)
573 (for-each (lambda (file)
574 (if (string=? (dirname file)
575 (dirname reference))
576 (symlink (basename reference)
577 file)
578 (symlink reference file)))
579 others))))
580 (delete-duplicates inodes)))))
581 (add-after 'install 'set-layer-path-in-manifests
582 (lambda _
583 (let* ((out #$output)
584 (implicit-path (string-append
585 out
586 "/share/vulkan/implicit_layer.d/"))
587 (explicit-path (string-append
588 out
589 "/share/vulkan/explicit_layer.d/"))
590 (fix-layer-path
591 (lambda (layer-name)
592 (let* ((explicit (string-append explicit-path layer-name ".json"))
593 (implicit (string-append implicit-path layer-name ".json"))
594 (manifest (if (file-exists? explicit)
595 explicit
596 implicit)))
597 (substitute* manifest
598 (((string-append "\"lib" layer-name ".so\""))
599 (string-append "\"" out "/lib/lib" layer-name ".so\"")))))))
600 (for-each fix-layer-path '("VkLayer_MESA_device_select"
601 "VkLayer_MESA_overlay"))))))))
602 (native-search-paths
603 (list (search-path-specification
604 ;; Ensure the Mesa VDPAU drivers can be found.
605 (variable "VDPAU_DRIVER_PATH")
606 (separator #f)
607 (files '("lib/vdpau")))))
608 (home-page "https://mesa3d.org/")
609 (synopsis "OpenGL and Vulkan implementations")
610 (description "Mesa is a free implementation of the OpenGL and Vulkan
611specifications - systems for rendering interactive 3D graphics. A variety of
612device drivers allows Mesa to be used in many different environments ranging
613from software emulation to complete hardware acceleration for modern GPUs.")
614 (license license:x11)))
615
616(define-public mesa-opencl
617 (package/inherit mesa
618 (name "mesa-opencl")
619 (source (origin
620 (inherit (package-source mesa))))
621 (arguments
622 (substitute-keyword-arguments arguments
623 ((#:modules modules)
624 (cons '(ice-9 textual-ports) modules))
625 ((#:configure-flags flags)
626 #~(cons* "-Dgallium-rusticl=true"
627 ;; Enable all drivers by default.
628 (string-append "-Dgallium-rusticl-enable-drivers="
629 "asahi,freedreno,radeonsi")
630 #$flags))
631 ((#:phases phases)
632 #~(modify-phases #$phases
633 (add-after 'install 'use-absolute-file-name-in-rusticl.icd
634 (lambda _
635 ;; Use absolute path for OpenCL platform library. Otherwise
636 ;; we would have to set LD_LIBRARY_PATH=LIBRARY_PATH for
637 ;; Rusticl in our applications to find the OpenCL platform.
638 (let* ((out #$output)
639 (rusticl.icd (string-append
640 out "/etc/OpenCL/vendors/rusticl.icd"))
641 (old-path (call-with-input-file rusticl.icd
642 get-string-all))
643 (new-path (string-append out "/lib/"
644 (string-trim-both old-path))))
645 (if (file-exists? new-path)
646 (call-with-output-file rusticl.icd
647 (lambda (port) (format port "~a\n" new-path)))))))))))))
648
649(define-public mesa-headers
650 (package/inherit mesa
651 (name "mesa-headers")
652 (propagated-inputs '())
653 (inputs '())
654 (native-inputs '())
655 (outputs '("out"))
656 (arguments
657 '(#:phases
658 (modify-phases %standard-phases
659 (delete 'configure)
660 (delete 'build)
661 (delete 'check)
662 (replace 'install
663 (lambda* (#:key outputs #:allow-other-keys)
664 (copy-recursively "include" (string-append
665 (assoc-ref outputs "out")
666 "/include")))))))))
667
668;;; The mesa-demos distribution contains non-free files, many files with no
669;;; clear license information, and many demos that aren't useful for most
670;;; people, so we just use this for the mesa-utils package below, and possibly
671;;; other packages in the future. This is modeled after Debian's solution.
672(define (mesa-demos-source version)
673 (origin
674 (method url-fetch)
675 (uri (string-append "ftp://ftp.freedesktop.org/pub/mesa/demos"
676 "/mesa-demos-" version ".tar.bz2"))
677 (sha256 (base32 "0zgzbz55a14hz83gbmm0n9gpjnf5zadzi2kjjvkn6khql2a9rs81"))))
678
679(define-public mesa-utils
680 (package
681 (name "mesa-utils")
682 (version "8.4.0")
683 (source (mesa-demos-source version))
684 (build-system gnu-build-system)
685 (inputs
686 (list mesa freeglut glew))
687 (native-inputs
688 (list pkg-config))
689 (arguments
690 (list
691 #:configure-flags
692 #~(list "CFLAGS=-g -O2 -Wno-error=incompatible-pointer-types")
693 #:phases
694 #~(modify-phases %standard-phases
695 (replace 'install
696 (lambda* (#:key outputs #:allow-other-keys)
697 (let ((out #$output))
698 (mkdir-p (string-append out "/bin"))
699 (for-each (lambda (file)
700 (copy-file file
701 (string-append out "/bin/"
702 (basename file))))
703 '("src/xdemos/glxdemo" "src/xdemos/glxgears"
704 "src/egl/opengl/eglinfo"
705 "src/xdemos/glxinfo" "src/xdemos/glxheads"))))))))
706 (home-page "https://mesa3d.org/")
707 (synopsis "Utility tools for Mesa")
708 (description
709 "The mesa-utils package contains several utility tools for Mesa: eglinfo,
710glxdemo, glxgears, glxheads, and glxinfo.")
711 ;; glxdemo is public domain; others expat.
712 (license (list license:expat license:public-domain))))
713
714(define-public glew
715 (package
716 (name "glew")
717 (version "2.2.0")
718 (source (origin
719 (method url-fetch)
720 (uri (string-append "mirror://sourceforge/glew/glew/" version
721 "/glew-" version ".tgz"))
722 (sha256
723 (base32
724 "1qak8f7g1iswgswrgkzc7idk7jmqgwrs58fhg2ai007v7j4q5z6l"))
725 (modules '((guix build utils)))
726 (snippet
727 '(begin
728 (substitute* "config/Makefile.linux"
729 (("= cc") "= gcc")
730 (("/lib64") "/lib"))
731 #t))))
732 (build-system gnu-build-system)
733 (arguments
734 (list #:make-flags #~(list #$@(if (%current-target-system)
735 #~((string-append "CC=" #$(cc-for-target))
736 (string-append "LD=" #$(cc-for-target))
737 (string-append "STRIP=" #$(strip-for-target)))
738 #~())
739 (string-append "GLEW_PREFIX=" #$output)
740 (string-append "GLEW_DEST=" #$output))
741 #:phases
742 #~(modify-phases %standard-phases
743 (delete 'configure)
744 (add-after 'install 'delete-static
745 (lambda _
746 (delete-file (string-append #$output "/lib/libGLEW.a")))))
747 #:tests? #f)) ;no 'check' target
748 (inputs
749 (list libxi libxmu libx11 mesa))
750
751 ;; <GL/glew.h> includes <GL/glu.h>.
752 (propagated-inputs (list glu))
753
754 (home-page "http://glew.sourceforge.net/")
755 (synopsis "OpenGL extension loading library for C and C++")
756 (description
757 "The OpenGL Extension Wrangler Library (GLEW) is a C/C++ extension
758loading library. GLEW provides efficient run-time mechanisms for determining
759which OpenGL extensions are supported on the target platform. OpenGL core and
760extension functionality is exposed in a single header file.")
761 (license license:bsd-3)))
762
763(define-public guile-opengl
764 (package
765 (name "guile-opengl")
766 (version "0.2.0")
767 (source (origin
768 (method url-fetch)
769 (uri (string-append "mirror://gnu/guile-opengl/guile-opengl-"
770 version ".tar.gz"))
771 (sha256
772 (base32
773 "0rbc2wf9x63ilj3n85h8wyllzc2b22abmhs2p2ghjgc253n8gw5q"))))
774 (build-system gnu-build-system)
775 (native-inputs (list pkg-config))
776 (inputs (list guile-2.2 mesa glu freeglut))
777 (arguments
778 '(#:phases (modify-phases %standard-phases
779 (add-before 'build 'patch-dynamic-link
780 (lambda* (#:key inputs outputs #:allow-other-keys)
781 (substitute* "gl/runtime.scm"
782 (("\\(dynamic-link\\)")
783 (string-append "(dynamic-link \""
784 (assoc-ref inputs "mesa")
785 "/lib/libGL.so" "\")")))
786 (define (dynamic-link-substitute file lib input)
787 (substitute* file
788 (("dynamic-link \"lib([a-zA-Z]+)\"" _ lib)
789 (string-append "dynamic-link \""
790 (assoc-ref inputs input)
791 "/lib/lib" lib "\""))))
792 ;; Replace dynamic-link calls for libGL, libGLU, and
793 ;; libglut with absolute paths to the store.
794 (dynamic-link-substitute "glx/runtime.scm" "GL" "mesa")
795 (dynamic-link-substitute "glu/runtime.scm" "GLU" "glu")
796 (dynamic-link-substitute "glut/runtime.scm" "glut"
797 "freeglut"))))))
798 (home-page "https://gnu.org/s/guile-opengl")
799 (synopsis "Guile binding for the OpenGL graphics API")
800 (description
801 "Guile-OpenGL is a library for Guile that provides bindings to the
802OpenGL graphics API.")
803 (license license:lgpl3+)))
804
805(define-public guile3.0-opengl
806 (package
807 (inherit guile-opengl)
808 (name "guile3.0-opengl")
809 (inputs
810 (list guile-3.0 mesa glu freeglut))))
811
812(define-public libepoxy
813 (package
814 (name "libepoxy")
815 (version "1.5.10")
816 (home-page "https://github.com/anholt/libepoxy")
817 (source (origin
818 (method git-fetch)
819 (uri (git-reference (url home-page) (commit version)))
820 (file-name (git-file-name name version))
821 (sha256
822 (base32
823 "0jw02bzdwynyrwsn5rhcacv92h9xx928j3xp436f8gdnwlyb5641"))))
824 (arguments
825 (list
826 #:phases
827 #~(modify-phases %standard-phases
828 (add-before 'configure 'patch-paths
829 (lambda* (#:key inputs #:allow-other-keys)
830 (let ((mesa-lib
831 (lambda (file)
832 (search-input-file inputs (string-append "lib/" file)))))
833 (substitute* (find-files "." "\\.[ch]$")
834 (("libGL.so.1") (mesa-lib "libGL.so.1"))
835 (("libEGL.so.1") (mesa-lib "libEGL.so.1"))
836 (("libGLESv1_CM.so.1") (mesa-lib "libGLESv1_CM.so.1"))
837 (("libGLESv2.so.2") (mesa-lib "libGLESv2.so.2")))))))))
838 (build-system meson-build-system)
839 (native-inputs
840 (list pkg-config python))
841 (propagated-inputs
842 ;; epoxy.pc: 'Requires.private: gl egl'
843 (list mesa))
844 (synopsis "Library for handling OpenGL function pointer management")
845 (description
846 "A library for handling OpenGL function pointer management.")
847 (license license:x11)))
848
849(define-public libglvnd
850 (package
851 (name "libglvnd")
852 (version "1.7.0")
853 (home-page "https://gitlab.freedesktop.org/glvnd/libglvnd")
854 (source (origin
855 (method git-fetch)
856 (uri (git-reference
857 (url home-page)
858 (commit (string-append "v" version))))
859 (file-name (git-file-name name version))
860 (sha256
861 (base32
862 "07v3bmwzmg0d4g2zp835v1g7j22j8vz7hjfmqrdqjgxjj6v4jkyr"))))
863 (build-system meson-build-system)
864 (arguments
865 '(#:configure-flags '("-Dx11=enabled")
866 #:phases (modify-phases %standard-phases
867 (add-after 'unpack 'disable-glx-tests
868 (lambda _
869 ;; This package is meant to be used alongside Mesa.
870 ;; To avoid a circular dependency, disable tests that
871 ;; require a running Xorg server.
872 (substitute* "tests/meson.build"
873 (("if with_glx")
874 "if false")))))))
875 (native-inputs
876 (list pkg-config))
877 (inputs
878 (list libx11 libxext xorgproto))
879 (synopsis "Vendor-neutral OpenGL dispatch library")
880 (description
881 "libglvnd is a vendor-neutral dispatch layer for arbitrating OpenGL
882API calls between multiple vendors. It allows multiple drivers from
883different vendors to coexist on the same file system, and determines which
884vendor to dispatch each API call to at runtime.
885
886Both GLX and EGL are supported, in any combination with OpenGL and OpenGL ES.")
887 ;; libglvnd is available under a custom X11-style license, and incorporates
888 ;; code with various other licenses. See README.md for details.
889 (license (list (license:x11-style "file://README.md")
890 license:x11
891 license:expat))))
892
893(define-public libopenglrecorder
894 (package
895 (name "libopenglrecorder")
896 (version "0.1.0")
897 (source (origin
898 (method git-fetch)
899 (uri (git-reference
900 (url "https://github.com/Benau/libopenglrecorder")
901 (commit (string-append "v" version))))
902 (file-name (git-file-name name version))
903 (sha256
904 (base32
905 "0sfx2kdw2mca3mx4fnk1yy74pilp2i9npcpyj894qkngz5aaz2wl"))))
906 (build-system cmake-build-system)
907 (arguments
908 (list #:tests? #f)) ;no test suite
909 (native-inputs (list pkg-config))
910 (inputs (list libjpeg-turbo))
911 (home-page "https://github.com/Benau/libopenglrecorder")
912 (synopsis "Async readback OpenGL frame buffer with audio recording")
913 (description
914 "libopenglrecorder is a library allowing optional async readback OpenGL
915frame buffer with optional audio recording. It will do video and audio
916encoding together.")
917 (license license:bsd-3)))
918
919(define-public soil
920 (package
921 (name "soil")
922 (version "1.0.7")
923 (source (origin
924 (method url-fetch)
925 ;; No versioned archive available.
926 (uri "http://www.lonesock.net/files/soil.zip")
927 (sha256
928 (base32
929 "00gpwp9dldzhsdhksjvmbhsd2ialraqbv6v6dpikdmpncj6mnc52"))))
930 (build-system gnu-build-system)
931 (arguments
932 '(#:tests? #f ; no tests
933 #:phases (modify-phases %standard-phases
934 (delete 'configure)
935 (add-before 'build 'init-build
936 (lambda* (#:key outputs #:allow-other-keys)
937 (let ((out (assoc-ref outputs "out")))
938 (setenv "CFLAGS" "-fPIC") ; needed for shared library
939 ;; Use alternate Makefile
940 (copy-file "projects/makefile/alternate Makefile.txt"
941 "src/Makefile")
942 (chdir "src")
943 (substitute* '("Makefile")
944 (("INCLUDEDIR = /usr/include/SOIL")
945 (string-append "INCLUDEDIR = " out "/include/SOIL"))
946 (("LIBDIR = /usr/lib")
947 (string-append "LIBDIR = " out "/lib"))
948 ;; Remove these flags from 'install' commands.
949 (("-o root -g root") ""))))))))
950 (native-inputs
951 (list unzip))
952 (inputs
953 (list mesa))
954 (home-page "https://www.lonesock.net/soil.html")
955 (synopsis "OpenGL texture loading library")
956 (description
957 "SOIL is a tiny C library used primarily for uploading textures into
958OpenGL.")
959 (license license:public-domain)
960 (properties '((lint-hidden-cpe-vendors . ("roots"))))))
961
962(define-public glfw
963 (package
964 (name "glfw")
965 (version "3.3.10")
966 (source (origin
967 (method url-fetch)
968 (uri (string-append "https://github.com/glfw/glfw"
969 "/releases/download/" version
970 "/glfw-" version ".zip"))
971 (sha256
972 (base32
973 "1f5xs4cj1y5wk1jimv1mylk6n6vh7433js28mfd1kf7p2zw3whz8"))))
974 (build-system cmake-build-system)
975 (arguments
976 (list
977 #:modules '((guix build cmake-build-system)
978 (guix build utils)
979 (ice-9 format))
980 #:tests? #f ;no test target
981 #:configure-flags #~(list "-DBUILD_SHARED_LIBS=ON")
982 #:phases
983 #~(modify-phases %standard-phases
984 (add-after 'unpack 'patch-sonames
985 (lambda* (#:key inputs #:allow-other-keys)
986 (let-syntax ((patch-sonames
987 (syntax-rules ()
988 ((_ (file ...) soname ...)
989 (substitute* (list file ...)
990 (((format #f "(~@{~a~^|~})" soname ...) lib)
991 (search-input-file
992 inputs (string-append
993 "lib/" lib))))))))
994 ;; Avoid looking in LD_LIBRARY_PATH for dlopen calls.
995 (patch-sonames ("src/egl_context.c"
996 "src/glx_context.c"
997 "src/vulkan.c"
998 "src/wl_init.c"
999 "src/x11_init.c")
1000 "libEGL.so.1"
1001 "libGL.so"
1002 "libGL.so.1"
1003 "libGLESv1_CM.so.1"
1004 "libGLESv2.so.2"
1005 "libvulkan.so.1"
1006 "libwayland-cursor.so.0"
1007 "libwayland-egl.so.1"
1008 "libwayland-client.so.0"
1009 "libxkbcommon.so.0"
1010 "libXxf86vm.so.1"
1011 "libXi.so.6"
1012 "libXrandr.so.2"
1013 "libXcursor.so.1"
1014 "libXinerama.so.1"
1015 "libX11-xcb.so.1"
1016 "libXrender.so.1")))))))
1017 (native-inputs (list doxygen unzip))
1018 (inputs (list libxkbcommon wayland vulkan-loader))
1019 (propagated-inputs
1020 (list mesa ;included in public headers
1021 ;; These are in 'Requires.private' of 'glfw3.pc'.
1022 libx11
1023 libxrandr
1024 libxi
1025 libxinerama
1026 libxcursor
1027 libxxf86vm))
1028 (home-page "https://www.glfw.org")
1029 (synopsis "OpenGL application development library")
1030 (description
1031 "GLFW is a library for OpenGL, OpenGL ES and Vulkan development for
1032desktop computers. It provides a simple API for creating windows, contexts
1033and surfaces, receiving input and events.")
1034 (license license:zlib)))
1035
1036(define-public glfw-3.4
1037 (package
1038 (inherit glfw)
1039 (version "3.4")
1040 (source (origin
1041 (method url-fetch)
1042 (uri (string-append "https://github.com/glfw/glfw"
1043 "/releases/download/" version
1044 "/glfw-" version ".zip"))
1045 (sha256
1046 (base32
1047 "1sd396kkn53myp61kxrd18h7b1q4ix173hhxhvl0iz8j4x5h1v5m"))))
1048 (native-inputs (modify-inputs native-inputs
1049 (prepend pkg-config)))
1050 ;; When building out of source, the install phase fails with:
1051 ;; file INSTALL cannot find "/tmp/guix-build-glfw-3.4.drv-0/build/docs/html":
1052 ;; No such file or directory
1053 (arguments (substitute-keyword-arguments arguments
1054 ((#:out-of-source? _ #f) #f)))))
1055
1056(define-public nanovg
1057 ;; No tags are available.
1058 (let ((revision "0")
1059 (commit "b83cf926525e7cea8d2483da2a75852b8c7b6d28"))
1060 (package
1061 (name "nanovg")
1062 (version (git-version "0" revision commit))
1063 (source (origin
1064 (method git-fetch)
1065 (uri (git-reference
1066 (url "https://github.com/memononen/nanovg")
1067 (commit commit)))
1068 (file-name (git-file-name name version))
1069 (sha256
1070 (base32
1071 "1zp355pw6xnb5mjarz67cxkglv7j1s0qzv705fz1wf0gl0sjhy8f"))
1072 (modules '((guix build utils)))
1073 (snippet
1074 ;; Fix including freetype.
1075 '(substitute* (find-files "." "\\.(c|h)$")
1076 (("ft2build\\.h") "freetype2/ft2build.h")))))
1077 (build-system gnu-build-system)
1078 (arguments
1079 (list #:tests? #f ;no test suite
1080 #:phases
1081 #~(modify-phases %standard-phases
1082 (delete 'configure) ;no configure script
1083 ;; No Makefile exists.
1084 (replace 'build
1085 (lambda _
1086 (invoke #$(cc-for-target)
1087 "../source/src/nanovg.c" "-c" "-fPIC"
1088 "-DFONS_USE_FREETYPE=1"
1089 (string-append "-I"
1090 #$(this-package-input "freetype")
1091 "/include/freetype2"))
1092 (invoke #$(cc-for-target)
1093 "-shared" "-olibnanovg.so" "nanovg.o"
1094 "-lfreetype")))
1095 ;; No Makefile exists.
1096 (replace 'install
1097 (lambda _
1098 (let ((lib (string-append #$output "/lib"))
1099 (include (string-append #$output
1100 "/include/nanovg")))
1101 (install-file "libnanovg.so" lib)
1102 (with-directory-excursion "../source"
1103 (for-each
1104 (lambda (file)
1105 (install-file file include))
1106 (append (find-files "src" "nanovg.*\\.h$")
1107 '("example/perf.h"
1108 "example/stb_image_write.h"))))))))))
1109 (inputs
1110 (list freetype))
1111 (home-page "https://github.com/memononen/nanovg")
1112 (synopsis "2D vector drawing library on top of OpenGL")
1113 (description
1114 "NanoVG is an antialiased vector graphics rendering library for OpenGL.
1115It is aimed for building scalable user interfaces and visualizations.")
1116 (license license:zlib))))
1117
1118(define-public nanovg-for-extempore
1119 (let ((version "0.7.1")
1120 (revision "0")
1121 (commit "3c60175fcc2e5fe305b04355cdce35d499c80310"))
1122 (package
1123 (name "nanovg-for-extempore")
1124 (version (git-version version revision commit))
1125 (source (origin
1126 (method git-fetch)
1127 (uri (git-reference
1128 (url "https://github.com/extemporelang/nanovg")
1129 (commit commit)))
1130 (file-name (git-file-name name version))
1131 (sha256
1132 (base32
1133 "0ddn3d3mxqn8hj9967v3pss7lz1wn08pcdnqzc118g7yjkq7hxzy"))))
1134 (build-system cmake-build-system)
1135 (arguments `(#:tests? #f)) ; no tests included
1136 (inputs
1137 (list mesa))
1138 ;; Extempore refuses to build on architectures other than x86_64
1139 (supported-systems '("x86_64-linux"))
1140 (home-page "https://github.com/extemporelang/nanovg")
1141 (synopsis "2D vector drawing library on top of OpenGL")
1142 (description "NanoVG is small antialiased vector graphics rendering
1143library for OpenGL. It has lean API modeled after HTML5 canvas API. It is
1144aimed to be a practical and fun toolset for building scalable user interfaces
1145and visualizations.")
1146 (license license:zlib))))
1147
1148(define-public gl2ps
1149 (package
1150 (name "gl2ps")
1151 (version "1.4.2")
1152 (source
1153 (origin
1154 (method url-fetch)
1155 (uri (string-append
1156 "http://geuz.org/gl2ps/src/gl2ps-"
1157 version ".tgz"))
1158 (sha256
1159 (base32 "1sgzv547h7hrskb9qd0x5yp45kmhvibjwj2mfswv95lg070h074d"))))
1160 (build-system cmake-build-system)
1161 (inputs
1162 (list libpng mesa zlib))
1163 (arguments
1164 `(#:tests? #f)) ; no tests
1165 (home-page "https://www.geuz.org/gl2ps/")
1166 (synopsis "OpenGL to PostScript printing library")
1167 (description "GL2PS is a C library providing high quality vector
1168output for any OpenGL application. GL2PS uses sorting algorithms
1169capable of handling intersecting and stretched polygons, as well as
1170non-manifold objects. GL2PS provides many features including advanced
1171smooth shading and text rendering, culling of invisible primitives and
1172mixed vector/bitmap output.")
1173 ;; GL2PS is dual-licenced and can be used under the terms of either.
1174 (license (list license:lgpl2.0+
1175 (license:fsf-free "http://www.geuz.org/gl2ps/COPYING.GL2PS"
1176 "GPL-incompatible copyleft license")))))
1177
1178(define-public virtualgl
1179 (package
1180 (name "virtualgl")
1181 (version "2.6.2")
1182 (source
1183 (origin
1184 (method git-fetch)
1185 (uri (git-reference
1186 (url "https://github.com/VirtualGL/virtualgl")
1187 (commit version)))
1188 (file-name (git-file-name name version))
1189 (sha256
1190 (base32 "0yyc553xsb5n0rx7jp9p4wdbd7md07b3qrkf3ssyjavqqg908qg9"))))
1191 (arguments
1192 `(#:tests? #f ; no tests are available
1193 #:configure-flags (list
1194 (string-append "-DCMAKE_INSTALL_LIBDIR="
1195 (assoc-ref %outputs "out") "/lib")
1196 "-DVGL_USESSL=1"))) ; use OpenSSL
1197 (build-system cmake-build-system)
1198 (inputs (list glu libjpeg-turbo libxtst mesa openssl))
1199 (native-inputs (list pkg-config))
1200 (home-page "https://www.virtualgl.org")
1201 (synopsis "Redirects 3D commands from an OpenGL application onto a 3D
1202graphics card")
1203 (description "VirtualGL redirects the 3D rendering commands from OpenGL
1204applications to 3D accelerator hardware in a dedicated server and displays the
1205rendered output interactively to a thin client located elsewhere on the
1206network.")
1207 (license license:wxwindows3.1+)))
1208
1209(define-public mojoshader
1210 (let ((changeset "5887634ea695"))
1211 (package
1212 (name "mojoshader")
1213 (version (string-append "20190825" "-" changeset))
1214 (source
1215 (origin
1216 (method hg-fetch)
1217 (uri (hg-reference
1218 (url "https://hg.icculus.org/icculus/mojoshader/")
1219 (changeset changeset)))
1220 (file-name (git-file-name name version))
1221 (sha256
1222 (base32 "0ibl4z1696jiifv9j5drir7jm0b5px0vwkwckbi7cfd46p7p6wcy"))))
1223 (arguments
1224 ;; Tests only for COMPILER_SUPPORT=ON.
1225 `(#:tests? #f
1226 #:configure-flags '("-DBUILD_SHARED=ON"
1227 "-DFLIP_VIEWPORT=ON"
1228 "-DDEPTH_CLIPPING=ON")
1229 #:phases
1230 (modify-phases %standard-phases
1231 (replace 'install
1232 (lambda* (#:key outputs #:allow-other-keys)
1233 (let* ((out (assoc-ref outputs "out"))
1234 (lib (string-append out "/lib"))
1235 (header (string-append out "/include")))
1236 (install-file "libmojoshader.so" lib)
1237 (for-each (lambda (f)
1238 (install-file f header))
1239 (find-files "../source" "mojoshader.*\\.h$"))
1240 (let ((profiles-header (string-append header "/profiles")))
1241 (mkdir-p profiles-header)
1242 (rename-file (string-append header "/mojoshader_profile.h")
1243 (string-append profiles-header "/mojoshader_profile.h"))))
1244 #t)))))
1245 (build-system cmake-build-system)
1246 (home-page "https://www.icculus.org/mojoshader/")
1247 (synopsis "Work with Direct3D shaders on alternate 3D APIs")
1248 (description "MojoShader is a library to work with Direct3D shaders on
1249alternate 3D APIs and non-Windows platforms. The primary motivation is moving
1250shaders to OpenGL languages on the fly. The developer deals with \"profiles\"
1251that represent various target languages, such as GLSL or ARB_*_program.
1252
1253This allows a developer to manage one set of shaders, presumably written in
1254Direct3D HLSL, and use them across multiple rendering backends. This also
1255means that the developer only has to worry about one (offline) compiler to
1256manage program complexity, while MojoShader itself deals with the reduced
1257complexity of the bytecode at runtime.
1258
1259MojoShader provides both a simple API to convert bytecode to various profiles,
1260and (optionally) basic glue to rendering APIs to abstract the management of
1261the shaders at runtime.")
1262 (license license:zlib))))
1263
1264(define-public mojoshader-with-viewport-flip
1265 ;; Changeset c586d4590241 replaced glProgramViewportFlip with
1266 ;; glProgramViewportInfo.
1267 ;; https://hg.icculus.org/icculus/mojoshader/rev/c586d4590241
1268 (let ((changeset "2e37299b13d8"))
1269 (package
1270 (inherit mojoshader)
1271 (name "mojoshader-with-viewport-flip")
1272 (version (string-append "20190725" "-" changeset))
1273 (source
1274 (origin
1275 (method hg-fetch)
1276 (uri (hg-reference
1277 (url "https://hg.icculus.org/icculus/mojoshader/")
1278 (changeset changeset)))
1279 (file-name (git-file-name name version))
1280 (sha256
1281 (base32 "0ffws7cqbskxwc3hjsnnzq4r2bbf008kdr3b11pa3kr7dsi50y6i"))))
1282 (synopsis "Work with Direct3D shaders on alternate 3D APIs (with viewport flip)")
1283 (description "This is the last version of the mojoshader library with
1284the glProgramViewportFlip before it was replaced with glProgramViewportInfo.")
1285 (license license:zlib))))
1286
1287(define-public glmark2
1288 (package
1289 (name "glmark2")
1290 (version "2023.01")
1291 (source (origin
1292 (method git-fetch)
1293 (uri (git-reference
1294 (url "https://github.com/glmark2/glmark2")
1295 (commit version)))
1296 (file-name (git-file-name name version))
1297 (sha256
1298 (base32
1299 "094dr0ljg1hq6wymw2hb3369p4g91sn5c2qf554dl0dbdbjdqasq"))))
1300 (build-system meson-build-system)
1301 (arguments
1302 '(#:tests? #f ; no check target
1303 #:configure-flags
1304 (list (string-append "-Dflavors="
1305 (string-join '("x11-gl" "x11-glesv2"
1306 "drm-gl" "drm-glesv2"
1307 "wayland-gl" "wayland-glesv2")
1308 ",")))
1309 #:phases
1310 (modify-phases %standard-phases
1311 (add-after 'unpack 'patch-paths
1312 (lambda* (#:key inputs #:allow-other-keys)
1313 (let ((mesa (assoc-ref inputs "mesa")))
1314 (substitute* (find-files "src" "gl-state-.*\\.cpp$")
1315 (("libGL.so") (string-append mesa "/lib/libGL.so"))
1316 (("libEGL.so") (string-append mesa "/lib/libEGL.so"))
1317 (("libGLESv2.so") (string-append mesa "/lib/libGLESv2.so")))
1318 #t))))))
1319 (native-inputs
1320 (list pkg-config))
1321 (inputs
1322 (list eudev
1323 libdrm
1324 libjpeg-turbo
1325 libpng
1326 libx11
1327 libxcb
1328 mesa
1329 wayland
1330 wayland-protocols))
1331 (home-page "https://github.com/glmark2/glmark2")
1332 (synopsis "OpenGL 2.0 and OpenGL ES 2.0 benchmark")
1333 (description
1334 "glmark2 is an OpenGL 2.0 and OpenGL ES 2.0 benchmark based on the
1335original glmark benchmark by Ben Smith.")
1336 (license license:gpl3+)))
1337
1338(define-public waffle
1339 (package
1340 (name "waffle")
1341 (version "1.8.0")
1342 (source (origin
1343 (method git-fetch)
1344 (uri (git-reference
1345 (url "https://gitlab.freedesktop.org/mesa/waffle")
1346 (commit (string-append "v" version))))
1347 (file-name (git-file-name name version))
1348 (sha256
1349 (base32 "1mrw0arlrpm83cwaz7rnimkkjv3a134rcmi1h512y2g4yjzhnm8r"))
1350 (modules '((ice-9 ftw)
1351 (guix build utils)))
1352 (snippet #~(with-directory-excursion "third_party"
1353 (let ((keep '("." ".." "meson.build" "threads")))
1354 (for-each (lambda (f)
1355 (unless (member f keep)
1356 (delete-file-recursively f)))
1357 (scandir ".")))))))
1358 (build-system meson-build-system)
1359 (propagated-inputs (list mesa wayland))
1360 (native-inputs (list cmocka pkg-config))
1361 (home-page "https://waffle.freedesktop.org/")
1362 (synopsis "Choose OpenGL API at runtime")
1363 (description "Waffle is a library that allows one to defer selection of an
1364 OpenGL API and a window system until runtime.")
1365 (license license:bsd-2)))
1366
1367(define-public piglit
1368 (let ((revision "2")
1369 (commit "040ed91f234abb6a502d3a6910f1b0e54bd239a7"))
1370 (package
1371 (name "piglit")
1372 (version (git-version "0.0.0" revision commit))
1373 (source (origin
1374 (method git-fetch)
1375 (uri (git-reference
1376 (url "https://gitlab.freedesktop.org/mesa/piglit")
1377 (commit commit)))
1378 (file-name (git-file-name name version))
1379 (sha256
1380 (base32 "1j5dmkym1mmz410xgwygimnjk2aswsqmcpjwz4s98pgmymh1yjvf"))))
1381 (build-system cmake-build-system)
1382 (arguments
1383 (list #:configure-flags #~(list "-DPIGLIT_SSE2=OFF")
1384 ;; Tests are not invoked through cmake. Instead, there are
1385 ;; pytest/tox-based tests for the framework, but they require
1386 ;; unpackaged plugins.
1387 #:tests? #f
1388 #:phases
1389 #~(modify-phases %standard-phases
1390 (add-after 'unpack 'patch-source
1391 (lambda* (#:key inputs #:allow-other-keys)
1392 (substitute* (find-files "framework/" "\\.py$")
1393 (("'wflinfo'")
1394 (string-append "'"
1395 (search-input-file inputs "/bin/wflinfo")
1396 "'")))))
1397 (add-after 'install 'wrap
1398 (lambda* (#:key outputs #:allow-other-keys)
1399 (wrap-script (string-append #$output "/bin/piglit")
1400 `("GUIX_PYTHONPATH" prefix
1401 (,(getenv "GUIX_PYTHONPATH")))))))))
1402 (inputs (list glslang
1403 guile-3.0 ; for wrap-script
1404 libxkbcommon
1405 python
1406 wayland-protocols
1407 vulkan-headers
1408 vulkan-loader
1409 waffle))
1410 (native-inputs (list pkg-config
1411 python-lxml
1412 python-mako
1413 python-numpy))
1414 (home-page "https://piglit.freedesktop.org/")
1415 (synopsis "Test OpenGL implementations")
1416 (description "Piglit is a collection of automated tests for OpenGL and
1417OpenCL implementations.")
1418 ;; A mix of licenses for various tests
1419 (license (list license:expat
1420 license:bsd-3
1421 license:gpl2+
1422 license:gpl3+)))))