gnu: All snippets report errors using exceptions, else return #t.
[jackhill/guix/guix.git] / gnu / packages / graphics.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2016 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, 2017 Ricardo Wurmus <rekado@elephly.net>
6 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2016 Andreas Enge <andreas@enge.fr>
8 ;;; Copyright © 2017 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
9 ;;; Copyright © 2017, 2018 Ben Woodcroft <donttrustben@gmail.com>
10 ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
11 ;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com>
12 ;;;
13 ;;; This file is part of GNU Guix.
14 ;;;
15 ;;; GNU Guix is free software; you can redistribute it and/or modify it
16 ;;; under the terms of the GNU General Public License as published by
17 ;;; the Free Software Foundation; either version 3 of the License, or (at
18 ;;; your option) any later version.
19 ;;;
20 ;;; GNU Guix is distributed in the hope that it will be useful, but
21 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;;; GNU General Public License for more details.
24 ;;;
25 ;;; You should have received a copy of the GNU General Public License
26 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27
28 (define-module (gnu packages graphics)
29 #:use-module (guix download)
30 #:use-module (guix git-download)
31 #:use-module (guix packages)
32 #:use-module (guix build-system gnu)
33 #:use-module (guix build-system cmake)
34 #:use-module (guix build-system python)
35 #:use-module ((guix licenses) #:prefix license:)
36 #:use-module (guix utils)
37 #:use-module (gnu packages)
38 #:use-module (gnu packages algebra)
39 #:use-module (gnu packages audio)
40 #:use-module (gnu packages autotools)
41 #:use-module (gnu packages bash)
42 #:use-module (gnu packages bison)
43 #:use-module (gnu packages boost)
44 #:use-module (gnu packages check)
45 #:use-module (gnu packages documentation)
46 #:use-module (gnu packages ghostscript)
47 #:use-module (gnu packages haskell)
48 #:use-module (gnu packages image)
49 #:use-module (gnu packages imagemagick)
50 #:use-module (gnu packages python)
51 #:use-module (gnu packages flex)
52 #:use-module (gnu packages fonts)
53 #:use-module (gnu packages fontutils)
54 #:use-module (gnu packages perl)
55 #:use-module (gnu packages pdf)
56 #:use-module (gnu packages pkg-config)
57 #:use-module (gnu packages pulseaudio) ;libsndfile, libsamplerate
58 #:use-module (gnu packages compression)
59 #:use-module (gnu packages multiprecision)
60 #:use-module (gnu packages boost)
61 #:use-module (gnu packages gl)
62 #:use-module (gnu packages glib)
63 #:use-module (gnu packages graphviz)
64 #:use-module (gnu packages gtk)
65 #:use-module (gnu packages gnome)
66 #:use-module (gnu packages image)
67 #:use-module (gnu packages jemalloc)
68 #:use-module (gnu packages photo)
69 #:use-module (gnu packages pth)
70 #:use-module (gnu packages python)
71 #:use-module (gnu packages qt)
72 #:use-module (gnu packages readline)
73 #:use-module (gnu packages sdl)
74 #:use-module (gnu packages swig)
75 #:use-module (gnu packages video)
76 #:use-module (gnu packages xml)
77 #:use-module (gnu packages xorg))
78
79 (define-public blender
80 (package
81 (name "blender")
82 (version "2.79")
83 (source (origin
84 (method url-fetch)
85 (uri (string-append "https://download.blender.org/source/"
86 "blender-" version ".tar.gz"))
87 (sha256
88 (base32
89 "16f84mdzkmwjmqahjj64kbyk4kagdj4mcr8qjazs1952d7kh7pm9"))))
90 (build-system cmake-build-system)
91 (arguments
92 (let ((python-version (version-major+minor (package-version python))))
93 `(;; Test files are very large and not included in the release tarball.
94 #:tests? #f
95 #:configure-flags
96 (list "-DWITH_CODEC_FFMPEG=ON"
97 "-DWITH_CODEC_SNDFILE=ON"
98 "-DWITH_CYCLES=ON"
99 "-DWITH_DOC_MANPAGE=ON"
100 "-DWITH_FFTW3=ON"
101 "-DWITH_GAMEENGINE=ON"
102 "-DWITH_IMAGE_OPENJPEG=ON"
103 "-DWITH_INPUT_NDOF=ON"
104 "-DWITH_INSTALL_PORTABLE=OFF"
105 "-DWITH_JACK=ON"
106 "-DWITH_MOD_OCEANSIM=ON"
107 "-DWITH_PLAYER=ON"
108 "-DWITH_PYTHON_INSTALL=OFF"
109 "-DWITH_PYTHON_INSTALL=OFF"
110 "-DWITH_SYSTEM_OPENJPEG=ON"
111 (string-append "-DPYTHON_LIBRARY=python" ,python-version "m")
112 (string-append "-DPYTHON_LIBPATH=" (assoc-ref %build-inputs "python")
113 "/lib")
114 (string-append "-DPYTHON_INCLUDE_DIR=" (assoc-ref %build-inputs "python")
115 "/include/python" ,python-version "m")
116 (string-append "-DPYTHON_VERSION=" ,python-version))
117 #:phases
118 (modify-phases %standard-phases
119 (add-after 'unpack 'fix-broken-import
120 (lambda _
121 (substitute* "release/scripts/addons/io_scene_fbx/json2fbx.py"
122 (("import encode_bin") "from . import encode_bin"))
123 #t))
124 (add-after 'set-paths 'add-ilmbase-include-path
125 (lambda* (#:key inputs #:allow-other-keys)
126 ;; OpenEXR propagates ilmbase, but its include files do not appear
127 ;; in the CPATH, so we need to add "$ilmbase/include/OpenEXR/" to
128 ;; the CPATH to satisfy the dependency on "half.h".
129 (setenv "CPATH"
130 (string-append (assoc-ref inputs "ilmbase")
131 "/include/OpenEXR"
132 ":" (or (getenv "CPATH") "")))
133 #t))))))
134 (inputs
135 `(("boost" ,boost)
136 ("jemalloc" ,jemalloc)
137 ("libx11" ,libx11)
138 ("openimageio" ,openimageio)
139 ("openexr" ,openexr)
140 ("ilmbase" ,ilmbase)
141 ("openjpeg" ,openjpeg-1)
142 ("libjpeg" ,libjpeg)
143 ("libpng" ,libpng)
144 ("libtiff" ,libtiff)
145 ("ffmpeg-2.8" ,ffmpeg-2.8) ;<https://lists.gnu.org/archive/html/guix-devel/2016-04/msg01019.html>
146 ("fftw" ,fftw)
147 ("jack" ,jack-1)
148 ("libsndfile" ,libsndfile)
149 ("freetype" ,freetype)
150 ("glew" ,glew)
151 ("openal" ,openal)
152 ("python" ,python)
153 ("zlib" ,zlib)))
154 (home-page "https://blender.org/")
155 (synopsis "3D graphics creation suite")
156 (description
157 "Blender is a 3D graphics creation suite. It supports the entirety of
158 the 3D pipeline—modeling, rigging, animation, simulation, rendering,
159 compositing and motion tracking, even video editing and game creation. The
160 application can be customized via its API for Python scripting.")
161 (license license:gpl2+)))
162
163 (define-public assimp
164 (package
165 (name "assimp")
166 (version "3.3.1")
167 (source (origin
168 (method url-fetch)
169 (uri (string-append "https://github.com/assimp/assimp/archive/v"
170 version ".tar.gz"))
171 (file-name (string-append name "-" version ".tar.gz"))
172 (sha256
173 (base32
174 "1gy7zlgkf4nmyv8n674p3f30asis0gjz8icyy11i693n13ww71fk"))))
175 (build-system cmake-build-system)
176 (inputs
177 `(("zlib" ,zlib)))
178 (home-page "http://assimp.org/")
179 (synopsis "Asset import library")
180 (description
181 "The Open Asset Import Library loads more than 40 3D file formats into
182 one unified data structure. Additionally, assimp features various mesh post
183 processing tools: normals and tangent space generation, triangulation, vertex
184 cache locality optimization, removal of degenerate primitives and duplicate
185 vertices, sorting by primitive type, merging of redundant materials and many
186 more.")
187 (license license:bsd-3)))
188
189 (define-public cgal
190 (package
191 (name "cgal")
192 (version "4.8.1")
193 (source (origin
194 (method url-fetch)
195 (uri (string-append
196 "https://github.com/CGAL/cgal/releases/download/releases/"
197 "CGAL-" version "/CGAL-" version ".tar.xz"))
198 (sha256
199 (base32
200 "1c41yzl2jg3d6zx5k0iccwqwibp950q7dr7z7pp4xi9wlph3c87s"))))
201 (build-system cmake-build-system)
202 (arguments
203 '(;; "RelWithDebInfo" is not supported.
204 #:build-type "Release"
205
206 ;; No 'test' target.
207 #:tests? #f))
208 (inputs
209 `(("mpfr" ,mpfr)
210 ("gmp" ,gmp)
211 ("boost" ,boost)))
212 (home-page "http://cgal.org/")
213 (synopsis "Computational geometry algorithms library")
214 (description
215 "CGAL provides easy access to efficient and reliable geometric algorithms
216 in the form of a C++ library. CGAL is used in various areas needing geometric
217 computation, such as: computer graphics, scientific visualization, computer
218 aided design and modeling, geographic information systems, molecular biology,
219 medical imaging, robotics and motion planning, mesh generation, numerical
220 methods, etc. It provides data structures and algorithms such as
221 triangulations, Voronoi diagrams, polygons, polyhedra, mesh generation, and
222 many more.")
223
224 ;; The 'LICENSE' file explains that a subset is available under more
225 ;; permissive licenses.
226 (license license:gpl3+)))
227
228 (define-public ilmbase
229 (package
230 (name "ilmbase")
231 (version "2.2.1")
232 (source (origin
233 (method url-fetch)
234 (uri (string-append "mirror://savannah/openexr/ilmbase-"
235 version ".tar.gz"))
236 (sha256
237 (base32
238 "17k0hq19wplx9s029kjrq6c51x2ryrfmaavcappkd0g67gk0dhna"))
239 (patches (search-patches "ilmbase-fix-tests.patch"))))
240 (build-system gnu-build-system)
241 (home-page "http://www.openexr.com/")
242 (synopsis "Utility C++ libraries for threads, maths, and exceptions")
243 (description
244 "IlmBase provides several utility libraries for C++. Half is a class
245 that encapsulates ILM's 16-bit floating-point format. IlmThread is a thread
246 abstraction. Imath implements 2D and 3D vectors, 3x3 and 4x4 matrices,
247 quaternions and other useful 2D and 3D math functions. Iex is an
248 exception-handling library.")
249 (license license:bsd-3)))
250
251 (define-public ogre
252 (package
253 (name "ogre")
254 (version "1.10.11")
255 (source
256 (origin
257 (method url-fetch)
258 (uri (string-append "https://github.com/OGRECave/" name
259 "/archive/v" version ".tar.gz"))
260 (sha256
261 (base32
262 "13bdh9v4026qf8w8rbfln2rmwf0rby1a8fz55zpdvpy105i6cbpz"))
263 (file-name (string-append name "-" version ".tar.gz"))))
264 (build-system cmake-build-system)
265 (arguments
266 '(#:phases
267 (modify-phases %standard-phases
268 (add-before 'configure 'pre-configure
269 (lambda _
270 ;; It expects googletest source to be downloaded and
271 ;; be in a specific place.
272 (substitute* "Tests/CMakeLists.txt"
273 (("URL(.*)$" _ suffix)
274 (string-append "URL " suffix
275 "\t\tURL_HASH "
276 "MD5=16877098823401d1bf2ed7891d7dce36\n")))
277 #t))
278 (add-before 'build 'pre-build
279 (lambda* (#:key inputs #:allow-other-keys)
280 (copy-file (assoc-ref inputs "googletest-source")
281 (string-append (getcwd)
282 "/Tests/googletest-prefix/src/"
283 "release-1.8.0.tar.gz"))
284 #t)))
285 #:configure-flags
286 (list "-DOGRE_BUILD_TESTS=TRUE"
287 (string-append "-DCMAKE_INSTALL_RPATH="
288 (assoc-ref %outputs "out") "/lib:"
289 (assoc-ref %outputs "out") "/lib/OGRE:"
290 (assoc-ref %build-inputs "googletest") "/lib")
291 "-DOGRE_INSTALL_DOCS=TRUE"
292 "-DOGRE_INSTALL_SAMPLES=TRUE"
293 "-DOGRE_INSTALL_SAMPLES_SOURCE=TRUE")))
294 (native-inputs
295 `(("boost" ,boost)
296 ("doxygen" ,doxygen)
297 ("googletest-source" ,(package-source googletest))
298 ("pkg-config" ,pkg-config)))
299 (inputs
300 `(("font-dejavu" ,font-dejavu)
301 ("freeimage" ,freeimage)
302 ("freetype" ,freetype)
303 ("glu" ,glu)
304 ("googletest" ,googletest)
305 ("sdl2" ,sdl2)
306 ("libxaw" ,libxaw)
307 ("libxrandr" ,libxrandr)
308 ("tinyxml" ,tinyxml)
309 ("zziplib" ,zziplib)))
310 (synopsis "Scene-oriented, flexible 3D engine written in C++")
311 (description
312 "OGRE (Object-Oriented Graphics Rendering Engine) is a scene-oriented,
313 flexible 3D engine written in C++ designed to make it easier and more intuitive
314 for developers to produce applications utilising hardware-accelerated 3D
315 graphics.")
316 (home-page "http://www.ogre3d.org/")
317 (license license:expat)))
318
319 (define-public openexr
320 (package
321 (name "openexr")
322 (version "2.2.1")
323 (source (origin
324 (method url-fetch)
325 (uri (string-append "mirror://savannah/openexr/openexr-"
326 version ".tar.gz"))
327 (sha256
328 (base32
329 "1kdf2gqznsdinbd5vcmqnif442nyhdf9l7ckc51410qm2gv5m6lg"))
330 (modules '((guix build utils)))
331 (snippet
332 '(begin
333 (substitute* (find-files "." "tmpDir\\.h")
334 (("\"/var/tmp/\"")
335 "\"/tmp/\""))
336
337 ;; Install 'ImfStdIO.h'. Reported at
338 ;; <https://lists.nongnu.org/archive/html/openexr-devel/2016-06/msg00001.html>
339 ;; and <https://github.com/openexr/openexr/pull/184>.
340 (substitute* "IlmImf/Makefile.in"
341 (("ImfIO\\.h")
342 "ImfIO.h ImfStdIO.h"))
343 #t))
344 (patches (search-patches "openexr-missing-samples.patch"))))
345 (build-system gnu-build-system)
346 (arguments
347 '(#:phases
348 (modify-phases %standard-phases
349 (add-after 'unpack 'disable-broken-test
350 ;; This test fails on i686. Upstream developers suggest that
351 ;; this test is broken on i686 and can be safely disabled:
352 ;; https://github.com/openexr/openexr/issues/67#issuecomment-21169748
353 (lambda _
354 (substitute* "IlmImfTest/main.cpp"
355 (("#include \"testOptimizedInterleavePatterns.h\"")
356 "//#include \"testOptimizedInterleavePatterns.h\"")
357 (("TEST \\(testOptimizedInterleavePatterns")
358 "//TEST (testOptimizedInterleavePatterns"))
359 #t)))))
360 (native-inputs
361 `(("pkg-config" ,pkg-config)))
362 (propagated-inputs
363 `(("ilmbase" ,ilmbase) ;used in public headers
364 ("zlib" ,zlib))) ;OpenEXR.pc reads "-lz"
365 (home-page "http://www.openexr.com")
366 (synopsis "High-dynamic range file format library")
367 (description
368 "OpenEXR is a high dynamic-range (HDR) image file format developed for
369 use in computer imaging applications. The IlmImf C++ libraries support
370 storage of the \"EXR\" file format for storing 16-bit floating-point images.")
371 (license license:bsd-3)))
372
373 (define-public openimageio
374 (package
375 (name "openimageio")
376 (version "1.6.15")
377 (source (origin
378 (method url-fetch)
379 (uri (string-append "https://github.com/OpenImageIO/oiio/"
380 "archive/Release-" version ".tar.gz"))
381 (file-name (string-append name "-" version ".tar.gz"))
382 (sha256
383 (base32
384 "144crq0205d0w5aq4iglh2rhzf54a8rv3pksy6d533b75w5d7rq7"))))
385 (build-system cmake-build-system)
386 ;; FIXME: To run all tests successfully, test image sets from multiple
387 ;; third party sources have to be present. For details see
388 ;; https://github.com/OpenImageIO/oiio/blob/master/INSTALL
389 (arguments `(#:tests? #f))
390 (native-inputs
391 `(("pkg-config" ,pkg-config)))
392 (inputs
393 `(("boost" ,boost)
394 ("libpng" ,libpng)
395 ("libjpeg" ,libjpeg-8)
396 ("libtiff" ,libtiff)
397 ("giflib" ,giflib)
398 ("openexr" ,openexr)
399 ("ilmbase" ,ilmbase)
400 ("python" ,python-2)
401 ("zlib" ,zlib)))
402 (synopsis "C++ library for reading and writing images")
403 (description
404 "OpenImageIO is a library for reading and writing images, and a bunch of
405 related classes, utilities, and applications. There is a particular emphasis
406 on formats and functionality used in professional, large-scale animation and
407 visual effects work for film.")
408 (home-page "http://www.openimageio.org")
409 (license license:bsd-3)))
410
411 (define-public openscenegraph
412 (package
413 (name "openscenegraph")
414 (version "3.4.0")
415 (source
416 (origin
417 (method url-fetch)
418 (uri (string-append "http://trac.openscenegraph.org/downloads/developer_releases/"
419 "OpenSceneGraph-" version ".zip"))
420 (sha256
421 (base32
422 "03h4wfqqk7rf3mpz0sa99gy715cwpala7964z2npd8jxfn27swjw"))
423 (patches (search-patches "openscenegraph-ffmpeg3.patch"))
424 (file-name (string-append name "-" version ".zip"))))
425 (build-system cmake-build-system)
426 (arguments
427 `(#:tests? #f ;; No test target available.
428 #:configure-flags
429 (list (string-append "-DCMAKE_INSTALL_RPATH="
430 (assoc-ref %outputs "out") "/lib:"
431 (assoc-ref %outputs "out") "/lib64")
432 ;; We need to set this flag or otherwise 'rd' will be added
433 ;; to the name of the library binaries and break linking
434 ;; with other programs.
435 "-DCMAKE_BUILD_TYPE=Release")))
436 (native-inputs
437 `(("unzip" ,unzip)))
438 (inputs
439 `(("giflib", giflib)
440 ("jasper", jasper)
441 ("librsvg", librsvg)
442 ("pth", pth)
443 ("qtbase", qtbase)
444 ("ffmpeg", ffmpeg)
445 ("mesa", mesa)))
446 (synopsis "High performance real-time graphics toolkit")
447 (description
448 "The OpenSceneGraph is a high performance 3D graphics toolkit
449 used by application developers in fields such as visual simulation, games,
450 virtual reality, scientific visualization and modeling.")
451 (home-page "http://www.openscenegraph.org")
452 ;; The 'LICENSE' file explains that the source is licensed under
453 ;; LGPL 2.1, but with 4 exceptions. This version is called OSGPL.
454 (license license:lgpl2.1)))
455
456 (define-public rapicorn
457 (package
458 (name "rapicorn")
459 (version "16.0.0")
460 (source (origin
461 (method url-fetch)
462 (uri (string-append "https://testbit.eu/pub/dists/rapicorn/"
463 "rapicorn-" version ".tar.xz"))
464 (sha256
465 (base32
466 "1y51yjrpsihas1jy905m9p3r8iiyhq6bwi2690c564i5dnix1f9d"))
467 (patches (search-patches "rapicorn-isnan.patch"))))
468 (build-system gnu-build-system)
469 (arguments
470 `(#:phases
471 (modify-phases %standard-phases
472 (add-after 'unpack 'fix-tests
473 (lambda _
474 ;; Our grep does not support perl regular expressions.
475 (substitute* "taptool.sh"
476 (("grep -P") "grep -E"))
477 ;; Disable path tests because we cannot access /bin or /sbin.
478 (substitute* "rcore/tests/multitest.cc"
479 (("TCMP \\(Path::equals \\(\"/bin\"") "//"))
480 #t))
481 (add-before 'check 'pre-check
482 (lambda _
483 ;; The test suite requires a running X server (with DISPLAY
484 ;; number 99 or higher).
485 (system "Xvfb :99 &")
486 (setenv "DISPLAY" ":99")
487 #t))
488 (add-after 'unpack 'replace-fhs-paths
489 (lambda _
490 (substitute* (cons "Makefile.decl"
491 (find-files "." "^Makefile\\.in$"))
492 (("/bin/ls") (which "ls"))
493 (("/usr/bin/env") (which "env")))
494 #t)))))
495 ;; These libraries are listed in the "Required" section of the pkg-config
496 ;; file.
497 (propagated-inputs
498 `(("librsvg" ,librsvg)
499 ("cairo" ,cairo)
500 ("pango" ,pango)
501 ("libxml2" ,libxml2)
502 ("python2-enum34" ,python2-enum34)))
503 (inputs
504 `(("gdk-pixbuf" ,gdk-pixbuf)
505 ("libpng" ,libpng-1.2)
506 ("readline" ,readline)
507 ("libcroco" ,libcroco)
508 ("python" ,python-2)
509 ("cython" ,python2-cython)))
510 (native-inputs
511 `(("pandoc" ,ghc-pandoc)
512 ("bison" ,bison)
513 ("flex" ,flex)
514 ("doxygen" ,doxygen)
515 ("graphviz" ,graphviz)
516 ("intltool" ,intltool)
517 ("pkg-config" ,pkg-config)
518 ("xvfb" ,xorg-server)))
519 (home-page "https://rapicorn.testbit.org/")
520 (synopsis "Toolkit for rapid development of user interfaces")
521 (description
522 "Rapicorn is a toolkit for rapid development of user interfaces in C++
523 and Python. The user interface is designed in a declarative markup language
524 and is connected to the programming logic using data bindings and commands.")
525 (license license:mpl2.0)))
526
527 (define-public ctl
528 (package
529 (name "ctl")
530 (version "1.5.2")
531 (source (origin
532 (method url-fetch)
533 (uri (string-append "https://github.com/ampas/CTL/archive/ctl-"
534 version ".tar.gz"))
535 (sha256
536 (base32
537 "1gg04pyvw0m398akn0s1l07g5b1haqv5na1wpi5dii1jjd1w3ynp"))))
538 (build-system cmake-build-system)
539 (arguments '(#:tests? #f)) ;no 'test' target
540
541 ;; Headers include OpenEXR and IlmBase headers.
542 (propagated-inputs `(("openexr" ,openexr)))
543
544 (home-page "http://ampasctl.sourceforge.net")
545 (synopsis "Color Transformation Language")
546 (description
547 "The Color Transformation Language, or CTL, is a small programming
548 language that was designed to serve as a building block for digital color
549 management systems. CTL allows users to describe color transforms in a
550 concise and unambiguous way by expressing them as programs. In order to apply
551 a given transform to an image, the color management system instructs a CTL
552 interpreter to load and run the CTL program that describes the transform. The
553 original and the transformed image constitute the CTL program's input and
554 output.")
555
556 ;; The web site says it's under a BSD-3 license, but the 'LICENSE' file
557 ;; and headers use different wording.
558 (license (license:non-copyleft "file://LICENSE"))))
559
560 (define-public brdf-explorer
561 ;; There are no release tarballs, and not even tags in the repo,
562 ;; so use the latest revision.
563 (let ((commit "5b2cd46f38a06e47207fa7229b72d37beb945019")
564 (revision "1"))
565 (package
566 (name "brdf-explorer")
567 (version (string-append "1.0.0-" revision "." (string-take commit 9)))
568 (source (origin
569 (method git-fetch)
570 (uri (git-reference
571 (url "https://github.com/wdas/brdf.git")
572 (commit commit)))
573 (sha256
574 (base32
575 "06vzbiajzbi2xl8jlff5d45bc9wd68i3jdndfab1f3jgfrd8bsgx"))
576 (file-name (string-append name "-" version "-checkout"))))
577 (build-system gnu-build-system)
578 (arguments
579 `(#:phases (modify-phases %standard-phases
580 (replace 'configure
581 (lambda* (#:key outputs #:allow-other-keys)
582 (let ((out (assoc-ref outputs "out")))
583 (zero? (system* "qmake"
584 (string-append "prefix=" out))))))
585 (add-after 'install 'wrap-program
586 (lambda* (#:key outputs #:allow-other-keys)
587 (let* ((out (assoc-ref outputs "out"))
588 (bin (string-append out "/bin"))
589 (data (string-append
590 out "/share/brdf")))
591 (with-directory-excursion bin
592 (rename-file "brdf" ".brdf-real")
593 (call-with-output-file "brdf"
594 (lambda (port)
595 (format port "#!/bin/sh
596 # Run the thing from its home, otherwise it just bails out.
597 cd \"~a\"
598 exec -a \"$0\" ~a/.brdf-real~%"
599 data bin)))
600 (chmod "brdf" #o555))))))))
601 (native-inputs
602 `(("qttools" ,qttools))) ;for 'qmake'
603 (inputs
604 `(("qtbase" ,qtbase)
605 ("mesa" ,mesa)
606 ("glew" ,glew)
607 ("freeglut" ,freeglut)
608 ("zlib" ,zlib)))
609 (home-page "http://www.disneyanimation.com/technology/brdf.html")
610 (synopsis
611 "Analyze bidirectional reflectance distribution functions (BRDFs)")
612 (description
613 "BRDF Explorer is an application that allows the development and analysis
614 of bidirectional reflectance distribution functions (BRDFs). It can load and
615 plot analytic BRDF functions (coded as functions in OpenGL's GLSL shader
616 language), measured material data from the MERL database, and anisotropic
617 measured material data from MIT CSAIL. Graphs and visualizations update in
618 real time as parameters are changed, making it a useful tool for evaluating
619 and understanding different BRDFs (and other component functions).")
620 (license license:ms-pl))))
621
622 (define-public agg
623 (package
624 (name "agg")
625 (version "2.5")
626 (source (origin
627 (method url-fetch)
628 (uri (list (string-append
629 "ftp://ftp.fau.de/gentoo/distfiles/agg-"
630 version ".tar.gz")
631 (string-append
632 "ftp://ftp.ula.ve/gentoo/distfiles/agg-"
633 version ".tar.gz")
634
635 ;; Site was discontinued.
636 (string-append "http://www.antigrain.com/agg-"
637 version ".tar.gz")))
638 (sha256
639 (base32 "07wii4i824vy9qsvjsgqxppgqmfdxq0xa87i5yk53fijriadq7mb"))
640 (patches (search-patches "agg-am_c_prototype.patch"))))
641 (build-system gnu-build-system)
642 (arguments
643 '(#:configure-flags
644 (list (string-append "--x-includes=" (assoc-ref %build-inputs "libx11")
645 "/include")
646 (string-append "--x-libraries=" (assoc-ref %build-inputs "libx11")
647 "/lib"))
648 #:phases
649 (modify-phases %standard-phases
650 (add-after 'unpack 'autoreconf
651 (lambda _
652 ;; let's call configure from configure phase and not now
653 (substitute* "autogen.sh" (("./configure") "# ./configure"))
654 (zero? (system* "sh" "autogen.sh")))))))
655 (native-inputs
656 `(("pkg-config" ,pkg-config)
657 ("libtool" ,libtool)
658 ("autoconf" ,autoconf)
659 ("automake" ,automake)
660 ("bash" ,bash)))
661 (inputs
662 `(("libx11" ,libx11)
663 ("freetype" ,freetype)
664 ("sdl" ,sdl)))
665
666 ;; Antigrain.com was discontinued.
667 (home-page "http://agg.sourceforge.net/antigrain.com/index.html")
668 (synopsis "High-quality 2D graphics rendering engine for C++")
669 (description
670 "Anti-Grain Geometry is a high quality rendering engine written in C++.
671 It supports sub-pixel resolutions and anti-aliasing. It is also library for
672 rendering SVG graphics.")
673 (license license:gpl2+)))
674
675 (define-public python-pastel
676 (package
677 (name "python-pastel")
678 (version "0.1.0")
679 (source
680 (origin
681 (method url-fetch)
682 (uri (pypi-uri "pastel" version))
683 (sha256
684 (base32
685 "1hqbm934n5yjwn31aq8h7shrr0rcy326wrqfc856vyn0gr0sy21i"))))
686 (build-system python-build-system)
687 (native-inputs
688 `(("python-pytest" ,python-pytest)))
689 (home-page "https://github.com/sdispater/pastel")
690 (synopsis "Library to colorize strings in your terminal")
691 (description "Pastel is a simple library to help you colorize strings in
692 your terminal. It comes bundled with predefined styles:
693 @enumerate
694 @item info: green
695 @item comment: yellow
696 @item question: black on cyan
697 @item error: white on red
698 @end enumerate
699 ")
700 (license license:expat)))
701
702 (define-public python2-pastel
703 (package-with-python2 python-pastel))
704
705 (define-public fgallery
706 (package
707 (name "fgallery")
708 (version "1.8.2")
709 (source (origin
710 (method url-fetch)
711 (uri
712 (string-append
713 "http://www.thregr.org/~wavexx/software/fgallery/releases/"
714 "fgallery-" version ".zip"))
715 (sha256
716 (base32
717 "18wlvqbxcng8pawimbc8f2422s8fnk840hfr6946lzsxr0ijakvf"))))
718 (build-system gnu-build-system)
719 (arguments
720 `(#:tests? #f ; no tests
721 #:phases
722 (modify-phases %standard-phases
723 (delete 'configure)
724 (delete 'build)
725 (replace 'install
726 (lambda* (#:key inputs outputs #:allow-other-keys)
727 (let* ((out (assoc-ref outputs "out"))
728 (bin (string-append out "/bin/"))
729 (share (string-append out "/share/fgallery"))
730 (man (string-append out "/share/man/man1"))
731 (perl5lib (getenv "PERL5LIB"))
732 (script (string-append share "/fgallery")))
733 (define (bin-directory input-name)
734 (string-append (assoc-ref inputs input-name) "/bin"))
735
736 (mkdir-p man)
737 (copy-file "fgallery.1" (string-append man "/fgallery.1"))
738
739 (mkdir-p share)
740 (copy-recursively "." share)
741
742 ;; fgallery copies files from store when it is run. The
743 ;; read-only permissions from the store directories will cause
744 ;; fgallery to fail. Do not preserve file attributes when
745 ;; copying files to prevent it.
746 (substitute* script
747 (("'cp'")
748 "'cp', '--no-preserve=all'"))
749
750 (mkdir-p bin)
751 (symlink script (string-append out "/bin/fgallery"))
752
753 (wrap-program script
754 `("PATH" ":" prefix
755 ,(map bin-directory '("imagemagick"
756 "lcms"
757 "fbida"
758 "libjpeg"
759 "zip"
760 "jpegoptim"
761 "pngcrush"
762 "p7zip")))
763 `("PERL5LIB" ":" prefix (,perl5lib)))
764 #t))))))
765 (native-inputs
766 `(("unzip" ,unzip)))
767 ;; TODO: Add missing optional dependency: facedetect.
768 (inputs
769 `(("imagemagick" ,imagemagick)
770 ("lcms" ,lcms)
771 ("fbida" ,fbida)
772 ("libjpeg" ,libjpeg)
773 ("zip" ,zip)
774 ("perl" ,perl)
775 ("perl-cpanel-json-xs" ,perl-cpanel-json-xs)
776 ("perl-image-exiftool" ,perl-image-exiftool)
777 ("jpegoptim" ,jpegoptim)
778 ("pngcrush" ,pngcrush)
779 ("p7zip" ,p7zip)))
780 (home-page "http://www.thregr.org/~wavexx/software/fgallery/")
781 (synopsis "Static photo gallery generator")
782 (description
783 "FGallery is a static, JavaScript photo gallery generator with minimalist
784 look. The result can be uploaded on any web server without additional
785 requirements.")
786 (license license:gpl2+)))