gnu: Add amtk.
[jackhill/guix/guix.git] / gnu / packages / graphics.scm
index 58c742b..f9baf49 100644 (file)
@@ -2,7 +2,7 @@
 ;;; Copyright © 2015, 2016 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2015 Tomáš Čech <sleep_walker@gnu.org>
 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
-;;; Copyright © 2016, 2017 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2016, 2017, 2019 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2016, 2018 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2017 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
@@ -11,6 +11,7 @@
 ;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;; Copyright © 2018 Alex Kost <alezost@gmail.com>
 ;;; Copyright © 2018 Kei Kebreau <kkebreau@posteo.net>
+;;; Copyright © 2019 Mark H Weaver <mhw@netris.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -59,6 +60,7 @@
   #:use-module (gnu packages pth)
   #:use-module (gnu packages pulseaudio)  ; libsndfile, libsamplerate
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages sdl)
   #:use-module (guix utils))
 
 (define-public blender
+  (let ((revision "0")
+        (commit "3c3d80ea22af15e13237f978181a881b90c41e7c"))
+  (package
+    (name "blender")
+    (version (git-version "2.80-beta" revision commit))
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                     (url "https://git.blender.org/blender.git")
+                     (commit commit)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1hhn8pf3a5556mxyrb2ggsiy6q0h75hnkdpcgq9b6vg284jl2l4q"))))
+    (build-system cmake-build-system)
+    (arguments
+      (let ((python-version (version-major+minor (package-version python))))
+       `(;; Test files are very large and not included in the release tarball.
+         #:tests? #f
+         #:configure-flags
+         (list "-DWITH_CODEC_FFMPEG=ON"
+               "-DWITH_CODEC_SNDFILE=ON"
+               "-DWITH_CYCLES=ON"
+               "-DWITH_DOC_MANPAGE=ON"
+               "-DWITH_FFTW3=ON"
+               "-DWITH_IMAGE_OPENJPEG=ON"
+               "-DWITH_INPUT_NDOF=ON"
+               "-DWITH_INSTALL_PORTABLE=OFF"
+               "-DWITH_JACK=ON"
+               "-DWITH_MOD_OCEANSIM=ON"
+               "-DWITH_PYTHON_INSTALL=OFF"
+               (string-append "-DPYTHON_LIBRARY=python" ,python-version "m")
+               (string-append "-DPYTHON_LIBPATH=" (assoc-ref %build-inputs "python")
+                              "/lib")
+               (string-append "-DPYTHON_INCLUDE_DIR=" (assoc-ref %build-inputs "python")
+                              "/include/python" ,python-version "m")
+               (string-append "-DPYTHON_VERSION=" ,python-version)
+               (string-append "-DPYTHON_NUMPY_PATH="
+                              (assoc-ref %build-inputs "python-numpy")
+                              "/lib/python" ,python-version "/site-packages/"))
+         #:phases
+         (modify-phases %standard-phases
+           ;; XXX This file doesn't exist in the Git sources but will probably
+           ;; exist in the eventual 2.80 source tarball.
+;           (add-after 'unpack 'fix-broken-import
+;             (lambda _
+;               (substitute* "release/scripts/addons/io_scene_fbx/json2fbx.py"
+;                 (("import encode_bin") "from . import encode_bin"))
+;               #t))
+           (add-after 'set-paths 'add-ilmbase-include-path
+             (lambda* (#:key inputs #:allow-other-keys)
+               ;; OpenEXR propagates ilmbase, but its include files do not appear
+               ;; in the CPATH, so we need to add "$ilmbase/include/OpenEXR/" to
+               ;; the CPATH to satisfy the dependency on "half.h".
+               (setenv "CPATH"
+                       (string-append (assoc-ref inputs "ilmbase")
+                                      "/include/OpenEXR"
+                                      ":" (or (getenv "CPATH") "")))
+               #t))))))
+    (inputs
+     `(("boost" ,boost)
+       ("jemalloc" ,jemalloc)
+       ("libx11" ,libx11)
+       ("openimageio" ,openimageio)
+       ("openexr" ,openexr)
+       ("ilmbase" ,ilmbase)
+       ("openjpeg" ,openjpeg)
+       ("libjpeg" ,libjpeg)
+       ("libpng" ,libpng)
+       ("libtiff" ,libtiff)
+       ("ffmpeg" ,ffmpeg)
+       ("fftw" ,fftw)
+       ("jack" ,jack-1)
+       ("libsndfile" ,libsndfile)
+       ("freetype" ,freetype)
+       ("glew" ,glew)
+       ("openal" ,openal)
+       ("python" ,python)
+       ("python-numpy" ,python-numpy)
+       ("zlib" ,zlib)))
+    (home-page "https://blender.org/")
+    (synopsis "3D graphics creation suite")
+    (description
+     "Blender is a 3D graphics creation suite.  It supports the entirety of
+the 3D pipeline—modeling, rigging, animation, simulation, rendering,
+compositing and motion tracking, even video editing and game creation.  The
+application can be customized via its API for Python scripting.
+
+WARNING: This is a beta build of Blender.")
+    (license license:gpl2+))))
+
+(define-public blender-2.79
   (package
     (name "blender")
     (version "2.79b")
                                   "blender-" version ".tar.gz"))
               (sha256
                (base32
-                "1g4kcdqmf67srzhi3hkdnr4z1ph4h9sza1pahz38mrj998q4r52c"))))
+                "1g4kcdqmf67srzhi3hkdnr4z1ph4h9sza1pahz38mrj998q4r52c"))
+              (patches (search-patches "blender-2.79-newer-ffmpeg.patch"
+                                       "blender-2.79-python-3.7-fix.patch"))))
     (build-system cmake-build-system)
     (arguments
       (let ((python-version (version-major+minor (package-version python))))
        ("libjpeg" ,libjpeg)
        ("libpng" ,libpng)
        ("libtiff" ,libtiff)
-       ("ffmpeg-2.8" ,ffmpeg-2.8) ;<https://lists.gnu.org/archive/html/guix-devel/2016-04/msg01019.html>
+       ("ffmpeg" ,ffmpeg)
        ("fftw" ,fftw)
        ("jack" ,jack-1)
        ("libsndfile" ,libsndfile)
      "Blender is a 3D graphics creation suite.  It supports the entirety of
 the 3D pipeline—modeling, rigging, animation, simulation, rendering,
 compositing and motion tracking, even video editing and game creation.  The
-application can be customized via its API for Python scripting.")
+application can be customized via its API for Python scripting.
+
+NOTE: This older version of Blender is the last release that does not require
+OpenGL 3.  It is retained for use with older computers.")
     (license license:gpl2+)))
 
 (define-public assimp
@@ -255,33 +354,23 @@ exception-handling library.")
     (version "1.10.11")
     (source
      (origin
-       (method url-fetch)
-       (uri (string-append "https://github.com/OGRECave/" name
-                           "/archive/v" version ".tar.gz"))
+       (method git-fetch)
+       (uri (git-reference
+              (url "https://github.com/OGRECave/ogre.git")
+              (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
        (sha256
         (base32
-         "13bdh9v4026qf8w8rbfln2rmwf0rby1a8fz55zpdvpy105i6cbpz"))
-       (file-name (string-append name "-" version ".tar.gz"))))
+         "072rzw9mxymbiypgkrbkk9h10rgly6gczik4dlmssk6xkpqckaqr"))))
     (build-system cmake-build-system)
     (arguments
      '(#:phases
        (modify-phases %standard-phases
          (add-before 'configure 'pre-configure
-           (lambda _
-             ;; It expects googletest source to be downloaded and
-             ;; be in a specific place.
-             (substitute* "Tests/CMakeLists.txt"
-               (("URL(.*)$" _ suffix)
-                (string-append "URL " suffix
-                               "\t\tURL_HASH "
-                               "MD5=16877098823401d1bf2ed7891d7dce36\n")))
-             #t))
-         (add-before 'build 'pre-build
            (lambda* (#:key inputs #:allow-other-keys)
-             (copy-file (assoc-ref inputs "googletest-source")
-                        (string-append (getcwd)
-                                       "/Tests/googletest-prefix/src/"
-                                       "release-1.8.0.tar.gz"))
+             (substitute* "Tests/CMakeLists.txt"
+               (("URL(.*)$")
+                (string-append "URL " (assoc-ref inputs "googletest-source"))))
              #t)))
        #:configure-flags
        (list "-DOGRE_BUILD_TESTS=TRUE"
@@ -449,6 +538,32 @@ virtual reality, scientific visualization and modeling.")
     ;; LGPL 2.1, but with 4 exceptions. This version is called OSGPL.
     (license license:lgpl2.1)))
 
+;; We need this for simgear
+(define-public openscenegraph-3.4
+  (package (inherit openscenegraph)
+    (name "openscenegraph")
+    (version "3.4.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/openscenegraph/OpenSceneGraph")
+             (commit (string-append "OpenSceneGraph-" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "1fbzg1ihjpxk6smlq80p3h3ggllbr16ihd2fxpfwzam8yr8yxip9"))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments openscenegraph)
+       ((#:configure-flags flags)
+        `(cons
+          ;; The jpeg plugin requires conversion between integers and booleans
+          "-DCMAKE_CXX_FLAGS=-fpermissive"
+          ,flags))))
+    (inputs
+     `(("libjpeg" ,libjpeg)
+       ,@(package-inputs openscenegraph)))))
+
 (define-public povray
   (package
     (name "povray")
@@ -641,8 +756,8 @@ output.")
                     (replace 'configure
                       (lambda* (#:key outputs #:allow-other-keys)
                         (let ((out (assoc-ref outputs "out")))
-                          (zero? (system* "qmake"
-                                          (string-append "prefix=" out))))))
+                          (invoke "qmake"
+                                  (string-append "prefix=" out)))))
                     (add-after 'install 'wrap-program
                       (lambda* (#:key outputs #:allow-other-keys)
                         (let* ((out (assoc-ref outputs "out"))
@@ -658,7 +773,8 @@ output.")
 cd \"~a\"
 exec -a \"$0\" ~a/.brdf-real~%"
                                         data bin)))
-                            (chmod "brdf" #o555))))))))
+                            (chmod "brdf" #o555)))
+                        #t)))))
       (native-inputs
        `(("qttools" ,qttools))) ;for 'qmake'
       (inputs
@@ -705,20 +821,20 @@ and understanding different BRDFs (and other component functions).")
        (list (string-append "--x-includes=" (assoc-ref %build-inputs "libx11")
                             "/include")
              (string-append "--x-libraries=" (assoc-ref %build-inputs "libx11")
-                            "/lib"))
+                            "/lib")
+             "--disable-examples")
        #:phases
        (modify-phases %standard-phases
-         (add-after 'unpack 'autoreconf
+         (replace 'bootstrap
            (lambda _
              ;; let's call configure from configure phase and not now
              (substitute* "autogen.sh" (("./configure") "# ./configure"))
-             (zero? (system* "sh" "autogen.sh")))))))
+             (invoke "sh" "autogen.sh"))))))
     (native-inputs
      `(("pkg-config" ,pkg-config)
        ("libtool" ,libtool)
        ("autoconf" ,autoconf)
-       ("automake" ,automake)
-       ("bash" ,bash)))
+       ("automake" ,automake)))
     (inputs
      `(("libx11" ,libx11)
        ("freetype" ,freetype)