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