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