d2cc020
# Force out of source build
d2cc020
%undefine __cmake_in_source_build
d2cc020
fca44dc
# Use soversion
fca44dc
%global soversion 9.1
fca44dc
fde0919
# Set to 1 to enable testsuite. Fails everywhere with GCC 8+.
fde0919
%global with_tests 0
e78e645
630aef3
# Optional OpenEXR support
630aef3
%global with_openexr 0
630aef3
e78e645
Name:           openvdb
fca44dc
Version:        9.1.0
fca44dc
Release:        %autorelease
e78e645
Summary:        C++ library for sparse volumetric data discretized on three-dimensional grids
e78e645
License:        MPLv2.0
e78e645
URL:            http://www.openvdb.org/
e78e645
45052a3
Source0:        https://github.com/AcademySoftwareFoundation/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
e78e645
2d19ad2
BuildRequires:  boost-devel >= 1.61
8c2ca4d
# boost-python3-devel merged in boost-devel for Fedora 33+
8c2ca4d
# https://src.fedoraproject.org/rpms/boost/c/1f2e448e099a867f9da62b9da009d3dec5e1ad64?branch=master
630aef3
%if 0%{?rhel}
fde0919
BuildRequires:  boost-python3-devel
798ba80
%endif
e78e645
BuildRequires:  cmake >= 2.8
e78e645
BuildRequires:  doxygen >= 1.8.11
3fc4e0c
#BuildRequires:  epydoc
ee76930
BuildRequires:  gcc-c++
e78e645
BuildRequires:  ghostscript >= 8.70
ee76930
BuildRequires:  libstdc++-devel
b43ae63
BuildRequires:  pkgconfig(blosc) >= 1.5.0
b43ae63
BuildRequires:  pkgconfig(cppunit) >= 1.10
630aef3
# RHEL and CentOS only have that build requirement for x86_64
315b01b
%if 0%{?rhel}
315b01b
%ifarch x86_64
315b01b
BuildRequires:  glfw-devel >= 2.7
315b01b
%endif
315b01b
%else
b43ae63
BuildRequires:  pkgconfig(glfw3) >= 2.7
315b01b
%endif
b43ae63
BuildRequires:  pkgconfig(jemalloc)
b43ae63
BuildRequires:  pkgconfig(log4cplus) >= 1.0
630aef3
%if 0%{?with_openexr}
630aef3
BuildRequires:  pkgconfig(OpenEXR) >= 3.0
630aef3
%endif
b43ae63
BuildRequires:  pkgconfig(tbb) >= 3.0
b43ae63
BuildRequires:  pkgconfig(xi)
b43ae63
BuildRequires:  pkgconfig(zlib) > 1.2.7
e78e645
e78e645
%description
e78e645
OpenVDB is an Academy Award-winning open-source C++ library comprising a novel
e78e645
hierarchical data structure and a suite of tools for the efficient storage and
e78e645
manipulation of sparse volumetric data discretized on three-dimensional grids.
ee76930
It is developed and maintained by Academy Software Foundation for use in
ee76930
volumetric applications typically encountered in feature film production.
e78e645
e78e645
This package contains some graphical tools.
e78e645
e78e645
%package        libs
e78e645
Summary:        Core OpenVDB libraries
e78e645
e78e645
%description    libs
e78e645
OpenVDB is an Academy Award-winning open-source C++ library comprising a novel
e78e645
hierarchical data structure and a suite of tools for the efficient storage and
e78e645
manipulation of sparse volumetric data discretized on three-dimensional grids.
ee76930
It is developed and maintained by Academy Software Foundation for use in
ee76930
volumetric applications typically encountered in feature film production.
e78e645
e78e645
%package        devel
e78e645
Summary:        Development files for %{name}
0f5b374
BuildRequires:  texlive-latex
3d699f4
Requires:       %{name}-libs%{?_isa} = %{version}-%{release}
ee76930
Obsoletes:      %{name}-doc < 6.1.0-1
ee76930
Provides:       %{name}-doc = %{version}-%{release}
e78e645
e78e645
%description    devel
e78e645
The %{name}-devel package contains libraries and header files for developing
e78e645
applications that use %{name}.
e78e645
b43ae63
%if 0%{?fedora}
21f4f5b
%package        -n python3-%{name}
e78e645
Summary:        OpenVDB Python module
3fc4e0c
BuildRequires:  pkgconfig(python3)
0f5b374
BuildRequires:  python3dist(numpy)
3d699f4
Requires:       %{name}-libs%{?_isa} = %{version}-%{release}
21f4f5b
Obsoletes:      %{name}-python3 < 6.2.0
fde0919
Obsoletes:      %{name}-python2 < 5.1.0-1
fde0919
Provides:       %{name}-python2 = %{version}-%{release}
3fc4e0c
%{?python_provide:%python_provide python3-%{name}}
21f4f5b
21f4f5b
%description    -n python3-%{name}
3fc4e0c
%{description}
e78e645
e78e645
This package contains the Python module.
b43ae63
%endif
b43ae63
e78e645
e78e645
%prep
5d0b811
%autosetup -p1
e78e645
ee76930
# Hardcoded values
543410d
sed -i \
ee76930
    -e 's|lib$|%{_lib}|g' \
