gnu: libringclient: Disable the libwrap feature.
[jackhill/guix/guix.git] / gnu / packages / gl.scm
CommitLineData
daca8666 1;;; GNU Guix --- Functional package management for GNU
187731a5 2;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
822efdff 3;;; Copyright © 2013 Joshua Grant <tadni@riseup.net>
432360d7 4;;; Copyright © 2014, 2016 David Thompson <davet@gnu.org>
d0d0f8d1 5;;; Copyright © 2014, 2015, 2016, 2017 Mark H Weaver <mhw@netris.org>
3c986a7d 6;;; Copyright © 2016 Nikita <nikita@n0.is>
21bc326b 7;;; Copyright © 2016, 2017, 2018, 2020, 2021 Ricardo Wurmus <rekado@elephly.net>
b4c8c413 8;;; Copyright © 2016 David Thompson <davet@gnu.org>
ba4c0d69 9;;; Copyright © 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
725d8d2c 10;;; Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net>
e6a668ec 11;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
6018d1ee 12;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
5c154738 13;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
8ae17933 14;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
7bb0ba81 15;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
906fc911 16;;; Copyright © 2020 Kei Kebreau <kkebreau@posteo.net>
daca8666
JG
17;;;
18;;; This file is part of GNU Guix.
19;;;
20;;; GNU Guix is free software; you can redistribute it and/or modify it
21;;; under the terms of the GNU General Public License as published by
22;;; the Free Software Foundation; either version 3 of the License, or (at
23;;; your option) any later version.
24;;;
25;;; GNU Guix is distributed in the hope that it will be useful, but
26;;; WITHOUT ANY WARRANTY; without even the implied warranty of
27;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28;;; GNU General Public License for more details.
29;;;
30;;; You should have received a copy of the GNU General Public License
31;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
32
33(define-module (gnu packages gl)
c4a667bf 34 #:use-module (gnu packages)
b021a2ad 35 #:use-module (gnu packages autotools)
200726ed 36 #:use-module (gnu packages bison)
725d8d2c 37 #:use-module (gnu packages compression)
432360d7 38 #:use-module (gnu packages documentation)
653569e8 39 #:use-module (gnu packages elf)
200726ed 40 #:use-module (gnu packages flex)
3a92a5b3
DC
41 #:use-module (gnu packages fontutils)
42 #:use-module (gnu packages freedesktop)
ce4d7abf 43 #:use-module (gnu packages gettext)
3a92a5b3 44 #:use-module (gnu packages guile)
725d8d2c 45 #:use-module (gnu packages image)
ce4d7abf 46 #:use-module (gnu packages linux)
093c6f8b 47 #:use-module (gnu packages llvm)
bea58fa1 48 #:use-module (gnu packages mono)
3a92a5b3 49 #:use-module (gnu packages pkg-config)
200726ed 50 #:use-module (gnu packages python)
44d10b1f 51 #:use-module (gnu packages python-xyz)
d64f3439 52 #:use-module (gnu packages tls)
7e31978b 53 #:use-module (gnu packages video)
301b2e74 54 #:use-module (gnu packages vulkan)
2b226af1 55 #:use-module (gnu packages xdisorg)
3a92a5b3
DC
56 #:use-module (gnu packages xml)
57 #:use-module (gnu packages xorg)
3a92a5b3 58 #:use-module (guix download)
872ea4eb 59 #:use-module (guix git-download)
5c154738 60 #:use-module (guix hg-download)
3a92a5b3
DC
61 #:use-module (guix build-system gnu)
62 #:use-module (guix build-system cmake)
54d860cc 63 #:use-module (guix build-system meson)
906fc911 64 #:use-module (guix build-system waf)
3a92a5b3
DC
65 #:use-module ((guix licenses) #:prefix license:)
66 #:use-module (guix packages)
67 #:use-module (guix utils)
3ee7b4cc 68 #:use-module (ice-9 match)
af403cf0 69 #:use-module ((srfi srfi-1) #:hide (zip)))
daca8666
JG
70
71(define-public glu
72 (package
73 (name "glu")
1dff73ac 74 (version "9.0.1")
daca8666 75 (source (origin
a124bbd2
SB
76 (method url-fetch)
77 (uri (string-append "ftp://ftp.freedesktop.org/pub/mesa/glu/glu-"
78 version ".tar.gz"))
79 (sha256
80 (base32
1dff73ac 81 "1xqhk9bn10nbvffw3r4p4rjslwz1l7gaycc0x2pqkr2irp7q9x7n"))))
daca8666 82 (build-system gnu-build-system)
187731a5 83 (propagated-inputs
a124bbd2 84 `(("mesa" ,mesa))) ; according to glu.pc
daca8666
JG
85 (home-page "http://www.opengl.org/archives/resources/faq/technical/glu.htm")
86 (synopsis "Mesa OpenGL Utility library")
87 (description
88 "GLU, or OpenGL Utility Library provides some higher-level functionality
35b9e423 89not provided by just OpenGL itself. Some of GLU's Features
daca8666
JG
90include: Scaling of 2D images and creation of mipmap pyramids,
91Transformation of object coordinates into device coordinates and
92vice versa, Support for NURBS surfaces, Support for tessellation
93of concave or bow tie polygonal primitives, Specialty transformation
94matrices for creating perspective and orthographic projections,
95positioning a camera, and selection/picking, Rendering of disk,
96cylinder, and sphere primitives, Interpreting OpenGL error values
97as ASCII text.")
584f2e1b 98 (license (license:x11-style "http://directory.fsf.org/wiki/License:SGIFreeBv2"))))
daca8666
JG
99
100(define-public freeglut
101 (package
102 (name "freeglut")
64136870 103 (version "3.2.1")
daca8666 104 (source (origin
a124bbd2
SB
105 (method url-fetch)
106 (uri (string-append
0f971a04 107 "mirror://sourceforge/freeglut/freeglut/"
a124bbd2
SB
108 version "/freeglut-" version ".tar.gz"))
109 (sha256
110 (base32
64136870 111 "0s6sk49q8ijgbsrrryb7dzqx2fa744jhx1wck5cz5jia2010w06l"))))
8ce36e81 112 (build-system cmake-build-system)
5f613047
MB
113 (arguments
114 '(#:tests? #f ;no test target
115 #:configure-flags '("-DFREEGLUT_BUILD_STATIC_LIBS=OFF")))
64136870 116 (inputs `(("libx11" ,libx11)
a124bbd2
SB
117 ("libxi" ,libxi)
118 ("libxrandr" ,libxrandr)
64136870 119 ("libxxf86vm" ,libxxf86vm)))
9b5db9be
TUBK
120 (propagated-inputs
121 ;; Headers from Mesa and GLU are needed.
122 `(("glu" ,glu)
123 ("mesa" ,mesa)))
daca8666
JG
124 (home-page "http://freeglut.sourceforge.net/")
125 (synopsis "Alternative to the OpenGL Utility Toolkit (GLUT)")
126 (description
127 "Freeglut is a completely Free/OpenSourced alternative to
35b9e423 128the OpenGL Utility Toolkit (GLUT) library. GLUT was originally
daca8666 129written by Mark Kilgard to support the sample programs in the
36a4366d 130second edition OpenGL @code{RedBook}. Since then, GLUT has been used
daca8666
JG
131in a wide variety of practical applications because it is simple,
132widely available and highly portable.
133
134GLUT (and hence freeglut) allows the user to create and manage windows
135containing OpenGL contexts on a wide range of platforms and also read
35b9e423 136the mouse, keyboard and joystick functions. Freeglut is released under
daca8666 137the X-Consortium license.")
584f2e1b 138 (license license:x11)))
daca8666 139
0da0f434
RW
140;; Needed for "kiki".
141(define-public freeglut-2.8
142 (package (inherit freeglut)
143 (name "freeglut")
144 (version "2.8.1")
145 (source (origin
146 (method url-fetch)
147 (uri (string-append
148 "mirror://sourceforge/freeglut/freeglut/"
149 version "/freeglut-" version ".tar.gz"))
150 (sha256
151 (base32
152 "16lrxxxd9ps9l69y3zsw6iy0drwjsp6m26d1937xj71alqk6dr6x"))))
80921d29
MB
153 (build-system gnu-build-system)
154 (arguments
155 '(#:configure-flags '("--disable-static")))))
0da0f434 156
daca8666
JG
157(define-public ftgl
158 (package
159 (name "ftgl")
c7e31cde
MB
160 (version "2.4.0")
161 (home-page "https://github.com/frankheckenbach/ftgl")
daca8666 162 (source (origin
c7e31cde
MB
163 (method git-fetch)
164 (uri (git-reference (url home-page)
165 (commit (string-append "v" version))))
166 (file-name (git-file-name name version))
a124bbd2
SB
167 (sha256
168 (base32
c7e31cde 169 "0zjs1h9w30gajq9lndzvjsa26rsmr1081lb1fbpbj10yhcdcsc79"))))
daca8666 170 (build-system gnu-build-system)
2e652add
MB
171 (arguments
172 `(#:configure-flags '("--disable-static")))
9e850534
RW
173 ;; The pkg-config file lists "freetype2" as Requires.private.
174 (propagated-inputs `(("freetype" ,freetype)))
175 (inputs `(("libx11" ,libx11)
a124bbd2
SB
176 ("mesa" ,mesa)
177 ("glu" ,glu)))
a53a5b71 178 (native-inputs
c7e31cde
MB
179 `(("pkg-config" ,pkg-config)
180 ("autoconf" ,autoconf)
181 ("automake" ,automake)
182 ("libtool" ,libtool)))
daca8666
JG
183 (synopsis "Font rendering library for OpenGL applications")
184 (description
35b9e423 185 "FTGL is a font rendering library for OpenGL applications. Supported
daca8666 186rendering modes are: Bitmaps, Anti-aliased pixmaps, Texture maps, Outlines,
e881752c 187Polygon meshes, and Extruded polygon meshes.")
584f2e1b 188 (license license:x11)))
200726ed 189
b021a2ad
TUBK
190(define-public s2tc
191 (package
192 (name "s2tc")
193 (version "1.0")
194 (source
195 (origin
872ea4eb
RW
196 (method git-fetch)
197 (uri (git-reference
b0e7b699 198 (url "https://github.com/divVerent/s2tc")
872ea4eb
RW
199 (commit (string-append "v" version))))
200 (file-name (git-file-name name version))
b021a2ad 201 (sha256
872ea4eb 202 (base32 "1fg323fk7wlv2xh6lw66wswgcv6qi8aaadk7c28h2f2lj1s7njnf"))))
b021a2ad
TUBK
203 (build-system gnu-build-system)
204 (native-inputs
205 `(("autoconf" ,autoconf)
206 ("automake" ,automake)
207 ("libtool" ,libtool)))
208 (inputs
209 `(("mesa-headers" ,mesa-headers)))
b021a2ad
TUBK
210 (home-page "https://github.com/divVerent/s2tc")
211 (synopsis "S3 Texture Compression implementation")
212 (description
213 "S2TC is a patent-free implementation of S3 Texture Compression (S3TC,
214also known as DXTn or DXTC) for Mesa.")
584f2e1b 215 (license license:expat)))
b021a2ad 216
7e31978b
TUBK
217;;; Mesa needs LibVA headers to build its Gallium-based VA API implementation;
218;;; LibVA itself depends on Mesa. We use the following to solve the circular
219;;; dependency.
220(define libva-without-mesa
221 ;; Delay to work around circular import problem.
222 (delay
223 (package
224 (inherit libva)
225 (name "libva-without-mesa")
3ee7b4cc
EF
226 (inputs `(,@(fold alist-delete (package-inputs libva)
227 '("mesa" "wayland"))))
7e31978b
TUBK
228 (arguments
229 (strip-keyword-arguments
230 '(#:make-flags)
231 (substitute-keyword-arguments (package-arguments libva)
232 ((#:configure-flags flags)
233 '(list "--disable-glx" "--disable-egl"))))))))
234
200726ed
JD
235(define-public mesa
236 (package
237 (name "mesa")
8115b5d4 238 (version "20.2.4")
200726ed
JD
239 (source
240 (origin
241 (method url-fetch)
57cdc1fa
MB
242 (uri (list (string-append "https://mesa.freedesktop.org/archive/"
243 "mesa-" version ".tar.xz")
244 (string-append "ftp://ftp.freedesktop.org/pub/mesa/"
0315b20a
MB
245 "mesa-" version ".tar.xz")
246 (string-append "ftp://ftp.freedesktop.org/pub/mesa/"
247 version "/mesa-" version ".tar.xz")))
200726ed 248 (sha256
ce4d7abf 249 (base32
8115b5d4 250 "14m09bk7akj0k02lg8fhvvzbdsashlbdsgl2cw7wbqfj2mhdqwh5"))
17f2b485 251 (patches
8b555442 252 (search-patches "mesa-skip-tests.patch"))))
f6dadee4 253 (build-system meson-build-system)
200726ed 254 (propagated-inputs
70b02a6a 255 `(;; The following are in the Requires.private field of gl.pc.
ce4d7abf 256 ("libdrm" ,libdrm)
4ea1ad91 257 ("libvdpau" ,libvdpau)
8bb1699b 258 ("libx11" ,libx11)
200726ed 259 ("libxdamage" ,libxdamage)
45191970
TUBK
260 ("libxfixes" ,libxfixes)
261 ("libxshmfence" ,libxshmfence)
70b02a6a
MB
262 ("libxxf86vm" ,libxxf86vm)
263 ("xorgproto" ,xorgproto)))
200726ed 264 (inputs
e0b744f1 265 `(("expat" ,expat)
9b3b4c05 266 ("libelf" ,elfutils) ;required for r600 when using llvm
7e31978b 267 ("libva" ,(force libva-without-mesa))
200726ed 268 ("libxml2" ,libxml2)
ce4d7abf 269 ;; TODO: Add 'libxml2-python' for OpenGL ES 1.1 and 2.0 support
aea3ec0f 270 ("libxrandr" ,libxrandr)
0272ee49 271 ("libxvmc" ,libxvmc)
c5e91014
EF
272 ,@(match (%current-system)
273 ((or "x86_64-linux" "i686-linux")
f5eb13b2 274 ;; Note: update the 'clang' input of mesa-opencl when bumping this.
4b4c93d6 275 `(("llvm" ,llvm-11)))
c5e91014
EF
276 (_
277 `()))
cb639269
MB
278 ("wayland" ,wayland)
279 ("wayland-protocols" ,wayland-protocols)))
200726ed 280 (native-inputs
f6dadee4
RH
281 `(("bison" ,bison)
282 ("flex" ,flex)
283 ("gettext" ,gettext-minimal)
301b2e74
RH
284 ,@(match (%current-system)
285 ((or "x86_64-linux" "i686-linux")
47406a92 286 `(("glslang" ,glslang)))
301b2e74
RH
287 (_
288 `()))
f6dadee4 289 ("pkg-config" ,pkg-config)
178611c8 290 ("python" ,python-wrapper)
17c3e0d8 291 ("python-mako" ,python-mako)
653569e8 292 ("which" ,(@ (gnu packages base) which))))
0df5bdf8 293 (outputs '("out" "bin"))
200726ed 294 (arguments
ce4d7abf 295 `(#:configure-flags
2a8b89c2 296 '(,@(match (%current-system)
cd9f99f1 297 ((or "armhf-linux" "aarch64-linux")
31c70cce 298 ;; TODO: Fix svga driver for aarch64 and armhf.
ee401ed9 299 '("-Dgallium-drivers=etnaviv,freedreno,kmsro,lima,nouveau,panfrost,r300,r600,swrast,tegra,v3d,vc4,virgl"))
2a8b89c2 300 (_
688d8f22 301 '("-Dgallium-drivers=iris,nouveau,r300,r600,radeonsi,svga,swrast,virgl")))
3e2570d8
TUBK
302 ;; Enable various optional features. TODO: opencl requires libclc,
303 ;; omx requires libomxil-bellagio
f6dadee4
RH
304 "-Dplatforms=x11,drm,surfaceless,wayland"
305 "-Dglx=dri" ;Thread Local Storage, improves performance
306 ;; "-Dopencl=true"
307 ;; "-Domx=true"
308 "-Dosmesa=gallium"
309 "-Dgallium-xa=true"
310
8ea75f27 311 ;; features required by wayland
f6dadee4
RH
312 "-Dgles2=true"
313 "-Dgbm=true"
314 "-Dshared-glapi=true"
0315b20a 315
abdb97f8 316 ;; Enable Vulkan on i686-linux and x86-64-linux.
6713e9cb 317 ,@(match (%current-system)
3f14c913 318 ((or "i686-linux" "x86_64-linux")
f6dadee4 319 '("-Dvulkan-drivers=intel,amd"))
6713e9cb 320 (_
7d1494d9 321 '("-Dvulkan-drivers=auto")))
6713e9cb 322
301b2e74
RH
323 ;; Enable the Vulkan overlay layer on i686-linux and x86-64-linux.
324 ,@(match (%current-system)
325 ((or "x86_64-linux" "i686-linux")
326 '("-Dvulkan-overlay-layer=true"))
327 (_
93ef8ca6 328 '()))
301b2e74 329
044006f3 330 ;; Also enable the tests.
f6dadee4 331 "-Dbuild-tests=true"
0f481f06
MW
332
333 ;; on non-intel systems, drop i915 and i965
334 ;; from the default dri drivers
335 ,@(match (%current-system)
336 ((or "x86_64-linux" "i686-linux")
f6dadee4
RH
337 '("-Ddri-drivers=i915,i965,nouveau,r200,r100"
338 "-Dllvm=true")) ; default is x86/x86_64 only
0f481f06 339 (_
f6dadee4 340 '("-Ddri-drivers=nouveau,r200,r100"))))
6fe808f4
MB
341
342 ;; XXX: 'debugoptimized' causes LTO link failures on some drivers. The
343 ;; documentation recommends using 'release' for performance anyway.
344 #:build-type "release"
345
dcc00f54
LC
346 #:modules ((ice-9 match)
347 (srfi srfi-1)
348 (guix build utils)
f6dadee4 349 (guix build meson-build-system))
e8a7a180
EF
350 #:phases
351 (modify-phases %standard-phases
ccbc1c5e
PN
352 ,@(if (string-prefix? "i686" (or (%current-target-system)
353 (%current-system)))
4bed3b10
MB
354 ;; Disable new test from Mesa 19 that fails on i686. Upstream
355 ;; report: <https://bugs.freedesktop.org/show_bug.cgi?id=110612>.
356 `((add-after 'unpack 'disable-failing-test
357 (lambda _
2d271359 358 (substitute* "src/util/tests/format/meson.build"
4bed3b10
MB
359 (("'u_format_test',") ""))
360 #t)))
361 '())
5a746104 362 (add-before 'configure 'fix-dlopen-libnames
e8a7a180 363 (lambda* (#:key inputs outputs #:allow-other-keys)
db481977 364 (let ((out (assoc-ref outputs "out")))
e8a7a180
EF
365 ;; Remain agnostic to .so.X.Y.Z versions while doing
366 ;; the substitutions so we're future-safe.
5a746104
MB
367 (substitute* "src/glx/meson.build"
368 (("-DGL_LIB_NAME=\"lib@0@\\.so\\.@1@\"")
369 (string-append "-DGL_LIB_NAME=\"" out
370 "/lib/lib@0@.so.@1@\"")))
371 (substitute* "src/gbm/backends/dri/gbm_dri.c"
e8a7a180
EF
372 (("\"libglapi\\.so")
373 (string-append "\"" out "/lib/libglapi.so")))
374 (substitute* "src/gbm/main/backend.c"
375 ;; No need to patch the gbm_gallium_drm.so reference;
376 ;; it's never installed since Mesa removed its
377 ;; egl_gallium support.
378 (("\"gbm_dri\\.so")
0315b20a 379 (string-append "\"" out "/lib/dri/gbm_dri.so")))
dcc00f54 380 #t)))
0df5bdf8
MB
381 (add-after 'install 'split-outputs
382 (lambda* (#:key outputs #:allow-other-keys)
383 (let ((out (assoc-ref outputs "out"))
384 (bin (assoc-ref outputs "bin")))
385 ,@(match (%current-system)
386 ((or "i686-linux" "x86_64-linux")
387 ;; Install the Vulkan overlay control script to a separate
388 ;; output to prevent a reference on Python, saving ~70 MiB
389 ;; on the closure size.
390 '((copy-recursively (string-append out "/bin")
391 (string-append bin "/bin"))
392 (delete-file-recursively (string-append out "/bin"))))
393 (_
394 ;; XXX: On architectures without the Vulkan overlay layer
395 ;; just create an empty file because outputs can not be
396 ;; added conditionally.
397 '((mkdir-p (string-append bin "/bin"))
398 (call-with-output-file (string-append bin "/bin/.empty")
399 (const #t)))))
400 #t)))
dcc00f54
LC
401 (add-after 'install 'symlinks-instead-of-hard-links
402 (lambda* (#:key outputs #:allow-other-keys)
403 ;; All the drivers and gallium targets create hard links upon
404 ;; installation (search for "hardlink each megadriver instance"
405 ;; in the makefiles). This is no good for us since we'd produce
406 ;; nars that contain several copies of these files. Thus, turn
407 ;; them into symlinks, which saves ~124 MiB.
408 (let* ((out (assoc-ref outputs "out"))
409 (lib (string-append out "/lib"))
410 (files (find-files lib
411 (lambda (file stat)
412 (and (string-contains file ".so")
413 (eq? 'regular
414 (stat:type stat))))))
415 (inodes (map (compose stat:ino stat) files)))
416 (for-each (lambda (inode)
417 (match (filter-map (match-lambda
418 ((file ino)
419 (and (= ino inode) file)))
420 (zip files inodes))
421 ((_)
422 #f)
423 ((reference others ..1)
424 (format #t "creating ~a symlinks to '~a'~%"
425 (length others) reference)
426 (for-each delete-file others)
427 (for-each (lambda (file)
428 (if (string=? (dirname file)
429 (dirname reference))
430 (symlink (basename reference)
431 file)
432 (symlink reference file)))
433 others))))
434 (delete-duplicates inodes))
0315b20a
MB
435 #t))))))
436 (home-page "https://mesa3d.org/")
6713e9cb
RH
437 (synopsis "OpenGL and Vulkan implementations")
438 (description "Mesa is a free implementation of the OpenGL and Vulkan
439specifications - systems for rendering interactive 3D graphics. A variety of
440device drivers allows Mesa to be used in many different environments ranging
441from software emulation to complete hardware acceleration for modern GPUs.")
584f2e1b 442 (license license:x11)))
7025a035 443
fae42942 444(define-public mesa-opencl
8ea91d05 445 (package/inherit mesa
fae42942
RW
446 (name "mesa-opencl")
447 (arguments
448 (substitute-keyword-arguments (package-arguments mesa)
449 ((#:configure-flags flags)
450 `(cons "-Dgallium-opencl=standalone" ,flags))))
451 (inputs
452 `(("libclc" ,libclc)
453 ,@(package-inputs mesa)))
454 (native-inputs
4b4c93d6 455 `(("clang" ,clang-11)
fae42942
RW
456 ,@(package-native-inputs mesa)))))
457
37cb4e5b 458(define-public mesa-opencl-icd
8ea91d05 459 (package/inherit mesa-opencl
37cb4e5b
RW
460 (name "mesa-opencl-icd")
461 (arguments
462 (substitute-keyword-arguments (package-arguments mesa)
463 ((#:configure-flags flags)
464 `(cons "-Dgallium-opencl=icd"
465 ,(delete "-Dgallium-opencl=standalone" flags)))))))
466
b021a2ad 467(define-public mesa-headers
8ea91d05 468 (package/inherit mesa
b021a2ad
TUBK
469 (name "mesa-headers")
470 (propagated-inputs '())
471 (inputs '())
472 (native-inputs '())
cb475eaa 473 (outputs '("out"))
b021a2ad
TUBK
474 (arguments
475 '(#:phases
476 (modify-phases %standard-phases
f8503e2b
LC
477 (delete 'configure)
478 (delete 'build)
479 (delete 'check)
480 (replace 'install
51b491b0
MW
481 (lambda* (#:key outputs #:allow-other-keys)
482 (copy-recursively "include" (string-append
483 (assoc-ref outputs "out")
484 "/include"))
485 #t)))))))
b021a2ad 486
c90a50eb
TUBK
487;;; The mesa-demos distribution contains non-free files, many files with no
488;;; clear license information, and many demos that aren't useful for most
489;;; people, so we just use this for the mesa-utils package below, and possibly
490;;; other packages in the future. This is modeled after Debian's solution.
491(define (mesa-demos-source version)
492 (origin
493 (method url-fetch)
18cbba26 494 (uri (string-append "ftp://ftp.freedesktop.org/pub/mesa/demos"
c90a50eb 495 "/mesa-demos-" version ".tar.bz2"))
18cbba26 496 (sha256 (base32 "0zgzbz55a14hz83gbmm0n9gpjnf5zadzi2kjjvkn6khql2a9rs81"))))
c90a50eb
TUBK
497
498(define-public mesa-utils
499 (package
500 (name "mesa-utils")
18cbba26 501 (version "8.4.0")
c90a50eb
TUBK
502 (source (mesa-demos-source version))
503 (build-system gnu-build-system)
504 (inputs
505 `(("mesa" ,mesa)
506 ("glut" ,freeglut)
507 ("glew" ,glew)))
508 (native-inputs
509 `(("pkg-config" ,pkg-config)))
510 (arguments
7fe3f8cf 511 '(#:phases
c90a50eb
TUBK
512 (modify-phases %standard-phases
513 (replace
f8503e2b 514 'install
c90a50eb
TUBK
515 (lambda* (#:key outputs #:allow-other-keys)
516 (let ((out (assoc-ref outputs "out")))
517 (mkdir-p (string-append out "/bin"))
518 (for-each
519 (lambda (file)
520 (copy-file file (string-append out "/bin/" (basename file))))
521 '("src/xdemos/glxdemo" "src/xdemos/glxgears"
feb08043
MW
522 "src/xdemos/glxinfo" "src/xdemos/glxheads"))
523 #t))))))
7c22aa63 524 (home-page "https://mesa3d.org/")
c90a50eb
TUBK
525 (synopsis "Utility tools for Mesa")
526 (description
527 "The mesa-utils package contains several utility tools for Mesa: glxdemo,
528glxgears, glxheads, and glxinfo.")
529 ;; glxdemo is public domain; others expat.
584f2e1b 530 (license (list license:expat license:public-domain))))
c90a50eb 531
524f4bec
LC
532(define-public glew
533 (package
534 (name "glew")
bbc94a08 535 (version "2.1.0")
524f4bec
LC
536 (source (origin
537 (method url-fetch)
de67e922
LF
538 (uri (string-append "mirror://sourceforge/glew/glew/" version
539 "/glew-" version ".tgz"))
524f4bec
LC
540 (sha256
541 (base32
bbc94a08 542 "159wk5dc0ykjbxvag5i1m2mhp23zkk6ra04l26y3jc3nwvkr3ph4"))
524f4bec
LC
543 (modules '((guix build utils)))
544 (snippet
6cbee49d
MW
545 '(begin
546 (substitute* "config/Makefile.linux"
547 (("= cc") "= gcc")
548 (("/lib64") "/lib"))
549 #t))))
524f4bec
LC
550 (build-system gnu-build-system)
551 (arguments
dc1d3cde 552 '(#:phases (modify-phases %standard-phases (delete 'configure))
524f4bec
LC
553 #:make-flags (list (string-append "GLEW_PREFIX="
554 (assoc-ref %outputs "out"))
555 (string-append "GLEW_DEST="
556 (assoc-ref %outputs "out")))
557 #:tests? #f)) ;no 'check' target
558 (inputs
559 `(("libxi" ,libxi)
560 ("libxmu" ,libxmu)
561 ("libx11" ,libx11)
562 ("mesa" ,mesa)))
563
564 ;; <GL/glew.h> includes <GL/glu.h>.
565 (propagated-inputs `(("glu" ,glu)))
566
567 (home-page "http://glew.sourceforge.net/")
568 (synopsis "OpenGL extension loading library for C and C++")
569 (description
570 "The OpenGL Extension Wrangler Library (GLEW) is a C/C++ extension
571loading library. GLEW provides efficient run-time mechanisms for determining
572which OpenGL extensions are supported on the target platform. OpenGL core and
573extension functionality is exposed in a single header file.")
584f2e1b 574 (license license:bsd-3)))
524f4bec 575
7025a035
DT
576(define-public guile-opengl
577 (package
578 (name "guile-opengl")
579 (version "0.1.0")
580 (source (origin
581 (method url-fetch)
582 (uri (string-append "mirror://gnu/guile-opengl/guile-opengl-"
583 version ".tar.gz"))
584 (sha256
585 (base32
586 "13qfx4xh8baryxqrv986l848ygd0piqwm6s2s90pxk9c0m9vklim"))))
587 (build-system gnu-build-system)
588 (native-inputs `(("pkg-config" ,pkg-config)))
42994090 589 (inputs `(("guile" ,guile-2.2)
7025a035 590 ("mesa" ,mesa)
4becc792 591 ("glu" ,glu)
7025a035
DT
592 ("freeglut" ,freeglut)))
593 (arguments
0e215f49
DT
594 '(#:phases (modify-phases %standard-phases
595 (add-after 'configure 'patch-makefile
596 (lambda _
597 ;; Install compiled Guile files in the expected place.
598 (substitute* '("Makefile")
599 (("^godir = .*$")
600 "godir = $(moddir)\n"))))
601 (add-before 'build 'patch-dynamic-link
602 (lambda* (#:key inputs outputs #:allow-other-keys)
21bc326b
RW
603 (substitute* "gl/runtime.scm"
604 (("\\(dynamic-link\\)")
605 (string-append "(dynamic-link \""
606 (assoc-ref inputs "mesa")
607 "/lib/libGL.so" "\")")))
0e215f49
DT
608 (define (dynamic-link-substitute file lib input)
609 (substitute* file
610 (("dynamic-link \"lib([a-zA-Z]+)\"" _ lib)
611 (string-append "dynamic-link \""
612 (assoc-ref inputs input)
613 "/lib/lib" lib "\""))))
614 ;; Replace dynamic-link calls for libGL, libGLU, and
615 ;; libglut with absolute paths to the store.
616 (dynamic-link-substitute "glx/runtime.scm" "GL" "mesa")
617 (dynamic-link-substitute "glu/runtime.scm" "GLU" "glu")
618 (dynamic-link-substitute "glut/runtime.scm" "glut"
619 "freeglut"))))))
cc7a5c71 620 (home-page "https://gnu.org/s/guile-opengl")
66672a45 621 (synopsis "Guile binding for the OpenGL graphics API")
7025a035 622 (description
66672a45
LC
623 "Guile-OpenGL is a library for Guile that provides bindings to the
624OpenGL graphics API.")
584f2e1b 625 (license license:lgpl3+)))
131ddf99 626
ad1edd03
RW
627(define-public guile3.0-opengl
628 (package
629 (inherit guile-opengl)
630 (name "guile3.0-opengl")
631 (arguments
632 (substitute-keyword-arguments (package-arguments guile-opengl)
633 ((#:phases phases)
634 `(modify-phases ,phases
635 (add-after 'unpack 'build-with-guile-3.0
636 (lambda _
637 (substitute* "configure"
638 (("_guile_versions_to_search=\"")
639 "_guile_versions_to_search=\"3.0 "))
640 #t))))))
641 (inputs
642 `(("guile" ,guile-3.0)
643 ("mesa" ,mesa)
644 ("glu" ,glu)
645 ("freeglut" ,freeglut)))))
646
131ddf99
AW
647(define-public libepoxy
648 (package
649 (name "libepoxy")
8d9d6adb 650 (version "1.5.4")
131ddf99
AW
651 (source (origin
652 (method url-fetch)
653 (uri (string-append
3d3d4014
EF
654 "https://github.com/anholt/libepoxy/releases/download/"
655 version "/libepoxy-" version ".tar.xz"))
131ddf99
AW
656 (sha256
657 (base32
8d9d6adb 658 "1ll9fach4v30dsyd47s5ial4gaiwihzr2afb77vxxzzy3mlcrlhb"))))
131ddf99 659 (arguments
9bbd52e5 660 `(#:phases
5f8dd6dc 661 (modify-phases %standard-phases
54d860cc 662 (delete 'bootstrap)
5f8dd6dc
EF
663 (add-before
664 'configure 'patch-paths
665 (lambda* (#:key inputs #:allow-other-keys)
666 (let ((python (assoc-ref inputs "python"))
667 (mesa (assoc-ref inputs "mesa")))
668 (substitute* "src/gen_dispatch.py"
669 (("/usr/bin/env python") python))
670 (substitute* (find-files "." "\\.[ch]$")
671 (("libGL.so.1") (string-append mesa "/lib/libGL.so.1"))
672 (("libEGL.so.1") (string-append mesa "/lib/libEGL.so.1")))
5f8dd6dc 673 #t))))))
54d860cc 674 (build-system meson-build-system)
131ddf99 675 (native-inputs
827dc629 676 `(("pkg-config" ,pkg-config)
131ddf99
AW
677 ("python" ,python)))
678 (inputs
679 `(("mesa" ,mesa)))
3d3d4014 680 (home-page "https://github.com/anholt/libepoxy/")
131ddf99
AW
681 (synopsis "A library for handling OpenGL function pointer management")
682 (description
683 "A library for handling OpenGL function pointer management.")
584f2e1b 684 (license license:x11)))
2b226af1 685
e7b2ac1c
MB
686(define-public libglvnd
687 (package
688 (name "libglvnd")
6018d1ee 689 (version "1.3.2")
e7b2ac1c
MB
690 (home-page "https://gitlab.freedesktop.org/glvnd/libglvnd")
691 (source (origin
692 (method git-fetch)
693 (uri (git-reference
694 (url home-page)
695 (commit (string-append "v" version))))
696 (file-name (git-file-name name version))
697 (sha256
698 (base32
6018d1ee 699 "10x7fgb114r4gikdg6flszl3kwzcb9y5qa7sj9936mk0zxhjaylz"))))
e7b2ac1c
MB
700 (build-system meson-build-system)
701 (arguments
702 '(#:configure-flags '("-Dx11=enabled")
703 #:phases (modify-phases %standard-phases
704 (add-after 'unpack 'disable-glx-tests
705 (lambda _
706 ;; This package is meant to be used alongside Mesa.
707 ;; To avoid a circular dependency, disable tests that
708 ;; require a running Xorg server.
709 (substitute* "tests/meson.build"
710 (("if with_glx")
711 "if false"))
712 #t)))))
713 (native-inputs
714 `(("pkg-config" ,pkg-config)))
715 (inputs
716 `(("libx11" ,libx11)
717 ("libxext" ,libxext)
718 ("xorgproto" ,xorgproto)))
719 (synopsis "Vendor-neutral OpenGL dispatch library")
720 (description
721 "libglvnd is a vendor-neutral dispatch layer for arbitrating OpenGL
722API calls between multiple vendors. It allows multiple drivers from
723different vendors to coexist on the same filesystem, and determines which
724vendor to dispatch each API call to at runtime.
725
726Both GLX and EGL are supported, in any combination with OpenGL and OpenGL ES.")
727 ;; libglvnd is available under a custom X11-style license, and incorporates
728 ;; code with various other licenses. See README.md for details.
729 (license (list (license:x11-style "file://README.md")
730 license:x11
731 license:expat))))
732
2b226af1
DT
733(define-public soil
734 (package
735 (name "soil")
736 (version "1.0.7")
737 (source (origin
738 (method url-fetch)
739 ;; No versioned archive available.
740 (uri "http://www.lonesock.net/files/soil.zip")
741 (sha256
742 (base32
743 "00gpwp9dldzhsdhksjvmbhsd2ialraqbv6v6dpikdmpncj6mnc52"))))
744 (build-system gnu-build-system)
745 (arguments
746 '(#:tests? #f ; no tests
747 #:phases (modify-phases %standard-phases
748 (delete 'configure)
749 (add-before 'build 'init-build
750 (lambda* (#:key outputs #:allow-other-keys)
751 (let ((out (assoc-ref outputs "out")))
752 (setenv "CFLAGS" "-fPIC") ; needed for shared library
753 ;; Use alternate Makefile
754 (copy-file "projects/makefile/alternate Makefile.txt"
755 "src/Makefile")
756 (chdir "src")
757 (substitute* '("Makefile")
758 (("INCLUDEDIR = /usr/include/SOIL")
759 (string-append "INCLUDEDIR = " out "/include/SOIL"))
760 (("LIBDIR = /usr/lib")
761 (string-append "LIBDIR = " out "/lib"))
762 ;; Remove these flags from 'install' commands.
763 (("-o root -g root") ""))))))))
764 (native-inputs
765 `(("unzip" ,unzip)))
766 (inputs
767 `(("mesa" ,mesa)))
c0f6eebb 768 (home-page "https://www.lonesock.net/soil.html")
2b226af1
DT
769 (synopsis "OpenGL texture loading library")
770 (description
771 "SOIL is a tiny C library used primarily for uploading textures into
772OpenGL.")
584f2e1b 773 (license license:public-domain)))
432360d7
DT
774
775(define-public glfw
776 (package
777 (name "glfw")
2ca33b3a 778 (version "3.3.3")
432360d7
DT
779 (source (origin
780 (method url-fetch)
781 (uri (string-append "https://github.com/glfw/glfw"
782 "/releases/download/" version
783 "/glfw-" version ".zip"))
784 (sha256
785 (base32
2ca33b3a 786 "0xrrahhbs4sn7sgvdk9sgz5zla4sw3ajq6kxpqrx635l8nnqfc3j"))))
432360d7
DT
787 (build-system cmake-build-system)
788 (arguments
789 '(#:tests? #f ; no test target
790 #:configure-flags '("-DBUILD_SHARED_LIBS=ON")))
791 (native-inputs
792 `(("doxygen" ,doxygen)
793 ("unzip" ,unzip)))
a966281f
LC
794 (propagated-inputs
795 `(("mesa" ,mesa) ;included in public headers
796
797 ;; These are in 'Requires.private' of 'glfw3.pc'.
432360d7
DT
798 ("libx11" ,libx11)
799 ("libxrandr" ,libxrandr)
1999934c 800 ("libxi" ,libxi)
432360d7 801 ("libxinerama" ,libxinerama)
a966281f
LC
802 ("libxcursor" ,libxcursor)
803 ("libxxf86vm" ,libxxf86vm)))
c9938fa8 804 (home-page "https://www.glfw.org")
432360d7
DT
805 (synopsis "OpenGL application development library")
806 (description
807 "GLFW is a library for OpenGL, OpenGL ES and Vulkan development for
808desktop computers. It provides a simple API for creating windows, contexts
809and surfaces, receiving input and events.")
810 (license license:zlib)))
78acbcb5
RW
811
812(define-public nanovg-for-extempore
7bb0ba81
GL
813 (let ((version "0.7.1")
814 (revision "0")
815 (commit "3c60175fcc2e5fe305b04355cdce35d499c80310"))
816 (package
817 (name "nanovg-for-extempore")
818 (version (git-version version revision commit))
819 (source (origin
820 (method git-fetch)
821 (uri (git-reference
b0e7b699 822 (url "https://github.com/extemporelang/nanovg")
7bb0ba81
GL
823 (commit commit)))
824 (file-name (git-file-name name version))
825 (sha256
826 (base32
827 "0ddn3d3mxqn8hj9967v3pss7lz1wn08pcdnqzc118g7yjkq7hxzy"))))
828 (build-system cmake-build-system)
829 (arguments `(#:tests? #f)) ; no tests included
830 (inputs
831 `(("mesa" ,mesa)))
832 ;; Extempore refuses to build on architectures other than x86_64
833 (supported-systems '("x86_64-linux"))
834 (home-page "https://github.com/extemporelang/nanovg")
835 (synopsis "2D vector drawing library on top of OpenGL")
836 (description "NanoVG is small antialiased vector graphics rendering
78acbcb5
RW
837library for OpenGL. It has lean API modeled after HTML5 canvas API. It is
838aimed to be a practical and fun toolset for building scalable user interfaces
839and visualizations.")
7bb0ba81 840 (license license:zlib))))
725d8d2c
AI
841
842(define-public gl2ps
843 (package
844 (name "gl2ps")
52c463a9 845 (version "1.4.2")
725d8d2c
AI
846 (source
847 (origin
848 (method url-fetch)
849 (uri (string-append
850 "http://geuz.org/gl2ps/src/gl2ps-"
851 version ".tgz"))
852 (sha256
52c463a9 853 (base32 "1sgzv547h7hrskb9qd0x5yp45kmhvibjwj2mfswv95lg070h074d"))))
725d8d2c
AI
854 (build-system cmake-build-system)
855 (inputs
856 `(("libpng" ,libpng)
857 ("mesa" ,mesa)
858 ("zlib" ,zlib)))
859 (arguments
52c463a9 860 `(#:tests? #f)) ; no tests
725d8d2c
AI
861 (home-page "http://www.geuz.org/gl2ps/")
862 (synopsis "OpenGL to PostScript printing library")
863 (description "GL2PS is a C library providing high quality vector
864output for any OpenGL application. GL2PS uses sorting algorithms
865capable of handling intersecting and stretched polygons, as well as
866non-manifold objects. GL2PS provides many features including advanced
867smooth shading and text rendering, culling of invisible primitives and
868mixed vector/bitmap output.")
905d15e1 869 ;; GL2PS is dual-licenced and can be used under the terms of either.
725d8d2c
AI
870 (license (list license:lgpl2.0+
871 (license:fsf-free "http://www.geuz.org/gl2ps/COPYING.GL2PS"
872 "GPL-incompatible copyleft license")))))
d64f3439
RH
873
874(define-public virtualgl
875 (package
876 (name "virtualgl")
0cece1b5 877 (version "2.6.2")
d64f3439
RH
878 (source
879 (origin
bd7daf9c
RW
880 (method git-fetch)
881 (uri (git-reference
b0e7b699 882 (url "https://github.com/VirtualGL/virtualgl")
bd7daf9c
RW
883 (commit version)))
884 (file-name (git-file-name name version))
d64f3439 885 (sha256
0cece1b5 886 (base32 "0yyc553xsb5n0rx7jp9p4wdbd7md07b3qrkf3ssyjavqqg908qg9"))))
d64f3439 887 (arguments
c30fd002 888 `(#:tests? #f ; no tests are available
07b8ea84 889 #:configure-flags (list
c30fd002
TGR
890 (string-append "-DCMAKE_INSTALL_LIBDIR="
891 (assoc-ref %outputs "out") "/lib")
892 "-DVGL_USESSL=1"))) ; use OpenSSL
d64f3439
RH
893 (build-system cmake-build-system)
894 (inputs `(("glu" ,glu)
895 ("libjpeg-turbo" ,libjpeg-turbo)
c30fd002 896 ("libxtst" ,libxtst)
d64f3439
RH
897 ("mesa" ,mesa)
898 ("openssl" ,openssl)))
c695fb76 899 (native-inputs `(("pkg-config" ,pkg-config)))
d64f3439
RH
900 (home-page "https://www.virtualgl.org")
901 (synopsis "Redirects 3D commands from an OpenGL application onto a 3D
902graphics card")
903 (description "VirtualGL redirects the 3D rendering commands from OpenGL
904applications to 3D accelerator hardware in a dedicated server and displays the
905rendered output interactively to a thin client located elsewhere on the
906network.")
907 (license license:wxwindows3.1+)))
5c154738
PN
908
909(define-public mojoshader
910 (let ((changeset "5887634ea695"))
911 (package
912 (name "mojoshader")
3429f5d9 913 (version (string-append "20190825" "-" changeset))
5c154738
PN
914 (source
915 (origin
916 (method hg-fetch)
917 (uri (hg-reference
918 (url "https://hg.icculus.org/icculus/mojoshader/")
919 (changeset changeset)))
920 (file-name (git-file-name name version))
921 (sha256
922 (base32 "0ibl4z1696jiifv9j5drir7jm0b5px0vwkwckbi7cfd46p7p6wcy"))))
923 (arguments
924 ;; Tests only for COMPILER_SUPPORT=ON.
925 `(#:tests? #f
3429f5d9
PN
926 #:configure-flags '("-DBUILD_SHARED=ON"
927 "-DFLIP_VIEWPORT=ON"
928 "-DDEPTH_CLIPPING=ON")
5c154738
PN
929 #:phases
930 (modify-phases %standard-phases
931 (replace 'install
932 (lambda* (#:key outputs #:allow-other-keys)
933 (let* ((out (assoc-ref outputs "out"))
934 (lib (string-append out "/lib"))
935 (header (string-append out "/include")))
936 (install-file "libmojoshader.so" lib)
937 (for-each (lambda (f)
938 (install-file f header))
939 (find-files "../source" "mojoshader.*\\.h$"))
940 (let ((profiles-header (string-append header "/profiles")))
941 (mkdir-p profiles-header)
942 (rename-file (string-append header "/mojoshader_profile.h")
943 (string-append profiles-header "/mojoshader_profile.h"))))
944 #t)))))
945 (build-system cmake-build-system)
946 (home-page "https://www.icculus.org/mojoshader/")
947 (synopsis "Work with Direct3D shaders on alternate 3D APIs")
948 (description "MojoShader is a library to work with Direct3D shaders on
949alternate 3D APIs and non-Windows platforms. The primary motivation is moving
950shaders to OpenGL languages on the fly. The developer deals with \"profiles\"
951that represent various target languages, such as GLSL or ARB_*_program.
952
953This allows a developer to manage one set of shaders, presumably written in
954Direct3D HLSL, and use them across multiple rendering backends. This also
955means that the developer only has to worry about one (offline) compiler to
956manage program complexity, while MojoShader itself deals with the reduced
957complexity of the bytecode at runtime.
958
959MojoShader provides both a simple API to convert bytecode to various profiles,
960and (optionally) basic glue to rendering APIs to abstract the management of
961the shaders at runtime.")
962 (license license:zlib))))
b150e83b
PN
963
964(define-public mojoshader-with-viewport-flip
965 ;; Changeset c586d4590241 replaced glProgramViewportFlip with
966 ;; glProgramViewportInfo.
967 ;; https://hg.icculus.org/icculus/mojoshader/rev/c586d4590241
968 (let ((changeset "2e37299b13d8"))
969 (package
970 (inherit mojoshader)
971 (name "mojoshader-with-viewport-flip")
972 (version (string-append "20190725" "-" changeset))
973 (source
974 (origin
975 (method hg-fetch)
976 (uri (hg-reference
977 (url "https://hg.icculus.org/icculus/mojoshader/")
978 (changeset changeset)))
979 (file-name (git-file-name name version))
980 (sha256
981 (base32 "0ffws7cqbskxwc3hjsnnzq4r2bbf008kdr3b11pa3kr7dsi50y6i"))))
982 (synopsis "Work with Direct3D shaders on alternate 3D APIs (with viewport flip)")
983 (description "This is the last version of the mojoshader library with
984the glProgramViewportFlip before it was replaced with glProgramViewportInfo.")
985 (license license:zlib))))
bea58fa1
PN
986
987(define-public mojoshader-cs
988 (let ((commit "10d0dba21ff1cfe332eb7de328a2adce01286bd7"))
989 (package
990 (name "mojoshader-cs")
991 (version (git-version "20191205" "1" commit))
992 (source (origin
993 (method git-fetch)
994 (uri (git-reference
995 (url "https://github.com/FNA-XNA/MojoShader")
996 (commit commit)))
997 (file-name (git-file-name name version))
998 (sha256
999 (base32
1000 "11mdhf3fmb9rsn2iv753gmb596j4dh5j2iipgw078vg0lj23rml7"))))
1001 (build-system gnu-build-system)
1002 (arguments
1003 '(#:tests? #f ; No tests.
1004 #:phases
1005 (modify-phases %standard-phases
1006 (delete 'configure)
1007 (replace 'build
1008 (lambda _
1009 (invoke "make" "-C" "csharp")))
1010 (replace 'install
1011 (lambda* (#:key outputs #:allow-other-keys)
1012 (let ((out (assoc-ref outputs "out")))
1013 (install-file "csharp/bin/MojoShader-CS.dll" (string-append out "/lib"))
1014 #t))))))
1015 (native-inputs
1016 `(("mono" ,mono)))
1017 (home-page "https://github.com/FNA-XNA/MojoShader")
1018 (synopsis "C# wrapper for MojoShader")
1019 (description
1020 "Mojoshader-CS provides C# bindings for the Mojoshader library.
1021The C# wrapper was written to be used for FNA's platform support. However, this
1022is written in a way that can be used for any general C# application.")
1023 (license license:zlib))))
906fc911
KK
1024
1025(define-public glmark2
1026 (package
1027 (name "glmark2")
1028 (version "2020.04")
1029 (source (origin
1030 (method git-fetch)
1031 (uri (git-reference
1032 (url "https://github.com/glmark2/glmark2")
1033 (commit version)))
1034 (file-name (git-file-name name version))
1035 (sha256
1036 (base32
1037 "0ywpzp0imi3f8iyp7d1739576zx2nsr3db5hp2as4yhflfyq1as2"))
1038 (modules '((guix build utils)))
1039 ;; Fix Python 3 incompatibility.
1040 (snippet
1041 '(begin
1042 (substitute* "wscript"
1043 (("(sorted\\()FLAVORS\\.keys\\(\\)(.*)" _ beginning end)
1044 (string-append beginning "list(FLAVORS)" end)))
1045 #t))))
1046 (build-system waf-build-system)
1047 (arguments
1048 '(#:tests? #f ; no check target
1049 #:configure-flags
1050 (list (string-append "--with-flavors="
1051 (string-join '("x11-gl" "x11-glesv2"
1052 "drm-gl" "drm-glesv2"
1053 "wayland-gl" "wayland-glesv2")
1054 ",")))
1055 #:phases
1056 (modify-phases %standard-phases
1057 (add-after 'unpack 'patch-paths
1058 (lambda* (#:key inputs #:allow-other-keys)
1059 (let ((mesa (assoc-ref inputs "mesa")))
1060 (substitute* (find-files "src" "gl-state-.*\\.cpp$")
1061 (("libGL.so") (string-append mesa "/lib/libGL.so"))
1062 (("libEGL.so") (string-append mesa "/lib/libEGL.so"))
1063 (("libGLESv2.so") (string-append mesa "/lib/libGLESv2.so")))
1064 #t))))))
1065 (native-inputs
1066 `(("pkg-config" ,pkg-config)))
1067 (inputs
1068 `(("eudev" ,eudev)
1069 ("libdrm" ,libdrm)
1070 ("libjpeg-turbo" ,libjpeg-turbo)
1071 ("libpng" ,libpng)
1072 ("libx11" ,libx11)
1073 ("libxcb" ,libxcb)
1074 ("mesa" ,mesa)
1075 ("wayland" ,wayland)
1076 ("wayland-protocols" ,wayland-protocols)))
1077 (home-page "https://github.com/glmark2/glmark2")
1078 (synopsis "OpenGL 2.0 and OpenGL ES 2.0 benchmark")
1079 (description
1080 "glmark2 is an OpenGL 2.0 and OpenGL ES 2.0 benchmark based on the
1081original glmark benchmark by Ben Smith.")
1082 (license license:gpl3+)))