summaryrefslogtreecommitdiff
path: root/nebula-core-decoders.spec
blob: d37b675f1811779e419d523d4d7ec5950adc19c9 (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
%define ros_distro humble
%define RosPkgName nebula-core-decoders
%define commit 8ce64073f41c2ec1166334ce7f8fb2edc13c86e5

Name:       ros-%{ros_distro}-%{RosPkgName}
Version:    1.2.0
Release:    1%{?dist}
Summary:    Nebula Decoders Base Library
License:    Apache-2.0
URL:        https://github.com/tier4/nebula
Source0:    https://github.com/tier4/nebula/archive/%{commit}.tar.gz#/nebula-core-decoders-%{version}.tar.gz

# debug 子包无意义(/opt 前缀,strip/debugedit 路径非常规)
%global debug_package %{nil}
# /opt 下 python 字节码编译会写标准 sitelib 路径,摘掉 brp-python-bytecompile
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
# ROS 包不做自动依赖扫描(.so 全在 /opt/ros 下,由 ament 间接依赖模型替代)
%global __provides_exclude_from ^/opt/ros/%{ros_distro}/.*$
%global __requires_exclude_from ^/opt/ros/%{ros_distro}/.*$

BuildRequires: cmake
BuildRequires: gcc-c++
# ament_cmake 形态构建工具依赖
BuildRequires: ros-%{ros_distro}-ament-cmake
# autoware_cmake 提供 autoware_package() 宏(ros-upstream.list,同 COPR 递归构建)
BuildRequires: ros-%{ros_distro}-autoware-cmake
# buildtool_depend
BuildRequires: ros-%{ros_distro}-ros-environment
# <depend> ROS 包(同 COPR 递归构建 / SIG 已有)
BuildRequires: ros-%{ros_distro}-nebula-core-common
BuildRequires: ros-%{ros_distro}-sensor-msgs
# <build_depend> 系统库(pkg.remap: libpng-dev -> libpng-devel)
BuildRequires: libpng-devel
# <depend> 系统库(pkg.remap: boost -> boost-devel, eigen -> eigen3-devel)
BuildRequires: boost-devel
BuildRequires: eigen3-devel
# nebula_core_common 通过 ament_cmake_export_dependencies 导出 find_package(nlohmann_json),
# 本包 find_package(nebula_core_common) 时 cmake 传递加载该配置,必须提供 nlohmann_jsonConfig.cmake
BuildRequires: nlohmann-json-devel

# 运行时 Requires(/opt/ros 被 __requires_exclude_from 豁免,autodeps 扫不到,必须手写)
Requires: ros-%{ros_distro}-ros-workspace
Requires: ros-%{ros_distro}-ament-cmake
Requires: ros-%{ros_distro}-nebula-core-common
Requires: ros-%{ros_distro}-sensor-msgs
Requires: boost-devel
Requires: eigen3-devel
Requires: libpng-devel
Requires: nlohmann-json-devel

# 单包策略:虚拟别名兼容依赖方,严禁拆实体子包
Provides: %{name}-devel = %{version}-%{release}
Provides: %{name}-doc = %{version}-%{release}
Provides: %{name}-runtime = %{version}-%{release}

%description
Nebula Decoders Base Library — a header-only INTERFACE library providing
decoder interfaces for the Nebula universal sensor driver platform.
Built from the tier4/nebula monorepo (package: nebula_core_decoders).

%prep
%autosetup -n %{RosPkgName}-%{version}-1

%build
# ROS 基座环境(chroot 已配置 ROS SIG repo;无 ROS 依赖的包 buildroot 里
# 可能没有 setup.sh,必须用 [ -f ] 守卫——直接 source 不存在的文件在
# 严格 sh 下会中止整个 %build 脚本,|| true 挡不住)
[ -f /opt/ros/%{ros_distro}/setup.sh ] && source /opt/ros/%{ros_distro}/setup.sh || true
export PYTHONPATH=/opt/ros/%{ros_distro}/lib/python%{python3_version}/site-packages${PYTHONPATH:+:$PYTHONPATH}
export PKG_CONFIG_PATH=/opt/ros/%{ros_distro}/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}

# monorepo 子包目录:src/nebula_core/nebula_core_decoders
cd src/nebula_core/nebula_core_decoders
# 显式 out-of-source 构建(避免 openEuler %%cmake 宏位置参数坑)
mkdir -p .obj && cd .obj
cmake .. \
  -DCMAKE_INSTALL_PREFIX="/opt/ros/%{ros_distro}" \
  -DAMENT_PREFIX_PATH="/opt/ros/%{ros_distro}" \
  -DCMAKE_PREFIX_PATH="/opt/ros/%{ros_distro}" \
  -UINCLUDE_INSTALL_DIR -ULIB_INSTALL_DIR -USYSCONF_INSTALL_DIR -USHARE_INSTALL_PREFIX -ULIB_SUFFIX \
  -DSETUPTOOLS_DEB_LAYOUT=OFF \
  -DBUILD_TESTING=OFF
%make_build

%install
# ROS 基座环境
[ -f /opt/ros/%{ros_distro}/setup.sh ] && source /opt/ros/%{ros_distro}/setup.sh || true
export PYTHONPATH=/opt/ros/%{ros_distro}/lib/python%{python3_version}/site-packages${PYTHONPATH:+:$PYTHONPATH}
export PKG_CONFIG_PATH=/opt/ros/%{ros_distro}/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}

cd src/nebula_core/nebula_core_decoders/.obj
make install DESTDIR=%{buildroot}

%files
/opt/ros/%{ros_distro}

%changelog
* Thu Oct 08 2026 ROS AI Importer <ros-sig@openeuler.org> - 1.2.0-1
- Add nlohmann-json-devel BuildRequires/Requires (nebula_core_common exports
  find_package(nlohmann_json) via ament_cmake, cmake configure needs its config file)
- Initial RPM package for ros-humble-nebula-core-decoders
- Built from tier4/nebula monorepo (commit 8ce64073)