gnu: Add cl-ana.statistical-learning.
[jackhill/guix/guix.git] / gnu / packages / gl.scm
CommitLineData
daca8666 1;;; GNU Guix --- Functional package management for GNU
187731a5 2;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
822efdff 3;;; Copyright © 2013 Joshua Grant <tadni@riseup.net>
432360d7 4;;; Copyright © 2014, 2016 David Thompson <davet@gnu.org>
d0d0f8d1 5;;; Copyright © 2014, 2015, 2016, 2017 Mark H Weaver <mhw@netris.org>
47956fa0 6;;; Copyright © 2016 ng0 <ng0@n0.is>
872ea4eb 7;;; Copyright © 2016, 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
b4c8c413 8;;; Copyright © 2016 David Thompson <davet@gnu.org>
ba4c0d69 9;;; Copyright © 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
725d8d2c 10;;; Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net>
e6a668ec 11;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
8d6813f9 12;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
5c154738 13;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
daca8666
JG
14;;;
15;;; This file is part of GNU Guix.
16;;;
17;;; GNU Guix is free software; you can redistribute it and/or modify it
18;;; under the terms of the GNU General Public License as published by
19;;; the Free Software Foundation; either version 3 of the License, or (at
20;;; your option) any later version.
21;;;
22;;; GNU Guix is distributed in the hope that it will be useful, but
23;;; WITHOUT ANY WARRANTY; without even the implied warranty of
24;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25;;; GNU General Public License for more details.
26;;;
27;;; You should have received a copy of the GNU General Public License
28;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
29
30(define-module (gnu packages gl)
c4a667bf 31 #:use-module (gnu packages)
b021a2ad 32 #:use-module (gnu packages autotools)
200726ed 33 #:use-module (gnu packages bison)
725d8d2c 34 #:use-module (gnu packages compression)
432360d7 35 #:use-module (gnu packages documentation)
653569e8 36 #:use-module (gnu packages elf)
200726ed 37 #:use-module (gnu packages flex)
3a92a5b3
DC
38 #:use-module (gnu packages fontutils)
39 #:use-module (gnu packages freedesktop)
ce4d7abf 40 #:use-module (gnu packages gettext)
3a92a5b3 41 #:use-module (gnu packages guile)
725d8d2c 42 #:use-module (gnu packages image)
ce4d7abf 43 #:use-module (gnu packages linux)
093c6f8b 44 #:use-module (gnu packages llvm)
bea58fa1 45 #:use-module (gnu packages mono)
3a92a5b3 46 #:use-module (gnu packages pkg-config)
200726ed 47 #:use-module (gnu packages python)
44d10b1f 48 #:use-module (gnu packages python-xyz)
d64f3439 49 #:use-module (gnu packages tls)
7e31978b 50 #:use-module (gnu packages video)
301b2e74 51 #:use-module (gnu packages vulkan)
2b226af1 52 #:use-module (gnu packages xdisorg)
3a92a5b3
DC
53 #:use-module (gnu packages xml)
54 #:use-module (gnu packages xorg)
3a92a5b3 55 #:use-module (guix download)
872ea4eb 56 #:use-module (guix git-download)
5c154738 57 #:use-module (guix hg-download)
3a92a5b3
DC
58 #:use-module (guix build-system gnu)
59 #:use-module (guix build-system cmake)
54d860cc 60 #:use-module (guix build-system meson)
3a92a5b3
DC
61 #:use-module ((guix licenses) #:prefix license:)
62 #:use-module (guix packages)
63 #:use-module (guix utils)
3ee7b4cc 64 #:use-module (ice-9 match)
af403cf0 65 #:use-module ((srfi srfi-1) #:hide (zip)))
daca8666
JG
66
67(define-public glu
68 (package
69 (name "glu")
1dff73ac 70 (version "9.0.1")
daca8666 71 (source (origin
a124bbd2
SB
72 (method url-fetch)
73 (uri (string-append "ftp://ftp.freedesktop.org/pub/mesa/glu/glu-"
74 version ".tar.gz"))
75 (sha256
76 (base32
1dff73ac 77 "1xqhk9bn10nbvffw3r4p4rjslwz1l7gaycc0x2pqkr2irp7q9x7n"))))
daca8666 78 (build-system gnu-build-system)
187731a5 79 (propagated-inputs
a124bbd2 80 `(("mesa" ,mesa))) ; according to glu.pc
daca8666
JG
81 (home-page "http://www.opengl.org/archives/resources/faq/technical/glu.htm")
82 (synopsis "Mesa OpenGL Utility library")
83 (description
84 "GLU, or OpenGL Utility Library provides some higher-level functionality
35b9e423 85not provided by just OpenGL itself. Some of GLU's Features
daca8666
JG
86include: Scaling of 2D images and creation of mipmap pyramids,
87Transformation of object coordinates into device coordinates and
88vice versa, Support for NURBS surfaces, Support for tessellation
89of concave or bow tie polygonal primitives, Specialty transformation
90matrices for creating perspective and orthographic projections,
91positioning a camera, and selection/picking, Rendering of disk,
92cylinder, and sphere primitives, Interpreting OpenGL error values
93as ASCII text.")
584f2e1b 94 (license (license:x11-style "http://directory.fsf.org/wiki/License:SGIFreeBv2"))))
daca8666
JG
95
96(define-public freeglut
97 (package
98 (name "freeglut")
8ce36e81 99 (version "3.0.0")
daca8666 100 (source (origin
a124bbd2
SB
101 (method url-fetch)
102 (uri (string-append
0f971a04 103 "mirror://sourceforge/freeglut/freeglut/"
a124bbd2
SB
104 version "/freeglut-" version ".tar.gz"))
105 (sha256
106 (base32
107 "18knkyczzwbmyg8hr4zh8a1i5ga01np2jzd1rwmsh7mh2n2vwhra"))))
8ce36e81
SB
108 (build-system cmake-build-system)
109 (arguments '(#:tests? #f)) ; no test target
daca8666 110 (inputs `(("mesa" ,mesa)
a124bbd2
SB
111 ("libx11" ,libx11)
112 ("libxi" ,libxi)
113 ("libxrandr" ,libxrandr)
114 ("libxxf86vm" ,libxxf86vm)
82b4d9ec 115 ("xorgproto" ,xorgproto)
a124bbd2 116 ("xinput" ,xinput)))
9b5db9be
TUBK
117 (propagated-inputs
118 ;; Headers from Mesa and GLU are needed.
119 `(("glu" ,glu)
120 ("mesa" ,mesa)))
daca8666
JG
121 (home-page "http://freeglut.sourceforge.net/")
122 (synopsis "Alternative to the OpenGL Utility Toolkit (GLUT)")
123 (description
124 "Freeglut is a completely Free/OpenSourced alternative to
35b9e423 125the OpenGL Utility Toolkit (GLUT) library. GLUT was originally
daca8666 126written by Mark Kilgard to support the sample programs in the
36a4366d 127second edition OpenGL @code{RedBook}. Since then, GLUT has been used
daca8666
JG
128in a wide variety of practical applications because it is simple,
129widely available and highly portable.
130
131GLUT (and hence freeglut) allows the user to create and manage windows
132containing OpenGL contexts on a wide range of platforms and also read
35b9e423 133the mouse, keyboard and joystick functions. Freeglut is released under
daca8666 134the X-Consortium license.")
584f2e1b 135 (license license:x11)))
daca8666 136
0da0f434
RW
137;; Needed for "kiki".
138(define-public freeglut-2.8
139 (package (inherit freeglut)
140 (name "freeglut")
141 (version "2.8.1")
142 (source (origin
143 (method url-fetch)
144 (uri (string-append
145 "mirror://sourceforge/freeglut/freeglut/"
146 version "/freeglut-" version ".tar.gz"))
147 (sha256
148 (base32
149 "16lrxxxd9ps9l69y3zsw6iy0drwjsp6m26d1937xj71alqk6dr6x"))))
150 (build-system gnu-build-system)))
151
daca8666
JG
152(define-public ftgl
153 (package
154 (name "ftgl")
c7e31cde
MB
155 (version "2.4.0")
156 (home-page "https://github.com/frankheckenbach/ftgl")
daca8666 157 (source (origin
c7e31cde
MB
158 (method git-fetch)
159 (uri (git-reference (url home-page)
160 (commit (string-append "v" version))))
161 (file-name (git-file-name name version))
a124bbd2
SB
162 (sha256
163 (base32
c7e31cde 164 "0zjs1h9w30gajq9lndzvjsa26rsmr1081lb1fbpbj10yhcdcsc79"))))
daca8666 165 (build-system gnu-build-system)
2e652add
MB
166 (arguments
167 `(#:configure-flags '("--disable-static")))
9e850534
RW
168 ;; The pkg-config file lists "freetype2" as Requires.private.
169 (propagated-inputs `(("freetype" ,freetype)))
170 (inputs `(("libx11" ,libx11)
a124bbd2
SB
171 ("mesa" ,mesa)
172 ("glu" ,glu)))
a53a5b71 173 (native-inputs
c7e31cde
MB
174 `(("pkg-config" ,pkg-config)
175 ("autoconf" ,autoconf)
176 ("automake" ,automake)
177 ("libtool" ,libtool)))
daca8666
JG
178 (synopsis "Font rendering library for OpenGL applications")
179 (description
35b9e423 180 "FTGL is a font rendering library for OpenGL applications. Supported
daca8666 181rendering modes are: Bitmaps, Anti-aliased pixmaps, Texture maps, Outlines,
e881752c 182Polygon meshes, and Extruded polygon meshes.")
584f2e1b 183 (license license:x11)))
200726ed 184
b021a2ad
TUBK
185(define-public s2tc
186 (package
187 (name "s2tc")
188 (version "1.0")
189 (source
190 (origin
872ea4eb
RW
191 (method git-fetch)
192 (uri (git-reference
193 (url "https://github.com/divVerent/s2tc.git")
194 (commit (string-append "v" version))))
195 (file-name (git-file-name name version))
b021a2ad 196 (sha256
872ea4eb 197 (base32 "1fg323fk7wlv2xh6lw66wswgcv6qi8aaadk7c28h2f2lj1s7njnf"))))
b021a2ad
TUBK
198 (build-system gnu-build-system)
199 (native-inputs
200 `(("autoconf" ,autoconf)
201 ("automake" ,automake)
202 ("libtool" ,libtool)))
203 (inputs
204 `(("mesa-headers" ,mesa-headers)))
b021a2ad
TUBK
205 (home-page "https://github.com/divVerent/s2tc")
206 (synopsis "S3 Texture Compression implementation")
207 (description
208 "S2TC is a patent-free implementation of S3 Texture Compression (S3TC,
209also known as DXTn or DXTC) for Mesa.")
584f2e1b 210 (license license:expat)))
b021a2ad 211
7e31978b
TUBK
212;;; Mesa needs LibVA headers to build its Gallium-based VA API implementation;
213;;; LibVA itself depends on Mesa. We use the following to solve the circular
214;;; dependency.
215(define libva-without-mesa
216 ;; Delay to work around circular import problem.
217 (delay
218 (package
219 (inherit libva)
220 (name "libva-without-mesa")
3ee7b4cc
EF
221 (inputs `(,@(fold alist-delete (package-inputs libva)
222 '("mesa" "wayland"))))
7e31978b
TUBK
223 (arguments
224 (strip-keyword-arguments
225 '(#:make-flags)
226 (substitute-keyword-arguments (package-arguments libva)
227 ((#:configure-flags flags)
228 '(list "--disable-glx" "--disable-egl"))))))))
229
200726ed
JD
230(define-public mesa
231 (package
232 (name "mesa")
178611c8 233 (version "19.2.1")
200726ed
JD
234 (source
235 (origin
236 (method url-fetch)
57cdc1fa
MB
237 (uri (list (string-append "https://mesa.freedesktop.org/archive/"
238 "mesa-" version ".tar.xz")
239 (string-append "ftp://ftp.freedesktop.org/pub/mesa/"
0315b20a
MB
240 "mesa-" version ".tar.xz")
241 (string-append "ftp://ftp.freedesktop.org/pub/mesa/"
242 version "/mesa-" version ".tar.xz")))
200726ed 243 (sha256
ce4d7abf 244 (base32
178611c8 245 "1s81kwcjkkahnf5y5mshmd3q9j057hhsai7awpq6yb6im2hkriac"))
17f2b485 246 (patches
2737c7fe
MB
247 (search-patches "mesa-skip-disk-cache-test.patch"
248 "mesa-timespec-test-32bit.patch"))))
f6dadee4 249 (build-system meson-build-system)
200726ed 250 (propagated-inputs
70b02a6a 251 `(;; The following are in the Requires.private field of gl.pc.
ce4d7abf 252 ("libdrm" ,libdrm)
4ea1ad91 253 ("libvdpau" ,libvdpau)
8bb1699b 254 ("libx11" ,libx11)
200726ed 255 ("libxdamage" ,libxdamage)
45191970
TUBK
256 ("libxfixes" ,libxfixes)
257 ("libxshmfence" ,libxshmfence)
70b02a6a
MB
258 ("libxxf86vm" ,libxxf86vm)
259 ("xorgproto" ,xorgproto)))
200726ed 260 (inputs
e0b744f1 261 `(("expat" ,expat)
9b3b4c05 262 ("libelf" ,elfutils) ;required for r600 when using llvm
7e31978b 263 ("libva" ,(force libva-without-mesa))
200726ed 264 ("libxml2" ,libxml2)
ce4d7abf 265 ;; TODO: Add 'libxml2-python' for OpenGL ES 1.1 and 2.0 support
aea3ec0f 266 ("libxrandr" ,libxrandr)
0272ee49 267 ("libxvmc" ,libxvmc)
c5e91014
EF
268 ,@(match (%current-system)
269 ((or "x86_64-linux" "i686-linux")
64766d5c 270 `(("llvm" ,llvm)))
c5e91014
EF
271 (_
272 `()))
3e71b9ff 273 ("makedepend" ,makedepend)
cb639269
MB
274 ("wayland" ,wayland)
275 ("wayland-protocols" ,wayland-protocols)))
200726ed 276 (native-inputs
f6dadee4
RH
277 `(("bison" ,bison)
278 ("flex" ,flex)
279 ("gettext" ,gettext-minimal)
301b2e74
RH
280 ,@(match (%current-system)
281 ((or "x86_64-linux" "i686-linux")
47406a92 282 `(("glslang" ,glslang)))
301b2e74
RH
283 (_
284 `()))
f6dadee4 285 ("pkg-config" ,pkg-config)
178611c8 286 ("python" ,python-wrapper)
17c3e0d8 287 ("python-mako" ,python-mako)
653569e8 288 ("which" ,(@ (gnu packages base) which))))
200726ed 289 (arguments
ce4d7abf 290 `(#:configure-flags
2a8b89c2 291 '(,@(match (%current-system)
cd9f99f1 292 ((or "armhf-linux" "aarch64-linux")
31c70cce 293 ;; TODO: Fix svga driver for aarch64 and armhf.
688d8f22 294 '("-Dgallium-drivers=etnaviv,freedreno,nouveau,r300,r600,swrast,tegra,v3d,vc4,virgl"))
2a8b89c2 295 (_
688d8f22 296 '("-Dgallium-drivers=iris,nouveau,r300,r600,radeonsi,svga,swrast,virgl")))
3e2570d8
TUBK
297 ;; Enable various optional features. TODO: opencl requires libclc,
298 ;; omx requires libomxil-bellagio
f6dadee4
RH
299 "-Dplatforms=x11,drm,surfaceless,wayland"
300 "-Dglx=dri" ;Thread Local Storage, improves performance
301 ;; "-Dopencl=true"
302 ;; "-Domx=true"
303 "-Dosmesa=gallium"
304 "-Dgallium-xa=true"
305
8ea75f27 306 ;; features required by wayland
f6dadee4
RH
307 "-Dgles2=true"
308 "-Dgbm=true"
309 "-Dshared-glapi=true"
0315b20a 310
abdb97f8 311 ;; Enable Vulkan on i686-linux and x86-64-linux.
6713e9cb 312 ,@(match (%current-system)
3f14c913 313 ((or "i686-linux" "x86_64-linux")
f6dadee4 314 '("-Dvulkan-drivers=intel,amd"))
6713e9cb 315 (_
7d1494d9 316 '("-Dvulkan-drivers=auto")))
6713e9cb 317
301b2e74
RH
318 ;; Enable the Vulkan overlay layer on i686-linux and x86-64-linux.
319 ,@(match (%current-system)
320 ((or "x86_64-linux" "i686-linux")
321 '("-Dvulkan-overlay-layer=true"))
322 (_
93ef8ca6 323 '()))
301b2e74 324
044006f3 325 ;; Also enable the tests.
f6dadee4 326 "-Dbuild-tests=true"
0f481f06
MW
327
328 ;; on non-intel systems, drop i915 and i965
329 ;; from the default dri drivers
330 ,@(match (%current-system)
331 ((or "x86_64-linux" "i686-linux")
f6dadee4
RH
332 '("-Ddri-drivers=i915,i965,nouveau,r200,r100"
333 "-Dllvm=true")) ; default is x86/x86_64 only
0f481f06 334 (_
f6dadee4 335 '("-Ddri-drivers=nouveau,r200,r100"))))
6fe808f4
MB
336
337 ;; XXX: 'debugoptimized' causes LTO link failures on some drivers. The
338 ;; documentation recommends using 'release' for performance anyway.
339 #:build-type "release"
340
dcc00f54
LC
341 #:modules ((ice-9 match)
342 (srfi srfi-1)
343 (guix build utils)
f6dadee4 344 (guix build meson-build-system))
e8a7a180
EF
345 #:phases
346 (modify-phases %standard-phases
347 (add-after
348 'unpack 'patch-create_test_cases
349 (lambda _
e8a7a180 350 (substitute* "src/intel/genxml/gen_pack_header.py"
0315b20a
MB
351 (("/usr/bin/env python2") (which "python")))
352 #t))
ccbc1c5e
PN
353 ,@(if (string-prefix? "i686" (or (%current-target-system)
354 (%current-system)))
4bed3b10
MB
355 ;; Disable new test from Mesa 19 that fails on i686. Upstream
356 ;; report: <https://bugs.freedesktop.org/show_bug.cgi?id=110612>.
357 `((add-after 'unpack 'disable-failing-test
358 (lambda _
359 (substitute* "src/gallium/tests/unit/meson.build"
360 (("'u_format_test',") ""))
361 #t)))
362 '())
e8a7a180 363 (add-before
f6dadee4 364 'configure 'fix-dlopen-libnames
e8a7a180 365 (lambda* (#:key inputs outputs #:allow-other-keys)
db481977 366 (let ((out (assoc-ref outputs "out")))
e8a7a180
EF
367 ;; Remain agnostic to .so.X.Y.Z versions while doing
368 ;; the substitutions so we're future-safe.
e8a7a180
EF
369 (substitute* "src/glx/dri_common.c"
370 (("dlopen\\(\"libGL\\.so")
371 (string-append "dlopen(\"" out "/lib/libGL.so")))
372 (substitute* "src/egl/drivers/dri2/egl_dri2.c"
373 (("\"libglapi\\.so")
374 (string-append "\"" out "/lib/libglapi.so")))
375 (substitute* "src/gbm/main/backend.c"
376 ;; No need to patch the gbm_gallium_drm.so reference;
377 ;; it's never installed since Mesa removed its
378 ;; egl_gallium support.
379 (("\"gbm_dri\\.so")
0315b20a 380 (string-append "\"" out "/lib/dri/gbm_dri.so")))
dcc00f54
LC
381 #t)))
382 (add-after 'install 'symlinks-instead-of-hard-links
383 (lambda* (#:key outputs #:allow-other-keys)
384 ;; All the drivers and gallium targets create hard links upon
385 ;; installation (search for "hardlink each megadriver instance"
386 ;; in the makefiles). This is no good for us since we'd produce
387 ;; nars that contain several copies of these files. Thus, turn
388 ;; them into symlinks, which saves ~124 MiB.
389 (let* ((out (assoc-ref outputs "out"))
390 (lib (string-append out "/lib"))
391 (files (find-files lib
392 (lambda (file stat)
393 (and (string-contains file ".so")
394 (eq? 'regular
395 (stat:type stat))))))
396 (inodes (map (compose stat:ino stat) files)))
397 (for-each (lambda (inode)
398 (match (filter-map (match-lambda
399 ((file ino)
400 (and (= ino inode) file)))
401 (zip files inodes))
402 ((_)
403 #f)
404 ((reference others ..1)
405 (format #t "creating ~a symlinks to '~a'~%"
406 (length others) reference)
407 (for-each delete-file others)
408 (for-each (lambda (file)
409 (if (string=? (dirname file)
410 (dirname reference))
411 (symlink (basename reference)
412 file)
413 (symlink reference file)))
414 others))))
415 (delete-duplicates inodes))
0315b20a
MB
416 #t))))))
417 (home-page "https://mesa3d.org/")
6713e9cb
RH
418 (synopsis "OpenGL and Vulkan implementations")
419 (description "Mesa is a free implementation of the OpenGL and Vulkan
420specifications - systems for rendering interactive 3D graphics. A variety of
421device drivers allows Mesa to be used in many different environments ranging
422from software emulation to complete hardware acceleration for modern GPUs.")
584f2e1b 423 (license license:x11)))
7025a035 424
fae42942
RW
425(define-public mesa-opencl
426 (package
427 (inherit mesa)
428 (name "mesa-opencl")
429 (arguments
430 (substitute-keyword-arguments (package-arguments mesa)
431 ((#:configure-flags flags)
432 `(cons "-Dgallium-opencl=standalone" ,flags))))
433 (inputs
434 `(("libclc" ,libclc)
435 ,@(package-inputs mesa)))
436 (native-inputs
437 `(("clang" ,clang)
438 ,@(package-native-inputs mesa)))))
439
37cb4e5b
RW
440(define-public mesa-opencl-icd
441 (package
442 (inherit mesa-opencl)
443 (name "mesa-opencl-icd")
444 (arguments
445 (substitute-keyword-arguments (package-arguments mesa)
446 ((#:configure-flags flags)
447 `(cons "-Dgallium-opencl=icd"
448 ,(delete "-Dgallium-opencl=standalone" flags)))))))
449
b021a2ad
TUBK
450(define-public mesa-headers
451 (package
452 (inherit mesa)
453 (name "mesa-headers")
454 (propagated-inputs '())
455 (inputs '())
456 (native-inputs '())
457 (arguments
458 '(#:phases
459 (modify-phases %standard-phases
f8503e2b
LC
460 (delete 'configure)
461 (delete 'build)
462 (delete 'check)
463 (replace 'install
51b491b0
MW
464 (lambda* (#:key outputs #:allow-other-keys)
465 (copy-recursively "include" (string-append
466 (assoc-ref outputs "out")
467 "/include"))
468 #t)))))))
b021a2ad 469
c90a50eb
TUBK
470;;; The mesa-demos distribution contains non-free files, many files with no
471;;; clear license information, and many demos that aren't useful for most
472;;; people, so we just use this for the mesa-utils package below, and possibly
473;;; other packages in the future. This is modeled after Debian's solution.
474(define (mesa-demos-source version)
475 (origin
476 (method url-fetch)
18cbba26 477 (uri (string-append "ftp://ftp.freedesktop.org/pub/mesa/demos"
c90a50eb 478 "/mesa-demos-" version ".tar.bz2"))
18cbba26 479 (sha256 (base32 "0zgzbz55a14hz83gbmm0n9gpjnf5zadzi2kjjvkn6khql2a9rs81"))))
c90a50eb
TUBK
480
481(define-public mesa-utils
482 (package
483 (name "mesa-utils")
18cbba26 484 (version "8.4.0")
c90a50eb
TUBK
485 (source (mesa-demos-source version))
486 (build-system gnu-build-system)
487 (inputs
488 `(("mesa" ,mesa)
489 ("glut" ,freeglut)
490 ("glew" ,glew)))
491 (native-inputs
492 `(("pkg-config" ,pkg-config)))
493 (arguments
7fe3f8cf 494 '(#:phases
c90a50eb
TUBK
495 (modify-phases %standard-phases
496 (replace
f8503e2b 497 'install
c90a50eb
TUBK
498 (lambda* (#:key outputs #:allow-other-keys)
499 (let ((out (assoc-ref outputs "out")))
500 (mkdir-p (string-append out "/bin"))
501 (for-each
502 (lambda (file)
503 (copy-file file (string-append out "/bin/" (basename file))))
504 '("src/xdemos/glxdemo" "src/xdemos/glxgears"
feb08043
MW
505 "src/xdemos/glxinfo" "src/xdemos/glxheads"))
506 #t))))))
7c22aa63 507 (home-page "https://mesa3d.org/")
c90a50eb
TUBK
508 (synopsis "Utility tools for Mesa")
509 (description
510 "The mesa-utils package contains several utility tools for Mesa: glxdemo,
511glxgears, glxheads, and glxinfo.")
512 ;; glxdemo is public domain; others expat.
584f2e1b 513 (license (list license:expat license:public-domain))))
c90a50eb 514
524f4bec
LC
515(define-public glew
516 (package
517 (name "glew")
bbc94a08 518 (version "2.1.0")
524f4bec
LC
519 (source (origin
520 (method url-fetch)
de67e922
LF
521 (uri (string-append "mirror://sourceforge/glew/glew/" version
522 "/glew-" version ".tgz"))
524f4bec
LC
523 (sha256
524 (base32
bbc94a08 525 "159wk5dc0ykjbxvag5i1m2mhp23zkk6ra04l26y3jc3nwvkr3ph4"))
524f4bec
LC
526 (modules '((guix build utils)))
527 (snippet
6cbee49d
MW
528 '(begin
529 (substitute* "config/Makefile.linux"
530 (("= cc") "= gcc")
531 (("/lib64") "/lib"))
532 #t))))
524f4bec
LC
533 (build-system gnu-build-system)
534 (arguments
dc1d3cde 535 '(#:phases (modify-phases %standard-phases (delete 'configure))
524f4bec
LC
536 #:make-flags (list (string-append "GLEW_PREFIX="
537 (assoc-ref %outputs "out"))
538 (string-append "GLEW_DEST="
539 (assoc-ref %outputs "out")))
540 #:tests? #f)) ;no 'check' target
541 (inputs
542 `(("libxi" ,libxi)
543 ("libxmu" ,libxmu)
544 ("libx11" ,libx11)
545 ("mesa" ,mesa)))
546
547 ;; <GL/glew.h> includes <GL/glu.h>.
548 (propagated-inputs `(("glu" ,glu)))
549
550 (home-page "http://glew.sourceforge.net/")
551 (synopsis "OpenGL extension loading library for C and C++")
552 (description
553 "The OpenGL Extension Wrangler Library (GLEW) is a C/C++ extension
554loading library. GLEW provides efficient run-time mechanisms for determining
555which OpenGL extensions are supported on the target platform. OpenGL core and
556extension functionality is exposed in a single header file.")
584f2e1b 557 (license license:bsd-3)))
524f4bec 558
7025a035
DT
559(define-public guile-opengl
560 (package
561 (name "guile-opengl")
562 (version "0.1.0")
563 (source (origin
564 (method url-fetch)
565 (uri (string-append "mirror://gnu/guile-opengl/guile-opengl-"
566 version ".tar.gz"))
567 (sha256
568 (base32
569 "13qfx4xh8baryxqrv986l848ygd0piqwm6s2s90pxk9c0m9vklim"))))
570 (build-system gnu-build-system)
571 (native-inputs `(("pkg-config" ,pkg-config)))
42994090 572 (inputs `(("guile" ,guile-2.2)
7025a035 573 ("mesa" ,mesa)
4becc792 574 ("glu" ,glu)
7025a035
DT
575 ("freeglut" ,freeglut)))
576 (arguments
0e215f49
DT
577 '(#:phases (modify-phases %standard-phases
578 (add-after 'configure 'patch-makefile
579 (lambda _
580 ;; Install compiled Guile files in the expected place.
581 (substitute* '("Makefile")
582 (("^godir = .*$")
583 "godir = $(moddir)\n"))))
584 (add-before 'build 'patch-dynamic-link
585 (lambda* (#:key inputs outputs #:allow-other-keys)
586 (define (dynamic-link-substitute file lib input)
587 (substitute* file
588 (("dynamic-link \"lib([a-zA-Z]+)\"" _ lib)
589 (string-append "dynamic-link \""
590 (assoc-ref inputs input)
591 "/lib/lib" lib "\""))))
592 ;; Replace dynamic-link calls for libGL, libGLU, and
593 ;; libglut with absolute paths to the store.
594 (dynamic-link-substitute "glx/runtime.scm" "GL" "mesa")
595 (dynamic-link-substitute "glu/runtime.scm" "GLU" "glu")
596 (dynamic-link-substitute "glut/runtime.scm" "glut"
597 "freeglut"))))))
cc7a5c71 598 (home-page "https://gnu.org/s/guile-opengl")
66672a45 599 (synopsis "Guile binding for the OpenGL graphics API")
7025a035 600 (description
66672a45
LC
601 "Guile-OpenGL is a library for Guile that provides bindings to the
602OpenGL graphics API.")
584f2e1b 603 (license license:lgpl3+)))
131ddf99
AW
604
605(define-public libepoxy
606 (package
607 (name "libepoxy")
54d860cc 608 (version "1.5.3")
131ddf99
AW
609 (source (origin
610 (method url-fetch)
611 (uri (string-append
3d3d4014
EF
612 "https://github.com/anholt/libepoxy/releases/download/"
613 version "/libepoxy-" version ".tar.xz"))
131ddf99
AW
614 (sha256
615 (base32
54d860cc 616 "0ga3qjv50x37my6pw5xr14g5n6z78hy5s8s06kays8c3ab2mha80"))))
131ddf99 617 (arguments
9bbd52e5 618 `(#:phases
5f8dd6dc 619 (modify-phases %standard-phases
54d860cc 620 (delete 'bootstrap)
5f8dd6dc
EF
621 (add-before
622 'configure 'patch-paths
623 (lambda* (#:key inputs #:allow-other-keys)
624 (let ((python (assoc-ref inputs "python"))
625 (mesa (assoc-ref inputs "mesa")))
626 (substitute* "src/gen_dispatch.py"
627 (("/usr/bin/env python") python))
628 (substitute* (find-files "." "\\.[ch]$")
629 (("libGL.so.1") (string-append mesa "/lib/libGL.so.1"))
630 (("libEGL.so.1") (string-append mesa "/lib/libEGL.so.1")))
5f8dd6dc 631 #t))))))
54d860cc 632 (build-system meson-build-system)
131ddf99 633 (native-inputs
827dc629 634 `(("pkg-config" ,pkg-config)
131ddf99
AW
635 ("python" ,python)))
636 (inputs
637 `(("mesa" ,mesa)))
3d3d4014 638 (home-page "https://github.com/anholt/libepoxy/")
131ddf99
AW
639 (synopsis "A library for handling OpenGL function pointer management")
640 (description
641 "A library for handling OpenGL function pointer management.")
584f2e1b 642 (license license:x11)))
2b226af1
DT
643
644(define-public soil
645 (package
646 (name "soil")
647 (version "1.0.7")
648 (source (origin
649 (method url-fetch)
650 ;; No versioned archive available.
651 (uri "http://www.lonesock.net/files/soil.zip")
652 (sha256
653 (base32
654 "00gpwp9dldzhsdhksjvmbhsd2ialraqbv6v6dpikdmpncj6mnc52"))))
655 (build-system gnu-build-system)
656 (arguments
657 '(#:tests? #f ; no tests
658 #:phases (modify-phases %standard-phases
659 (delete 'configure)
660 (add-before 'build 'init-build
661 (lambda* (#:key outputs #:allow-other-keys)
662 (let ((out (assoc-ref outputs "out")))
663 (setenv "CFLAGS" "-fPIC") ; needed for shared library
664 ;; Use alternate Makefile
665 (copy-file "projects/makefile/alternate Makefile.txt"
666 "src/Makefile")
667 (chdir "src")
668 (substitute* '("Makefile")
669 (("INCLUDEDIR = /usr/include/SOIL")
670 (string-append "INCLUDEDIR = " out "/include/SOIL"))
671 (("LIBDIR = /usr/lib")
672 (string-append "LIBDIR = " out "/lib"))
673 ;; Remove these flags from 'install' commands.
674 (("-o root -g root") ""))))))))
675 (native-inputs
676 `(("unzip" ,unzip)))
677 (inputs
678 `(("mesa" ,mesa)))
c0f6eebb 679 (home-page "https://www.lonesock.net/soil.html")
2b226af1
DT
680 (synopsis "OpenGL texture loading library")
681 (description
682 "SOIL is a tiny C library used primarily for uploading textures into
683OpenGL.")
584f2e1b 684 (license license:public-domain)))
432360d7
DT
685
686(define-public glfw
687 (package
688 (name "glfw")
689 (version "3.2.1")
690 (source (origin
691 (method url-fetch)
692 (uri (string-append "https://github.com/glfw/glfw"
693 "/releases/download/" version
694 "/glfw-" version ".zip"))
695 (sha256
696 (base32
697 "09kk5yc1zhss9add8ryqrngrr16hdmc94rszgng135bhw09mxmdp"))))
698 (build-system cmake-build-system)
699 (arguments
700 '(#:tests? #f ; no test target
701 #:configure-flags '("-DBUILD_SHARED_LIBS=ON")))
702 (native-inputs
703 `(("doxygen" ,doxygen)
704 ("unzip" ,unzip)))
a966281f
LC
705 (propagated-inputs
706 `(("mesa" ,mesa) ;included in public headers
707
708 ;; These are in 'Requires.private' of 'glfw3.pc'.
432360d7
DT
709 ("libx11" ,libx11)
710 ("libxrandr" ,libxrandr)
711 ("libxinerama" ,libxinerama)
a966281f
LC
712 ("libxcursor" ,libxcursor)
713 ("libxxf86vm" ,libxxf86vm)))
432360d7
DT
714 (home-page "http://www.glfw.org")
715 (synopsis "OpenGL application development library")
716 (description
717 "GLFW is a library for OpenGL, OpenGL ES and Vulkan development for
718desktop computers. It provides a simple API for creating windows, contexts
719and surfaces, receiving input and events.")
720 (license license:zlib)))
78acbcb5
RW
721
722(define-public nanovg-for-extempore
723 (package
724 (name "nanovg-for-extempore")
725 (version "0.7.1")
726 (source (origin
727 (method url-fetch)
728 (uri (string-append "https://github.com/extemporelang/nanovg/"
729 "archive/" version ".tar.gz"))
730 (file-name (string-append name "-" version ".tar.gz"))
731 (sha256
732 (base32
733 "0ivs1sagq19xiw8jxd9f8w2b39svi0n9hrbmdvckwvqg95r8701g"))))
734 (build-system cmake-build-system)
735 (arguments `(#:tests? #f)) ; no tests included
736 (inputs
737 `(("mesa" ,mesa)))
39162ee4
RW
738 ;; Extempore refuses to build on architectures other than x86_64
739 (supported-systems '("x86_64-linux"))
78acbcb5
RW
740 (home-page "https://github.com/extemporelang/nanovg")
741 (synopsis "2D vector drawing library on top of OpenGL")
742 (description "NanoVG is small antialiased vector graphics rendering
743library for OpenGL. It has lean API modeled after HTML5 canvas API. It is
744aimed to be a practical and fun toolset for building scalable user interfaces
745and visualizations.")
746 (license license:zlib)))
725d8d2c
AI
747
748(define-public gl2ps
749 (package
750 (name "gl2ps")
905d15e1 751 (version "1.4.0")
725d8d2c
AI
752 (source
753 (origin
754 (method url-fetch)
755 (uri (string-append
756 "http://geuz.org/gl2ps/src/gl2ps-"
757 version ".tgz"))
758 (sha256
759 (base32
905d15e1 760 "1qpidkz8x3bxqf69hlhyz1m0jmfi9kq24fxsp7rq6wfqzinmxjq3"))))
725d8d2c
AI
761 (build-system cmake-build-system)
762 (inputs
763 `(("libpng" ,libpng)
764 ("mesa" ,mesa)
765 ("zlib" ,zlib)))
766 (arguments
767 `(#:tests? #f)) ;; no tests
768 (home-page "http://www.geuz.org/gl2ps/")
769 (synopsis "OpenGL to PostScript printing library")
770 (description "GL2PS is a C library providing high quality vector
771output for any OpenGL application. GL2PS uses sorting algorithms
772capable of handling intersecting and stretched polygons, as well as
773non-manifold objects. GL2PS provides many features including advanced
774smooth shading and text rendering, culling of invisible primitives and
775mixed vector/bitmap output.")
905d15e1 776 ;; GL2PS is dual-licenced and can be used under the terms of either.
725d8d2c
AI
777 (license (list license:lgpl2.0+
778 (license:fsf-free "http://www.geuz.org/gl2ps/COPYING.GL2PS"
779 "GPL-incompatible copyleft license")))))
d64f3439
RH
780
781(define-public virtualgl
782 (package
783 (name "virtualgl")
0cece1b5 784 (version "2.6.2")
d64f3439
RH
785 (source
786 (origin
bd7daf9c
RW
787 (method git-fetch)
788 (uri (git-reference
789 (url "https://github.com/VirtualGL/virtualgl.git")
790 (commit version)))
791 (file-name (git-file-name name version))
d64f3439 792 (sha256
0cece1b5 793 (base32 "0yyc553xsb5n0rx7jp9p4wdbd7md07b3qrkf3ssyjavqqg908qg9"))))
d64f3439 794 (arguments
c30fd002 795 `(#:tests? #f ; no tests are available
07b8ea84 796 #:configure-flags (list
c30fd002
TGR
797 (string-append "-DCMAKE_INSTALL_LIBDIR="
798 (assoc-ref %outputs "out") "/lib")
799 "-DVGL_USESSL=1"))) ; use OpenSSL
d64f3439
RH
800 (build-system cmake-build-system)
801 (inputs `(("glu" ,glu)
802 ("libjpeg-turbo" ,libjpeg-turbo)
c30fd002 803 ("libxtst" ,libxtst)
d64f3439
RH
804 ("mesa" ,mesa)
805 ("openssl" ,openssl)))
c695fb76 806 (native-inputs `(("pkg-config" ,pkg-config)))
d64f3439
RH
807 (home-page "https://www.virtualgl.org")
808 (synopsis "Redirects 3D commands from an OpenGL application onto a 3D
809graphics card")
810 (description "VirtualGL redirects the 3D rendering commands from OpenGL
811applications to 3D accelerator hardware in a dedicated server and displays the
812rendered output interactively to a thin client located elsewhere on the
813network.")
814 (license license:wxwindows3.1+)))
5c154738
PN
815
816(define-public mojoshader
817 (let ((changeset "5887634ea695"))
818 (package
819 (name "mojoshader")
3429f5d9 820 (version (string-append "20190825" "-" changeset))
5c154738
PN
821 (source
822 (origin
823 (method hg-fetch)
824 (uri (hg-reference
825 (url "https://hg.icculus.org/icculus/mojoshader/")
826 (changeset changeset)))
827 (file-name (git-file-name name version))
828 (sha256
829 (base32 "0ibl4z1696jiifv9j5drir7jm0b5px0vwkwckbi7cfd46p7p6wcy"))))
830 (arguments
831 ;; Tests only for COMPILER_SUPPORT=ON.
832 `(#:tests? #f
3429f5d9
PN
833 #:configure-flags '("-DBUILD_SHARED=ON"
834 "-DFLIP_VIEWPORT=ON"
835 "-DDEPTH_CLIPPING=ON")
5c154738
PN
836 #:phases
837 (modify-phases %standard-phases
838 (replace 'install
839 (lambda* (#:key outputs #:allow-other-keys)
840 (let* ((out (assoc-ref outputs "out"))
841 (lib (string-append out "/lib"))
842 (header (string-append out "/include")))
843 (install-file "libmojoshader.so" lib)
844 (for-each (lambda (f)
845 (install-file f header))
846 (find-files "../source" "mojoshader.*\\.h$"))
847 (let ((profiles-header (string-append header "/profiles")))
848 (mkdir-p profiles-header)
849 (rename-file (string-append header "/mojoshader_profile.h")
850 (string-append profiles-header "/mojoshader_profile.h"))))
851 #t)))))
852 (build-system cmake-build-system)
853 (home-page "https://www.icculus.org/mojoshader/")
854 (synopsis "Work with Direct3D shaders on alternate 3D APIs")
855 (description "MojoShader is a library to work with Direct3D shaders on
856alternate 3D APIs and non-Windows platforms. The primary motivation is moving
857shaders to OpenGL languages on the fly. The developer deals with \"profiles\"
858that represent various target languages, such as GLSL or ARB_*_program.
859
860This allows a developer to manage one set of shaders, presumably written in
861Direct3D HLSL, and use them across multiple rendering backends. This also
862means that the developer only has to worry about one (offline) compiler to
863manage program complexity, while MojoShader itself deals with the reduced
864complexity of the bytecode at runtime.
865
866MojoShader provides both a simple API to convert bytecode to various profiles,
867and (optionally) basic glue to rendering APIs to abstract the management of
868the shaders at runtime.")
869 (license license:zlib))))
b150e83b
PN
870
871(define-public mojoshader-with-viewport-flip
872 ;; Changeset c586d4590241 replaced glProgramViewportFlip with
873 ;; glProgramViewportInfo.
874 ;; https://hg.icculus.org/icculus/mojoshader/rev/c586d4590241
875 (let ((changeset "2e37299b13d8"))
876 (package
877 (inherit mojoshader)
878 (name "mojoshader-with-viewport-flip")
879 (version (string-append "20190725" "-" changeset))
880 (source
881 (origin
882 (method hg-fetch)
883 (uri (hg-reference
884 (url "https://hg.icculus.org/icculus/mojoshader/")
885 (changeset changeset)))
886 (file-name (git-file-name name version))
887 (sha256
888 (base32 "0ffws7cqbskxwc3hjsnnzq4r2bbf008kdr3b11pa3kr7dsi50y6i"))))
889 (synopsis "Work with Direct3D shaders on alternate 3D APIs (with viewport flip)")
890 (description "This is the last version of the mojoshader library with
891the glProgramViewportFlip before it was replaced with glProgramViewportInfo.")
892 (license license:zlib))))
bea58fa1
PN
893
894(define-public mojoshader-cs
895 (let ((commit "10d0dba21ff1cfe332eb7de328a2adce01286bd7"))
896 (package
897 (name "mojoshader-cs")
898 (version (git-version "20191205" "1" commit))
899 (source (origin
900 (method git-fetch)
901 (uri (git-reference
902 (url "https://github.com/FNA-XNA/MojoShader")
903 (commit commit)))
904 (file-name (git-file-name name version))
905 (sha256
906 (base32
907 "11mdhf3fmb9rsn2iv753gmb596j4dh5j2iipgw078vg0lj23rml7"))))
908 (build-system gnu-build-system)
909 (arguments
910 '(#:tests? #f ; No tests.
911 #:phases
912 (modify-phases %standard-phases
913 (delete 'configure)
914 (replace 'build
915 (lambda _
916 (invoke "make" "-C" "csharp")))
917 (replace 'install
918 (lambda* (#:key outputs #:allow-other-keys)
919 (let ((out (assoc-ref outputs "out")))
920 (install-file "csharp/bin/MojoShader-CS.dll" (string-append out "/lib"))
921 #t))))))
922 (native-inputs
923 `(("mono" ,mono)))
924 (home-page "https://github.com/FNA-XNA/MojoShader")
925 (synopsis "C# wrapper for MojoShader")
926 (description
927 "Mojoshader-CS provides C# bindings for the Mojoshader library.
928The C# wrapper was written to be used for FNA's platform support. However, this
929is written in a way that can be used for any general C# application.")
930 (license license:zlib))))