commit:     6af03d83c698063b3328230c2106eab4134a4470
Author:     Jonathan Scruggs <j.scruggs <AT> gmail <DOT> com>
AuthorDate: Sat Oct 22 17:23:53 2016 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Sat Oct 22 23:25:26 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6af03d83

media-gfx/openvdb: New package

OpenVDB is an Academy Award-winning open-source C++ library
comprising a novel hierarchical data structure and a suite of tools
for the efficient storage and manipulation of sparse volumetric
data discretized on three-dimensional grids. It is developed and
maintained by DreamWorks Animation for use in volumetric
applications typically encountered in feature film production.

Gentoo-Bug: 482664

Signed off by: Jonathan Scruggs (j.scruggs <AT> gmail.com, irc: Dracwyrm)
Signed off by: Adrian Grigo (agrigo2001 <AT> yahoo.com.au)
Closes: https://github.com/gentoo/gentoo/pull/2531

Signed-off-by: David Seifert <soap <AT> gentoo.org>

 media-gfx/openvdb/Manifest                         |   1 +
 .../openvdb/files/openvdb-3.2.0-build-fixes.patch  |  33 +++++
 .../files/openvdb-3.2.0-makefile-fixes.patch       |  93 ++++++++++++
 .../openvdb/files/openvdb-3.2.0-numpy-fix.patch    |  17 +++
 media-gfx/openvdb/metadata.xml                     |  28 ++++
 media-gfx/openvdb/openvdb-3.2.0.ebuild             | 158 +++++++++++++++++++++
 6 files changed, 330 insertions(+)

diff --git a/media-gfx/openvdb/Manifest b/media-gfx/openvdb/Manifest
new file mode 100644
index 00000000..175e892
--- /dev/null
+++ b/media-gfx/openvdb/Manifest
@@ -0,0 +1 @@
+DIST openvdb-3.2.0.tar.gz 1368870 SHA256 
d4b6eb63a2c1c62ca449399f3d7789638fde655c32a977b50717b727420a634b SHA512 
df9a4895b219aae3b5a9616c34eb846d565877ff76648405691f0c903507f6faba94e8eba9173423b50cb5cef80f3ec500a9f70977cb7161701d39fd105abc91
 WHIRLPOOL 
3b76ba4998ac39405bbbdf0b1a80488234c5f25e8b0943d4520d9fa783384a111e48ff2120e942f5d9b3862e1f227ff89dcc633842e1290060afb1836785455f

