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