gnu: libidn: Update to 1.30.
[jackhill/guix/guix.git] / gnu / packages / gl.scm
CommitLineData
daca8666 1;;; GNU Guix --- Functional package management for GNU
10b4d0f6 2;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
822efdff 3;;; Copyright © 2013 Joshua Grant <tadni@riseup.net>
7025a035 4;;; Copyright © 2014 David Thompson <davet@gnu.org>
9bbd52e5 5;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
daca8666
JG
6;;;
7;;; This file is part of GNU Guix.
8;;;
9;;; GNU Guix is free software; you can redistribute it and/or modify it
10;;; under the terms of the GNU General Public License as published by
11;;; the Free Software Foundation; either version 3 of the License, or (at
12;;; your option) any later version.
13;;;
14;;; GNU Guix is distributed in the hope that it will be useful, but
15;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;;; GNU General Public License for more details.
18;;;
19;;; You should have received a copy of the GNU General Public License
20;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22(define-module (gnu packages gl)
0f481f06 23 #:use-module (ice-9 match)
b5b73a82 24 #:use-module ((guix licenses) #:prefix l:)
daca8666
JG
25 #:use-module (guix packages)
26 #:use-module (guix download)
27 #:use-module (guix build-system gnu)
28 #:use-module (guix packages)
b021a2ad 29 #:use-module (gnu packages autotools)
200726ed
JD
30 #:use-module (gnu packages bison)
31 #:use-module (gnu packages flex)
32 #:use-module (gnu packages pkg-config)
ce4d7abf
MW
33 #:use-module (gnu packages gettext)
34 #:use-module (gnu packages linux)
200726ed 35 #:use-module (gnu packages python)
daca8666 36 #:use-module (gnu packages xorg)
200726ed 37 #:use-module (gnu packages xml)
7025a035 38 #:use-module (gnu packages fontutils)
b2b7def1
LC
39 #:use-module (gnu packages guile)
40 #:use-module (gnu packages xdisorg))
daca8666
JG
41
42(define-public glu
43 (package
44 (name "glu")
45 (version "9.0.0")
46 (source (origin
47 (method url-fetch)
48 (uri (string-append "ftp://ftp.freedesktop.org/pub/mesa/glu/glu-"
49 version ".tar.gz"))
50 (sha256
51 (base32 "0r72yyhj09x3krn3kn629jqbwyq50ji8w5ri2pn6zwrk35m4g1s3"))))
52 (build-system gnu-build-system)
53 (inputs `(("mesa" ,mesa)))
54 (home-page "http://www.opengl.org/archives/resources/faq/technical/glu.htm")
55 (synopsis "Mesa OpenGL Utility library")
56 (description
57 "GLU, or OpenGL Utility Library provides some higher-level functionality
35b9e423 58not provided by just OpenGL itself. Some of GLU's Features
daca8666
JG
59include: Scaling of 2D images and creation of mipmap pyramids,
60Transformation of object coordinates into device coordinates and
61vice versa, Support for NURBS surfaces, Support for tessellation
62of concave or bow tie polygonal primitives, Specialty transformation
63matrices for creating perspective and orthographic projections,
64positioning a camera, and selection/picking, Rendering of disk,
65cylinder, and sphere primitives, Interpreting OpenGL error values
66as ASCII text.")
67 (license (l:x11-style "http://directory.fsf.org/wiki/License:SGIFreeBv2"))))
68
69(define-public freeglut
70 (package
71 (name "freeglut")
72 (version "2.8.1")
73 (source (origin
74 (method url-fetch)
75 (uri (string-append "mirror://sourceforge/project/freeglut/freeglut/"
76 version "/freeglut-" version ".tar.gz"))
77 (sha256
78 (base32 "16lrxxxd9ps9l69y3zsw6iy0drwjsp6m26d1937xj71alqk6dr6x"))))
79 (build-system gnu-build-system)
80 (inputs `(("mesa" ,mesa)
81 ("libx11" ,libx11)
82 ("libxi" ,libxi)
83 ("libxrandr" ,libxrandr)
84 ("libxxf86vm" ,libxxf86vm)
85 ("inputproto" ,inputproto)
01793502 86 ("xinput" ,xinput)))
9b5db9be
TUBK
87 (propagated-inputs
88 ;; Headers from Mesa and GLU are needed.
89 `(("glu" ,glu)
90 ("mesa" ,mesa)))
daca8666
JG
91 (home-page "http://freeglut.sourceforge.net/")
92 (synopsis "Alternative to the OpenGL Utility Toolkit (GLUT)")
93 (description
94 "Freeglut is a completely Free/OpenSourced alternative to
35b9e423 95the OpenGL Utility Toolkit (GLUT) library. GLUT was originally
daca8666 96written by Mark Kilgard to support the sample programs in the
35b9e423 97second edition OpenGL 'RedBook'. Since then, GLUT has been used
daca8666
JG
98in a wide variety of practical applications because it is simple,
99widely available and highly portable.
100
101GLUT (and hence freeglut) allows the user to create and manage windows
102containing OpenGL contexts on a wide range of platforms and also read
35b9e423 103the mouse, keyboard and joystick functions. Freeglut is released under
daca8666
JG
104the X-Consortium license.")
105 (license l:x11)))
106
107(define-public ftgl
108 (package
109 (name "ftgl")
110 (version "2.1.3-rc5")
111 (source (origin
112 (method url-fetch)
113 (uri (string-append "mirror://sourceforge/project/ftgl/FTGL%20Source/2.1.3~rc5/ftgl-"
114 version ".tar.gz"))
115 (sha256
116 (base32 "0nsn4s6vnv5xcgxcw6q031amvh2zfj2smy1r5mbnjj2548hxcn2l"))))
117 (build-system gnu-build-system)
118 (inputs `(("freetype" ,freetype)
119 ("libx11" ,libx11)
120 ("mesa" ,mesa)
121 ("glu" ,glu)))
122 (home-page "http://ftgl.sourceforge.net")
123 (synopsis "Font rendering library for OpenGL applications")
124 (description
35b9e423 125 "FTGL is a font rendering library for OpenGL applications. Supported
daca8666
JG
126rendering modes are: Bitmaps, Anti-aliased pixmaps, Texture maps, Outlines,
127Polygon meshes, and Extruded polygon meshes")
128 (license l:x11)))
200726ed 129
b021a2ad
TUBK
130(define-public s2tc
131 (package
132 (name "s2tc")
133 (version "1.0")
134 (source
135 (origin
136 (method url-fetch)
137 (uri (string-append
138 "https://github.com/divVerent/s2tc/archive/v" version ".tar.gz"))
139 (sha256
140 (base32 "0ibfdib277fhbqvxzan0bmglwnsl1y1rw2g8skvz82l1sfmmn752"))
141 (file-name (string-append name "-" version ".tar.gz"))))
142 (build-system gnu-build-system)
143 (native-inputs
144 `(("autoconf" ,autoconf)
145 ("automake" ,automake)
146 ("libtool" ,libtool)))
147 (inputs
148 `(("mesa-headers" ,mesa-headers)))
149 (arguments
150 '(#:phases
151 (modify-phases %standard-phases
f8503e2b 152 (add-after 'unpack 'autogen
b021a2ad
TUBK
153 (lambda _
154 (zero? (system* "sh" "autogen.sh")))))))
155 (home-page "https://github.com/divVerent/s2tc")
156 (synopsis "S3 Texture Compression implementation")
157 (description
158 "S2TC is a patent-free implementation of S3 Texture Compression (S3TC,
159also known as DXTn or DXTC) for Mesa.")
160 (license l:expat)))
161
200726ed
JD
162(define-public mesa
163 (package
164 (name "mesa")
ce4d7abf 165 (version "10.4.0")
200726ed
JD
166 (source
167 (origin
168 (method url-fetch)
ce4d7abf
MW
169 (uri (string-append "ftp://ftp.freedesktop.org/pub/mesa/"
170 version "/MesaLib-" version ".tar.bz2"))
200726ed 171 (sha256
ce4d7abf
MW
172 (base32
173 "069j4ck51hc70gryhw3z0rkyhhl0bnhbks4xg1wqqw56l7rxz9wq"))))
200726ed
JD
174 (build-system gnu-build-system)
175 (propagated-inputs
176 `(("glproto" ,glproto)
45191970 177 ;; The following are in the Requires.private field of gl.pc.
ce4d7abf 178 ("libdrm" ,libdrm)
8bb1699b 179 ("libx11" ,libx11)
200726ed 180 ("libxdamage" ,libxdamage)
45191970
TUBK
181 ("libxfixes" ,libxfixes)
182 ("libxshmfence" ,libxshmfence)
200726ed
JD
183 ("libxxf86vm" ,libxxf86vm)))
184 (inputs
ce4d7abf
MW
185 `(("udev" ,eudev)
186 ("dri2proto" ,dri2proto)
187 ("dri3proto" ,dri3proto)
188 ("presentproto" ,presentproto)
200726ed 189 ("expat" ,expat)
200726ed 190 ("libxml2" ,libxml2)
ce4d7abf
MW
191 ;; TODO: Add 'libva'
192 ;; TODO: Add 'libxml2-python' for OpenGL ES 1.1 and 2.0 support
3e71b9ff
TUBK
193 ("makedepend" ,makedepend)
194 ("s2tc" ,s2tc)))
200726ed
JD
195 (native-inputs
196 `(("pkg-config" ,pkg-config)
ce4d7abf 197 ("gettext" ,gnu-gettext)
200726ed
JD
198 ("flex" ,flex)
199 ("bison" ,bison)
200 ("python" ,python-2))) ; incompatible with Python 3 (print syntax)
201 (arguments
ce4d7abf 202 `(#:configure-flags
0f481f06 203 '(;; drop r300 from default gallium drivers, as it requires llvm
ce4d7abf 204 "--with-gallium-drivers=r600,svga,swrast"
3e2570d8
TUBK
205 ;; Enable various optional features. TODO: opencl requires libclc,
206 ;; omx requires libomxil-bellagio
207 "--with-egl-platforms=x11,drm"
208 "--enable-glx-tls" ;Thread Local Storage, improves performance
209 ;; "--enable-opencl"
210 ;; "--enable-omx"
211 "--enable-osmesa"
0f481f06
MW
212 "--enable-xa"
213
214 ;; on non-intel systems, drop i915 and i965
215 ;; from the default dri drivers
216 ,@(match (%current-system)
217 ((or "x86_64-linux" "i686-linux")
218 '())
219 (_
220 '("--with-dri-drivers=nouveau,r200,radeon,swrast"))))
ce4d7abf
MW
221 #:phases (alist-cons-after
222 'unpack 'add-missing-m4-files
223 (lambda _
224 ;; When these files are missing, make tries to rebuild
225 ;; several parts of the build system.
226 (zero? (system* "touch" "--date=@0"
227 "m4/libtool.m4" "m4/ltoptions.m4"
228 "m4/ltsugar.m4" "m4/ltversion.m4"
229 "m4/lt~obsolete.m4")))
230 (alist-cons-after
231 'unpack 'patch-create_test_cases
232 (lambda _
233 (substitute* "src/glsl/tests/lower_jumps/create_test_cases.py"
234 (("/usr/bin/env bash") (which "bash"))))
3e71b9ff 235 (alist-cons-before
e682c327
TUBK
236 'build 'fix-dlopen-libnames
237 (lambda* (#:key inputs outputs #:allow-other-keys)
238 (let ((s2tc (assoc-ref inputs "s2tc"))
239 (udev (assoc-ref inputs "udev"))
240 (out (assoc-ref outputs "out")))
3e71b9ff
TUBK
241 ;; Remain agnostic to .so.X.Y.Z versions while doing
242 ;; the substitutions so we're future-safe.
243 (substitute*
244 '("src/gallium/auxiliary/util/u_format_s3tc.c"
245 "src/mesa/main/texcompress_s3tc.c")
246 (("\"libtxc_dxtn\\.so")
e682c327
TUBK
247 (string-append "\"" s2tc "/lib/libtxc_dxtn.so")))
248 (substitute* "src/gallium/targets/egl-static/egl_st.c"
249 (("\"libglapi\"")
250 (string-append "\"" out "/lib/libglapi\"")))
251 (substitute* "src/loader/loader.c"
252 (("dlopen\\(\"libudev\\.so")
253 (string-append "dlopen(\"" udev "/lib/libudev.so")))
254 (substitute* "src/glx/dri_common.c"
255 (("dlopen\\(\"libGL\\.so")
256 (string-append "dlopen(\"" out "/lib/libGL.so")))
257 (substitute* "src/egl/drivers/dri2/egl_dri2.c"
258 (("\"libglapi\\.so")
3e2570d8
TUBK
259 (string-append "\"" out "/lib/libglapi.so")))
260 (substitute* "src/gbm/main/backend.c"
261 ;; No need to patch the gbm_gallium_drm.so reference;
262 ;; it's never installed since Mesa removed its
263 ;; egl_gallium support.
264 (("\"gbm_dri\\.so")
265 (string-append "\"" out "/lib/dri/gbm_dri.so")))))
3e71b9ff 266 %standard-phases)))))
200726ed 267 (home-page "http://mesa3d.org/")
35b9e423 268 (synopsis "OpenGL implementation")
200726ed 269 (description "Mesa is a free implementation of the OpenGL specification -
35b9e423 270a system for rendering interactive 3D graphics. A variety of device drivers
200726ed
JD
271allows Mesa to be used in many different environments ranging from software
272emulation to complete hardware acceleration for modern GPUs.")
273 (license l:x11)))
7025a035 274
b021a2ad
TUBK
275(define-public mesa-headers
276 (package
277 (inherit mesa)
278 (name "mesa-headers")
279 (propagated-inputs '())
280 (inputs '())
281 (native-inputs '())
282 (arguments
283 '(#:phases
284 (modify-phases %standard-phases
f8503e2b
LC
285 (delete 'configure)
286 (delete 'build)
287 (delete 'check)
288 (replace 'install
b021a2ad
TUBK
289 (lambda* (#:key outputs #:allow-other-keys)
290 (copy-recursively "include" (string-append
291 (assoc-ref outputs "out")
292 "/include")))))))))
293
c90a50eb
TUBK
294;;; The mesa-demos distribution contains non-free files, many files with no
295;;; clear license information, and many demos that aren't useful for most
296;;; people, so we just use this for the mesa-utils package below, and possibly
297;;; other packages in the future. This is modeled after Debian's solution.
298(define (mesa-demos-source version)
299 (origin
300 (method url-fetch)
301 (uri (string-append "ftp://ftp.freedesktop.org/pub/mesa/demos/" version
302 "/mesa-demos-" version ".tar.bz2"))
303 (sha256 (base32 "14msj0prbl3ljwd24yaqv9pz1xzicdmqgg616xxlppbdh6syrgz4"))))
304
305(define-public mesa-utils
306 (package
307 (name "mesa-utils")
308 (version "8.2.0")
309 (source (mesa-demos-source version))
310 (build-system gnu-build-system)
311 (inputs
312 `(("mesa" ,mesa)
313 ("glut" ,freeglut)
314 ("glew" ,glew)))
315 (native-inputs
316 `(("pkg-config" ,pkg-config)))
317 (arguments
318 '(#:phases
319 (modify-phases %standard-phases
320 (replace
f8503e2b 321 'install
c90a50eb
TUBK
322 (lambda* (#:key outputs #:allow-other-keys)
323 (let ((out (assoc-ref outputs "out")))
324 (mkdir-p (string-append out "/bin"))
325 (for-each
326 (lambda (file)
327 (copy-file file (string-append out "/bin/" (basename file))))
328 '("src/xdemos/glxdemo" "src/xdemos/glxgears"
329 "src/xdemos/glxinfo" "src/xdemos/glxheads"))))))))
330 (home-page "http://mesa3d.org/")
331 (synopsis "Utility tools for Mesa")
332 (description
333 "The mesa-utils package contains several utility tools for Mesa: glxdemo,
334glxgears, glxheads, and glxinfo.")
335 ;; glxdemo is public domain; others expat.
336 (license (list l:expat l:public-domain))))
337
524f4bec
LC
338(define-public glew
339 (package
340 (name "glew")
341 (version "1.11.0")
342 (source (origin
343 (method url-fetch)
344 (uri (string-append
345 "mirror://sourceforge/glew/glew-"
346 version
347 ".tgz"))
348 (sha256
349 (base32
350 "1mhkllxz49l1x680dmzrv2i82qjrq017sykah3xc90f2d8qcxfv9"))
351 (modules '((guix build utils)))
352 (snippet
353 '(substitute* "config/Makefile.linux"
354 (("= cc") "= gcc")
355 (("/lib64") "/lib")))))
356 (build-system gnu-build-system)
357 (arguments
358 '(#:phases (alist-delete 'configure %standard-phases)
359 #:make-flags (list (string-append "GLEW_PREFIX="
360 (assoc-ref %outputs "out"))
361 (string-append "GLEW_DEST="
362 (assoc-ref %outputs "out")))
363 #:tests? #f)) ;no 'check' target
364 (inputs
365 `(("libxi" ,libxi)
366 ("libxmu" ,libxmu)
367 ("libx11" ,libx11)
368 ("mesa" ,mesa)))
369
370 ;; <GL/glew.h> includes <GL/glu.h>.
371 (propagated-inputs `(("glu" ,glu)))
372
373 (home-page "http://glew.sourceforge.net/")
374 (synopsis "OpenGL extension loading library for C and C++")
375 (description
376 "The OpenGL Extension Wrangler Library (GLEW) is a C/C++ extension
377loading library. GLEW provides efficient run-time mechanisms for determining
378which OpenGL extensions are supported on the target platform. OpenGL core and
379extension functionality is exposed in a single header file.")
380 (license l:bsd-3)))
381
7025a035
DT
382(define-public guile-opengl
383 (package
384 (name "guile-opengl")
385 (version "0.1.0")
386 (source (origin
387 (method url-fetch)
388 (uri (string-append "mirror://gnu/guile-opengl/guile-opengl-"
389 version ".tar.gz"))
390 (sha256
391 (base32
392 "13qfx4xh8baryxqrv986l848ygd0piqwm6s2s90pxk9c0m9vklim"))))
393 (build-system gnu-build-system)
394 (native-inputs `(("pkg-config" ,pkg-config)))
395 (inputs `(("guile" ,guile-2.0)
396 ("mesa" ,mesa)
397 ("freeglut" ,freeglut)))
398 (arguments
399 '(#:phases (alist-cons-before
400 'build 'patch-dynamic-link
401 (lambda* (#:key inputs outputs #:allow-other-keys)
402 (define (dynamic-link-substitute file lib input)
403 (substitute* file
404 (("dynamic-link \"lib([a-zA-Z]+)\"" _ lib)
405 (string-append "dynamic-link \""
406 (assoc-ref inputs input)
407 "/lib/lib" lib "\""))))
408 ;; Replace dynamic-link calls for libGL, libGLU, and
409 ;; libglut with absolute paths to the store.
410 (dynamic-link-substitute "glx/runtime.scm" "GL" "mesa")
411 (dynamic-link-substitute "glu/runtime.scm" "GLU" "mesa")
412 (dynamic-link-substitute "glut/runtime.scm" "glut"
413 "freeglut"))
414 %standard-phases)))
415 (home-page "http://gnu.org/s/guile-opengl")
66672a45 416 (synopsis "Guile binding for the OpenGL graphics API")
7025a035 417 (description
66672a45
LC
418 "Guile-OpenGL is a library for Guile that provides bindings to the
419OpenGL graphics API.")
7025a035 420 (license l:lgpl3+)))
131ddf99
AW
421
422(define-public libepoxy
423 (package
424 (name "libepoxy")
425 (version "1.2")
426 (source (origin
427 (method url-fetch)
428 (uri (string-append
429 "https://github.com/anholt/libepoxy/archive/v"
430 version
431 ".tar.gz"))
432 (file-name (string-append name "-" version ".tar.gz"))
433 (sha256
434 (base32
435 "1xp8g6b7xlbym2rj4vkbl6xpb7ijq7glpv656mc7k9b01x22ihs2"))))
436 (arguments
9bbd52e5 437 `(#:phases
131ddf99
AW
438 (alist-cons-after
439 'unpack 'autoreconf
440 (lambda _
441 (zero? (system* "autoreconf" "-vif")))
442 (alist-cons-before
443 'configure 'patch-paths
444 (lambda* (#:key inputs #:allow-other-keys)
445 (let ((python (assoc-ref inputs "python"))
446 (mesa (assoc-ref inputs "mesa")))
447 (substitute* "src/gen_dispatch.py"
448 (("/usr/bin/env python") python))
449 (substitute* (find-files "." "\\.[ch]$")
450 (("libGL.so.1") (string-append mesa "/lib/libGL.so.1"))
451 (("libEGL.so.1") (string-append mesa "/lib/libEGL.so.1")))
9bbd52e5
MW
452
453 ;; XXX On armhf systems, we must add "GLIBC_2.4" to the list of
454 ;; versions in test/dlwrap.c:dlwrap_real_dlsym. It would be
455 ;; better to make this a normal patch, but for now we do it here
456 ;; to prevent rebuilding on other platforms.
457 ,@(if (string-prefix? "arm" (or (%current-target-system)
458 (%current-system)))
459 '((substitute* '"test/dlwrap.c"
460 (("\"GLIBC_2\\.0\"") "\"GLIBC_2.0\", \"GLIBC_2.4\"")))
461 '())
131ddf99
AW
462 #t))
463 %standard-phases))))
464 (build-system gnu-build-system)
465 (native-inputs
466 `(("autoconf" ,autoconf)
467 ("automake" ,automake)
468 ("libtool" ,libtool)
469 ("pkg-config" ,pkg-config)
470 ("python" ,python)))
471 (inputs
472 `(("mesa" ,mesa)))
473 (home-page "http://github.com/anholt/libepoxy/")
474 (synopsis "A library for handling OpenGL function pointer management")
475 (description
476 "A library for handling OpenGL function pointer management.")
477 (license l:x11)))