diff --git a/media-gfx/openvdb/files/openvdb-3.2.0-build-fixes.patch 
b/media-gfx/openvdb/files/openvdb-3.2.0-build-fixes.patch
new file mode 100644
index 00000000..e919ec2
--- /dev/null
+++ b/media-gfx/openvdb/files/openvdb-3.2.0-build-fixes.patch
@@ -0,0 +1,33 @@
+diff -purN a/doxygen-config b/doxygen-config
+--- a/doxygen-config   2016-08-10 16:59:33.000000000 +0100
++++ b/doxygen-config   2016-10-12 12:19:06.124785164 +0100
+@@ -2257,7 +2257,7 @@ DIRECTORY_GRAPH        = YES
+ # The default value is: png.
+ # This tag requires that the tag HAVE_DOT is set to YES.
+ 
+-DOT_IMAGE_FORMAT       = png
++DOT_IMAGE_FORMAT       = svg
+ 
+ # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+ # enable generation of interactive SVG images that allow zooming and panning.
+diff -purN a/Makefile b/Makefile
+--- a/Makefile 2016-08-10 16:59:33.000000000 +0100
++++ b/Makefile 2016-10-12 12:18:32.434773635 +0100
+@@ -678,7 +678,7 @@ ALL_PRODUCTS := \
+       @echo "Building $@ because of $(call list_deps)"
+       $(CXX) -c $(CXXFLAGS) -fPIC -o $@ $<
+ 
+-all: lib python vdb_print vdb_render vdb_test depend
++all: lib python vdb_print vdb_render vdb_view vdb_test depend
+ 
+ $(OBJ_NAMES): %.o: %.cc
+       @echo "Building $@ because of $(call list_deps)"
+@@ -794,7 +794,7 @@ pydoc: $(PYTHON_MODULE) $(LIBOPENVDB_SON
+       echo "Created $${pydocdir}"; \
+       export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$(CURDIR); \
+       export PYTHONPATH=${PYTHONPATH}:$(CURDIR); \
+-          $(EPYDOC) --html -o $${pydocdir} $(PYTHON_MODULE_NAME) $(QUIET)
++          $(EPYDOC) --html --html-dir $${pydocdir} $(PYTHON_MODULE_NAME) 
$(QUIET)
+ else
+ pydoc:
+       @echo "$@"': $$EPYDOC is undefined'

diff --git a/media-gfx/openvdb/files/openvdb-3.2.0-makefile-fixes.patch 
b/media-gfx/openvdb/files/openvdb-3.2.0-makefile-fixes.patch
new file mode 100644
index 00000000..633c380
--- /dev/null
+++ b/media-gfx/openvdb/files/openvdb-3.2.0-makefile-fixes.patch
@@ -0,0 +1,93 @@
+diff --git a/Makefile b/Makefile
+index fba4fb6..0054f64 100644
+--- a/Makefile
++++ b/Makefile
+@@ -158,6 +158,9 @@ PYCONFIG_INCL_DIR := $(PYTHON_INCL_DIR)
+ # The directory containing libpython
+ PYTHON_LIB_DIR := $(HFS)/python/lib
+ PYTHON_LIB := -lpython$(PYTHON_VERSION)
++# The Directory to install the python module and includes to.
++PYTHON_INSTALL_INCL_DIR := $(DESTDIR)/python/include/python$(PYTHON_VERSION)
++PYTHON_INSTALL_LIB_DIR := $(DESTDIR)/python/lib/python$(PYTHON_VERSION)
+ # The directory containing libboost_python
+ BOOST_PYTHON_LIB_DIR := /rel/depot/third_party_build/boost/rhel6-1.46.1-0/lib
+ BOOST_PYTHON_LIB := -lboost_python-gcc41-mt-python26-1_46_1
+@@ -179,7 +182,6 @@ PYTHON_WRAP_ALL_GRID_TYPES := no
+ # (leave blank if Doxygen is unavailable)
+ DOXYGEN := doxygen
+ 
+-
+ #
+ # Ideally, users shouldn't need to change anything below this line.
+ #
+@@ -717,8 +719,13 @@ $(DOC_PDF): doxygen-config $(INCLUDE_NAMES) $(SRC_NAMES) 
$(DOC_FILES)
+       @echo "Generating documentation because of $(list_deps)"
+       echo -e 'OUTPUT_DIRECTORY=./doc\nGENERATE_LATEX=YES\nGENERATE_HTML=NO' \
+           | cat doxygen-config - | $(DOXYGEN) - $(QUIET) \
+-          && cd ./doc/latex && make refman.pdf $(QUIET) \
++          && cd ./doc/latex && $(MAKE) refman.pdf $(QUIET) \
+           && echo 'Created doc/latex/refman.pdf'
++      @#
++          mkdir -p $(DESTDIR)/share/doc/openvdb/pdf; \
++          echo "Created $(DESTDIR)/share/doc/openvdb/pdf"; \
++          cp -r -f doc/latex/refman.pdf $(DESTDIR)/share/doc/openvdb/pdf/; \
++          echo "Copied documentation to $(DESTDIR)/share/doc/openvdb/pdf/"; \
+ 
+ ifneq (,$(strip $(DOXYGEN)))
+ doc: $(DOC_INDEX)
+@@ -782,6 +789,22 @@ $(PYTHON_MODULE): $(LIBOPENVDB) $(PYTHON_OBJ_NAMES)
+           -Wl,-rpath,$(BOOST_PYTHON_LIB_DIR) -L$(BOOST_PYTHON_LIB_DIR) 
$(BOOST_PYTHON_LIB) \
+           $(LIBOPENVDB_RPATH) -L$(CURDIR) $(LIBOPENVDB) \
+           $(LIBS_RPATH) $(CONCURRENT_MALLOC_LIB)
++      @echo "Installing the python module and includes"
++      @#
++          mkdir -p $(PYTHON_INSTALL_INCL_DIR); \
++          echo "Created $(PYTHON_INSTALL_INCL_DIR)"; \
++          cp -f $(PYTHON_PUBLIC_INCLUDE_NAMES) $(PYTHON_INSTALL_INCL_DIR)/; \
++          echo "Copied Python header files to $(PYTHON_INSTALL_INCL_DIR)"; \
++          mkdir -p $(PYTHON_INSTALL_LIB_DIR); \
++          echo "Created $(PYTHON_INSTALL_LIB_DIR)"; \
++          cp -f $(PYTHON_MODULE) $(PYTHON_INSTALL_LIB_DIR)/; \
++          pushd $(PYTHON_INSTALL_LIB_DIR) > /dev/null; \
++          ln -f -s $(PYTHON_MODULE) $(PYTHON_SONAME); \
++          popd > /dev/null; \
++          echo "Copied Python module to $(PYTHON_INSTALL_LIB_DIR)"
++      @echo "Clean the Python modules so the next one will compile"
++      @#
++          $(RM) $(PYTHON_OBJ_NAMES)
+ 
+ ifeq (yes,$(has_python))
+ ifneq (,$(strip $(EPYDOC)))
+@@ -833,7 +856,7 @@ test:
+       @echo "$@"': $$(CPPUNIT_INCL_DIR) is undefined'
+ endif
+ 
+-install: lib python vdb_print vdb_render vdb_view doc pydoc
++install: lib vdb_print vdb_render vdb_view doc pydoc
+       mkdir -p $(DESTDIR)/include/openvdb
+       @echo "Created $(DESTDIR)/include/openvdb"
+       pushd $(DESTDIR)/include/openvdb > /dev/null; \
+@@ -870,23 +893,6 @@ install: lib python vdb_print vdb_render vdb_view doc 
pydoc
+           echo "Copied libopenvdb_viewer to $(DESTDIR)/lib/"; \
+       fi
+       @#
+-      if [ -f $(PYTHON_MODULE) ]; \
+-      then \
+-          installdir=$(DESTDIR)/python/include/python$(PYTHON_VERSION); \
+-          mkdir -p $${installdir}; \
+-          echo "Created $${installdir}"; \
+-          cp -f $(PYTHON_PUBLIC_INCLUDE_NAMES) $${installdir}/; \
+-          echo "Copied Python header files to $${installdir}"; \
+-          installdir=$(DESTDIR)/python/lib/python$(PYTHON_VERSION); \
+-          mkdir -p $${installdir}; \
+-          echo "Created $${installdir}"; \
+-          cp -f $(PYTHON_MODULE) $${installdir}/; \
+-          pushd $${installdir} > /dev/null; \
+-          ln -f -s $(PYTHON_MODULE) $(PYTHON_SONAME); \
+-          popd > /dev/null; \
+-          echo "Copied Python module to $${installdir}"; \
+-      fi
+-      @#
+       mkdir -p $(DESTDIR)/bin
+       @echo "Created $(DESTDIR)/bin/"
+       cp -f vdb_print $(DESTDIR)/bin

diff --git a/media-gfx/openvdb/files/openvdb-3.2.0-numpy-fix.patch 
b/media-gfx/openvdb/files/openvdb-3.2.0-numpy-fix.patch
new file mode 100644
index 00000000..bef1024
--- /dev/null
+++ b/media-gfx/openvdb/files/openvdb-3.2.0-numpy-fix.patch
@@ -0,0 +1,17 @@
+diff --git a/python/pyOpenVDBModule.cc b/openvdb/python/pyOpenVDBModule.cc
+index 508c787..dd069e0 100644
+--- a/python/pyOpenVDBModule.cc
++++ b/python/pyOpenVDBModule.cc
+@@ -592,8 +592,12 @@ BOOST_PYTHON_MODULE(PY_OPENVDB_MODULE_NAME)
+ 
+ #ifdef PY_OPENVDB_USE_NUMPY
+     // Initialize NumPy.
++#if PY_MAJOR_VERSION >= 3
++    if (_import_array()) { };
++#else
+     import_array();
+ #endif
++#endif
+ 
+     using namespace openvdb::OPENVDB_VERSION_NAME;
+ 

diff --git a/media-gfx/openvdb/metadata.xml b/media-gfx/openvdb/metadata.xml
new file mode 100644
index 00000000..611db53
--- /dev/null
+++ b/media-gfx/openvdb/metadata.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer restrict="&gt;=media-gfx/openvdb-3.1.0" type="person">
+               <email>[email protected]</email>
+               <name>Jonathan Scruggs</name>
+        </maintainer>
+       <maintainer restrict="&gt;=media-gfx/openvdb-3.1.0" type="person">
+               <email>[email protected]</email>
+               <name>Adrian Grigo</name>
+       </maintainer>
+       <maintainer type="project">
+               <email>[email protected]</email>
+               <name>Proxy Maintainers</name>
+       </maintainer>
+       <longdescription>
+               Libraries from Dreamworks Animation for the efficient 
manipulation 
+                of volumetric data used in big budget movies like 'Cloudy with 
a
+                Chance of Meatballs2' and 'How to Train Your Dragon 2'. 
+       </longdescription>
+       <use>
+               <flag name="openvdb-compression">
+                       Adds enhanced compression to files through
+                       <pkg>dev-libs/c-blosc</pkg>. Very useful so
+                       enabled by dfault.
+               </flag>
+       </use>
+</pkgmetadata>

diff --git a/media-gfx/openvdb/openvdb-3.2.0.ebuild 
b/media-gfx/openvdb/openvdb-3.2.0.ebuild
new file mode 100644
index 00000000..649cd99
--- /dev/null
+++ b/media-gfx/openvdb/openvdb-3.2.0.ebuild
@@ -0,0 +1,158 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $id$
+
+EAPI="6"
+PYTHON_COMPAT=( python{2_7,3_4,3_5} )
+
+inherit eutils python-r1
+
+DESCRIPTION="Libs for the efficient manipulation of volumetric data"
+HOMEPAGE="http://www.openvdb.org";
+
+SRC_URI="https://github.com/dreamworksanimation/${PN}/archive/v${PV}.tar.gz -> 
${P}.tar.gz"
+
+LICENSE="MPL-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="+openvdb-compression doc python X"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+COMMON_DEPEND="
+       sys-libs/zlib
+       >=dev-libs/boost-1.62:=[${PYTHON_USEDEP}]
+       media-libs/openexr
+       dev-util/cppunit
+       X? ( media-libs/glfw )
+       dev-libs/jemalloc
+       python? ( dev-python/numpy[${PYTHON_USEDEP}] )
+       openvdb-compression? ( >=dev-libs/c-blosc-1.5.0 )
+       dev-libs/log4cplus"
+
+RDEPEND="python? ( ${PYTHON_DEPS} )
+        ${COMMON_DEPEND}"
+
+DEPEND="${RDEPEND}
+       dev-cpp/tbb
+       doc? (
+               app-doc/doxygen
+               python? ( dev-python/pdoc[${PYTHON_USEDEP}] )
+       )
+       ${COMMON_DEPEND}"
+
+S="${WORKDIR}/${P}/${PN}"
+
+PATCHES=( "${FILESDIR}"/${P}-numpy-fix.patch
+         "${FILESDIR}"/${P}-makefile-fixes.patch
+         "${FILESDIR}"/${P}-build-fixes.patch )
+
+python_module_compile() {
+       mypythonargs=(
+               PYTHON_VERSION=${EPYTHON/python/}
+               PYTHON_INCL_DIR="$(python_get_includedir)"
+               PYCONFIG_INCL_DIR="$(python_get_includedir)"
+               PYTHON_LIB_DIR="$(python_get_library_path)"
+               PYTHON_LIB="$(python_get_LIBS)"
+               PYTHON_INSTALL_INCL_DIR="${D}$(python_get_includedir)"
+               PYTHON_INSTALL_LIB_DIR="${D}$(python_get_sitedir)"
+               NUMPY_INCL_DIR="$(python_get_sitedir)"/numpy/core/include/numpy
+               BOOST_PYTHON_LIB_DIR="${myprefixlibdir}"
+               BOOST_PYTHON_LIB=-lboost_python-${EPYTHON/python/}
+       )
+
+       einfo "Compiling module for ${EPYTHON}."
+       emake python "${myemakeargs[@]}" "${mypythonargs[@]}" EPYDOC=""
+
+       # This is so the correct version of pdoc is used
+       mypyscriptdir=$(python_get_scriptdir)
+}
+
+src_compile() {
+       # The build system is designed to compile and install all
+       # in one go, so doing each phase separately would be be
+       # impossible and the functions would all overlap anyways.
+       # Do nothing
+       return
+}
+
+src_install() {
+       local myprefix="${EPREFIX}"/usr
+       local myprefixlibdir="${myprefix}"/"$(get_libdir)"
+       local mypyscriptdir
+
+       # So individule targets can be called without duplication
+       # Common depends:
+       local myemakeargs=(
+               rpath=no shared=yes
+               LIBOPENVDB_RPATH=
+               DESTDIR="${D}"
+               HFS="${myprefix}"
+               HT="${myprefix}"
+               HDSO="${myprefixlibdir}"
+               CPPUNIT_INCL_DIR="${myprefix}"/include/cppunit
+               CPPUNIT_LIB_DIR="${myprefixlibdir}"
+               LOG4CPLUS_INCL_DIR="${myprefix}"/include/log4cplus
+               LOG4CPLUS_LIB_DIR="${myprefixlibdir}"
+       )
+
+       # Create python list here for use during install phase:
+       # - If python is used, then the last used module will trigger
+       #   document install phase. It's the same doc, so build once.
+       # - If no python used, then this will remail blanked out to
+       #   disable pydoc.
+       # - pydoc will be called if doc and python use flags are set.
+       local mypythonargs=(
+               PYTHON_VERSION=
+               PYTHON_INCL_DIR=
+               PYCONFIG_INCL_DIR=
+               PYTHON_LIB_DIR=
+               PYTHON_LIB=
+               PYTHON_INSTALL_INCL_DIR=
+               PYTHON_INSTALL_LIB_DIR=
+               NUMPY_INCL_DIR=
+               BOOST_PYTHON_LIB_DIR=
+               BOOST_PYTHON_LIB=
+       )
+
+       # Optional depends:
+       if use X; then
+               myemakeargs+=(
+                       GLFW_INCL_DIR="${myprefixlibdir}"
+                       GLFW_LIB_DIR="${myprefixlibdir}"
+               )
+       else
+               myemakeargs+=(
+                       GLFW_INCL_DIR=
+                       GLFW_LIB_DIR=
+                       GLFW_LIB=
+                       GLFW_MAJOR_VERSION=
+               )
+       fi
+
+       if use openvdb-compression; then
+               myemakeargs+=(
+                       BLOSC_INCL_DIR="${myprefix}"/include
+                       BLOSC_LIB_DIR="${myprefixlibdir}"
+               )
+       else
+               myemakeargs+=(
+                       BLOSC_INCL_DIR=
+                       BLOSC_LIB_DIR=
+               )
+       fi
+
+       use doc || myemakeargs+=( DOXYGEN= )
+
+       # Create python modules for each version selected
+       use python && python_foreach_impl python_module_compile
+
+       if use python && use doc; then
+               mypythonargs+=( EPYDOC="${mypyscriptdir}"/pdoc )
+       else
+               mypythonargs+=( EPYDOC="" )
+       fi
+
+       einfo "Compiling the main components."
+       emake install "${myemakeargs[@]}" "${mypythonargs[@]}"
+}

Reply via email to