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