Subject: [PATCH]: Fix Blender missing Voxel Remesher

From: Ekaitz Zarraga <[email-masked]>
Date: Mon, 29 Mar 2021 14:17:20 +0000

Hi,

According to bug#47463[^1], Blender is missing a dependency that
doesn't allow to run the Voxel Remesher.

This series of patches solve that.

I have a comment on the first one. I'm not sure if I did it right.

I don't see a better way to set the `rpath` correcty. It should
find the lib by itself but the package has an executable as
ouput that doesn't find the library the package itself generates.
Removing the extra phase I added shows the RPATH is set to `lib`
instead to the absolute path of the library so the runpath check
fails to execute.

This is the best way I found to solve that but I'm sure whoever
that gets this patch knows a better way to handle that.

I tested Blender with this and it runs the Voxel Remesher as
expected.

Please, don't hesitate to send me any comment.

Thanks!

[^1]: https://lists.gnu.org/archive/html/bug-guix/2021-03/msg00647.html
From 9a3bec5d8c19351d106d471a722e7b3d3d0350c0 Mon Sep 17 00:00:00 2001
From: Ekaitz Zarraga <[email-masked]>
Date: Mon, 29 Mar 2021 16:04:23 +0200
Subject: [PATCH 1/2] gnu: Add openvdb.

* gnu/packages/graphics.scm (openvdb): New variable.
---
 gnu/packages/graphics.scm | 44 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index 4a301d387a..b4df9f5c04 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -463,6 +463,50 @@ Embree is meant to increase performance of photo-realistic rendering
 applications.")
     (license license:asl2.0)))
 
+
+(define-public openvdb
+  (package
+      (name "openvdb")
+      (version "8.0.1")
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                       (url "https://github.com/AcademySoftwareFoundation/openvdb/")
+                       (commit (string-append "v" version))
+                       (recursive? #t)))
+                (file-name (git-file-name name version))
+                (sha256
+                  (base32 "0qzx6l5c183k6j9zki31gg9aixf5s1j46wdi7wr1h3bz7k53syg9"))))
+      (arguments
+        `(#:phases
+          (modify-phases %standard-phases
+            (add-before 'configure 'fix-runpath
+              (lambda* (#:key outputs #:allow-other-keys)
+                (setenv
+                  "LDFLAGS"
+                  (string-append "-Wl,-rpath=" (assoc-ref outputs "out") "/lib/"))
+                #t)))))
+      (build-system cmake-build-system)
+      (native-inputs
+        `(("unzip"    ,unzip)
+          ("pkg-config",pkg-config)))
+      (inputs
+        `(("openexr"  ,openexr)
+          ("boost"    ,boost)
+          ("jemalloc" ,jemalloc)
+          ("c-blosc"  ,c-blosc)
+          ("ilmbase"  ,ilmbase)
+          ("tbb"      ,tbb)))
+      (home-page "https://www.openvdb.org/")
+      (synopsis "Sparse volume data structure and tools")
+      (description "OpenVDB is an open source C++ library comprising a novel
+hierarchical data structure and a large suite of tools for the efficient
+storage and manipulation of sparse volumetric data discretized on
+three-dimensional grids.  It was developed by DreamWorks Animation for use in
+volumetric applications typically encountered in feature film production.")
+      (license license:mpl2.0)))
+
+
 (define-public blender
   (package
     (name "blender")
-- 
2.31.0

From 630ebdeec1b8524d09c811ac93dbbe46d31daa45 Mon Sep 17 00:00:00 2001
From: Ekaitz Zarraga <[email-masked]>
Date: Mon, 29 Mar 2021 16:05:04 +0200
Subject: [PATCH 2/2] gnu: blender: Update dependencies

    * gnu/packages/graphics.scm (blender): Add dependencies and flags
---
 gnu/packages/graphics.scm | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index b4df9f5c04..ddf6a6c2ba 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -534,6 +534,8 @@ volumetric applications typically encountered in feature film production.")
                "-DWITH_INSTALL_PORTABLE=OFF"
                "-DWITH_JACK=ON"
                "-DWITH_MOD_OCEANSIM=ON"
+               "-DWITH_OPENVDB=ON"
+               "-DWITH_TBB=ON"
                "-DWITH_OPENSUBDIV=ON"
                "-DWITH_PYTHON_INSTALL=OFF"
                (string-append "-DPYTHON_LIBRARY=python" ,python-version)
@@ -589,6 +591,8 @@ volumetric applications typically encountered in feature film production.")
        ("pugixml" ,pugixml)
        ("python" ,python)
        ("python-numpy" ,python-numpy)
+       ("openvdb" ,openvdb)
+       ("libxxf86vm" ,libxxf86vm)
        ("tbb" ,tbb)
        ("zlib" ,zlib)
        ("embree" ,embree)))
-- 
2.31.0