summaryrefslogtreecommitdiff
path: root/openvdb-vendor.spec
blob: 69ae53923cce89a096b2c3f994a5cd1169e41796 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
%define ros_distro humble
%define RosPkgName openvdb-vendor
%define ros_pkg_name openvdb_vendor
%define src_version 2.3.4-1
%define openvdb_version 10.0.1

Name:           ros-%{ros_distro}-%{RosPkgName}
Version:        2.3.4
Release:        3%{?dist}
Summary:        Wrapper around OpenVDB, if not found on the system, will compile from source
License:        LGPL v2.1
URL:            https://github.com/SteveMacenski/spatio_temporal_voxel_layer/tree/humble
Source0:        %{RosPkgName}-%{src_version}.tar.gz
Source1:        openvdb-%{openvdb_version}.tar.gz

%global debug_package %{nil}
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
%global __provides_exclude_from ^/opt/ros/%{ros_distro}/.*$
%global __requires_exclude_from ^/opt/ros/%{ros_distro}/.*$

BuildRequires:  cmake
BuildRequires:  boost-devel
BuildRequires:  tbb-devel
BuildRequires:  zlib-devel
BuildRequires:  blosc-devel

Requires:       ros-%{ros_distro}-ros-workspace
Requires:       boost-devel
Requires:       tbb-devel
Requires:       zlib-devel
Requires:       blosc-devel

Provides:       %{name}-devel = %{version}-%{release}
Provides:       %{name}-doc = %{version}-%{release}
Provides:       %{name}-runtime = %{version}-%{release}

%description
Wrapper around OpenVDB, if not found on the system, will compile from source.
Vendors OpenVDB %{openvdb_version} built directly from source tarball,
bypassing ament_cmake_vendor_package (which requires python3-vcstool
unavailable in the build environment).
Static library disabled to reduce compile time; only shared lib is built.

%prep
%autosetup -n %{RosPkgName}-%{src_version} -a1

%build
cd openvdb-%{openvdb_version}
mkdir -p build && cd build
export CXXFLAGS="-O1 -pipe -fstack-protector-strong -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/generic-hardened-cc1 -fasynchronous-unwind-tables -fstack-clash-protection"
%cmake3 \
    -DCMAKE_INSTALL_PREFIX="/opt/ros/%{ros_distro}/opt/openvdb_vendor" \
    -DCMAKE_INSTALL_LIBDIR="lib" \
    -UINCLUDE_INSTALL_DIR -ULIB_INSTALL_DIR -USYSCONF_INSTALL_DIR -USHARE_INSTALL_PREFIX -ULIB_SUFFIX \
    -DOPENVDB_BUILD_BINARIES=OFF \
    -DOPENVDB_CORE_STATIC=OFF \
    -DOPENVDB_BUILD_PYTHON_MODULE=OFF \
    -DOPENVDB_BUILD_UNITTESTS=OFF \
    -DOPENVDB_BUILD_DOCS=OFF \
    -DCONCURRENT_MALLOC=Tbbmalloc \
    -DBUILD_TESTING=OFF -DTESTING=OFF -DCMAKE_SUPPRESS_REGENERATION=ON \
    ..
make -j2

%install
cd openvdb-%{openvdb_version}/build
make install DESTDIR=%{buildroot}

ROS_PREFIX=%{buildroot}/opt/ros/%{ros_distro}
ROS_SHARE_DIR=${ROS_PREFIX}/share/%{ros_pkg_name}
mkdir -p ${ROS_SHARE_DIR}/cmake
mkdir -p ${ROS_PREFIX}/share/ament_index/resource_index/packages

cp %{_builddir}/%{RosPkgName}-%{src_version}/openvdb_vendor/package.xml ${ROS_SHARE_DIR}/
cp %{_builddir}/%{RosPkgName}-%{src_version}/openvdb_vendor/openvdb_vendor-extras.cmake ${ROS_SHARE_DIR}/cmake/

cat > ${ROS_SHARE_DIR}/cmake/%{ros_pkg_name}Config.cmake << 'CMAKE_EOF'
list(APPEND openvdb_vendor_CONFIG_INCLUDED TRUE)
include("${CMAKE_CURRENT_LIST_DIR}/openvdb_vendor-extras.cmake")
CMAKE_EOF

cat > ${ROS_SHARE_DIR}/cmake/%{ros_pkg_name}ConfigVersion.cmake << 'CMAKE_EOF'
set(PACKAGE_VERSION "2.3.4")
set(PACKAGE_VERSION_EXACT FALSE)
set(PACKAGE_VERSION_COMPATIBLE TRUE)
CMAKE_EOF

touch ${ROS_PREFIX}/share/ament_index/resource_index/packages/%{ros_pkg_name}

%files
/opt/ros/%{ros_distro}

%changelog
* Thu Oct 22 2026 ai-importer <ai-importer@openeuler.org> - 2.3.4-3
- Disable static library (OPENVDB_CORE_STATIC=OFF) to halve compilation time
- Reduce CXXFLAGS to -O1 without -g to speed up template-heavy compilation
- Reduce parallelism to make -j2 to avoid OOM on 2GB builder VM
- Build was canceled at 0% after 65min due to extremely slow OpenVDB compilation

* Thu Oct 22 2026 ai-importer <ai-importer@openeuler.org> - 2.3.4-2
- Rebuild without ament-cmake-vendor-package (python3-vcstool unavailable)
- Vendor OpenVDB 10.0.1 directly from Source1 tarball
- Manually install ROS package metadata (package.xml, cmake config, ament index)

* Thu Oct 22 2026 ai-importer <ai-importer@openeuler.org> - 2.3.4-1
- Initial import (ROS batch)