gnu-build-system: Add 'patch-usr-bin-file' to %standard-phases.
[jackhill/guix/guix.git] / gnu / packages / gl.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2013 Guy Grant <gzg@riseup.net>
4 ;;; Copyright © 2014 David Thompson <davet@gnu.org>
5 ;;;
6 ;;; This file is part of GNU Guix.
7 ;;;
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
12 ;;;
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
17 ;;;
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21 (define-module (gnu packages gl)
22 #:use-module ((guix licenses)
23 #:renamer (symbol-prefix-proc 'l:))
24 #:use-module (guix packages)
25 #:use-module (guix download)
26 #:use-module (guix build-system gnu)
27 #:use-module (guix packages)
28 #:use-module (gnu packages bison)
29 #:use-module (gnu packages flex)
30 #:use-module (gnu packages pkg-config)
31 #:use-module (gnu packages python)
32 #:use-module (gnu packages xorg)
33 #:use-module (gnu packages xml)
34 #:use-module (gnu packages fontutils)
35 #:use-module (gnu packages guile))
36
37 (define-public glu
38 (package
39 (name "glu")
40 (version "9.0.0")
41 (source (origin
42 (method url-fetch)
43 (uri (string-append "ftp://ftp.freedesktop.org/pub/mesa/glu/glu-"
44 version ".tar.gz"))
45 (sha256
46 (base32 "0r72yyhj09x3krn3kn629jqbwyq50ji8w5ri2pn6zwrk35m4g1s3"))))
47 (build-system gnu-build-system)
48 (inputs `(("mesa" ,mesa)))
49 (home-page "http://www.opengl.org/archives/resources/faq/technical/glu.htm")
50 (synopsis "Mesa OpenGL Utility library")
51 (description
52 "GLU, or OpenGL Utility Library provides some higher-level functionality
53 not provided by just OpenGL itself. Some of GLU's Features
54 include: Scaling of 2D images and creation of mipmap pyramids,
55 Transformation of object coordinates into device coordinates and
56 vice versa, Support for NURBS surfaces, Support for tessellation
57 of concave or bow tie polygonal primitives, Specialty transformation
58 matrices for creating perspective and orthographic projections,
59 positioning a camera, and selection/picking, Rendering of disk,
60 cylinder, and sphere primitives, Interpreting OpenGL error values
61 as ASCII text.")
62 (license (l:x11-style "http://directory.fsf.org/wiki/License:SGIFreeBv2"))))
63
64 (define-public freeglut
65 (package
66 (name "freeglut")
67 (version "2.8.1")
68 (source (origin
69 (method url-fetch)
70 (uri (string-append "mirror://sourceforge/project/freeglut/freeglut/"
71 version "/freeglut-" version ".tar.gz"))
72 (sha256
73 (base32 "16lrxxxd9ps9l69y3zsw6iy0drwjsp6m26d1937xj71alqk6dr6x"))))
74 (build-system gnu-build-system)
75 (inputs `(("mesa" ,mesa)
76 ("libx11" ,libx11)
77 ("libxi" ,libxi)
78 ("libxrandr" ,libxrandr)
79 ("libxxf86vm" ,libxxf86vm)
80 ("inputproto" ,inputproto)
81 ("xinput" ,xinput)
82 ("glu" ,glu)))
83 (home-page "http://freeglut.sourceforge.net/")
84 (synopsis "Alternative to the OpenGL Utility Toolkit (GLUT)")
85 (description
86 "Freeglut is a completely Free/OpenSourced alternative to
87 the OpenGL Utility Toolkit (GLUT) library. GLUT was originally
88 written by Mark Kilgard to support the sample programs in the
89 second edition OpenGL 'RedBook'. Since then, GLUT has been used
90 in a wide variety of practical applications because it is simple,
91 widely available and highly portable.
92
93 GLUT (and hence freeglut) allows the user to create and manage windows
94 containing OpenGL contexts on a wide range of platforms and also read
95 the mouse, keyboard and joystick functions. freeglut is released under
96 the X-Consortium license.")
97 (license l:x11)))
98
99 (define-public ftgl
100 (package
101 (name "ftgl")
102 (version "2.1.3-rc5")
103 (source (origin
104 (method url-fetch)
105 (uri (string-append "mirror://sourceforge/project/ftgl/FTGL%20Source/2.1.3~rc5/ftgl-"
106 version ".tar.gz"))
107 (sha256
108 (base32 "0nsn4s6vnv5xcgxcw6q031amvh2zfj2smy1r5mbnjj2548hxcn2l"))))
109 (build-system gnu-build-system)
110 (inputs `(("freetype" ,freetype)
111 ("libx11" ,libx11)
112 ("mesa" ,mesa)
113 ("glu" ,glu)))
114 (home-page "http://ftgl.sourceforge.net")
115 (synopsis "Font rendering library for OpenGL applications")
116 (description
117 "FTGL is a font rendering library for OpenGL applications. Supported
118 rendering modes are: Bitmaps, Anti-aliased pixmaps, Texture maps, Outlines,
119 Polygon meshes, and Extruded polygon meshes")
120 (license l:x11)))
121
122 (define-public mesa
123 (package
124 (name "mesa")
125 ;; In newer versions (9.0.5, 9.1 and 9.2 tested), "make" results in an
126 ;; infinite configure loop, see
127 ;; https://bugs.freedesktop.org/show_bug.cgi?id=58812
128 (version "8.0.5")
129 (source
130 (origin
131 (method url-fetch)
132 (uri (string-append
133 "ftp://ftp.freedesktop.org/pub/mesa/older-versions/8.x/"
134 version
135 "/MesaLib-" version
136 ".tar.bz2"))
137 (sha256
138 (base32
139 "0pjs8x51c0i6mawgd4w03lxpyx5fnx7rc8plr8jfsscf9yiqs6si"))))
140 (build-system gnu-build-system)
141 (propagated-inputs
142 `(("glproto" ,glproto)
143 ("libdrm" ,libdrm-2.4.33)
144 ("libx11" ,libx11)
145 ("libxdamage" ,libxdamage)
146 ("libxxf86vm" ,libxxf86vm)))
147 (inputs
148 `(("dri2proto" ,dri2proto)
149 ("expat" ,expat)
150 ("libxfixes" ,libxfixes)
151 ("libxml2" ,libxml2)
152 ("makedepend" ,makedepend)))
153 (native-inputs
154 `(("pkg-config" ,pkg-config)
155 ("flex" ,flex)
156 ("bison" ,bison)
157 ("python" ,python-2))) ; incompatible with Python 3 (print syntax)
158 (arguments
159 `(#:configure-flags
160 `("--with-gallium-drivers=r600,svga,swrast") ; drop r300 from the default list as it requires llvm
161 #:phases
162 (alist-cons-after
163 'unpack 'remove-symlink
164 (lambda _
165 ;; remove dangling symlink to /usr/include/wine/windows
166 (delete-file "src/gallium/state_trackers/d3d1x/w32api"))
167 %standard-phases)))
168 (home-page "http://mesa3d.org/")
169 (synopsis "Mesa, an OpenGL implementation")
170 (description "Mesa is a free implementation of the OpenGL specification -
171 a system for rendering interactive 3D graphics. A variety of device drivers
172 allows Mesa to be used in many different environments ranging from software
173 emulation to complete hardware acceleration for modern GPUs.")
174 (license l:x11)))
175
176 (define-public guile-opengl
177 (package
178 (name "guile-opengl")
179 (version "0.1.0")
180 (source (origin
181 (method url-fetch)
182 (uri (string-append "mirror://gnu/guile-opengl/guile-opengl-"
183 version ".tar.gz"))
184 (sha256
185 (base32
186 "13qfx4xh8baryxqrv986l848ygd0piqwm6s2s90pxk9c0m9vklim"))))
187 (build-system gnu-build-system)
188 (native-inputs `(("pkg-config" ,pkg-config)))
189 (inputs `(("guile" ,guile-2.0)
190 ("mesa" ,mesa)
191 ("freeglut" ,freeglut)))
192 (arguments
193 '(#:phases (alist-cons-before
194 'build 'patch-dynamic-link
195 (lambda* (#:key inputs outputs #:allow-other-keys)
196 (define (dynamic-link-substitute file lib input)
197 (substitute* file
198 (("dynamic-link \"lib([a-zA-Z]+)\"" _ lib)
199 (string-append "dynamic-link \""
200 (assoc-ref inputs input)
201 "/lib/lib" lib "\""))))
202 ;; Replace dynamic-link calls for libGL, libGLU, and
203 ;; libglut with absolute paths to the store.
204 (dynamic-link-substitute "glx/runtime.scm" "GL" "mesa")
205 (dynamic-link-substitute "glu/runtime.scm" "GLU" "mesa")
206 (dynamic-link-substitute "glut/runtime.scm" "glut"
207 "freeglut"))
208 %standard-phases)))
209 (home-page "http://gnu.org/s/guile-opengl")
210 (synopsis "Guile binding for the OpenGL graphics API")
211 (description
212 "Guile-OpenGL is a library for Guile that provides bindings to the
213 OpenGL graphics API.")
214 (license l:lgpl3+)))