0f5b374
    %{name}/%{name}/CMakeLists.txt %{name}/%{name}/python/CMakeLists.txt
e78e645
2d19ad2
e78e645
%build
1072aa4
%ifarch %{arm}
1072aa4
# https://bugzilla.redhat.com/show_bug.cgi?id=2021376
1072aa4
%global optflags %(echo %{optflags} | sed 's/-g /-g1 /')
1072aa4
%endif
1072aa4
export CXXFLAGS="%{build_cxxflags} -Wl,--as-needed"
dd35663
ee76930
# Ignore versions (python 3, etc.)
e78e645
%cmake \
ee76930
    -DCMAKE_NO_SYSTEM_FROM_IMPORTED=TRUE \
a7c3c2a
    -DDISABLE_DEPENDENCY_VERSION_CHECKS=ON \
ee76930
    -DOPENVDB_BUILD_DOCS=ON \
b43ae63
%if 0%{?fedora}
3fc4e0c
    -DOPENVDB_BUILD_PYTHON_MODULE=ON \
b43ae63
%endif
f972080
%if 0%{?rhel}
f972080
    -DCONCURRENT_MALLOC=None \
f972080
%endif
c601478
    -DOPENVDB_BUILD_UNITTESTS=OFF \
ee76930
    -DOPENVDB_ENABLE_RPATH=OFF \
ee76930
    -DOPENVDB_INSTALL_CMAKE_MODULES=OFF \
630aef3
    -DPYOPENVDB_INSTALL_DIRECTORY=%{python3_sitearch} \
630aef3
%if 0%{?with_openexr}
630aef3
    -DUSE_EXR=ON \
630aef3
%endif
630aef3
    -DUSE_NANOVDB=ON
d2cc020
%cmake_build
e78e645
fde0919
%if 0%{?with_tests}
fde0919
%check
d2cc020
%ctest test
fde0919
%endif
e78e645
e78e645
%install
d2cc020
%cmake_install
e78e645
b4346ff
# Let RPM pick up html documents in the files section
b4346ff
mv %{buildroot}%{_docdir}/OpenVDB/html .
21f4f5b
rm -fr %{buildroot}%{_datadir}/doc
e78e645
e78e645
find %{buildroot} -name '*.a' -delete
e78e645
e78e645
%files
e78e645
%{_bindir}/vdb_print
630aef3
%{_bindir}/nanovdb_{print,validate}
e78e645
e78e645
%files libs
0f5b374
%license LICENSE
21f4f5b
%doc README.md CHANGES
4792088
%{_libdir}/lib%{name}.so.%{version}
fca44dc
%{_libdir}/lib%{name}.so.%{soversion}
e78e645
b43ae63
%if 0%{?fedora}
21f4f5b
%files -n python3-%{name}
f688fdb
%{python3_sitearch}/py%{name}.so
b43ae63
%endif
e78e645
e78e645
%files devel
ee76930
%doc html
e78e645
%{_includedir}/*
4792088
%{_libdir}/lib%{name}.so
e78e645
e78e645
%changelog
fca44dc
%autochangelog