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 Ben Woodcroft <donttrustben@gmail.com>
11 ;;; This file is part of GNU Guix.
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26 (define-module (gnu packages graphics)
27 #:use-module (guix download)
28 #:use-module (guix git-download)
29 #:use-module (guix packages)
30 #:use-module (guix build-system gnu)
31 #:use-module (guix build-system cmake)
32 #:use-module (guix build-system python)
33 #:use-module ((guix licenses) #:prefix license:)
34 #:use-module (gnu packages)
35 #:use-module (gnu packages algebra)
36 #:use-module (gnu packages audio)
37 #:use-module (gnu packages autotools)
38 #:use-module (gnu packages bash)
39 #:use-module (gnu packages bison)
40 #:use-module (gnu packages boost)
41 #:use-module (gnu packages check)
42 #:use-module (gnu packages documentation)
43 #:use-module (gnu packages haskell)
44 #:use-module (gnu packages image)
45 #:use-module (gnu packages python)
46 #:use-module (gnu packages flex)
47 #:use-module (gnu packages fonts)
48 #:use-module (gnu packages fontutils)
49 #:use-module (gnu packages pkg-config)
50 #:use-module (gnu packages pulseaudio) ;libsndfile, libsamplerate
51 #:use-module (gnu packages compression)
52 #:use-module (gnu packages multiprecision)
53 #:use-module (gnu packages boost)
54 #:use-module (gnu packages gl)
55 #:use-module (gnu packages glib)
56 #:use-module (gnu packages graphviz)
57 #:use-module (gnu packages gtk)
58 #:use-module (gnu packages gnome)
59 #:use-module (gnu packages image)
60 #:use-module (gnu packages jemalloc)
61 #:use-module (gnu packages photo)
62 #:use-module (gnu packages pth)
63 #:use-module (gnu packages python)
64 #:use-module (gnu packages qt)
65 #:use-module (gnu packages readline)
66 #:use-module (gnu packages sdl)
67 #:use-module (gnu packages swig)
68 #:use-module (gnu packages video)
69 #:use-module (gnu packages xml)
70 #:use-module (gnu packages xorg))
72 (define-public blender
78 (uri (string-append "https://download.blender.org/source/"
79 "blender-" version ".tar.gz"))
82 "16f84mdzkmwjmqahjj64kbyk4kagdj4mcr8qjazs1952d7kh7pm9"))))
83 (build-system cmake-build-system)
85 `(;; Test files are very large and not included in the release tarball.
88 (list "-DWITH_CODEC_FFMPEG=ON"
89 "-DWITH_CODEC_SNDFILE=ON"
91 "-DWITH_DOC_MANPAGE=ON"
93 "-DWITH_GAMEENGINE=ON"
94 "-DWITH_IMAGE_OPENJPEG=ON"
95 "-DWITH_INPUT_NDOF=ON"
96 "-DWITH_INSTALL_PORTABLE=OFF"
98 "-DWITH_MOD_OCEANSIM=ON"
100 "-DWITH_PYTHON_INSTALL=OFF"
101 "-DWITH_SYSTEM_OPENJPEG=ON")
103 (modify-phases %standard-phases
104 (add-after 'unpack 'fix-broken-import
106 (substitute* "release/scripts/addons/io_scene_fbx/json2fbx.py"
107 (("import encode_bin") "from . import encode_bin"))
109 (add-after 'set-paths 'add-ilmbase-include-path
110 (lambda* (#:key inputs #:allow-other-keys)
111 ;; OpenEXR propagates ilmbase, but its include files do not appear
112 ;; in the CPATH, so we need to add "$ilmbase/include/OpenEXR/" to
113 ;; the CPATH to satisfy the dependency on "half.h".
115 (string-append (assoc-ref inputs "ilmbase")
117 ":" (or (getenv "CPATH") "")))
121 ("jemalloc" ,jemalloc)
123 ("openimageio" ,openimageio)
126 ("openjpeg" ,openjpeg-1)
130 ("ffmpeg-2.8" ,ffmpeg-2.8) ;<https://lists.gnu.org/archive/html/guix-devel/2016-04/msg01019.html>
133 ("libsndfile" ,libsndfile)
134 ("freetype" ,freetype)
137 ("python" ,python-wrapper)
139 (home-page "https://blender.org/")
140 (synopsis "3D graphics creation suite")
142 "Blender is a 3D graphics creation suite. It supports the entirety of
143 the 3D pipeline—modeling, rigging, animation, simulation, rendering,
144 compositing and motion tracking, even video editing and game creation. The
145 application can be customized via its API for Python scripting.")
146 (license license:gpl2+)))
148 (define-public assimp
154 (uri (string-append "https://github.com/assimp/assimp/archive/v"
156 (file-name (string-append name "-" version ".tar.gz"))
159 "1gy7zlgkf4nmyv8n674p3f30asis0gjz8icyy11i693n13ww71fk"))))
160 (build-system cmake-build-system)
163 (home-page "http://assimp.org/")
164 (synopsis "Asset import library")
166 "The Open Asset Import Library loads more than 40 3D file formats into
167 one unified data structure. Additionally, assimp features various mesh post
168 processing tools: normals and tangent space generation, triangulation, vertex
169 cache locality optimization, removal of degenerate primitives and duplicate
170 vertices, sorting by primitive type, merging of redundant materials and many
172 (license license:bsd-3)))
181 "https://github.com/CGAL/cgal/releases/download/releases/"
182 "CGAL-" version "/CGAL-" version ".tar.xz"))
185 "1c41yzl2jg3d6zx5k0iccwqwibp950q7dr7z7pp4xi9wlph3c87s"))))
186 (build-system cmake-build-system)
188 '(;; "RelWithDebInfo" is not supported.
189 #:build-type "Release"
197 (home-page "http://cgal.org/")
198 (synopsis "Computational geometry algorithms library")
200 "CGAL provides easy access to efficient and reliable geometric algorithms
201 in the form of a C++ library. CGAL is used in various areas needing geometric
202 computation, such as: computer graphics, scientific visualization, computer
203 aided design and modeling, geographic information systems, molecular biology,
204 medical imaging, robotics and motion planning, mesh generation, numerical
205 methods, etc. It provides data structures and algorithms such as
206 triangulations, Voronoi diagrams, polygons, polyhedra, mesh generation, and
209 ;; The 'LICENSE' file explains that a subset is available under more
210 ;; permissive licenses.
211 (license license:gpl3+)))
213 (define-public ilmbase
219 (uri (string-append "mirror://savannah/openexr/ilmbase-"
223 "1izddjwbh1grs8080vmaix72z469qy29wrvkphgmqmcm0sv1by7c"))
224 (patches (search-patches "ilmbase-fix-tests.patch"))))
225 (build-system gnu-build-system)
226 (home-page "http://www.openexr.com/")
227 (synopsis "Utility C++ libraries for threads, maths, and exceptions")
229 "IlmBase provides several utility libraries for C++. Half is a class
230 that encapsulates ILM's 16-bit floating-point format. IlmThread is a thread
231 abstraction. Imath implements 2D and 3D vectors, 3x3 and 4x4 matrices,
232 quaternions and other useful 2D and 3D math functions. Iex is an
233 exception-handling library.")
234 (license license:bsd-3)))
243 (uri (string-append "https://github.com/OGRECave/" name
244 "/archive/v" version ".tar.gz"))
247 "1ab354bmwwryxr4zgxchfkm6h4z38mjgif8yn89x640rsrgw5ipj"))
248 (file-name (string-append name "-" version ".tar.gz"))))
249 (build-system cmake-build-system)
252 (modify-phases %standard-phases
253 (add-before 'configure 'pre-configure
255 ;; It expects googletest source to be downloaded and
256 ;; be in a specific place.
257 (substitute* "Tests/CMakeLists.txt"
258 (("URL(.*)$" _ suffix)
259 (string-append "URL " suffix
261 "MD5=16877098823401d1bf2ed7891d7dce36\n")))
263 (add-before 'build 'pre-build
264 (lambda* (#:key inputs #:allow-other-keys)
265 (copy-file (assoc-ref inputs "googletest-source")
266 (string-append (getcwd)
267 "/Tests/googletest-prefix/src/"
268 "release-1.8.0.tar.gz"))
271 (list "-DOGRE_BUILD_TESTS=TRUE"
272 (string-append "-DCMAKE_INSTALL_RPATH="
273 (assoc-ref %outputs "out") "/lib:"
274 (assoc-ref %outputs "out") "/lib/OGRE:"
275 (assoc-ref %build-inputs "googletest") "/lib")
276 "-DOGRE_INSTALL_DOCS=TRUE"
277 "-DOGRE_INSTALL_SAMPLES=TRUE"
278 "-DOGRE_INSTALL_SAMPLES_SOURCE=TRUE")))
282 ("googletest-source" ,(package-source googletest))
283 ("pkg-config" ,pkg-config)))
285 `(("font-dejavu" ,font-dejavu)
286 ("freeimage" ,freeimage)
287 ("freetype" ,freetype)
289 ("googletest" ,googletest)
292 ("libxrandr" ,libxrandr)
294 ("zziplib" ,zziplib)))
295 (synopsis "Scene-oriented, flexible 3D engine written in C++")
297 "OGRE (Object-Oriented Graphics Rendering Engine) is a scene-oriented,
298 flexible 3D engine written in C++ designed to make it easier and more intuitive
299 for developers to produce applications utilising hardware-accelerated 3D
301 (home-page "http://www.ogre3d.org/")
302 (license license:expat)))
304 (define-public openexr
310 (uri (string-append "mirror://savannah/openexr/openexr-"
314 "0ca2j526n4wlamrxb85y2jrgcv0gf21b3a19rr0gh4rjqkv1581n"))
315 (modules '((guix build utils)))
318 (substitute* (find-files "." "tmpDir\\.h")
322 ;; Install 'ImfStdIO.h'. Reported at
323 ;; <https://lists.nongnu.org/archive/html/openexr-devel/2016-06/msg00001.html>
324 ;; and <https://github.com/openexr/openexr/pull/184>.
325 (substitute* "IlmImf/Makefile.in"
327 "ImfIO.h ImfStdIO.h"))))
328 (patches (search-patches "openexr-missing-samples.patch"))))
329 (build-system gnu-build-system)
332 (modify-phases %standard-phases
333 (add-after 'unpack 'disable-broken-test
334 ;; This test fails on i686. Upstream developers suggest that
335 ;; this test is broken on i686 and can be safely disabled:
336 ;; https://github.com/openexr/openexr/issues/67#issuecomment-21169748
338 (substitute* "IlmImfTest/main.cpp"
339 (("#include \"testOptimizedInterleavePatterns.h\"")
340 "//#include \"testOptimizedInterleavePatterns.h\"")
341 (("TEST \\(testOptimizedInterleavePatterns")
342 "//TEST (testOptimizedInterleavePatterns"))
345 `(("pkg-config" ,pkg-config)))
347 `(("ilmbase" ,ilmbase) ;used in public headers
348 ("zlib" ,zlib))) ;OpenEXR.pc reads "-lz"
349 (home-page "http://www.openexr.com")
350 (synopsis "High-dynamic range file format library")
352 "OpenEXR is a high dynamic-range (HDR) image file format developed for
353 use in computer imaging applications. The IlmImf C++ libraries support
354 storage of the \"EXR\" file format for storing 16-bit floating-point images.")
355 (license license:bsd-3)))
357 (define-public openimageio
363 (uri (string-append "https://github.com/OpenImageIO/oiio/"
364 "archive/Release-" version ".tar.gz"))
365 (file-name (string-append name "-" version ".tar.gz"))
368 "144crq0205d0w5aq4iglh2rhzf54a8rv3pksy6d533b75w5d7rq7"))))
369 (build-system cmake-build-system)
370 ;; FIXME: To run all tests successfully, test image sets from multiple
371 ;; third party sources have to be present. For details see
372 ;; https://github.com/OpenImageIO/oiio/blob/master/INSTALL
373 (arguments `(#:tests? #f))
375 `(("pkg-config" ,pkg-config)))
379 ("libjpeg" ,libjpeg-8)
386 (synopsis "C++ library for reading and writing images")
388 "OpenImageIO is a library for reading and writing images, and a bunch of
389 related classes, utilities, and applications. There is a particular emphasis
390 on formats and functionality used in professional, large-scale animation and
391 visual effects work for film.")
392 (home-page "http://www.openimageio.org")
393 (license license:bsd-3)))
395 (define-public openscenegraph
397 (name "openscenegraph")
402 (uri (string-append "http://trac.openscenegraph.org/downloads/developer_releases/"
403 "OpenSceneGraph-" version ".zip"))
406 "03h4wfqqk7rf3mpz0sa99gy715cwpala7964z2npd8jxfn27swjw"))
407 (patches (search-patches "openscenegraph-ffmpeg3.patch"))
408 (file-name (string-append name "-" version ".zip"))))
409 (build-system cmake-build-system)
411 `(#:tests? #f ;; No test target available.
413 (list (string-append "-DCMAKE_INSTALL_RPATH="
414 (assoc-ref %outputs "out") "/lib:"
415 (assoc-ref %outputs "out") "/lib64")
416 ;; We need to set this flag or otherwise 'rd' will be added
417 ;; to the name of the library binaries and break linking
418 ;; with other programs.
419 "-DCMAKE_BUILD_TYPE=Release")))
430 (synopsis "High performance real-time graphics toolkit")
432 "The OpenSceneGraph is a high performance 3D graphics toolkit
433 used by application developers in fields such as visual simulation, games,
434 virtual reality, scientific visualization and modeling.")
435 (home-page "http://www.openscenegraph.org")
436 ;; The 'LICENSE' file explains that the source is licensed under
437 ;; LGPL 2.1, but with 4 exceptions. This version is called OSGPL.
438 (license license:lgpl2.1)))
440 (define-public rapicorn
446 (uri (string-append "https://testbit.eu/pub/dists/rapicorn/"
447 "rapicorn-" version ".tar.xz"))
450 "1y51yjrpsihas1jy905m9p3r8iiyhq6bwi2690c564i5dnix1f9d"))
451 (patches (search-patches "rapicorn-isnan.patch"))))
452 (build-system gnu-build-system)
455 (modify-phases %standard-phases
456 (add-after 'unpack 'fix-tests
458 ;; Our grep does not support perl regular expressions.
459 (substitute* "taptool.sh"
460 (("grep -P") "grep -E"))
461 ;; Disable path tests because we cannot access /bin or /sbin.
462 (substitute* "rcore/tests/multitest.cc"
463 (("TCMP \\(Path::equals \\(\"/bin\"") "//"))
465 (add-before 'check 'pre-check
467 ;; The test suite requires a running X server (with DISPLAY
468 ;; number 99 or higher).
469 (system "Xvfb :99 &")
470 (setenv "DISPLAY" ":99")
472 (add-after 'unpack 'replace-fhs-paths
474 (substitute* (cons "Makefile.decl"
475 (find-files "." "^Makefile\\.in$"))
476 (("/bin/ls") (which "ls"))
477 (("/usr/bin/env") (which "env")))
479 ;; These libraries are listed in the "Required" section of the pkg-config
482 `(("librsvg" ,librsvg)
486 ("python2-enum34" ,python2-enum34)))
488 `(("gdk-pixbuf" ,gdk-pixbuf)
489 ("libpng" ,libpng-1.2)
490 ("readline" ,readline)
491 ("libcroco" ,libcroco)
493 ("cython" ,python2-cython)))
495 `(("pandoc" ,ghc-pandoc)
499 ("graphviz" ,graphviz)
500 ("intltool" ,intltool)
501 ("pkg-config" ,pkg-config)
502 ("xvfb" ,xorg-server)))
503 (home-page "http://rapicorn.org")
504 (synopsis "Toolkit for rapid development of user interfaces")
506 "Rapicorn is a toolkit for rapid development of user interfaces in C++
507 and Python. The user interface is designed in a declarative markup language
508 and is connected to the programming logic using data bindings and commands.")
509 (license license:mpl2.0)))
517 (uri (string-append "https://github.com/ampas/CTL/archive/ctl-"
521 "1gg04pyvw0m398akn0s1l07g5b1haqv5na1wpi5dii1jjd1w3ynp"))))
522 (build-system cmake-build-system)
523 (arguments '(#:tests? #f)) ;no 'test' target
525 ;; Headers include OpenEXR and IlmBase headers.
526 (propagated-inputs `(("openexr" ,openexr)))
528 (home-page "http://ampasctl.sourceforge.net")
529 (synopsis "Color Transformation Language")
531 "The Color Transformation Language, or CTL, is a small programming
532 language that was designed to serve as a building block for digital color
533 management systems. CTL allows users to describe color transforms in a
534 concise and unambiguous way by expressing them as programs. In order to apply
535 a given transform to an image, the color management system instructs a CTL
536 interpreter to load and run the CTL program that describes the transform. The
537 original and the transformed image constitute the CTL program's input and
540 ;; The web site says it's under a BSD-3 license, but the 'LICENSE' file
541 ;; and headers use different wording.
542 (license (license:non-copyleft "file://LICENSE"))))
544 (define-public brdf-explorer
545 ;; There are no release tarballs, and not even tags in the repo,
546 ;; so use the latest revision.
547 (let ((commit "5b2cd46f38a06e47207fa7229b72d37beb945019")
550 (name "brdf-explorer")
551 (version (string-append "1.0.0-" revision "." (string-take commit 9)))
555 (url "https://github.com/wdas/brdf.git")
559 "06vzbiajzbi2xl8jlff5d45bc9wd68i3jdndfab1f3jgfrd8bsgx"))
560 (file-name (string-append name "-" version "-checkout"))))
561 (build-system gnu-build-system)
563 `(#:phases (modify-phases %standard-phases
565 (lambda* (#:key outputs #:allow-other-keys)
566 (let ((out (assoc-ref outputs "out")))
567 (zero? (system* "qmake"
568 (string-append "prefix=" out))))))
569 (add-after 'install 'wrap-program
570 (lambda* (#:key outputs #:allow-other-keys)
571 (let* ((out (assoc-ref outputs "out"))
572 (bin (string-append out "/bin"))
575 (with-directory-excursion bin
576 (rename-file "brdf" ".brdf-real")
577 (call-with-output-file "brdf"
579 (format port "#!/bin/sh
580 # Run the thing from its home, otherwise it just bails out.
582 exec -a \"$0\" ~a/.brdf-real~%"
584 (chmod "brdf" #o555))))))))
586 `(("qttools" ,qttools))) ;for 'qmake'
591 ("freeglut" ,freeglut)
593 (home-page "http://www.disneyanimation.com/technology/brdf.html")
595 "Analyze bidirectional reflectance distribution functions (BRDFs)")
597 "BRDF Explorer is an application that allows the development and analysis
598 of bidirectional reflectance distribution functions (BRDFs). It can load and
599 plot analytic BRDF functions (coded as functions in OpenGL's GLSL shader
600 language), measured material data from the MERL database, and anisotropic
601 measured material data from MIT CSAIL. Graphs and visualizations update in
602 real time as parameters are changed, making it a useful tool for evaluating
603 and understanding different BRDFs (and other component functions).")
604 (license license:ms-pl))))
612 (uri (list (string-append
613 "ftp://ftp.fau.de/gentoo/distfiles/agg-"
616 "ftp://ftp.ula.ve/gentoo/distfiles/agg-"
619 ;; Site was discontinued.
620 (string-append "http://www.antigrain.com/agg-"
623 (base32 "07wii4i824vy9qsvjsgqxppgqmfdxq0xa87i5yk53fijriadq7mb"))
624 (patches (search-patches "agg-am_c_prototype.patch"))))
625 (build-system gnu-build-system)
628 (list (string-append "--x-includes=" (assoc-ref %build-inputs "libx11")
630 (string-append "--x-libraries=" (assoc-ref %build-inputs "libx11")
633 (modify-phases %standard-phases
634 (add-after 'unpack 'autoreconf
636 ;; let's call configure from configure phase and not now
637 (substitute* "autogen.sh" (("./configure") "# ./configure"))
638 (zero? (system* "sh" "autogen.sh")))))))
640 `(("pkg-config" ,pkg-config)
642 ("autoconf" ,autoconf)
643 ("automake" ,automake)
647 ("freetype" ,freetype)
650 ;; Antigrain.com was discontinued.
651 (home-page "http://agg.sourceforge.net/antigrain.com/index.html")
652 (synopsis "High-quality 2D graphics rendering engine for C++")
654 "Anti-Grain Geometry is a high quality rendering engine written in C++.
655 It supports sub-pixel resolutions and anti-aliasing. It is also library for
656 rendering SVG graphics.")
657 (license license:gpl2+)))
659 (define-public python-pastel
661 (name "python-pastel")
666 (uri (pypi-uri "pastel" version))
669 "1hqbm934n5yjwn31aq8h7shrr0rcy326wrqfc856vyn0gr0sy21i"))))
670 (build-system python-build-system)
672 `(("python-pytest" ,python-pytest)))
673 (home-page "https://github.com/sdispater/pastel")
674 (synopsis "Library to colorize strings in your terminal")
675 (description "Pastel is a simple library to help you colorize strings in
676 your terminal. It comes bundled with predefined styles:
679 @item comment: yellow
680 @item question: black on cyan
681 @item error: white on red
684 (license license:expat)))
686 (define-public python2-pastel
687 (package-with-python2 python-pastel))