gnu: libepoxy: Update to 1.5.3.
[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 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 git-download)
53 #:use-module (guix build utils)
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 '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 ;; The pkg-config file lists "freetype2" as Requires.private.
162 (propagated-inputs `(("freetype" ,freetype)))
163 (inputs `(("libx11" ,libx11)
164 ("mesa" ,mesa)
165 ("glu" ,glu)))
166 (native-inputs
167 `(("pkg-config" ,pkg-config)))
168 (home-page "http://ftgl.sourceforge.net")
169 (synopsis "Font rendering library for OpenGL applications")
170 (description
171 "FTGL is a font rendering library for OpenGL applications. Supported
172 rendering modes are: Bitmaps, Anti-aliased pixmaps, Texture maps, Outlines,
173 Polygon meshes, and Extruded polygon meshes.")
174 (license license:x11)))
175
176 (define-public s2tc
177 (package
178 (name "s2tc")
179 (version "1.0")
180 (source
181 (origin
182 (method git-fetch)
183 (uri (git-reference
184 (url "https://github.com/divVerent/s2tc.git")
185 (commit (string-append "v" version))))
186 (file-name (git-file-name name version))
187 (sha256
188 (base32 "1fg323fk7wlv2xh6lw66wswgcv6qi8aaadk7c28h2f2lj1s7njnf"))))
189 (build-system gnu-build-system)
190 (native-inputs
191 `(("autoconf" ,autoconf)
192 ("automake" ,automake)
193 ("libtool" ,libtool)))
194 (inputs
195 `(("mesa-headers" ,mesa-headers)))
196 (home-page "https://github.com/divVerent/s2tc")
197 (synopsis "S3 Texture Compression implementation")
198 (description
199 "S2TC is a patent-free implementation of S3 Texture Compression (S3TC,
200 also known as DXTn or DXTC) for Mesa.")
201 (license license:expat)))
202
203 ;;; Mesa needs LibVA headers to build its Gallium-based VA API implementation;
204 ;;; LibVA itself depends on Mesa. We use the following to solve the circular
205 ;;; dependency.
206 (define libva-without-mesa
207 ;; Delay to work around circular import problem.
208 (delay
209 (package
210 (inherit libva)
211 (name "libva-without-mesa")
212 (inputs `(,@(fold alist-delete (package-inputs libva)
213 '("mesa" "wayland"))))
214 (arguments
215 (strip-keyword-arguments
216 '(#:make-flags)
217 (substitute-keyword-arguments (package-arguments libva)
218 ((#:configure-flags flags)
219 '(list "--disable-glx" "--disable-egl"))))))))
220
221 (define-public mesa
222 (package
223 (name "mesa")
224 (version "18.2.6")
225 (source
226 (origin
227 (method url-fetch)
228 (uri (list (string-append "https://mesa.freedesktop.org/archive/"
229 "mesa-" version ".tar.xz")
230 (string-append "ftp://ftp.freedesktop.org/pub/mesa/"
231 "mesa-" version ".tar.xz")
232 (string-append "ftp://ftp.freedesktop.org/pub/mesa/"
233 version "/mesa-" version ".tar.xz")))
234 (sha256
235 (base32
236 "04nwxykmc80gicmal0zkk8is34rmbqawmfckirqhrps9h97zmfly"))
237 (patches
238 (search-patches "mesa-skip-disk-cache-test.patch"))))
239 (build-system gnu-build-system)
240 (propagated-inputs
241 `(;; The following are in the Requires.private field of gl.pc.
242 ("libdrm" ,libdrm)
243 ("libvdpau" ,libvdpau)
244 ("libx11" ,libx11)
245 ("libxdamage" ,libxdamage)
246 ("libxfixes" ,libxfixes)
247 ("libxshmfence" ,libxshmfence)
248 ("libxxf86vm" ,libxxf86vm)
249 ("xorgproto" ,xorgproto)))
250 (inputs
251 `(("expat" ,expat)
252 ("libelf" ,elfutils) ;required for r600 when using llvm
253 ("libva" ,(force libva-without-mesa))
254 ("libxml2" ,libxml2)
255 ;; TODO: Add 'libxml2-python' for OpenGL ES 1.1 and 2.0 support
256 ("libxrandr" ,libxrandr)
257 ("libxvmc" ,libxvmc)
258 ,@(match (%current-system)
259 ((or "x86_64-linux" "i686-linux")
260 ;; FIXME: Change to 'llvm' in the next rebuild cycle.
261 `(("llvm" ,llvm-without-rtti)))
262 (_
263 `()))
264 ("makedepend" ,makedepend)
265 ("wayland" ,wayland)
266 ("wayland-protocols" ,wayland-protocols)))
267 (native-inputs
268 `(("pkg-config" ,pkg-config)
269 ("python" ,python-2)
270 ("python2-mako" ,python2-mako)
271 ("which" ,(@ (gnu packages base) which))))
272 (arguments
273 `(#:configure-flags
274 '(,@(match (%current-system)
275 ("armhf-linux"
276 ;; TODO: Add etnaviv,imx when libdrm supports etnaviv.
277 '("--with-gallium-drivers=freedreno,nouveau,r300,r600,swrast,tegra,vc4,virgl"))
278 ("aarch64-linux"
279 ;; TODO: Fix svga driver for aarch64 and armhf.
280 '("--with-gallium-drivers=freedreno,nouveau,pl111,r300,r600,swrast,tegra,vc4,virgl"))
281 (_
282 '("--with-gallium-drivers=i915,nouveau,r300,r600,radeonsi,svga,swrast,virgl")))
283 ;; Enable various optional features. TODO: opencl requires libclc,
284 ;; omx requires libomxil-bellagio
285 "--with-platforms=x11,drm,surfaceless,wayland"
286 "--enable-glx-tls" ;Thread Local Storage, improves performance
287 ;; "--enable-opencl"
288 ;; "--enable-omx"
289 "--enable-osmesa"
290 "--enable-xa"
291 ;; features required by wayland
292 "--enable-gles2"
293 "--enable-gbm"
294 "--enable-shared-glapi"
295
296 ;; Enable Vulkan on i686-linux and x86-64-linux.
297 ,@(match (%current-system)
298 ("x86_64-linux"
299 '("--with-vulkan-drivers=intel,radeon"))
300 ;; TODO: Fix intel driver on i686-linux.
301 ("i686-linux"
302 '("--with-vulkan-drivers=radeon"))
303 (_
304 '("")))
305
306 ;; Also enable the tests.
307 "--enable-gallium-tests"
308
309 ;; on non-intel systems, drop i915 and i965
310 ;; from the default dri drivers
311 ,@(match (%current-system)
312 ((or "x86_64-linux" "i686-linux")
313 '("--with-dri-drivers=i915,i965,nouveau,r200,radeon,swrast"
314 "--enable-llvm")) ; default is x86/x86_64 only
315 (_
316 '("--with-dri-drivers=nouveau,r200,radeon,swrast"))))
317 #:modules ((ice-9 match)
318 (srfi srfi-1)
319 (guix build utils)
320 (guix build gnu-build-system))
321 #:phases
322 (modify-phases %standard-phases
323 (add-after
324 'unpack 'patch-create_test_cases
325 (lambda _
326 (substitute* "src/intel/genxml/gen_pack_header.py"
327 (("/usr/bin/env python2") (which "python")))
328 #t))
329 (add-before
330 'build 'fix-dlopen-libnames
331 (lambda* (#:key inputs outputs #:allow-other-keys)
332 (let ((out (assoc-ref outputs "out")))
333 ;; Remain agnostic to .so.X.Y.Z versions while doing
334 ;; the substitutions so we're future-safe.
335 (substitute* "src/glx/dri_common.c"
336 (("dlopen\\(\"libGL\\.so")
337 (string-append "dlopen(\"" out "/lib/libGL.so")))
338 (substitute* "src/egl/drivers/dri2/egl_dri2.c"
339 (("\"libglapi\\.so")
340 (string-append "\"" out "/lib/libglapi.so")))
341 (substitute* "src/gbm/main/backend.c"
342 ;; No need to patch the gbm_gallium_drm.so reference;
343 ;; it's never installed since Mesa removed its
344 ;; egl_gallium support.
345 (("\"gbm_dri\\.so")
346 (string-append "\"" out "/lib/dri/gbm_dri.so")))
347 #t)))
348 (add-after 'install 'symlinks-instead-of-hard-links
349 (lambda* (#:key outputs #:allow-other-keys)
350 ;; All the drivers and gallium targets create hard links upon
351 ;; installation (search for "hardlink each megadriver instance"
352 ;; in the makefiles). This is no good for us since we'd produce
353 ;; nars that contain several copies of these files. Thus, turn
354 ;; them into symlinks, which saves ~124 MiB.
355 (let* ((out (assoc-ref outputs "out"))
356 (lib (string-append out "/lib"))
357 (files (find-files lib
358 (lambda (file stat)
359 (and (string-contains file ".so")
360 (eq? 'regular
361 (stat:type stat))))))
362 (inodes (map (compose stat:ino stat) files)))
363 (for-each (lambda (inode)
364 (match (filter-map (match-lambda
365 ((file ino)
366 (and (= ino inode) file)))
367 (zip files inodes))
368 ((_)
369 #f)
370 ((reference others ..1)
371 (format #t "creating ~a symlinks to '~a'~%"
372 (length others) reference)
373 (for-each delete-file others)
374 (for-each (lambda (file)
375 (if (string=? (dirname file)
376 (dirname reference))
377 (symlink (basename reference)
378 file)
379 (symlink reference file)))
380 others))))
381 (delete-duplicates inodes))
382 #t))))))
383 (home-page "https://mesa3d.org/")
384 (synopsis "OpenGL and Vulkan implementations")
385 (description "Mesa is a free implementation of the OpenGL and Vulkan
386 specifications - systems for rendering interactive 3D graphics. A variety of
387 device drivers allows Mesa to be used in many different environments ranging
388 from software emulation to complete hardware acceleration for modern GPUs.")
389 (license license:x11)))
390
391 (define-public mesa-headers
392 (package
393 (inherit mesa)
394 (name "mesa-headers")
395 (propagated-inputs '())
396 (inputs '())
397 (native-inputs '())
398 (arguments
399 '(#:phases
400 (modify-phases %standard-phases
401 (delete 'configure)
402 (delete 'build)
403 (delete 'check)
404 (replace 'install
405 (lambda* (#:key outputs #:allow-other-keys)
406 (copy-recursively "include" (string-append
407 (assoc-ref outputs "out")
408 "/include"))
409 #t)))))))
410
411 ;;; The mesa-demos distribution contains non-free files, many files with no
412 ;;; clear license information, and many demos that aren't useful for most
413 ;;; people, so we just use this for the mesa-utils package below, and possibly
414 ;;; other packages in the future. This is modeled after Debian's solution.
415 (define (mesa-demos-source version)
416 (origin
417 (method url-fetch)
418 (uri (string-append "ftp://ftp.freedesktop.org/pub/mesa/demos"
419 "/mesa-demos-" version ".tar.bz2"))
420 (sha256 (base32 "0zgzbz55a14hz83gbmm0n9gpjnf5zadzi2kjjvkn6khql2a9rs81"))))
421
422 (define-public mesa-utils
423 (package
424 (name "mesa-utils")
425 (version "8.4.0")
426 (source (mesa-demos-source version))
427 (build-system gnu-build-system)
428 (inputs
429 `(("mesa" ,mesa)
430 ("glut" ,freeglut)
431 ("glew" ,glew)))
432 (native-inputs
433 `(("pkg-config" ,pkg-config)))
434 (arguments
435 '(#:phases
436 (modify-phases %standard-phases
437 (replace
438 'install
439 (lambda* (#:key outputs #:allow-other-keys)
440 (let ((out (assoc-ref outputs "out")))
441 (mkdir-p (string-append out "/bin"))
442 (for-each
443 (lambda (file)
444 (copy-file file (string-append out "/bin/" (basename file))))
445 '("src/xdemos/glxdemo" "src/xdemos/glxgears"
446 "src/xdemos/glxinfo" "src/xdemos/glxheads"))
447 #t))))))
448 (home-page "http://mesa3d.org/")
449 (synopsis "Utility tools for Mesa")
450 (description
451 "The mesa-utils package contains several utility tools for Mesa: glxdemo,
452 glxgears, glxheads, and glxinfo.")
453 ;; glxdemo is public domain; others expat.
454 (license (list license:expat license:public-domain))))
455
456 (define-public glew
457 (package
458 (name "glew")
459 (version "2.0.0")
460 (source (origin
461 (method url-fetch)
462 (uri (string-append "mirror://sourceforge/glew/glew/" version
463 "/glew-" version ".tgz"))
464 (sha256
465 (base32
466 "0r37fg2s1f0jrvwh6c8cz5x6v4wqmhq42qm15cs9qs349q5c6wn5"))
467 (modules '((guix build utils)))
468 (snippet
469 '(begin
470 (substitute* "config/Makefile.linux"
471 (("= cc") "= gcc")
472 (("/lib64") "/lib"))
473 #t))))
474 (build-system gnu-build-system)
475 (arguments
476 '(#:phases (modify-phases %standard-phases (delete 'configure))
477 #:make-flags (list (string-append "GLEW_PREFIX="
478 (assoc-ref %outputs "out"))
479 (string-append "GLEW_DEST="
480 (assoc-ref %outputs "out")))
481 #:tests? #f)) ;no 'check' target
482 (inputs
483 `(("libxi" ,libxi)
484 ("libxmu" ,libxmu)
485 ("libx11" ,libx11)
486 ("mesa" ,mesa)))
487
488 ;; <GL/glew.h> includes <GL/glu.h>.
489 (propagated-inputs `(("glu" ,glu)))
490
491 (home-page "http://glew.sourceforge.net/")
492 (synopsis "OpenGL extension loading library for C and C++")
493 (description
494 "The OpenGL Extension Wrangler Library (GLEW) is a C/C++ extension
495 loading library. GLEW provides efficient run-time mechanisms for determining
496 which OpenGL extensions are supported on the target platform. OpenGL core and
497 extension functionality is exposed in a single header file.")
498 (license license:bsd-3)))
499
500 (define-public guile-opengl
501 (package
502 (name "guile-opengl")
503 (version "0.1.0")
504 (source (origin
505 (method url-fetch)
506 (uri (string-append "mirror://gnu/guile-opengl/guile-opengl-"
507 version ".tar.gz"))
508 (sha256
509 (base32
510 "13qfx4xh8baryxqrv986l848ygd0piqwm6s2s90pxk9c0m9vklim"))))
511 (build-system gnu-build-system)
512 (native-inputs `(("pkg-config" ,pkg-config)))
513 (inputs `(("guile" ,guile-2.2)
514 ("mesa" ,mesa)
515 ("glu" ,glu)
516 ("freeglut" ,freeglut)))
517 (arguments
518 '(#:phases (modify-phases %standard-phases
519 (add-after 'configure 'patch-makefile
520 (lambda _
521 ;; Install compiled Guile files in the expected place.
522 (substitute* '("Makefile")
523 (("^godir = .*$")
524 "godir = $(moddir)\n"))))
525 (add-before 'build 'patch-dynamic-link
526 (lambda* (#:key inputs outputs #:allow-other-keys)
527 (define (dynamic-link-substitute file lib input)
528 (substitute* file
529 (("dynamic-link \"lib([a-zA-Z]+)\"" _ lib)
530 (string-append "dynamic-link \""
531 (assoc-ref inputs input)
532 "/lib/lib" lib "\""))))
533 ;; Replace dynamic-link calls for libGL, libGLU, and
534 ;; libglut with absolute paths to the store.
535 (dynamic-link-substitute "glx/runtime.scm" "GL" "mesa")
536 (dynamic-link-substitute "glu/runtime.scm" "GLU" "glu")
537 (dynamic-link-substitute "glut/runtime.scm" "glut"
538 "freeglut"))))))
539 (home-page "https://gnu.org/s/guile-opengl")
540 (synopsis "Guile binding for the OpenGL graphics API")
541 (description
542 "Guile-OpenGL is a library for Guile that provides bindings to the
543 OpenGL graphics API.")
544 (license license:lgpl3+)))
545
546 (define-public libepoxy
547 (package
548 (name "libepoxy")
549 (version "1.5.3")
550 (source (origin
551 (method url-fetch)
552 (uri (string-append
553 "https://github.com/anholt/libepoxy/releases/download/"
554 version "/libepoxy-" version ".tar.xz"))
555 (sha256
556 (base32
557 "0ga3qjv50x37my6pw5xr14g5n6z78hy5s8s06kays8c3ab2mha80"))))
558 (arguments
559 `(#:phases
560 (modify-phases %standard-phases
561 (delete 'bootstrap)
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 meson-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+)))