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> |
cc7a5c71 | 6 | ;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is> |
78acbcb5 | 7 | ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net> |
b4c8c413 | 8 | ;;; Copyright © 2016 David Thompson <davet@gnu.org> |
daca8666 JG |
9 | ;;; |
10 | ;;; This file is part of GNU Guix. | |
11 | ;;; | |
12 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
13 | ;;; under the terms of the GNU General Public License as published by | |
14 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
15 | ;;; your option) any later version. | |
16 | ;;; | |
17 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
18 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | ;;; GNU General Public License for more details. | |
21 | ;;; | |
22 | ;;; You should have received a copy of the GNU General Public License | |
23 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
24 | ||
25 | (define-module (gnu packages gl) | |
c4a667bf | 26 | #:use-module (gnu packages) |
b021a2ad | 27 | #:use-module (gnu packages autotools) |
200726ed | 28 | #:use-module (gnu packages bison) |
432360d7 | 29 | #:use-module (gnu packages documentation) |
200726ed | 30 | #:use-module (gnu packages flex) |
3a92a5b3 DC |
31 | #:use-module (gnu packages fontutils) |
32 | #:use-module (gnu packages freedesktop) | |
ce4d7abf | 33 | #:use-module (gnu packages gettext) |
3a92a5b3 | 34 | #:use-module (gnu packages guile) |
ce4d7abf | 35 | #:use-module (gnu packages linux) |
3a92a5b3 | 36 | #:use-module (gnu packages pkg-config) |
200726ed | 37 | #:use-module (gnu packages python) |
7e31978b | 38 | #:use-module (gnu packages video) |
2b226af1 | 39 | #:use-module (gnu packages xdisorg) |
3a92a5b3 DC |
40 | #:use-module (gnu packages xml) |
41 | #:use-module (gnu packages xorg) | |
42 | #:use-module (gnu packages zip) | |
43 | #:use-module (guix download) | |
44 | #:use-module (guix build utils) | |
45 | #:use-module (guix build-system gnu) | |
46 | #:use-module (guix build-system cmake) | |
47 | #:use-module ((guix licenses) #:prefix license:) | |
48 | #:use-module (guix packages) | |
49 | #:use-module (guix utils) | |
50 | #:use-module (ice-9 match)) | |
daca8666 JG |
51 | |
52 | (define-public glu | |
53 | (package | |
54 | (name "glu") | |
55 | (version "9.0.0") | |
56 | (source (origin | |
a124bbd2 SB |
57 | (method url-fetch) |
58 | (uri (string-append "ftp://ftp.freedesktop.org/pub/mesa/glu/glu-" | |
59 | version ".tar.gz")) | |
60 | (sha256 | |
61 | (base32 | |
62 | "0r72yyhj09x3krn3kn629jqbwyq50ji8w5ri2pn6zwrk35m4g1s3")))) | |
daca8666 | 63 | (build-system gnu-build-system) |
187731a5 | 64 | (propagated-inputs |
a124bbd2 | 65 | `(("mesa" ,mesa))) ; according to glu.pc |
daca8666 JG |
66 | (home-page "http://www.opengl.org/archives/resources/faq/technical/glu.htm") |
67 | (synopsis "Mesa OpenGL Utility library") | |
68 | (description | |
69 | "GLU, or OpenGL Utility Library provides some higher-level functionality | |
35b9e423 | 70 | not provided by just OpenGL itself. Some of GLU's Features |
daca8666 JG |
71 | include: Scaling of 2D images and creation of mipmap pyramids, |
72 | Transformation of object coordinates into device coordinates and | |
73 | vice versa, Support for NURBS surfaces, Support for tessellation | |
74 | of concave or bow tie polygonal primitives, Specialty transformation | |
75 | matrices for creating perspective and orthographic projections, | |
76 | positioning a camera, and selection/picking, Rendering of disk, | |
77 | cylinder, and sphere primitives, Interpreting OpenGL error values | |
78 | as ASCII text.") | |
584f2e1b | 79 | (license (license:x11-style "http://directory.fsf.org/wiki/License:SGIFreeBv2")))) |
daca8666 JG |
80 | |
81 | (define-public freeglut | |
82 | (package | |
83 | (name "freeglut") | |
8ce36e81 | 84 | (version "3.0.0") |
daca8666 | 85 | (source (origin |
a124bbd2 SB |
86 | (method url-fetch) |
87 | (uri (string-append | |
0f971a04 | 88 | "mirror://sourceforge/freeglut/freeglut/" |
a124bbd2 SB |
89 | version "/freeglut-" version ".tar.gz")) |
90 | (sha256 | |
91 | (base32 | |
92 | "18knkyczzwbmyg8hr4zh8a1i5ga01np2jzd1rwmsh7mh2n2vwhra")))) | |
8ce36e81 SB |
93 | (build-system cmake-build-system) |
94 | (arguments '(#:tests? #f)) ; no test target | |
daca8666 | 95 | (inputs `(("mesa" ,mesa) |
a124bbd2 SB |
96 | ("libx11" ,libx11) |
97 | ("libxi" ,libxi) | |
98 | ("libxrandr" ,libxrandr) | |
99 | ("libxxf86vm" ,libxxf86vm) | |
100 | ("inputproto" ,inputproto) | |
101 | ("xinput" ,xinput))) | |
9b5db9be TUBK |
102 | (propagated-inputs |
103 | ;; Headers from Mesa and GLU are needed. | |
104 | `(("glu" ,glu) | |
105 | ("mesa" ,mesa))) | |
daca8666 JG |
106 | (home-page "http://freeglut.sourceforge.net/") |
107 | (synopsis "Alternative to the OpenGL Utility Toolkit (GLUT)") | |
108 | (description | |
109 | "Freeglut is a completely Free/OpenSourced alternative to | |
35b9e423 | 110 | the OpenGL Utility Toolkit (GLUT) library. GLUT was originally |
daca8666 | 111 | written by Mark Kilgard to support the sample programs in the |
35b9e423 | 112 | second edition OpenGL 'RedBook'. Since then, GLUT has been used |
daca8666 JG |
113 | in a wide variety of practical applications because it is simple, |
114 | widely available and highly portable. | |
115 | ||
116 | GLUT (and hence freeglut) allows the user to create and manage windows | |
117 | containing OpenGL contexts on a wide range of platforms and also read | |
35b9e423 | 118 | the mouse, keyboard and joystick functions. Freeglut is released under |
daca8666 | 119 | the X-Consortium license.") |
584f2e1b | 120 | (license license:x11))) |
daca8666 JG |
121 | |
122 | (define-public ftgl | |
123 | (package | |
124 | (name "ftgl") | |
125 | (version "2.1.3-rc5") | |
126 | (source (origin | |
a124bbd2 SB |
127 | (method url-fetch) |
128 | (uri (string-append | |
0f971a04 | 129 | "mirror://sourceforge/ftgl/FTGL%20Source/2.1.3~rc5/" |
a124bbd2 SB |
130 | "ftgl-" version ".tar.gz")) |
131 | (sha256 | |
132 | (base32 | |
133 | "0nsn4s6vnv5xcgxcw6q031amvh2zfj2smy1r5mbnjj2548hxcn2l")))) | |
daca8666 | 134 | (build-system gnu-build-system) |
9e850534 RW |
135 | ;; The pkg-config file lists "freetype2" as Requires.private. |
136 | (propagated-inputs `(("freetype" ,freetype))) | |
137 | (inputs `(("libx11" ,libx11) | |
a124bbd2 SB |
138 | ("mesa" ,mesa) |
139 | ("glu" ,glu))) | |
daca8666 JG |
140 | (home-page "http://ftgl.sourceforge.net") |
141 | (synopsis "Font rendering library for OpenGL applications") | |
142 | (description | |
35b9e423 | 143 | "FTGL is a font rendering library for OpenGL applications. Supported |
daca8666 | 144 | rendering modes are: Bitmaps, Anti-aliased pixmaps, Texture maps, Outlines, |
e881752c | 145 | Polygon meshes, and Extruded polygon meshes.") |
584f2e1b | 146 | (license license:x11))) |
200726ed | 147 | |
b021a2ad TUBK |
148 | (define-public s2tc |
149 | (package | |
150 | (name "s2tc") | |
151 | (version "1.0") | |
152 | (source | |
153 | (origin | |
154 | (method url-fetch) | |
155 | (uri (string-append | |
156 | "https://github.com/divVerent/s2tc/archive/v" version ".tar.gz")) | |
157 | (sha256 | |
158 | (base32 "0ibfdib277fhbqvxzan0bmglwnsl1y1rw2g8skvz82l1sfmmn752")) | |
159 | (file-name (string-append name "-" version ".tar.gz")))) | |
160 | (build-system gnu-build-system) | |
161 | (native-inputs | |
162 | `(("autoconf" ,autoconf) | |
163 | ("automake" ,automake) | |
164 | ("libtool" ,libtool))) | |
165 | (inputs | |
166 | `(("mesa-headers" ,mesa-headers))) | |
167 | (arguments | |
168 | '(#:phases | |
169 | (modify-phases %standard-phases | |
f8503e2b | 170 | (add-after 'unpack 'autogen |
b021a2ad TUBK |
171 | (lambda _ |
172 | (zero? (system* "sh" "autogen.sh"))))))) | |
173 | (home-page "https://github.com/divVerent/s2tc") | |
174 | (synopsis "S3 Texture Compression implementation") | |
175 | (description | |
176 | "S2TC is a patent-free implementation of S3 Texture Compression (S3TC, | |
177 | also known as DXTn or DXTC) for Mesa.") | |
584f2e1b | 178 | (license license:expat))) |
b021a2ad | 179 | |
7e31978b TUBK |
180 | ;;; Mesa needs LibVA headers to build its Gallium-based VA API implementation; |
181 | ;;; LibVA itself depends on Mesa. We use the following to solve the circular | |
182 | ;;; dependency. | |
183 | (define libva-without-mesa | |
184 | ;; Delay to work around circular import problem. | |
185 | (delay | |
186 | (package | |
187 | (inherit libva) | |
188 | (name "libva-without-mesa") | |
189 | (inputs (alist-delete "mesa" (package-inputs libva))) | |
190 | (arguments | |
191 | (strip-keyword-arguments | |
192 | '(#:make-flags) | |
193 | (substitute-keyword-arguments (package-arguments libva) | |
194 | ((#:configure-flags flags) | |
195 | '(list "--disable-glx" "--disable-egl")))))))) | |
196 | ||
200726ed JD |
197 | (define-public mesa |
198 | (package | |
199 | (name "mesa") | |
d0d0f8d1 | 200 | (version "13.0.3") |
200726ed JD |
201 | (source |
202 | (origin | |
203 | (method url-fetch) | |
ce4d7abf | 204 | (uri (string-append "ftp://ftp.freedesktop.org/pub/mesa/" |
0272ee49 | 205 | version "/mesa-" version ".tar.xz")) |
200726ed | 206 | (sha256 |
ce4d7abf | 207 | (base32 |
d0d0f8d1 | 208 | "03m4gc6qc50lb0ic06f83r3yl0x4lmj2zjq3sl60vl3nq7jqpanr")) |
17f2b485 MB |
209 | (patches |
210 | (search-patches "mesa-wayland-egl-symbols-check-mips.patch")))) | |
200726ed JD |
211 | (build-system gnu-build-system) |
212 | (propagated-inputs | |
213 | `(("glproto" ,glproto) | |
45191970 | 214 | ;; The following are in the Requires.private field of gl.pc. |
ce4d7abf | 215 | ("libdrm" ,libdrm) |
4ea1ad91 | 216 | ("libvdpau" ,libvdpau) |
8bb1699b | 217 | ("libx11" ,libx11) |
200726ed | 218 | ("libxdamage" ,libxdamage) |
45191970 TUBK |
219 | ("libxfixes" ,libxfixes) |
220 | ("libxshmfence" ,libxshmfence) | |
200726ed JD |
221 | ("libxxf86vm" ,libxxf86vm))) |
222 | (inputs | |
e0b744f1 | 223 | `(("expat" ,expat) |
ce4d7abf MW |
224 | ("dri2proto" ,dri2proto) |
225 | ("dri3proto" ,dri3proto) | |
7e31978b | 226 | ("libva" ,(force libva-without-mesa)) |
200726ed | 227 | ("libxml2" ,libxml2) |
ce4d7abf | 228 | ;; TODO: Add 'libxml2-python' for OpenGL ES 1.1 and 2.0 support |
0272ee49 | 229 | ("libxvmc" ,libxvmc) |
3e71b9ff | 230 | ("makedepend" ,makedepend) |
e0b744f1 DC |
231 | ("presentproto" ,presentproto) |
232 | ("s2tc" ,s2tc) | |
8ea75f27 | 233 | ("wayland" ,wayland))) |
200726ed | 234 | (native-inputs |
e0b744f1 | 235 | `(("pkg-config" ,pkg-config) |
17f2b485 | 236 | ("python" ,python-2))) |
200726ed | 237 | (arguments |
ce4d7abf | 238 | `(#:configure-flags |
0f481f06 | 239 | '(;; drop r300 from default gallium drivers, as it requires llvm |
6ac45618 | 240 | "--with-gallium-drivers=r600,svga,swrast,nouveau,virgl" |
3e2570d8 TUBK |
241 | ;; Enable various optional features. TODO: opencl requires libclc, |
242 | ;; omx requires libomxil-bellagio | |
8ea75f27 | 243 | "--with-egl-platforms=x11,drm,wayland" |
3e2570d8 TUBK |
244 | "--enable-glx-tls" ;Thread Local Storage, improves performance |
245 | ;; "--enable-opencl" | |
246 | ;; "--enable-omx" | |
247 | "--enable-osmesa" | |
0f481f06 | 248 | "--enable-xa" |
8ea75f27 DC |
249 | ;; features required by wayland |
250 | "--enable-gles2" | |
251 | "--enable-gbm" | |
252 | "--enable-shared-glapi" | |
b4c8c413 DT |
253 | ;; Without floating point texture support, drivers such as Nouveau |
254 | ;; are stuck at OpenGL 2.1 instead of OpenGL 3.0+. | |
255 | "--enable-texture-float" | |
0f481f06 MW |
256 | |
257 | ;; on non-intel systems, drop i915 and i965 | |
258 | ;; from the default dri drivers | |
259 | ,@(match (%current-system) | |
260 | ((or "x86_64-linux" "i686-linux") | |
261 | '()) | |
262 | (_ | |
263 | '("--with-dri-drivers=nouveau,r200,radeon,swrast")))) | |
e8a7a180 EF |
264 | #:phases |
265 | (modify-phases %standard-phases | |
266 | (add-after | |
267 | 'unpack 'patch-create_test_cases | |
268 | (lambda _ | |
269 | (substitute* "src/compiler/glsl/tests/lower_jumps/create_test_cases.py" | |
270 | (("/usr/bin/env bash") (which "bash"))) | |
271 | (substitute* "src/intel/genxml/gen_pack_header.py" | |
272 | (("/usr/bin/env python2") (which "python"))))) | |
273 | (add-before | |
274 | 'build 'fix-dlopen-libnames | |
275 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
276 | (let ((s2tc (assoc-ref inputs "s2tc")) | |
e8a7a180 EF |
277 | (out (assoc-ref outputs "out"))) |
278 | ;; Remain agnostic to .so.X.Y.Z versions while doing | |
279 | ;; the substitutions so we're future-safe. | |
280 | (substitute* | |
281 | '("src/gallium/auxiliary/util/u_format_s3tc.c" | |
282 | "src/mesa/main/texcompress_s3tc.c") | |
283 | (("\"libtxc_dxtn\\.so") | |
284 | (string-append "\"" s2tc "/lib/libtxc_dxtn.so"))) | |
e8a7a180 EF |
285 | (substitute* "src/glx/dri_common.c" |
286 | (("dlopen\\(\"libGL\\.so") | |
287 | (string-append "dlopen(\"" out "/lib/libGL.so"))) | |
288 | (substitute* "src/egl/drivers/dri2/egl_dri2.c" | |
289 | (("\"libglapi\\.so") | |
290 | (string-append "\"" out "/lib/libglapi.so"))) | |
291 | (substitute* "src/gbm/main/backend.c" | |
292 | ;; No need to patch the gbm_gallium_drm.so reference; | |
293 | ;; it's never installed since Mesa removed its | |
294 | ;; egl_gallium support. | |
295 | (("\"gbm_dri\\.so") | |
296 | (string-append "\"" out "/lib/dri/gbm_dri.so"))))))))) | |
200726ed | 297 | (home-page "http://mesa3d.org/") |
35b9e423 | 298 | (synopsis "OpenGL implementation") |
200726ed | 299 | (description "Mesa is a free implementation of the OpenGL specification - |
35b9e423 | 300 | a system for rendering interactive 3D graphics. A variety of device drivers |
200726ed JD |
301 | allows Mesa to be used in many different environments ranging from software |
302 | emulation to complete hardware acceleration for modern GPUs.") | |
584f2e1b | 303 | (license license:x11))) |
7025a035 | 304 | |
b021a2ad TUBK |
305 | (define-public mesa-headers |
306 | (package | |
307 | (inherit mesa) | |
308 | (name "mesa-headers") | |
309 | (propagated-inputs '()) | |
310 | (inputs '()) | |
311 | (native-inputs '()) | |
312 | (arguments | |
313 | '(#:phases | |
314 | (modify-phases %standard-phases | |
f8503e2b LC |
315 | (delete 'configure) |
316 | (delete 'build) | |
317 | (delete 'check) | |
318 | (replace 'install | |
b021a2ad TUBK |
319 | (lambda* (#:key outputs #:allow-other-keys) |
320 | (copy-recursively "include" (string-append | |
321 | (assoc-ref outputs "out") | |
322 | "/include"))))))))) | |
323 | ||
c90a50eb TUBK |
324 | ;;; The mesa-demos distribution contains non-free files, many files with no |
325 | ;;; clear license information, and many demos that aren't useful for most | |
326 | ;;; people, so we just use this for the mesa-utils package below, and possibly | |
327 | ;;; other packages in the future. This is modeled after Debian's solution. | |
328 | (define (mesa-demos-source version) | |
329 | (origin | |
330 | (method url-fetch) | |
331 | (uri (string-append "ftp://ftp.freedesktop.org/pub/mesa/demos/" version | |
332 | "/mesa-demos-" version ".tar.bz2")) | |
7fe3f8cf | 333 | (sha256 (base32 "1vqb7s5m3fcg2csbiz45mha1pys2xx6rhw94fcyvapqdpm5iawy1")))) |
c90a50eb TUBK |
334 | |
335 | (define-public mesa-utils | |
336 | (package | |
337 | (name "mesa-utils") | |
7fe3f8cf | 338 | (version "8.3.0") |
c90a50eb TUBK |
339 | (source (mesa-demos-source version)) |
340 | (build-system gnu-build-system) | |
341 | (inputs | |
342 | `(("mesa" ,mesa) | |
343 | ("glut" ,freeglut) | |
344 | ("glew" ,glew))) | |
345 | (native-inputs | |
346 | `(("pkg-config" ,pkg-config))) | |
347 | (arguments | |
7fe3f8cf | 348 | '(#:phases |
c90a50eb TUBK |
349 | (modify-phases %standard-phases |
350 | (replace | |
f8503e2b | 351 | 'install |
c90a50eb TUBK |
352 | (lambda* (#:key outputs #:allow-other-keys) |
353 | (let ((out (assoc-ref outputs "out"))) | |
354 | (mkdir-p (string-append out "/bin")) | |
355 | (for-each | |
356 | (lambda (file) | |
357 | (copy-file file (string-append out "/bin/" (basename file)))) | |
358 | '("src/xdemos/glxdemo" "src/xdemos/glxgears" | |
359 | "src/xdemos/glxinfo" "src/xdemos/glxheads")))))))) | |
360 | (home-page "http://mesa3d.org/") | |
361 | (synopsis "Utility tools for Mesa") | |
362 | (description | |
363 | "The mesa-utils package contains several utility tools for Mesa: glxdemo, | |
364 | glxgears, glxheads, and glxinfo.") | |
365 | ;; glxdemo is public domain; others expat. | |
584f2e1b | 366 | (license (list license:expat license:public-domain)))) |
c90a50eb | 367 | |
524f4bec LC |
368 | (define-public glew |
369 | (package | |
370 | (name "glew") | |
766c1488 | 371 | (version "2.0.0") |
524f4bec LC |
372 | (source (origin |
373 | (method url-fetch) | |
de67e922 LF |
374 | (uri (string-append "mirror://sourceforge/glew/glew/" version |
375 | "/glew-" version ".tgz")) | |
524f4bec LC |
376 | (sha256 |
377 | (base32 | |
766c1488 | 378 | "0r37fg2s1f0jrvwh6c8cz5x6v4wqmhq42qm15cs9qs349q5c6wn5")) |
524f4bec LC |
379 | (modules '((guix build utils))) |
380 | (snippet | |
381 | '(substitute* "config/Makefile.linux" | |
382 | (("= cc") "= gcc") | |
383 | (("/lib64") "/lib"))))) | |
384 | (build-system gnu-build-system) | |
385 | (arguments | |
386 | '(#:phases (alist-delete 'configure %standard-phases) | |
387 | #:make-flags (list (string-append "GLEW_PREFIX=" | |
388 | (assoc-ref %outputs "out")) | |
389 | (string-append "GLEW_DEST=" | |
390 | (assoc-ref %outputs "out"))) | |
391 | #:tests? #f)) ;no 'check' target | |
392 | (inputs | |
393 | `(("libxi" ,libxi) | |
394 | ("libxmu" ,libxmu) | |
395 | ("libx11" ,libx11) | |
396 | ("mesa" ,mesa))) | |
397 | ||
398 | ;; <GL/glew.h> includes <GL/glu.h>. | |
399 | (propagated-inputs `(("glu" ,glu))) | |
400 | ||
401 | (home-page "http://glew.sourceforge.net/") | |
402 | (synopsis "OpenGL extension loading library for C and C++") | |
403 | (description | |
404 | "The OpenGL Extension Wrangler Library (GLEW) is a C/C++ extension | |
405 | loading library. GLEW provides efficient run-time mechanisms for determining | |
406 | which OpenGL extensions are supported on the target platform. OpenGL core and | |
407 | extension functionality is exposed in a single header file.") | |
584f2e1b | 408 | (license license:bsd-3))) |
524f4bec | 409 | |
7025a035 DT |
410 | (define-public guile-opengl |
411 | (package | |
412 | (name "guile-opengl") | |
413 | (version "0.1.0") | |
414 | (source (origin | |
415 | (method url-fetch) | |
416 | (uri (string-append "mirror://gnu/guile-opengl/guile-opengl-" | |
417 | version ".tar.gz")) | |
418 | (sha256 | |
419 | (base32 | |
420 | "13qfx4xh8baryxqrv986l848ygd0piqwm6s2s90pxk9c0m9vklim")))) | |
421 | (build-system gnu-build-system) | |
422 | (native-inputs `(("pkg-config" ,pkg-config))) | |
423 | (inputs `(("guile" ,guile-2.0) | |
424 | ("mesa" ,mesa) | |
4becc792 | 425 | ("glu" ,glu) |
7025a035 DT |
426 | ("freeglut" ,freeglut))) |
427 | (arguments | |
0e215f49 DT |
428 | '(#:phases (modify-phases %standard-phases |
429 | (add-after 'configure 'patch-makefile | |
430 | (lambda _ | |
431 | ;; Install compiled Guile files in the expected place. | |
432 | (substitute* '("Makefile") | |
433 | (("^godir = .*$") | |
434 | "godir = $(moddir)\n")))) | |
435 | (add-before 'build 'patch-dynamic-link | |
436 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
437 | (define (dynamic-link-substitute file lib input) | |
438 | (substitute* file | |
439 | (("dynamic-link \"lib([a-zA-Z]+)\"" _ lib) | |
440 | (string-append "dynamic-link \"" | |
441 | (assoc-ref inputs input) | |
442 | "/lib/lib" lib "\"")))) | |
443 | ;; Replace dynamic-link calls for libGL, libGLU, and | |
444 | ;; libglut with absolute paths to the store. | |
445 | (dynamic-link-substitute "glx/runtime.scm" "GL" "mesa") | |
446 | (dynamic-link-substitute "glu/runtime.scm" "GLU" "glu") | |
447 | (dynamic-link-substitute "glut/runtime.scm" "glut" | |
448 | "freeglut")))))) | |
cc7a5c71 | 449 | (home-page "https://gnu.org/s/guile-opengl") |
66672a45 | 450 | (synopsis "Guile binding for the OpenGL graphics API") |
7025a035 | 451 | (description |
66672a45 LC |
452 | "Guile-OpenGL is a library for Guile that provides bindings to the |
453 | OpenGL graphics API.") | |
584f2e1b | 454 | (license license:lgpl3+))) |
131ddf99 AW |
455 | |
456 | (define-public libepoxy | |
457 | (package | |
458 | (name "libepoxy") | |
f75f261f | 459 | (version "1.3.1") |
131ddf99 AW |
460 | (source (origin |
461 | (method url-fetch) | |
462 | (uri (string-append | |
463 | "https://github.com/anholt/libepoxy/archive/v" | |
464 | version | |
465 | ".tar.gz")) | |
466 | (file-name (string-append name "-" version ".tar.gz")) | |
467 | (sha256 | |
468 | (base32 | |
13b5f44b LC |
469 | "1d1brhwfmlzgnphmdwlvn5wbcrxsdyzf1qfcf8nb89xqzznxs037")) |
470 | (patches (search-patches "libepoxy-gl-null-checks.patch")))) | |
131ddf99 | 471 | (arguments |
9bbd52e5 | 472 | `(#:phases |
5f8dd6dc EF |
473 | (modify-phases %standard-phases |
474 | (add-after | |
475 | 'unpack 'autoreconf | |
476 | (lambda _ | |
477 | (zero? (system* "autoreconf" "-vif")))) | |
478 | (add-before | |
479 | 'configure 'patch-paths | |
480 | (lambda* (#:key inputs #:allow-other-keys) | |
481 | (let ((python (assoc-ref inputs "python")) | |
482 | (mesa (assoc-ref inputs "mesa"))) | |
483 | (substitute* "src/gen_dispatch.py" | |
484 | (("/usr/bin/env python") python)) | |
485 | (substitute* (find-files "." "\\.[ch]$") | |
486 | (("libGL.so.1") (string-append mesa "/lib/libGL.so.1")) | |
487 | (("libEGL.so.1") (string-append mesa "/lib/libEGL.so.1"))) | |
9bbd52e5 | 488 | |
5f8dd6dc EF |
489 | ;; XXX On armhf systems, we must add "GLIBC_2.4" to the list of |
490 | ;; versions in test/dlwrap.c:dlwrap_real_dlsym. It would be | |
491 | ;; better to make this a normal patch, but for now we do it here | |
492 | ;; to prevent rebuilding on other platforms. | |
493 | ,@(if (string-prefix? "arm" (or (%current-target-system) | |
494 | (%current-system))) | |
495 | '((substitute* '"test/dlwrap.c" | |
496 | (("\"GLIBC_2\\.0\"") "\"GLIBC_2.0\", \"GLIBC_2.4\""))) | |
497 | '()) | |
498 | #t)))))) | |
131ddf99 AW |
499 | (build-system gnu-build-system) |
500 | (native-inputs | |
501 | `(("autoconf" ,autoconf) | |
502 | ("automake" ,automake) | |
503 | ("libtool" ,libtool) | |
504 | ("pkg-config" ,pkg-config) | |
505 | ("python" ,python))) | |
506 | (inputs | |
507 | `(("mesa" ,mesa))) | |
508 | (home-page "http://github.com/anholt/libepoxy/") | |
509 | (synopsis "A library for handling OpenGL function pointer management") | |
510 | (description | |
511 | "A library for handling OpenGL function pointer management.") | |
584f2e1b | 512 | (license license:x11))) |
2b226af1 DT |
513 | |
514 | (define-public soil | |
515 | (package | |
516 | (name "soil") | |
517 | (version "1.0.7") | |
518 | (source (origin | |
519 | (method url-fetch) | |
520 | ;; No versioned archive available. | |
521 | (uri "http://www.lonesock.net/files/soil.zip") | |
522 | (sha256 | |
523 | (base32 | |
524 | "00gpwp9dldzhsdhksjvmbhsd2ialraqbv6v6dpikdmpncj6mnc52")))) | |
525 | (build-system gnu-build-system) | |
526 | (arguments | |
527 | '(#:tests? #f ; no tests | |
528 | #:phases (modify-phases %standard-phases | |
529 | (delete 'configure) | |
530 | (add-before 'build 'init-build | |
531 | (lambda* (#:key outputs #:allow-other-keys) | |
532 | (let ((out (assoc-ref outputs "out"))) | |
533 | (setenv "CFLAGS" "-fPIC") ; needed for shared library | |
534 | ;; Use alternate Makefile | |
535 | (copy-file "projects/makefile/alternate Makefile.txt" | |
536 | "src/Makefile") | |
537 | (chdir "src") | |
538 | (substitute* '("Makefile") | |
539 | (("INCLUDEDIR = /usr/include/SOIL") | |
540 | (string-append "INCLUDEDIR = " out "/include/SOIL")) | |
541 | (("LIBDIR = /usr/lib") | |
542 | (string-append "LIBDIR = " out "/lib")) | |
543 | ;; Remove these flags from 'install' commands. | |
544 | (("-o root -g root") "")))))))) | |
545 | (native-inputs | |
546 | `(("unzip" ,unzip))) | |
547 | (inputs | |
548 | `(("mesa" ,mesa))) | |
549 | (home-page "http://www.lonesock.net/soil.html") | |
550 | (synopsis "OpenGL texture loading library") | |
551 | (description | |
552 | "SOIL is a tiny C library used primarily for uploading textures into | |
553 | OpenGL.") | |
584f2e1b | 554 | (license license:public-domain))) |
432360d7 DT |
555 | |
556 | (define-public glfw | |
557 | (package | |
558 | (name "glfw") | |
559 | (version "3.2.1") | |
560 | (source (origin | |
561 | (method url-fetch) | |
562 | (uri (string-append "https://github.com/glfw/glfw" | |
563 | "/releases/download/" version | |
564 | "/glfw-" version ".zip")) | |
565 | (sha256 | |
566 | (base32 | |
567 | "09kk5yc1zhss9add8ryqrngrr16hdmc94rszgng135bhw09mxmdp")))) | |
568 | (build-system cmake-build-system) | |
569 | (arguments | |
570 | '(#:tests? #f ; no test target | |
571 | #:configure-flags '("-DBUILD_SHARED_LIBS=ON"))) | |
572 | (native-inputs | |
573 | `(("doxygen" ,doxygen) | |
574 | ("unzip" ,unzip))) | |
a966281f LC |
575 | (propagated-inputs |
576 | `(("mesa" ,mesa) ;included in public headers | |
577 | ||
578 | ;; These are in 'Requires.private' of 'glfw3.pc'. | |
432360d7 DT |
579 | ("libx11" ,libx11) |
580 | ("libxrandr" ,libxrandr) | |
581 | ("libxinerama" ,libxinerama) | |
a966281f LC |
582 | ("libxcursor" ,libxcursor) |
583 | ("libxxf86vm" ,libxxf86vm))) | |
432360d7 DT |
584 | (home-page "http://www.glfw.org") |
585 | (synopsis "OpenGL application development library") | |
586 | (description | |
587 | "GLFW is a library for OpenGL, OpenGL ES and Vulkan development for | |
588 | desktop computers. It provides a simple API for creating windows, contexts | |
589 | and surfaces, receiving input and events.") | |
590 | (license license:zlib))) | |
78acbcb5 RW |
591 | |
592 | (define-public nanovg-for-extempore | |
593 | (package | |
594 | (name "nanovg-for-extempore") | |
595 | (version "0.7.1") | |
596 | (source (origin | |
597 | (method url-fetch) | |
598 | (uri (string-append "https://github.com/extemporelang/nanovg/" | |
599 | "archive/" version ".tar.gz")) | |
600 | (file-name (string-append name "-" version ".tar.gz")) | |
601 | (sha256 | |
602 | (base32 | |
603 | "0ivs1sagq19xiw8jxd9f8w2b39svi0n9hrbmdvckwvqg95r8701g")))) | |
604 | (build-system cmake-build-system) | |
605 | (arguments `(#:tests? #f)) ; no tests included | |
606 | (inputs | |
607 | `(("mesa" ,mesa))) | |
39162ee4 RW |
608 | ;; Extempore refuses to build on architectures other than x86_64 |
609 | (supported-systems '("x86_64-linux")) | |
78acbcb5 RW |
610 | (home-page "https://github.com/extemporelang/nanovg") |
611 | (synopsis "2D vector drawing library on top of OpenGL") | |
612 | (description "NanoVG is small antialiased vector graphics rendering | |
613 | library for OpenGL. It has lean API modeled after HTML5 canvas API. It is | |
614 | aimed to be a practical and fun toolset for building scalable user interfaces | |
615 | and visualizations.") | |
616 | (license license:zlib))) |