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