gnu: Add iml.
[jackhill/guix/guix.git] / gnu / packages / gl.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2013 Joshua Grant <tadni@riseup.net>
4 ;;; Copyright © 2014, 2016 David Thompson <davet@gnu.org>
5 ;;; Copyright © 2014, 2015, 2016, 2017 Mark H Weaver <mhw@netris.org>
6 ;;; Copyright © 2016 ng0 <ng0@n0.is>
7 ;;; Copyright © 2016, 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
8 ;;; Copyright © 2016 David Thompson <davet@gnu.org>
9 ;;; Copyright © 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
10 ;;; Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net>
11 ;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
12 ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
13 ;;;
14 ;;; This file is part of GNU Guix.
15 ;;;
16 ;;; GNU Guix is free software; you can redistribute it and/or modify it
17 ;;; under the terms of the GNU General Public License as published by
18 ;;; the Free Software Foundation; either version 3 of the License, or (at
19 ;;; your option) any later version.
20 ;;;
21 ;;; GNU Guix is distributed in the hope that it will be useful, but
22 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 ;;; GNU General Public License for more details.
25 ;;;
26 ;;; You should have received a copy of the GNU General Public License
27 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28
29 (define-module (gnu packages gl)
30 #:use-module (gnu packages)
31 #:use-module (gnu packages autotools)
32 #:use-module (gnu packages bison)
33 #:use-module (gnu packages compression)
34 #:use-module (gnu packages documentation)
35 #:use-module (gnu packages elf)
36 #:use-module (gnu packages flex)
37 #:use-module (gnu packages fontutils)
38 #:use-module (gnu packages freedesktop)
39 #:use-module (gnu packages gettext)
40 #:use-module (gnu packages guile)
41 #:use-module (gnu packages image)
42 #:use-module (gnu packages linux)
43 #:use-module (gnu packages llvm)
44 #:use-module (gnu packages pkg-config)
45 #:use-module (gnu packages python)
46 #:use-module (gnu packages python-xyz)
47 #:use-module (gnu packages tls)
48 #:use-module (gnu packages video)
49 #:use-module (gnu packages xdisorg)
50 #:use-module (gnu packages xml)
51 #:use-module (gnu packages xorg)
52 #:use-module (guix download)
53 #:use-module (guix git-download)
54 #:use-module (guix build-system gnu)
55 #:use-module (guix build-system cmake)
56 #:use-module (guix build-system meson)
57 #:use-module ((guix licenses) #:prefix license:)
58 #:use-module (guix packages)
59 #:use-module (guix utils)
60 #:use-module (ice-9 match)
61 #:use-module ((srfi srfi-1) #:hide (zip)))
62
63 (define-public glu
64 (package
65 (name "glu")
66 (version "9.0.0")
67 (source (origin
68 (method url-fetch)
69 (uri (string-append "ftp://ftp.freedesktop.org/pub/mesa/glu/glu-"
70 version ".tar.gz"))
71 (sha256
72 (base32
73 "0r72yyhj09x3krn3kn629jqbwyq50ji8w5ri2pn6zwrk35m4g1s3"))))
74 (build-system gnu-build-system)
75 (propagated-inputs
76 `(("mesa" ,mesa))) ; according to glu.pc
77 (home-page "http://www.opengl.org/archives/resources/faq/technical/glu.htm")
78 (synopsis "Mesa OpenGL Utility library")
79 (description
80 "GLU, or OpenGL Utility Library provides some higher-level functionality
81 not provided by just OpenGL itself. Some of GLU's Features
82 include: Scaling of 2D images and creation of mipmap pyramids,
83 Transformation of object coordinates into device coordinates and
84 vice versa, Support for NURBS surfaces, Support for tessellation
85 of concave or bow tie polygonal primitives, Specialty transformation
86 matrices for creating perspective and orthographic projections,
87 positioning a camera, and selection/picking, Rendering of disk,
88 cylinder, and sphere primitives, Interpreting OpenGL error values
89 as ASCII text.")
90 (license (license:x11-style "http://directory.fsf.org/wiki/License:SGIFreeBv2"))))
91
92 (define-public freeglut
93 (package
94 (name "freeglut")
95 (version "3.0.0")
96 (source (origin
97 (method url-fetch)
98 (uri (string-append
99 "mirror://sourceforge/freeglut/freeglut/"
100 version "/freeglut-" version ".tar.gz"))
101 (sha256
102 (base32
103 "18knkyczzwbmyg8hr4zh8a1i5ga01np2jzd1rwmsh7mh2n2vwhra"))))
104 (build-system cmake-build-system)
105 (arguments '(#:tests? #f)) ; no test target
106 (inputs `(("mesa" ,mesa)
107 ("libx11" ,libx11)
108 ("libxi" ,libxi)
109 ("libxrandr" ,libxrandr)
110 ("libxxf86vm" ,libxxf86vm)
111 ("xorgproto" ,xorgproto)
112 ("xinput" ,xinput)))
113 (propagated-inputs
114 ;; Headers from Mesa and GLU are needed.
115 `(("glu" ,glu)
116 ("mesa" ,mesa)))
117 (home-page "http://freeglut.sourceforge.net/")
118 (synopsis "Alternative to the OpenGL Utility Toolkit (GLUT)")
119 (description
120 "Freeglut is a completely Free/OpenSourced alternative to
121 the OpenGL Utility Toolkit (GLUT) library. GLUT was originally
122 written by Mark Kilgard to support the sample programs in the
123 second edition OpenGL @code{RedBook}. Since then, GLUT has been used
124 in a wide variety of practical applications because it is simple,
125 widely available and highly portable.
126
127 GLUT (and hence freeglut) allows the user to create and manage windows
128 containing OpenGL contexts on a wide range of platforms and also read
129 the mouse, keyboard and joystick functions. Freeglut is released under
130 the X-Consortium license.")
131 (license license:x11)))
132
133 ;; Needed for "kiki".
134 (define-public freeglut-2.8
135 (package (inherit freeglut)
136 (name "freeglut")
137 (version "2.8.1")
138 (source (origin
139 (method url-fetch)
140 (uri (string-append
141 "mirror://sourceforge/freeglut/freeglut/"
142 version "/freeglut-" version ".tar.gz"))
143 (sha256
144 (base32
145 "16lrxxxd9ps9l69y3zsw6iy0drwjsp6m26d1937xj71alqk6dr6x"))))
146 (build-system gnu-build-system)))
147
148 (define-public ftgl
149 (package
150 (name "ftgl")
151 (version "2.1.3-rc5")
152 (source (origin
153 (method url-fetch)
154 (uri (string-append
155 "mirror://sourceforge/ftgl/FTGL%20Source/2.1.3~rc5/"
156 "ftgl-" version ".tar.gz"))
157 (sha256
158 (base32
159 "0nsn4s6vnv5xcgxcw6q031amvh2zfj2smy1r5mbnjj2548hxcn2l"))))
160 (build-system gnu-build-system)
161 (arguments
162 `(#:configure-flags '("--disable-static")))
163 ;; The pkg-config file lists "freetype2" as Requires.private.
164 (propagated-inputs `(("freetype" ,freetype)))
165 (inputs `(("libx11" ,libx11)
166 ("mesa" ,mesa)
167 ("glu" ,glu)))
168 (native-inputs
169 `(("pkg-config" ,pkg-config)))
170 (home-page "http://ftgl.sourceforge.net")
171 (synopsis "Font rendering library for OpenGL applications")
172 (description
173 "FTGL is a font rendering library for OpenGL applications. Supported
174 rendering modes are: Bitmaps, Anti-aliased pixmaps, Texture maps, Outlines,
175 Polygon meshes, and Extruded polygon meshes.")
176 (license license:x11)))
177
178 (define-public s2tc
179 (package
180 (name "s2tc")
181 (version "1.0")
182 (source
183 (origin
184 (method git-fetch)
185 (uri (git-reference
186 (url "https://github.com/divVerent/s2tc.git")
187 (commit (string-append "v" version))))
188 (file-name (git-file-name name version))
189 (sha256
190 (base32 "1fg323fk7wlv2xh6lw66wswgcv6qi8aaadk7c28h2f2lj1s7njnf"))))
191 (build-system gnu-build-system)
192 (native-inputs
193 `(("autoconf" ,autoconf)
194 ("automake" ,automake)
195 ("libtool" ,libtool)))
196 (inputs
197 `(("mesa-headers" ,mesa-headers)))
198 (home-page "https://github.com/divVerent/s2tc")
199 (synopsis "S3 Texture Compression implementation")
200 (description
201 "S2TC is a patent-free implementation of S3 Texture Compression (S3TC,
202 also known as DXTn or DXTC) for Mesa.")
203 (license license:expat)))
204
205 ;;; Mesa needs LibVA headers to build its Gallium-based VA API implementation;
206 ;;; LibVA itself depends on Mesa. We use the following to solve the circular
207 ;;; dependency.
208 (define libva-without-mesa
209 ;; Delay to work around circular import problem.
210 (delay
211 (package
212 (inherit libva)
213 (name "libva-without-mesa")
214 (inputs `(,@(fold alist-delete (package-inputs libva)
215 '("mesa" "wayland"))))
216 (arguments
217 (strip-keyword-arguments
218 '(#:make-flags)
219 (substitute-keyword-arguments (package-arguments libva)
220 ((#:configure-flags flags)
221 '(list "--disable-glx" "--disable-egl"))))))))
222
223 (define-public mesa
224 (package
225 (name "mesa")
226 (version "19.0.4")
227 (source
228 (origin
229 (method url-fetch)
230 (uri (list (string-append "https://mesa.freedesktop.org/archive/"
231 "mesa-" version ".tar.xz")
232 (string-append "ftp://ftp.freedesktop.org/pub/mesa/"
233 "mesa-" version ".tar.xz")
234 (string-append "ftp://ftp.freedesktop.org/pub/mesa/"
235 version "/mesa-" version ".tar.xz")))
236 (sha256
237 (base32
238 "0iyffj3xd7f0vsayirswh6aia37ba26hkihpz273hxwd8hpz7y9r"))
239 (patches
240 (search-patches "mesa-skip-disk-cache-test.patch"))))
241 (build-system meson-build-system)
242 (propagated-inputs
243 `(;; The following are in the Requires.private field of gl.pc.
244 ("libdrm" ,libdrm)
245 ("libvdpau" ,libvdpau)
246 ("libx11" ,libx11)
247 ("libxdamage" ,libxdamage)
248 ("libxfixes" ,libxfixes)
249 ("libxshmfence" ,libxshmfence)
250 ("libxxf86vm" ,libxxf86vm)
251 ("xorgproto" ,xorgproto)))
252 (inputs
253 `(("expat" ,expat)
254 ("libelf" ,elfutils) ;required for r600 when using llvm
255 ("libva" ,(force libva-without-mesa))
256 ("libxml2" ,libxml2)
257 ;; TODO: Add 'libxml2-python' for OpenGL ES 1.1 and 2.0 support
258 ("libxrandr" ,libxrandr)
259 ("libxvmc" ,libxvmc)
260 ,@(match (%current-system)
261 ((or "x86_64-linux" "i686-linux")
262 `(("llvm" ,llvm)))
263 (_
264 `()))
265 ("makedepend" ,makedepend)
266 ("wayland" ,wayland)
267 ("wayland-protocols" ,wayland-protocols)))
268 (native-inputs
269 `(("bison" ,bison)
270 ("flex" ,flex)
271 ("gettext" ,gettext-minimal)
272 ("pkg-config" ,pkg-config)
273 ("python" ,python)
274 ("python-mako" ,python-mako)
275 ("which" ,(@ (gnu packages base) which))))
276 (arguments
277 `(#:configure-flags
278 '(,@(match (%current-system)
279 ((or "armhf-linux" "aarch64-linux")
280 ;; TODO: Fix svga driver for aarch64 and armhf.
281 '("-Dgallium-drivers=etnaviv,freedreno,nouveau,r300,r600,swrast,tegra,v3d,vc4,virgl"))
282 (_
283 '("-Dgallium-drivers=nouveau,r300,r600,radeonsi,svga,swrast,virgl")))
284 ;; Enable various optional features. TODO: opencl requires libclc,
285 ;; omx requires libomxil-bellagio
286 "-Dplatforms=x11,drm,surfaceless,wayland"
287 "-Dglx=dri" ;Thread Local Storage, improves performance
288 ;; "-Dopencl=true"
289 ;; "-Domx=true"
290 "-Dosmesa=gallium"
291 "-Dgallium-xa=true"
292
293 ;; features required by wayland
294 "-Dgles2=true"
295 "-Dgbm=true"
296 "-Dshared-glapi=true"
297
298 ;; Enable Vulkan on i686-linux and x86-64-linux.
299 ,@(match (%current-system)
300 ("x86_64-linux"
301 '("-Dvulkan-drivers=intel,amd"))
302 ;; TODO: Fix intel driver on i686-linux.
303 ("i686-linux"
304 '("-Dvulkan-drivers=amd"))
305 (_
306 '("-Dvulkan-drivers=auto")))
307
308 ;; Also enable the tests.
309 "-Dbuild-tests=true"
310
311 ;; on non-intel systems, drop i915 and i965
312 ;; from the default dri drivers
313 ,@(match (%current-system)
314 ((or "x86_64-linux" "i686-linux")
315 '("-Ddri-drivers=i915,i965,nouveau,r200,r100"
316 "-Dllvm=true")) ; default is x86/x86_64 only
317 (_
318 '("-Ddri-drivers=nouveau,r200,r100"))))
319 #:modules ((ice-9 match)
320 (srfi srfi-1)
321 (guix build utils)
322 (guix build meson-build-system))
323 #:phases
324 (modify-phases %standard-phases
325 (add-after
326 'unpack 'patch-create_test_cases
327 (lambda _
328 (substitute* "src/intel/genxml/gen_pack_header.py"
329 (("/usr/bin/env python2") (which "python")))
330 #t))
331 ,@(if (string-prefix? "i686" (%current-system))
332 ;; Disable new test from Mesa 19 that fails on i686. Upstream
333 ;; report: <https://bugs.freedesktop.org/show_bug.cgi?id=110612>.
334 `((add-after 'unpack 'disable-failing-test
335 (lambda _
336 (substitute* "src/gallium/tests/unit/meson.build"
337 (("'u_format_test',") ""))
338 #t)))
339 '())
340 (add-before
341 'configure 'fix-dlopen-libnames
342 (lambda* (#:key inputs outputs #:allow-other-keys)
343 (let ((out (assoc-ref outputs "out")))
344 ;; Remain agnostic to .so.X.Y.Z versions while doing
345 ;; the substitutions so we're future-safe.
346 (substitute* "src/glx/dri_common.c"
347 (("dlopen\\(\"libGL\\.so")
348 (string-append "dlopen(\"" out "/lib/libGL.so")))
349 (substitute* "src/egl/drivers/dri2/egl_dri2.c"
350 (("\"libglapi\\.so")
351 (string-append "\"" out "/lib/libglapi.so")))
352 (substitute* "src/gbm/main/backend.c"
353 ;; No need to patch the gbm_gallium_drm.so reference;
354 ;; it's never installed since Mesa removed its
355 ;; egl_gallium support.
356 (("\"gbm_dri\\.so")
357 (string-append "\"" out "/lib/dri/gbm_dri.so")))
358 #t)))
359 (add-after 'install 'symlinks-instead-of-hard-links
360 (lambda* (#:key outputs #:allow-other-keys)
361 ;; All the drivers and gallium targets create hard links upon
362 ;; installation (search for "hardlink each megadriver instance"
363 ;; in the makefiles). This is no good for us since we'd produce
364 ;; nars that contain several copies of these files. Thus, turn
365 ;; them into symlinks, which saves ~124 MiB.
366 (let* ((out (assoc-ref outputs "out"))
367 (lib (string-append out "/lib"))
368 (files (find-files lib
369 (lambda (file stat)
370 (and (string-contains file ".so")
371 (eq? 'regular
372 (stat:type stat))))))
373 (inodes (map (compose stat:ino stat) files)))
374 (for-each (lambda (inode)
375 (match (filter-map (match-lambda
376 ((file ino)
377 (and (= ino inode) file)))
378 (zip files inodes))
379 ((_)
380 #f)
381 ((reference others ..1)
382 (format #t "creating ~a symlinks to '~a'~%"
383 (length others) reference)
384 (for-each delete-file others)
385 (for-each (lambda (file)
386 (if (string=? (dirname file)
387 (dirname reference))
388 (symlink (basename reference)
389 file)
390 (symlink reference file)))
391 others))))
392 (delete-duplicates inodes))
393 #t))))))
394 (home-page "https://mesa3d.org/")
395 (synopsis "OpenGL and Vulkan implementations")
396 (description "Mesa is a free implementation of the OpenGL and Vulkan
397 specifications - systems for rendering interactive 3D graphics. A variety of
398 device drivers allows Mesa to be used in many different environments ranging
399 from software emulation to complete hardware acceleration for modern GPUs.")
400 (license license:x11)))
401
402 (define-public mesa-headers
403 (package
404 (inherit mesa)
405 (name "mesa-headers")
406 (propagated-inputs '())
407 (inputs '())
408 (native-inputs '())
409 (arguments
410 '(#:phases
411 (modify-phases %standard-phases
412 (delete 'configure)
413 (delete 'build)
414 (delete 'check)
415 (replace 'install
416 (lambda* (#:key outputs #:allow-other-keys)
417 (copy-recursively "include" (string-append
418 (assoc-ref outputs "out")
419 "/include"))
420 #t)))))))
421
422 ;;; The mesa-demos distribution contains non-free files, many files with no
423 ;;; clear license information, and many demos that aren't useful for most
424 ;;; people, so we just use this for the mesa-utils package below, and possibly
425 ;;; other packages in the future. This is modeled after Debian's solution.
426 (define (mesa-demos-source version)
427 (origin
428 (method url-fetch)
429 (uri (string-append "ftp://ftp.freedesktop.org/pub/mesa/demos"
430 "/mesa-demos-" version ".tar.bz2"))
431 (sha256 (base32 "0zgzbz55a14hz83gbmm0n9gpjnf5zadzi2kjjvkn6khql2a9rs81"))))
432
433 (define-public mesa-utils
434 (package
435 (name "mesa-utils")
436 (version "8.4.0")
437 (source (mesa-demos-source version))
438 (build-system gnu-build-system)
439 (inputs
440 `(("mesa" ,mesa)
441 ("glut" ,freeglut)
442 ("glew" ,glew)))
443 (native-inputs
444 `(("pkg-config" ,pkg-config)))
445 (arguments
446 '(#:phases
447 (modify-phases %standard-phases
448 (replace
449 'install
450 (lambda* (#:key outputs #:allow-other-keys)
451 (let ((out (assoc-ref outputs "out")))
452 (mkdir-p (string-append out "/bin"))
453 (for-each
454 (lambda (file)
455 (copy-file file (string-append out "/bin/" (basename file))))
456 '("src/xdemos/glxdemo" "src/xdemos/glxgears"
457 "src/xdemos/glxinfo" "src/xdemos/glxheads"))
458 #t))))))
459 (home-page "https://mesa3d.org/")
460 (synopsis "Utility tools for Mesa")
461 (description
462 "The mesa-utils package contains several utility tools for Mesa: glxdemo,
463 glxgears, glxheads, and glxinfo.")
464 ;; glxdemo is public domain; others expat.
465 (license (list license:expat license:public-domain))))
466
467 (define-public glew
468 (package
469 (name "glew")
470 (version "2.1.0")
471 (source (origin
472 (method url-fetch)
473 (uri (string-append "mirror://sourceforge/glew/glew/" version
474 "/glew-" version ".tgz"))
475 (sha256
476 (base32
477 "159wk5dc0ykjbxvag5i1m2mhp23zkk6ra04l26y3jc3nwvkr3ph4"))
478 (modules '((guix build utils)))
479 (snippet
480 '(begin
481 (substitute* "config/Makefile.linux"
482 (("= cc") "= gcc")
483 (("/lib64") "/lib"))
484 #t))))
485 (build-system gnu-build-system)
486 (arguments
487 '(#:phases (modify-phases %standard-phases (delete 'configure))
488 #:make-flags (list (string-append "GLEW_PREFIX="
489 (assoc-ref %outputs "out"))
490 (string-append "GLEW_DEST="
491 (assoc-ref %outputs "out")))
492 #:tests? #f)) ;no 'check' target
493 (inputs
494 `(("libxi" ,libxi)
495 ("libxmu" ,libxmu)
496 ("libx11" ,libx11)
497 ("mesa" ,mesa)))
498
499 ;; <GL/glew.h> includes <GL/glu.h>.
500 (propagated-inputs `(("glu" ,glu)))
501
502 (home-page "http://glew.sourceforge.net/")
503 (synopsis "OpenGL extension loading library for C and C++")
504 (description
505 "The OpenGL Extension Wrangler Library (GLEW) is a C/C++ extension
506 loading library. GLEW provides efficient run-time mechanisms for determining
507 which OpenGL extensions are supported on the target platform. OpenGL core and
508 extension functionality is exposed in a single header file.")
509 (license license:bsd-3)))
510
511 (define-public guile-opengl
512 (package
513 (name "guile-opengl")
514 (version "0.1.0")
515 (source (origin
516 (method url-fetch)
517 (uri (string-append "mirror://gnu/guile-opengl/guile-opengl-"
518 version ".tar.gz"))
519 (sha256
520 (base32
521 "13qfx4xh8baryxqrv986l848ygd0piqwm6s2s90pxk9c0m9vklim"))))
522 (build-system gnu-build-system)
523 (native-inputs `(("pkg-config" ,pkg-config)))
524 (inputs `(("guile" ,guile-2.2)
525 ("mesa" ,mesa)
526 ("glu" ,glu)
527 ("freeglut" ,freeglut)))
528 (arguments
529 '(#:phases (modify-phases %standard-phases
530 (add-after 'configure 'patch-makefile
531 (lambda _
532 ;; Install compiled Guile files in the expected place.
533 (substitute* '("Makefile")
534 (("^godir = .*$")
535 "godir = $(moddir)\n"))))
536 (add-before 'build 'patch-dynamic-link
537 (lambda* (#:key inputs outputs #:allow-other-keys)
538 (define (dynamic-link-substitute file lib input)
539 (substitute* file
540 (("dynamic-link \"lib([a-zA-Z]+)\"" _ lib)
541 (string-append "dynamic-link \""
542 (assoc-ref inputs input)
543 "/lib/lib" lib "\""))))
544 ;; Replace dynamic-link calls for libGL, libGLU, and
545 ;; libglut with absolute paths to the store.
546 (dynamic-link-substitute "glx/runtime.scm" "GL" "mesa")
547 (dynamic-link-substitute "glu/runtime.scm" "GLU" "glu")
548 (dynamic-link-substitute "glut/runtime.scm" "glut"
549 "freeglut"))))))
550 (home-page "https://gnu.org/s/guile-opengl")
551 (synopsis "Guile binding for the OpenGL graphics API")
552 (description
553 "Guile-OpenGL is a library for Guile that provides bindings to the
554 OpenGL graphics API.")
555 (license license:lgpl3+)))
556
557 (define-public libepoxy
558 (package
559 (name "libepoxy")
560 (version "1.5.3")
561 (source (origin
562 (method url-fetch)
563 (uri (string-append
564 "https://github.com/anholt/libepoxy/releases/download/"
565 version "/libepoxy-" version ".tar.xz"))
566 (sha256
567 (base32
568 "0ga3qjv50x37my6pw5xr14g5n6z78hy5s8s06kays8c3ab2mha80"))))
569 (arguments
570 `(#:phases
571 (modify-phases %standard-phases
572 (delete 'bootstrap)
573 (add-before
574 'configure 'patch-paths
575 (lambda* (#:key inputs #:allow-other-keys)
576 (let ((python (assoc-ref inputs "python"))
577 (mesa (assoc-ref inputs "mesa")))
578 (substitute* "src/gen_dispatch.py"
579 (("/usr/bin/env python") python))
580 (substitute* (find-files "." "\\.[ch]$")
581 (("libGL.so.1") (string-append mesa "/lib/libGL.so.1"))
582 (("libEGL.so.1") (string-append mesa "/lib/libEGL.so.1")))
583 #t))))))
584 (build-system meson-build-system)
585 (native-inputs
586 `(("pkg-config" ,pkg-config)
587 ("python" ,python)))
588 (inputs
589 `(("mesa" ,mesa)))
590 (home-page "https://github.com/anholt/libepoxy/")
591 (synopsis "A library for handling OpenGL function pointer management")
592 (description
593 "A library for handling OpenGL function pointer management.")
594 (license license:x11)))
595
596 (define-public soil
597 (package
598 (name "soil")
599 (version "1.0.7")
600 (source (origin
601 (method url-fetch)
602 ;; No versioned archive available.
603 (uri "http://www.lonesock.net/files/soil.zip")
604 (sha256
605 (base32
606 "00gpwp9dldzhsdhksjvmbhsd2ialraqbv6v6dpikdmpncj6mnc52"))))
607 (build-system gnu-build-system)
608 (arguments
609 '(#:tests? #f ; no tests
610 #:phases (modify-phases %standard-phases
611 (delete 'configure)
612 (add-before 'build 'init-build
613 (lambda* (#:key outputs #:allow-other-keys)
614 (let ((out (assoc-ref outputs "out")))
615 (setenv "CFLAGS" "-fPIC") ; needed for shared library
616 ;; Use alternate Makefile
617 (copy-file "projects/makefile/alternate Makefile.txt"
618 "src/Makefile")
619 (chdir "src")
620 (substitute* '("Makefile")
621 (("INCLUDEDIR = /usr/include/SOIL")
622 (string-append "INCLUDEDIR = " out "/include/SOIL"))
623 (("LIBDIR = /usr/lib")
624 (string-append "LIBDIR = " out "/lib"))
625 ;; Remove these flags from 'install' commands.
626 (("-o root -g root") ""))))))))
627 (native-inputs
628 `(("unzip" ,unzip)))
629 (inputs
630 `(("mesa" ,mesa)))
631 (home-page "https://www.lonesock.net/soil.html")
632 (synopsis "OpenGL texture loading library")
633 (description
634 "SOIL is a tiny C library used primarily for uploading textures into
635 OpenGL.")
636 (license license:public-domain)))
637
638 (define-public glfw
639 (package
640 (name "glfw")
641 (version "3.2.1")
642 (source (origin
643 (method url-fetch)
644 (uri (string-append "https://github.com/glfw/glfw"
645 "/releases/download/" version
646 "/glfw-" version ".zip"))
647 (sha256
648 (base32
649 "09kk5yc1zhss9add8ryqrngrr16hdmc94rszgng135bhw09mxmdp"))))
650 (build-system cmake-build-system)
651 (arguments
652 '(#:tests? #f ; no test target
653 #:configure-flags '("-DBUILD_SHARED_LIBS=ON")))
654 (native-inputs
655 `(("doxygen" ,doxygen)
656 ("unzip" ,unzip)))
657 (propagated-inputs
658 `(("mesa" ,mesa) ;included in public headers
659
660 ;; These are in 'Requires.private' of 'glfw3.pc'.
661 ("libx11" ,libx11)
662 ("libxrandr" ,libxrandr)
663 ("libxinerama" ,libxinerama)
664 ("libxcursor" ,libxcursor)
665 ("libxxf86vm" ,libxxf86vm)))
666 (home-page "http://www.glfw.org")
667 (synopsis "OpenGL application development library")
668 (description
669 "GLFW is a library for OpenGL, OpenGL ES and Vulkan development for
670 desktop computers. It provides a simple API for creating windows, contexts
671 and surfaces, receiving input and events.")
672 (license license:zlib)))
673
674 (define-public nanovg-for-extempore
675 (package
676 (name "nanovg-for-extempore")
677 (version "0.7.1")
678 (source (origin
679 (method url-fetch)
680 (uri (string-append "https://github.com/extemporelang/nanovg/"
681 "archive/" version ".tar.gz"))
682 (file-name (string-append name "-" version ".tar.gz"))
683 (sha256
684 (base32
685 "0ivs1sagq19xiw8jxd9f8w2b39svi0n9hrbmdvckwvqg95r8701g"))))
686 (build-system cmake-build-system)
687 (arguments `(#:tests? #f)) ; no tests included
688 (inputs
689 `(("mesa" ,mesa)))
690 ;; Extempore refuses to build on architectures other than x86_64
691 (supported-systems '("x86_64-linux"))
692 (home-page "https://github.com/extemporelang/nanovg")
693 (synopsis "2D vector drawing library on top of OpenGL")
694 (description "NanoVG is small antialiased vector graphics rendering
695 library for OpenGL. It has lean API modeled after HTML5 canvas API. It is
696 aimed to be a practical and fun toolset for building scalable user interfaces
697 and visualizations.")
698 (license license:zlib)))
699
700 (define-public gl2ps
701 (package
702 (name "gl2ps")
703 (version "1.4.0")
704 (source
705 (origin
706 (method url-fetch)
707 (uri (string-append
708 "http://geuz.org/gl2ps/src/gl2ps-"
709 version ".tgz"))
710 (sha256
711 (base32
712 "1qpidkz8x3bxqf69hlhyz1m0jmfi9kq24fxsp7rq6wfqzinmxjq3"))))
713 (build-system cmake-build-system)
714 (inputs
715 `(("libpng" ,libpng)
716 ("mesa" ,mesa)
717 ("zlib" ,zlib)))
718 (arguments
719 `(#:tests? #f)) ;; no tests
720 (home-page "http://www.geuz.org/gl2ps/")
721 (synopsis "OpenGL to PostScript printing library")
722 (description "GL2PS is a C library providing high quality vector
723 output for any OpenGL application. GL2PS uses sorting algorithms
724 capable of handling intersecting and stretched polygons, as well as
725 non-manifold objects. GL2PS provides many features including advanced
726 smooth shading and text rendering, culling of invisible primitives and
727 mixed vector/bitmap output.")
728 ;; GL2PS is dual-licenced and can be used under the terms of either.
729 (license (list license:lgpl2.0+
730 (license:fsf-free "http://www.geuz.org/gl2ps/COPYING.GL2PS"
731 "GPL-incompatible copyleft license")))))
732
733 (define-public virtualgl
734 (package
735 (name "virtualgl")
736 (version "2.6.2")
737 (source
738 (origin
739 (method git-fetch)
740 (uri (git-reference
741 (url "https://github.com/VirtualGL/virtualgl.git")
742 (commit version)))
743 (file-name (git-file-name name version))
744 (sha256
745 (base32 "0yyc553xsb5n0rx7jp9p4wdbd7md07b3qrkf3ssyjavqqg908qg9"))))
746 (arguments
747 `(#:tests? #f ; no tests are available
748 #:configure-flags (list
749 (string-append "-DCMAKE_INSTALL_LIBDIR="
750 (assoc-ref %outputs "out") "/lib")
751 "-DVGL_USESSL=1"))) ; use OpenSSL
752 (build-system cmake-build-system)
753 (inputs `(("glu" ,glu)
754 ("libjpeg-turbo" ,libjpeg-turbo)
755 ("libxtst" ,libxtst)
756 ("mesa" ,mesa)
757 ("openssl" ,openssl)))
758 (native-inputs `(("pkg-config" ,pkg-config)))
759 (home-page "https://www.virtualgl.org")
760 (synopsis "Redirects 3D commands from an OpenGL application onto a 3D
761 graphics card")
762 (description "VirtualGL redirects the 3D rendering commands from OpenGL
763 applications to 3D accelerator hardware in a dedicated server and displays the
764 rendered output interactively to a thin client located elsewhere on the
765 network.")
766 (license license:wxwindows3.1+)))