diff --git a/openvdb-python3.patch b/openvdb-python3.patch new file mode 100644 index 0000000..a50566b --- /dev/null +++ b/openvdb-python3.patch @@ -0,0 +1,62 @@ +From 8f12e3c2e0232456eff06642e1620a9538811f29 Mon Sep 17 00:00:00 2001 +From: Nick Avramoussis <4256455+Idclip@users.noreply.github.com> +Date: Sat, 11 May 2019 14:27:50 +0100 +Subject: [PATCH] Fixes for Python3 and loading the python module on MacOS + +Signed-off-by: Nick Avramoussis <4256455+Idclip@users.noreply.github.com> +--- + openvdb/python/CMakeLists.txt | 9 ++++++++- + openvdb/python/pyOpenVDBModule.cc | 9 ++++++++- + 2 files changed, 16 insertions(+), 2 deletions(-) + +diff --git a/openvdb/python/CMakeLists.txt b/openvdb/python/CMakeLists.txt +index c1e7a2b2..b255483a 100644 +--- a/openvdb/python/CMakeLists.txt ++++ b/openvdb/python/CMakeLists.txt +@@ -182,9 +182,16 @@ target_link_libraries(pyopenvdb + ) + + set_target_properties(pyopenvdb PROPERTIES +- PREFIX "" ++ PREFIX "" # no 'lib' prefix + ) + ++if(UNIX) ++ # must be .so (not .dylib) ++ set_target_properties(pyopenvdb PROPERTIES ++ SUFFIX ".so" ++ ) ++endif() ++ + if(OPENVDB_ENABLE_RPATH) + # @todo There is probably a better way to do this for imported targets + set(RPATHS "") +diff --git a/openvdb/python/pyOpenVDBModule.cc b/openvdb/python/pyOpenVDBModule.cc +index b41095bb..5f423176 100644 +--- a/openvdb/python/pyOpenVDBModule.cc ++++ b/openvdb/python/pyOpenVDBModule.cc +@@ -320,7 +320,11 @@ struct PointIndexConverter + /// @return nullptr if the given Python object is not convertible to the PointIndex. + static void* convertible(PyObject* obj) + { ++#if PY_MAJOR_VERSION >= 3 ++ if (!PyLong_Check(obj)) return nullptr; // not a Python integer ++#else + if (!PyInt_Check(obj)) return nullptr; // not a Python integer ++#endif + return obj; + } + +@@ -336,8 +340,11 @@ struct PointIndexConverter + + // Extract the PointIndex from the python integer + PointIndexT* index = static_cast(storage); +- ++#if PY_MAJOR_VERSION >= 3 ++ *index = static_cast(PyLong_AsLong(obj)); ++#else + *index = static_cast(PyInt_AsLong(obj)); ++#endif + } + + /// Register both the PointIndex-to-integer and the integer-to-PointIndex converters. diff --git a/openvdb.spec b/openvdb.spec index f6240c5..985727d 100644 --- a/openvdb.spec +++ b/openvdb.spec @@ -6,12 +6,13 @@ Name: openvdb Version: 6.1.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: C++ library for sparse volumetric data discretized on three-dimensional grids License: MPLv2.0 URL: http://www.openvdb.org/ Source0: https://github.com/AcademySoftwareFoundation/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz +Patch1: https://patch-diff.githubusercontent.com/raw/AcademySoftwareFoundation/openvdb/pull/428.patch#/%{name}-python3.patch BuildRequires: blosc-devel >= 1.5.0 BuildRequires: boost-devel >= 1.61 @@ -20,30 +21,26 @@ BuildRequires: cmake >= 2.8 BuildRequires: cppunit-devel >= 1.10 BuildRequires: doxygen >= 1.8.11 BuildRequires: epydoc -BuildRequires: gcc-c++ +BuildRequires: gcc-c++ BuildRequires: ghostscript >= 8.70 BuildRequires: glfw-devel >= 2.7 BuildRequires: ilmbase-devel -BuildRequires: jemalloc-devel +BuildRequires: jemalloc-devel +BuildRequires: libstdc++-devel BuildRequires: libXi-devel BuildRequires: log4cplus-devel >= 1.0 BuildRequires: OpenEXR-devel >= 2.2 -Requires: python3 BuildRequires: python3-numpy BuildRequires: python3-devel BuildRequires: tbb-devel >= 3.0 BuildRequires: zlib-devel > 1.2.7 -# Borrowed from Arch linux -# Patch: boost-1.67.patch - - %description 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 Academy Software Foundation for use in volumetric -applications typically encountered in feature film production. +It is developed and maintained by Academy Software Foundation for use in +volumetric applications typically encountered in feature film production. This package contains some graphical tools. @@ -54,12 +51,14 @@ Summary: Core OpenVDB libraries 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. +It is developed and maintained by Academy Software Foundation for use in +volumetric applications typically encountered in feature film production. %package devel Summary: Development files for %{name} Requires: %{name}-libs%{?_isa} = %{version}-%{release} +Obsoletes: %{name}-doc < 6.1.0-1 +Provides: %{name}-doc = %{version}-%{release} %description devel The %{name}-devel package contains libraries and header files for developing @@ -75,94 +74,55 @@ Provides: %{name}-python2 = %{version}-%{release} 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. +It is developed and maintained by Academy Software Foundation for use in +volumetric applications typically encountered in feature film production. This package contains the Python module. -%package doc -Summary: Documentation for %{name} -BuildArch: noarch - -%description doc -The %{name}-doc package contains documentation for developing applications that -use %{name}. - %prep %autosetup -p1 -iconv -f iso8859-1 -t utf-8 %{name}/CHANGES > %{name}/CHANGES.conv && \ - mv -f %{name}/CHANGES.conv %{name}/CHANGES - -# Hardcoded values for Python module +# Hardcoded values sed -i \ - -e 's|lib$|%{_lib}|g' -e 's|lib/python|%{_lib}/python|g' \ + -e 's|lib$|%{_lib}|g' \ + -e 's|lib/python|%{_lib}/python|g' \ %{name}/CMakeLists.txt %{name}/python/CMakeLists.txt -# Save Makefile that contains doc building instructions, new cmake build system -# does not build docs yet -cp %{name}/Makefile %{name}/Makefile.docbuild - mkdir build %build pushd build export CXXFLAGS="%{optflags} -Wl,--as-needed" - -# Versioning on ilmbase is broken, using workaround -# https://www.openvdb.org/documentation/doxygen/build.html#buildTroubleshooting +# Ignore versions (python 3, etc.) %cmake \ - -DBLOSC_LOCATION=%{_prefix} \ - -DCMAKE_EXE_LINKER_FLAGS="%{optflags} -fPIE" \ - -DCPPUNIT_LOCATION=%{_prefix} \ + -DCMAKE_NO_SYSTEM_FROM_IMPORTED=TRUE \ -DDISABLE_DEPENDENCY_VERSION_CHECKS=ON \ - -DGLEW_LOCATION=%{_prefix} \ - -DGLFW3_LOCATION=%{_prefix} \ - -DILMBASE_NAMESPACE_VERSIONING=OFF \ - -DILMBASE_LOCATION=%{_prefix} \ - -DOPENEXR_LOCATION=%{_prefix} \ - -DOPENEXR_NAMESPACE_VERSIONING=OFF \ - -DOPENVDB_ENABLE_RPATH=OFF \ + -DOPENVDB_BUILD_DOCS=ON \ -DOPENVDB_BUILD_UNITTESTS=OFF \ - -DPYTHON_VERSION=%{python_version} \ - -DPY_OPENVDB_USE_NUMPY=True \ - -DTBB_LOCATION=%{_prefix} \ - -DUSE_GLFW3=True \ - .. + -DOPENVDB_ENABLE_RPATH=OFF \ + -DOPENVDB_INSTALL_CMAKE_MODULES=OFF \ + .. %make_build popd -# Build docs with previously saved Makefile -pushd %{name} -make -f Makefile.docbuild doc -popd - %if 0%{?with_tests} -%ifarch x86_64 %check %make test %endif -%endif %install pushd build %make_install popd -# Remove CMakeFiles from includes -rm -fr %{buildroot}/%{_includedir}/%{name}/CMakeFiles - # Let RPM pick up HTML documents in the files section +mv %{buildroot}/%{_prefix}/docs/html . rm -fr %{buildroot}/%{_datadir}/doc find %{buildroot} -name '*.a' -delete -#%%ldconfig_scriptlets libs - %files -%{_bindir}/vdb_view %{_bindir}/vdb_print -%{_bindir}/vdb_render %files libs %license %{name}/LICENSE %{name}/COPYRIGHT @@ -173,13 +133,16 @@ find %{buildroot} -name '*.a' -delete %{_libdir}/python%{python_version}/py%{name}.so %files devel +%doc html %{_includedir}/* %{_libdir}/*.so -%files doc -%doc %{name}/doc/html - %changelog +* Sun Aug 18 2019 Simone Caronni - 6.1.0-2 +- Fix build with latest options. +- Update SPEC file. +- rpmlint fixes. + * Thu Aug 01 2019 Luya Tshimbalanga - 6.1.0-1 - Update to 6.1.0 - Fix cmake build