gnu: packages: Use 'search-patches' everywhere.
[jackhill/guix/guix.git] / gnu / packages / graphics.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015 Tomáš Čech <sleep_walker@gnu.org>
4 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
5 ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
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 graphics)
23 #:use-module (guix download)
24 #:use-module (guix svn-download)
25 #:use-module (guix packages)
26 #:use-module (guix build-system gnu)
27 #:use-module (guix build-system cmake)
28 #:use-module ((guix licenses) #:prefix license:)
29 #:use-module (gnu packages)
30 #:use-module (gnu packages algebra)
31 #:use-module (gnu packages audio)
32 #:use-module (gnu packages autotools)
33 #:use-module (gnu packages bash)
34 #:use-module (gnu packages boost)
35 #:use-module (gnu packages image)
36 #:use-module (gnu packages python)
37 #:use-module (gnu packages fontutils)
38 #:use-module (gnu packages pkg-config)
39 #:use-module (gnu packages pulseaudio) ;libsndfile, libsamplerate
40 #:use-module (gnu packages compression)
41 #:use-module (gnu packages multiprecision)
42 #:use-module (gnu packages boost)
43 #:use-module (gnu packages gl)
44 #:use-module (gnu packages image)
45 #:use-module (gnu packages jemalloc)
46 #:use-module (gnu packages photo)
47 #:use-module (gnu packages python)
48 #:use-module (gnu packages qt)
49 #:use-module (gnu packages sdl)
50 #:use-module (gnu packages video)
51 #:use-module (gnu packages xorg))
52
53 (define-public blender
54 (package
55 (name "blender")
56 (version "2.76b")
57 (source (origin
58 (method url-fetch)
59 (uri (string-append "http://download.blender.org/source/"
60 "blender-" version ".tar.gz"))
61 (sha256
62 (base32
63 "0pb0mlj4vj0iir528ifqq67nsh3ca1942933d9cwlbpcja2jm1dx"))))
64 (build-system cmake-build-system)
65 (arguments
66 `(;; Test files are very large and not included in the release tarball.
67 #:tests? #f
68 #:configure-flags
69 (list "-DWITH_CODEC_FFMPEG=ON"
70 "-DWITH_CODEC_SNDFILE=ON"
71 "-DWITH_CYCLES=ON"
72 "-DWITH_DOC_MANPAGE=ON"
73 "-DWITH_FFTW3=ON"
74 "-DWITH_GAMEENGINE=ON"
75 "-DWITH_IMAGE_OPENJPEG=ON"
76 "-DWITH_INPUT_NDOF=ON"
77 "-DWITH_INSTALL_PORTABLE=OFF"
78 "-DWITH_JACK=ON"
79 "-DWITH_MOD_OCEANSIM=ON"
80 "-DWITH_PLAYER=ON"
81 "-DWITH_PYTHON_INSTALL=OFF"
82 "-DWITH_SYSTEM_OPENJPEG=ON")
83 #:phases
84 (modify-phases %standard-phases
85 (add-after 'unpack 'fix-broken-import
86 (lambda _
87 (substitute* "release/scripts/addons/io_scene_fbx/json2fbx.py"
88 (("import encode_bin") "from . import encode_bin"))
89 #t))
90 (add-after 'set-paths 'add-ilmbase-include-path
91 (lambda* (#:key inputs #:allow-other-keys)
92 ;; OpenEXR propagates ilmbase, but its include files do not appear
93 ;; in the CPATH, so we need to add "$ilmbase/include/OpenEXR/" to
94 ;; the CPATH to satisfy the dependency on "half.h".
95 (setenv "CPATH"
96 (string-append (assoc-ref inputs "ilmbase")
97 "/include/OpenEXR"
98 ":" (or (getenv "CPATH") "")))
99 #t)))))
100 (inputs
101 `(("boost" ,boost)
102 ("jemalloc" ,jemalloc)
103 ("libx11" ,libx11)
104 ("openimageio" ,openimageio)
105 ("openexr" ,openexr)
106 ("ilmbase" ,ilmbase)
107 ("openjpeg" ,openjpeg-1)
108 ("libjpeg" ,libjpeg)
109 ("libpng" ,libpng)
110 ("libtiff" ,libtiff)
111 ("ffmpeg" ,ffmpeg)
112 ("fftw" ,fftw)
113 ("jack" ,jack-1)
114 ("libsndfile" ,libsndfile)
115 ("freetype" ,freetype)
116 ("glew" ,glew)
117 ("openal" ,openal)
118 ("python" ,python-wrapper)
119 ("zlib" ,zlib)))
120 (home-page "http://blender.org/")
121 (synopsis "3D graphics creation suite")
122 (description
123 "Blender is a 3D graphics creation suite. It supports the entirety of
124 the 3D pipeline—modeling, rigging, animation, simulation, rendering,
125 compositing and motion tracking, even video editing and game creation. The
126 application can be customized via its API for Python scripting.")
127 (license license:gpl2+)))
128
129 (define-public cgal
130 (package
131 (name "cgal")
132 (version "4.6.3")
133 (source (origin
134 (method url-fetch)
135 (uri (string-append
136 "http://gforge.inria.fr/frs/download.php/file/"
137 "35139/CGAL-4.6.3.tar.xz"))
138 (sha256
139 (base32
140 "08gwjjh0qz3fakj1y2nsl2qvb0qv5lc7k1pxwjkagh37hxxh4f73"))))
141 (build-system cmake-build-system)
142 (arguments
143 '(;; "RelWithDebInfo" is not supported.
144 #:build-type "Release"
145
146 ;; No 'test' target.
147 #:tests? #f))
148 (inputs
149 `(("mpfr" ,mpfr)
150 ("gmp" ,gmp)
151 ("boost" ,boost)))
152 (home-page "http://cgal.org/")
153 (synopsis "Computational geometry algorithms library")
154 (description
155 "CGAL provides easy access to efficient and reliable geometric algorithms
156 in the form of a C++ library. CGAL is used in various areas needing geometric
157 computation, such as: computer graphics, scientific visualization, computer
158 aided design and modeling, geographic information systems, molecular biology,
159 medical imaging, robotics and motion planning, mesh generation, numerical
160 methods, etc. It provides data structures and algorithms such as
161 triangulations, Voronoi diagrams, polygons, polyhedra, mesh generation, and
162 many more.")
163
164 ;; The 'LICENSE' file explains that a subset is available under more
165 ;; permissive licenses.
166 (license license:gpl3+)))
167
168 (define-public ilmbase
169 (package
170 (name "ilmbase")
171 (version "2.2.0")
172 (source (origin
173 (method url-fetch)
174 (uri (string-append "mirror://savannah/openexr/ilmbase-"
175 version ".tar.gz"))
176 (sha256
177 (base32
178 "1izddjwbh1grs8080vmaix72z469qy29wrvkphgmqmcm0sv1by7c"))
179 (patches (search-patches "ilmbase-fix-tests.patch"))))
180 (build-system gnu-build-system)
181 (home-page "http://www.openexr.com/")
182 (synopsis "Utility C++ libraries for threads, maths, and exceptions")
183 (description
184 "IlmBase provides several utility libraries for C++. Half is a class
185 that encapsulates ILM's 16-bit floating-point format. IlmThread is a thread
186 abstraction. Imath implements 2D and 3D vectors, 3x3 and 4x4 matrices,
187 quaternions and other useful 2D and 3D math functions. Iex is an
188 exception-handling library.")
189 (license license:bsd-3)))
190
191 (define-public openexr
192 (package
193 (name "openexr")
194 (version "2.2.0")
195 (source (origin
196 (method url-fetch)
197 (uri (string-append "mirror://savannah/openexr/openexr-"
198 version ".tar.gz"))
199 (sha256
200 (base32
201 "0ca2j526n4wlamrxb85y2jrgcv0gf21b3a19rr0gh4rjqkv1581n"))
202 (modules '((guix build utils)))
203 (snippet
204 '(substitute* (find-files "." "tmpDir\\.h")
205 (("\"/var/tmp/\"")
206 "\"/tmp/\"")))
207 (patches (search-patches "openexr-missing-samples.patch"))))
208 (build-system gnu-build-system)
209 (arguments
210 '(#:phases
211 (modify-phases %standard-phases
212 (add-after 'unpack 'disable-broken-test
213 ;; This test fails on i686. Upstream developers suggest that
214 ;; this test is broken on i686 and can be safely disabled:
215 ;; https://github.com/openexr/openexr/issues/67#issuecomment-21169748
216 (lambda _
217 (substitute* "IlmImfTest/main.cpp"
218 (("#include \"testOptimizedInterleavePatterns.h\"")
219 "//#include \"testOptimizedInterleavePatterns.h\"")
220 (("TEST \\(testOptimizedInterleavePatterns")
221 "//TEST (testOptimizedInterleavePatterns"))
222 #t)))))
223 (native-inputs
224 `(("pkg-config" ,pkg-config)))
225 (propagated-inputs
226 `(("ilmbase" ,ilmbase) ;used in public headers
227 ("zlib" ,zlib))) ;OpenEXR.pc reads "-lz"
228 (home-page "http://www.openexr.com")
229 (synopsis "High-dynamic range file format library")
230 (description
231 "OpenEXR is a high dynamic-range (HDR) image file format developed for
232 use in computer imaging applications. The IlmImf C++ libraries support
233 storage of the \"EXR\" file format for storing 16-bit floating-point images.")
234 (license license:bsd-3)))
235
236 (define-public openimageio
237 (package
238 (name "openimageio")
239 (version "1.5.18")
240 (source (origin
241 (method url-fetch)
242 (uri (string-append "https://github.com/OpenImageIO/oiio/"
243 "archive/Release-" version ".tar.gz"))
244 (file-name (string-append name "-" version ".tar.gz"))
245 (sha256
246 (base32
247 "0mn7cz19mn8dcrhkq15h25gl20ammr1wz0j2j3c2vxs6ph7zn8jy"))
248 (patches (search-patches "openimageio-boost-1.60.patch"))))
249 (build-system cmake-build-system)
250 ;; FIXME: To run all tests successfully, test image sets from multiple
251 ;; third party sources have to be present. For details see
252 ;; https://github.com/OpenImageIO/oiio/blob/master/INSTALL
253 (arguments `(#:tests? #f))
254 (native-inputs
255 `(("pkg-config" ,pkg-config)))
256 (inputs
257 `(("boost" ,boost)
258 ("libpng" ,libpng)
259 ("libjpeg" ,libjpeg-8)
260 ("libtiff" ,libtiff)
261 ("giflib" ,giflib)
262 ("openexr" ,openexr)
263 ("ilmbase" ,ilmbase)
264 ("python" ,python-2)
265 ("zlib" ,zlib)))
266 (synopsis "C++ library for reading and writing images")
267 (description
268 "OpenImageIO is a library for reading and writing images, and a bunch of
269 related classes, utilities, and applications. There is a particular emphasis
270 on formats and functionality used in professional, large-scale animation and
271 visual effects work for film.")
272 (home-page "http://www.openimageio.org")
273 (license license:bsd-3)))
274
275 (define-public ctl
276 (package
277 (name "ctl")
278 (version "1.5.2")
279 (source (origin
280 (method url-fetch)
281 (uri (string-append "https://github.com/ampas/CTL/archive/ctl-"
282 version ".tar.gz"))
283 (sha256
284 (base32
285 "1gg04pyvw0m398akn0s1l07g5b1haqv5na1wpi5dii1jjd1w3ynp"))))
286 (build-system cmake-build-system)
287 (arguments '(#:tests? #f)) ;no 'test' target
288
289 ;; Headers include OpenEXR and IlmBase headers.
290 (propagated-inputs `(("openexr" ,openexr)))
291
292 (home-page "http://ampasctl.sourceforge.net")
293 (synopsis "Color Transformation Language")
294 (description
295 "The Color Transformation Language, or CTL, is a small programming
296 language that was designed to serve as a building block for digital color
297 management systems. CTL allows users to describe color transforms in a
298 concise and unambiguous way by expressing them as programs. In order to apply
299 a given transform to an image, the color management system instructs a CTL
300 interpreter to load and run the CTL program that describes the transform. The
301 original and the transformed image constitute the CTL program's input and
302 output.")
303
304 ;; The web site says it's under a BSD-3 license, but the 'LICENSE' file
305 ;; and headers use different wording.
306 (license (license:non-copyleft "file://LICENSE"))))
307
308 (define-public brdf-explorer
309 (package
310 (name "brdf-explorer")
311 (version "17") ;svn revision
312 (source (origin
313 ;; There are no release tarballs, and not even tags in the repo,
314 ;; so use the latest revision.
315 (method svn-fetch)
316 (uri (svn-reference
317 (url "http://github.com/wdas/brdf")
318 (revision (string->number version))))
319 (sha256
320 (base32
321 "1458fwsqxramh0gpnp24x7brfpl9afhvr1wqg6c78xqwf32960m5"))
322 (file-name (string-append name "-" version "-checkout"))))
323 (build-system gnu-build-system)
324 (arguments
325 `(#:phases (modify-phases %standard-phases
326 (replace 'configure
327 (lambda* (#:key outputs #:allow-other-keys)
328 (let ((out (assoc-ref outputs "out")))
329 (chdir "trunk")
330 (zero? (system* "qmake"
331 (string-append
332 "prefix=" out))))))
333 (add-after 'install 'wrap-program
334 (lambda* (#:key outputs #:allow-other-keys)
335 (let* ((out (assoc-ref outputs "out"))
336 (bin (string-append out "/bin"))
337 (data (string-append
338 out "/share/brdf")))
339 (with-directory-excursion bin
340 (rename-file "brdf" ".brdf-real")
341 (call-with-output-file "brdf"
342 (lambda (port)
343 (format port "#!/bin/sh
344 # Run the thing from its home, otherwise it just bails out.
345 cd \"~a\"
346 exec -a \"$0\" ~a/.brdf-real~%"
347 data bin)))
348 (chmod "brdf" #o555))))))))
349 (native-inputs
350 `(("qt" ,qt-4))) ;for 'qmake'
351 (inputs
352 `(("qt" ,qt-4)
353 ("mesa" ,mesa)
354 ("glew" ,glew)
355 ("freeglut" ,freeglut)
356 ("zlib" ,zlib)))
357 (home-page "http://www.disneyanimation.com/technology/brdf.html")
358 (synopsis
359 "Analyze bidirectional reflectance distribution functions (BRDFs)")
360 (description
361 "BRDF Explorer is an application that allows the development and analysis
362 of bidirectional reflectance distribution functions (BRDFs). It can load and
363 plot analytic BRDF functions (coded as functions in OpenGL's GLSL shader
364 language), measured material data from the MERL database, and anisotropic
365 measured material data from MIT CSAIL. Graphs and visualizations update in
366 real time as parameters are changed, making it a useful tool for evaluating
367 and understanding different BRDFs (and other component functions).")
368 (license license:ms-pl)))
369
370 (define-public agg
371 (package
372 (name "agg")
373 (version "2.5")
374 (source (origin
375 (method url-fetch)
376 (uri (list (string-append
377 "ftp://ftp.fau.de/gentoo/distfiles/agg-"
378 version ".tar.gz")
379 (string-append
380 "ftp://ftp.ula.ve/gentoo/distfiles/agg-"
381 version ".tar.gz")
382
383 ;; Site was discontinued.
384 (string-append "http://www.antigrain.com/agg-"
385 version ".tar.gz")))
386 (sha256
387 (base32 "07wii4i824vy9qsvjsgqxppgqmfdxq0xa87i5yk53fijriadq7mb"))
388 (patches (search-patches "agg-am_c_prototype.patch"))))
389 (build-system gnu-build-system)
390 (arguments
391 '(#:configure-flags
392 (list (string-append "--x-includes=" (assoc-ref %build-inputs "libx11")
393 "/include")
394 (string-append "--x-libraries=" (assoc-ref %build-inputs "libx11")
395 "/lib"))
396 #:phases
397 (alist-cons-after
398 'unpack 'autoreconf
399 (lambda _
400 ;; let's call configure from configure phase and not now
401 (substitute* "autogen.sh" (("./configure") "# ./configure"))
402 (zero? (system* "sh" "autogen.sh")))
403 %standard-phases)))
404 (native-inputs
405 `(("pkg-config" ,pkg-config)
406 ("libtool" ,libtool)
407 ("autoconf" ,autoconf)
408 ("automake" ,automake)
409 ("bash" ,bash)))
410 (inputs
411 `(("libx11" ,libx11)
412 ("freetype" ,freetype)
413 ("sdl" ,sdl)))
414
415 ;; Antigrain.com was discontinued.
416 (home-page "http://agg.sourceforge.net/antigrain.com/index.html")
417 (synopsis "High-quality 2D graphics rendering engine for C++")
418 (description
419 "Anti-Grain Geometry is a high quality rendering engine written in C++.
420 It supports sub-pixel resolutions and anti-aliasing. It is also library for
421 rendering SVG graphics.")
422 (license license:gpl2+)))