blob: b1f489e315a646bdb99d946870518bcd74bca9cd (
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
%define ros_distro humble
%define RosPkgName mrpt-libtclap
%define src_version 2.15.21-2
%define mrpt_version 2.15.21
# mrpt 的 git submodule 内容(GitHub archive tarball 不含),按需手工补:
%define nanoflann_version 1.5.5
%define simpleini_version 4.22
Name: ros-%{ros_distro}-%{RosPkgName}
Version: 2.15.21
Release: 1%{?dist}
Summary: Mobile Robot Programming Toolkit (MRPT) libraries (tclap C++ library)
License: BSD
URL: https://github.com/MRPT/mrpt_ros/tree/main
Source0: %{RosPkgName}-%{src_version}.tar.gz
# mrpt upstream source: 预取,避免 ExternalProject 在构建期 git clone(COPR chroot 无外网)
Source1: https://github.com/MRPT/mrpt/archive/refs/tags/%{mrpt_version}.tar.gz#/mrpt-%{mrpt_version}.tar.gz
# mrpt 的两个 submodule(COPR chroot 无外网,构建期无法克隆,须随 SRPM 携带):
# nanoflann —— script_nanoflann.cmake 在找不到系统包时对 3rdparty/nanoflann 跑
# cmake,而 GitHub archive tarball 里该目录为空目录 → FATAL_ERROR
# simpleini —— mrpt-config 的 include 目录(与已成功构建的 mrpt-libbase 同款处置)
Source2: https://github.com/jlblancoc/nanoflann/archive/refs/tags/v%{nanoflann_version}.tar.gz#/nanoflann-%{nanoflann_version}.tar.gz
Source3: https://github.com/brofield/simpleini/archive/refs/tags/v%{simpleini_version}.tar.gz#/simpleini-%{simpleini_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: ros-%{ros_distro}-mrpt-libbase
BuildRequires: assimp-devel
BuildRequires: cmake
BuildRequires: eigen3-devel
BuildRequires: ffmpeg-devel
BuildRequires: freeglut-devel
BuildRequires: git
BuildRequires: gtest-devel
BuildRequires: libXrandr-devel
BuildRequires: libXxf86vm-devel
BuildRequires: libglvnd-devel
BuildRequires: libjpeg-devel
BuildRequires: libpcap-devel
BuildRequires: libudev-devel
BuildRequires: libusbx-devel
BuildRequires: libzstd-devel
BuildRequires: mesa-libGL-devel
BuildRequires: mesa-libGLU-devel
BuildRequires: opencv
BuildRequires: pkgconfig
BuildRequires: pybind11-devel
BuildRequires: suitesparse-devel
BuildRequires: tbb-devel
BuildRequires: tinyxml2-devel
BuildRequires: zlib-devel
Requires: ros-%{ros_distro}-ros-workspace
Provides: %{name}-devel = %{version}-%{release}
Provides: %{name}-doc = %{version}-%{release}
Provides: %{name}-runtime = %{version}-%{release}
%description
Mobile Robot Programming Toolkit (MRPT) libraries (tclap C++ library).
This package contains: mrpt-tclap
%prep
%autosetup -n %{RosPkgName}-%{src_version}
# --- 复用预置 mrpt 源码,避免 ExternalProject 在构建期 git clone -----------------
# mrpt_libtclap/CMakeLists.txt 用 ExternalProject_Add(mrpt ...) 拉取上游 mrpt,本地
# 复用路径写成 ${CMAKE_BINARY_DIR}/../mrpt_libbase/mrpt-build/...,那是 ROS 官方
# buildfarm 的目录布局(build 目录 = <ws>/build/mrpt_libtclap,故其 .. 即 <ws>/build)。
# 本 spec 的 CMAKE_BINARY_DIR = <top>/mrpt_libtclap/.obj,同一表达式会多出一层
# mrpt_libtclap(<top>/mrpt_libtclap/mrpt_libtclap/mrpt-build),EXISTS 检查必然
# 失败而退回 git clone;COPR chroot 无外网,clone 100% 失败。统一改写成相对
# CMakeLists.txt 自身目录的 ../mrpt-build,与下面预置的 <top>/mrpt-build 对齐。
sed -i 's|\${CMAKE_BINARY_DIR}/\.\./mrpt_libbase/mrpt-build|${CMAKE_CURRENT_LIST_DIR}/../mrpt-build|g' \
mrpt_libtclap/CMakeLists.txt
# 去掉 HOME==/home/buildfarm 守卫:该条件只对官方 buildfarm 屏蔽本地复用,COPR 里
# HOME 并非 /home/buildfarm,去掉后复用分支在任何构建环境都成立。
sed -i 's| AND NOT "\$ENV{HOME}" STREQUAL "/home/buildfarm"||' \
mrpt_libtclap/CMakeLists.txt
# 给内层 mrpt 追加开关(外层 cmake 命令行传的 MRPT_WITH_xxx 落在 ROS 包装工程上,
# 而包装工程只把它们原样忽略——真正生效的是写死在 ExternalProject_Add 的
# CMAKE_ARGS,必须在此注入):
# MRPT_HAS_LIBFYAML=OFF openEuler 无 libfyaml,内置分支要 3rdparty/libfyaml
# (submodule 空目录)且会 file(READ .tarball-version) 报错
# MRPT_WITH_KINECT=OFF libusb 存在时默认开启 Kinect,会去编译空的
# 3rdparty/libfreenect(openEuler 无 libfreenect-devel)
# MRPT_HAS_OPENNI2=OFF 无 libopenni2
# MRPT_BUILD_OCTOMAP=OFF 无系统 octomap 时 ExternalProject 会从 GitHub 下载
# octomap(构建期无外网必失败)
sed -i 's|^\(\s*-DDISABLE_JSONCPP=ON\)$|\1\n -DMRPT_HAS_LIBFYAML=OFF\n -DMRPT_WITH_KINECT=OFF\n -DMRPT_HAS_OPENNI2=OFF\n -DMRPT_BUILD_OCTOMAP=OFF|' \
mrpt_libtclap/CMakeLists.txt
# 预置 ExternalProject 的 SOURCE_DIR:<top>/mrpt-build/src/mrpt
mkdir -p mrpt-build/src
tar -xzf %{SOURCE1} -C mrpt-build/src
mv mrpt-build/src/mrpt-%{mrpt_version} mrpt-build/src/mrpt
echo -n "%{mrpt_version}" > mrpt-build/MRPT_VERSION_TO_DOWNLOAD.txt
# GitHub archive tarball 不含 git submodule 内容,而上游 mrpt 顶层 CMakeLists.txt
# 有无条件存在性检查(3rdparty/nanogui/include、3rdparty/rplidar_sdk/sdk/src),
# 缺失即 FATAL_ERROR "git submodules missing!"。补空目录绕过;两个子项目在内层
# CMAKE_ARGS 里已分别用 -DMRPT_BUILD_nanogui=OFF / -DMRPT_BUILD_rplidar_sdk=OFF 关闭。
mkdir -p mrpt-build/src/mrpt/3rdparty/nanogui/include \
mrpt-build/src/mrpt/3rdparty/rplidar_sdk/sdk/src
# 填充 mrpt 的两个必需 submodule(见 Source2/Source3 说明)
rm -rf mrpt-build/src/mrpt/3rdparty/nanoflann mrpt-build/src/mrpt/3rdparty/simpleini
mkdir -p mrpt-build/src/mrpt/3rdparty/nanoflann mrpt-build/src/mrpt/3rdparty/simpleini
tar -xzf %{SOURCE2} -C mrpt-build/src/mrpt/3rdparty/nanoflann --strip-components=1
tar -xzf %{SOURCE3} -C mrpt-build/src/mrpt/3rdparty/simpleini --strip-components=1
# Override the version cmake reads from package.xml to match the pre-fetched source
echo 'set(MRPT_VERSION_TO_DOWNLOAD "%{mrpt_version}")' > override_mrpt_version.cmake
%build
[ -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 mrpt_libtclap
mkdir -p .obj && cd .obj
%cmake3 \
-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 -DTESTING=OFF -DCMAKE_SUPPRESS_REGENERATION=ON \
-DMRPT_WITH_FREENECT=OFF \
-DMRPT_WITH_OPENNI2=OFF \
-DMRPT_WITH_GLFW=OFF \
-DMRPT_BUILD_wxThings=OFF \
..
# 闸门:cmake 生成 mrpt-gitclone.cmake 即表示未复用 %prep 预置的 mrpt 源码,构建期
# 将 git clone(COPR chroot 无外网,必然失败)。提前失败并给出明确原因,避免白烧
# 一轮 COPR 构建。
if [ -e mrpt-build/tmp/mrpt-gitclone.cmake ]; then
echo "ERROR: cmake 准备 git clone mrpt —— %prep 预置源码未被复用,请检查预置路径" >&2
exit 1
fi
make %{?_smp_mflags}
%install
[ -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 mrpt_libtclap
cd .obj
make install DESTDIR=%{buildroot}
%files
/opt/ros/%{ros_distro}
%changelog
* Tue Sep 22 2026 ai-importer <ai-importer@openeuler.org> - 2.15.21-1
- Rebase to 2.15.21-2 (ROS batch import)
* Tue Sep 22 2026 ai-importer <ai-importer@openeuler.org> - 2.15.21-1
- 依赖预检修复:删除在 openEuler 全部已配置源(官方 everything/update/EPOL +
ROS SIG 外挂源)均无 provider 的 rosdep 键/裸名(libfreenect-devel、
libglfw3-dev、libopenni2-dev、libxxf86vm、libjpeg、nanoflann_vendor、
wx-common、wxwidgets、freeglut、python3-pip)——mrpt 上游 cmake 对它们均为
可选特性探测,本包只构建 mrpt-tclap 粒度用不到;对应豁免见 waived_deps.txt。
改名补入 openEuler 真实包:freeglut-devel、libjpeg-devel、libXxf86vm-devel、
libglvnd-devel、mesa-libGLU-devel、libzstd-devel、tbb-devel、gtest-devel、git。
- 离线构建支持(对齐已成功构建的 mrpt-libbase):Source1 预取 mrpt 2.15.21 源码
喂 ExternalProject 的 SOURCE_DIR,避免 COPR chroot 无外网时 git clone 失败;
Source2/Source3 补 nanoflann 1.5.5 与 simpleini 4.22 两个 submodule。
- 内层 mrpt 注入 -DMRPT_HAS_LIBFYAML=OFF / -DMRPT_WITH_KINECT=OFF /
-DMRPT_HAS_OPENNI2=OFF / -DMRPT_BUILD_OCTOMAP=OFF。
|