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