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