summaryrefslogtreecommitdiff
path: root/mrpt-libnav.spec
blob: 8945b150f2c092533439032e519662c4fbe9e3cf (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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
%define ros_distro humble
%define RosPkgName mrpt-libnav
%define src_version 2.15.20
%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.20
Release:        2%{?dist}
Summary:        Mobile Robot Programming Toolkit (MRPT) libraries (nav C++ libraries)
License:        BSD
URL:            https://github.com/MRPT/mrpt_ros.git
Source0:        %{RosPkgName}-%{src_version}.tar.gz
# mrpt upstream source, pre-fetched to avoid ExternalProject git clone at build time
Source1:        https://github.com/MRPT/mrpt/archive/refs/tags/%{mrpt_version}.tar.gz#/mrpt-%{mrpt_version}.tar.gz
# mrpt 的两个 submodule(COPR chroot 无外网,构建期无法下载/克隆,须随 SRPM 携带):
#   nanoflann —— mrpt 强制依赖(script_nanoflann.cmake: FATAL_ERROR if not found),
#                openEuler 官方源无系统包,只能喂 3rdparty/nanoflann 让内层自建
#   simpleini —— mrpt-config 编译 CConfigFile.cpp 需要 SimpleIni.h
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}/.*$

# 本包内层只构建 mrpt-nav 与 mrpt-kinematics。按上游 libs/nav/CMakeLists.txt 与
# libs/kinematics/CMakeLists.txt 的 define_mrpt_lib 声明:
#   mrpt-nav        依赖 mrpt-maps + mrpt-kinematics
#   mrpt-kinematics 依赖 mrpt-opengl
# 这些兄弟库在本包内层均为 BUILD_mrpt-*=OFF,靠 DeclareMRPTLib.cmake 的
# find_package(mrpt-XXX) 分支复用已安装的兄弟库,故 BuildRequires 须列全提供方:
#   mrpt-maps / mrpt-graphs ← ros-humble-mrpt-libmaps
#                             (其 config 会 find_dependency(mrpt-obs, mrpt-graphs))
#   mrpt-opengl / mrpt-img  ← ros-humble-mrpt-libopengl
#   mrpt-obs                ← ros-humble-mrpt-libobs
#                             (其 config 又会 find_dependency mrpt-opengl + mrpt-tfest)
#   mrpt-tfest / mrpt-poses / mrpt-bayes ← ros-humble-mrpt-libposes
#   mrpt-math               ← ros-humble-mrpt-libmath
#   mrpt-core/-io/-config/-random/-rtti/-serialization/-system
#   /-expr/-containers/-typemeta 等 ← ros-humble-mrpt-libbase
BuildRequires:  ros-%{ros_distro}-mrpt-libbase
BuildRequires:  ros-%{ros_distro}-mrpt-libmath
BuildRequires:  ros-%{ros_distro}-mrpt-libobs
BuildRequires:  ros-%{ros_distro}-mrpt-libmaps
BuildRequires:  ros-%{ros_distro}-mrpt-libopengl
BuildRequires:  ros-%{ros_distro}-mrpt-libposes
BuildRequires:  assimp-devel
BuildRequires:  eigen3-devel
BuildRequires:  ffmpeg-devel
# openEuler 的 freeglut 只有运行库,头文件/so 链接在 -devel;找不到系统 GLUT 时
# mrpt 会去编内置 freeglut(3rdparty/freeglut 为空目录),因
# -Werror=implicit-function-declaration 失败
BuildRequires:  freeglut-devel
BuildRequires:  git
BuildRequires:  gtest-devel
BuildRequires:  libXrandr-devel
# 上游 package.xml 写的是 Debian 名 libxxf86vm(apt 的 libxxf86vm-dev),
# RPM 名是 libXxf86vm-devel(dnf repoquery --whatprovides 已实证)
BuildRequires:  libXxf86vm-devel
BuildRequires:  libglvnd-devel
# 上游 package.xml 写的是 Debian 名 libjpeg,RPM 名 libjpeg-devel
# (由 openEuler 的 libjpeg-turbo-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
BuildRequires:  cmake
BuildRequires:  python3-pip

Requires:       ros-%{ros_distro}-ros-workspace
Requires:       ros-%{ros_distro}-mrpt-libbase
Requires:       ros-%{ros_distro}-mrpt-libmath
Requires:       ros-%{ros_distro}-mrpt-libobs
Requires:       ros-%{ros_distro}-mrpt-libmaps
Requires:       ros-%{ros_distro}-mrpt-libopengl
Requires:       ros-%{ros_distro}-mrpt-libposes
Requires:       eigen3-devel

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

%description
Mobile Robot Programming Toolkit (MRPT) libraries (nav C++ libraries).
  This package contains: mrpt-nav, mrpt-kinematics

%prep
%autosetup -n %{RosPkgName}-%{src_version}
# --- 复用预置 mrpt 源码,避免 ExternalProject 在构建期 git clone -------------
# mrpt_libnav/CMakeLists.txt 用 ExternalProject_Add(mrpt ...) 拉取上游 mrpt,
# 本地复用路径写成 ${CMAKE_BINARY_DIR}/../mrpt_libbase/mrpt-build/...,那是 ROS
# 官方 buildfarm 的目录布局(build 目录 = <ws>/build/mrpt_libnav,故其 .. 即
# <ws>/build)。本 spec 的 CMAKE_BINARY_DIR = <top>/mrpt_libnav/.obj,同一表达式
# 会多出一层 mrpt_libnav(<top>/mrpt_libnav/mrpt_libbase/mrpt-build),EXISTS
# 检查必然失败而退回 git clone;COPR chroot 无外网,clone 100% 失败。
# 统一改写成相对 CMakeLists.txt 自身目录的 ../mrpt-build,与下面预置的
# <top>/mrpt-build 对齐(EXISTS 检查 / SOURCE_DIR 两处)。
sed -i 's|\${CMAKE_BINARY_DIR}/\.\./mrpt_libbase/mrpt-build|${CMAKE_CURRENT_LIST_DIR}/../mrpt-build|g' \
    mrpt_libnav/CMakeLists.txt
# 去掉 HOME==/home/buildfarm 守卫:该条件只对 buildfarm 屏蔽本地复用,去掉后
# 复用分支在任何构建环境都成立。本仓库 mrpt_libnav 的条件与 mrpt_libbase /
# mrpt_libmath / mrpt_libposes / mrpt_libopengl / mrpt_libobs / mrpt_libmaps
# 一致,是裸 "AND NOT ..."(不加括号),模式须与之逐字对应。
sed -i 's/ AND NOT "\$ENV{HOME}" STREQUAL "\/home\/buildfarm"//' \
    mrpt_libnav/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   本包 BuildRequires 了 libusbx-devel,libusb 存在时
#                          script_kinect.cmake 默认开启 Kinect,会去编译空的
#                          3rdparty/libfreenect(openEuler 无 libfreenect-devel)
#   MRPT_HAS_OPENNI2=OFF   无 libopenni2;script_openni2.cmake 在开启却找不到
#                          时是 FATAL_ERROR(不是静默关闭),必须显式关
#   MRPT_BUILD_OCTOMAP=OFF script_octomap.cmake 在顶层被无条件 include,找不到
#                          系统 octomap 时会 ExternalProject_Add(EP_octomap) 去
#                          GitHub 下 zip(chroot 无外网必失败)。本包内层
#                          BUILD_mrpt-maps=OFF,octomap 的唯一消费者(libs/maps)
#                          不参与编译,nav/kinematics 源码亦不引用 octomap 头
#                          (已逐个 grep 实证),故关掉内置 octomap 分支即可,
#                          无需引入 octomap-devel —— 这与建 mrpt-maps 的
#                          ros-humble-mrpt-libmaps 不同:那边 octomap 是硬依赖
#                          (CColouredOctoMap.cpp 无条件 include 且源文件不过滤),
#                          必须提供系统库。
#   CMAKE_PREFIX_PATH      内层 mrpt 对 BUILD_mrpt-*=OFF 的兄弟库走
#                          DeclareMRPTLib.cmake 的 find_package(mrpt-XXX) 分支,
#                          必须能搜到 mrpt-libbase / -libmath / -libobs /
#                          -libmaps / -libopengl / -libposes 装到
#                          /opt/ros/<distro> 的 mrpt-*-config.cmake;缺了它会打出
#                          "*Warning* ==> Disabling compilation of lib mrpt-nav
#                          for missing dependencies" 而静默产出空包。
# GLFW / wx / openni2 / freenect 等特性在上游 package.xml 里本就自注为 "not
# actually required by this ROS package, but we need them for the mrpt/config.h
# to reflect we have such feature"(openEuler 无 provider),故不写 BuildRequires,
# 改由此处内层开关关闭(glfw 仅 3rdparty/nanogui 使用,包装工程自带
# -DMRPT_BUILD_nanogui=OFF;wx 仅 mrpt-gui 使用,包装工程自带
# -DBUILD_mrpt-gui=OFF 与 -DMRPT_BUILD_wxThings=OFF);libxxf86vm / libjpeg 是
# Debian 名,已在上面改成 libXxf86vm-devel / libjpeg-devel。
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\n    -DCMAKE_PREFIX_PATH=/opt/ros/%{ros_distro}|' \
    mrpt_libnav/CMakeLists.txt
# 闸门:确认上面三处 sed 真的改到了 CMakeLists.txt(模式不匹配时 sed 是静默空
# 操作,要到构建期才以 git clone 超时 / 空包暴露)
if ! grep -q 'CMAKE_CURRENT_LIST_DIR}/../mrpt-build' mrpt_libnav/CMakeLists.txt; then
    echo "ERROR: CMakeLists.txt 本地复用路径改写失败(sed 模式不匹配)" >&2
    exit 1
fi
if ! grep -q 'MRPT_BUILD_OCTOMAP=OFF' mrpt_libnav/CMakeLists.txt; then
    echo "ERROR: 内层 CMAKE_ARGS 开关注入失败(sed 锚点 -DDISABLE_JSONCPP=ON 不匹配)" >&2
    exit 1
fi
if grep -q 'buildfarm' mrpt_libnav/CMakeLists.txt; then
    echo "ERROR: buildfarm HOME 守卫未移除(sed 模式不匹配)" >&2
    exit 1
fi
# 预置 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
# 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
# 覆盖包装工程从 package.xml 读到的版本号,与预取的上游源码一致
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_libnav
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 \
    ..
# 闸门:cmake 生成 mrpt-gitclone.cmake 即表示未复用准备段预置的 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
# --- 并行度与内存 -----------------------------------------------------------
# mrpt-nav / mrpt-kinematics 大量使用 mrpt-math 的定长矩阵模板(CPose3D、
# CSerializable、CObservation* 等公共头),单进程峰值内存可达 GB 级;COPR
# builder 仅 4 核 / 6.9GiB / 无 swap,多路 cc1plus 叠峰会被 OOM killer SIGKILL
# (同链 mrpt-libmath 在 build 112579 实测:c++ fatal error: Killed signal
# terminated program cc1plus)。
#   (1) 降单进程内存:CMake 用环境变量 CXXFLAGS/CFLAGS 初始化 CMAKE_<LANG>_FLAGS,
#       故在 make 之前覆盖为 -O1 -g0:本包 debug_package 已置空,-g 只烧内存
#       不出产物;并保留下游 hardening 项。
#   (2) 限并行:按"每个 cc1plus 预留 2.5GiB"从 MemTotal 反推 job 数,取
#       min(nproc, 内存上限)、至少 1 路。
#   ★ 本段注释里禁止出现百分号前缀的宏指令字样(global / define / undefine):
#     rpm 的 scriptlet 解析器会把注释行里的这类文本当宏定义提取,定义之后同一行
#     的残留文本会被丢出来当命令执行(同链 mrpt-libmath 的 build 112584 实踩:
#     line 105: command not found → Bad exit status,而编译本身已 100% 通过)。
export CFLAGS="-O1 -g0 -fstack-protector-strong -Wp,-D_FORTIFY_SOURCE=2 -fasynchronous-unwind-tables"
export CXXFLAGS="-O1 -g0 -fstack-protector-strong -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fasynchronous-unwind-tables"
JOBS="$(nproc 2>/dev/null || echo 1)"
MEM_KB="$(awk '/^MemTotal:/{print $2; exit}' /proc/meminfo 2>/dev/null)"
case "$MEM_KB" in
    ''|*[!0-9]*) MEM_KB=0 ;;
esac
if [ "$MEM_KB" -gt 0 ]; then
    MEM_JOBS=$(( MEM_KB / 2621440 ))
    if [ "$MEM_JOBS" -lt 1 ]; then MEM_JOBS=1; fi
    if [ "$JOBS" -gt "$MEM_JOBS" ]; then JOBS="$MEM_JOBS"; fi
fi
echo "mrpt-nav 构建并行度: -j${JOBS}(nproc=$(nproc 2>/dev/null || echo '?'), MemTotal=${MEM_KB}KiB)"
make -j"$JOBS"
# 闸门:确认真的产出了 libmrpt-nav.so 与 libmrpt-kinematics.so。内层若没搜到
# mrpt-maps / mrpt-opengl(CMAKE_PREFIX_PATH 失效 / 兄弟库缺失),
# DeclareMRPTLib.cmake 只会打一行 Warning 就静默禁用该库,构建"成功"但装出的
# 是空包——这里把它变成构建期硬失败。
for _lib in nav kinematics; do
    _so="$(find mrpt-build/src/mrpt-build -name "libmrpt-${_lib}.so*" -print -quit 2>/dev/null)"
    if [ -z "$_so" ]; then
        echo "ERROR: 未产出 libmrpt-${_lib}.so —— 内层 mrpt 很可能因 find_package(mrpt-maps/mrpt-opengl) 未命中而静默禁用了 mrpt-${_lib}(空包)" >&2
        exit 1
    fi
    echo "已产出: $_so"
done

%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_libnav
cd .obj
make install DESTDIR=%{buildroot}

%files
/opt/ros/%{ros_distro}

%changelog
* Tue Sep 22 2026 ai-importer <ai-importer@openeuler.org> - 2.15.20-2
- 依赖预检无 provider 修复(对齐同链已构建成功的 ros-humble-mrpt-libopengl-2 /
  -libposes-2 / -libobs-2 / -libgui-2 / -libmaps-3 处置方式;这些名字在 openEuler
  官方源 / EPOL / ROS SIG 外挂源均查无 provider,已逐个 dnf repoquery
  --whatprovides 实证):
  * Debian 名修正:libxxf86vm → libXxf86vm-devel,libjpeg → libjpeg-devel,
    freeglut → freeglut-devel。
  * libfreenect-devel / libopenni2-dev / libglfw3-dev / wx-common / wxwidgets
    从 BuildRequires 移除,改为关掉内层 mrpt 对应特性:-DMRPT_WITH_KINECT=OFF /
    -DMRPT_HAS_OPENNI2=OFF(glfw 仅 3rdparty/nanogui 使用,其构建已由包装工程
    自带的 -DMRPT_BUILD_nanogui=OFF 关闭;wx 仅 mrpt-gui 使用,包装工程自带
    -DBUILD_mrpt-gui=OFF 与 -DMRPT_BUILD_wxThings=OFF)。这些条目在
    mrpt_libnav/package.xml 里本就自注为 "not actually required by this ROS
    package, but we need them for the mrpt/config.h to reflect we have such
    feature",只影响 config.h 的特性开关。已在 waived_deps.txt 逐条注明理由。
  * 按既有基线补齐 openEuler 实际可用的 devel 包:新增 eigen3-devel / git /
    gtest-devel / libglvnd-devel / libzstd-devel / mesa-libGLU-devel /
    suitesparse-devel / tbb-devel(mrpt 找不到系统 GLUT 会去编内置 freeglut、
    找不到 assimp/openjpeg 会 ExternalProject 下源码,chroot 无外网必挂)。
  * BuildRequires/Requires 补齐 ros-humble-mrpt-libbase / -libmath / -libobs /
    -libmaps / -libopengl / -libposes:本包内层只建 mrpt-nav + mrpt-kinematics,
    按上游 define_mrpt_lib 声明 mrpt-nav ← mrpt-maps + mrpt-kinematics、
    mrpt-kinematics ← mrpt-opengl,而 mrpt-maps 的 config 又要
    find_dependency(mrpt-obs, mrpt-graphs)、mrpt-obs 又要 mrpt-opengl +
    mrpt-tfest,其余 core/io/config/img/math/poses 等兄弟库均走
    DeclareMRPTLib.cmake 的 find_package 复用,提供方必须列为构建依赖。
  * octomap 不引入:本包不建 mrpt-maps,nav/kinematics 源码亦不引用 octomap
    头(已逐个 grep 实证),内层以 -DMRPT_BUILD_OCTOMAP=OFF 关掉内置下载分支
    即可(顶层 CMakeLists 无条件 include script_octomap.cmake,不关的话
    ExternalProject_Add(EP_octomap) 会在 chroot 里去 GitHub 下 zip)。
- 修复构建期 ExternalProject 退回 git clone(COPR chroot 无外网必失败):
  %prep 预置 mrpt 源码到 <top>/mrpt-build/src/mrpt,并把 CMakeLists.txt 的本地
  复用路径改写为 ${CMAKE_CURRENT_LIST_DIR}/../mrpt-build、移除 buildfarm HOME
  守卫;补 3rdparty/nanogui/include 与 3rdparty/rplidar_sdk/sdk/src 空目录绕过
  上游 "git submodules missing!" 致命检查;Source2/Source3 填入 nanoflann 与
  simpleini;%build 增加 gitclone 闸门与 libmrpt-nav/libmrpt-kinematics 产物闸门。
- 内层 mrpt 的 CMAKE_ARGS 注入 -DCMAKE_PREFIX_PATH=/opt/ros/%{ros_distro}:
  mrpt-nav / mrpt-kinematics 对 BUILD_mrpt-*=OFF 的兄弟库走
  DeclareMRPTLib.cmake 的 find_package(mrpt-XXX),命中不了时会被静默禁用、
  产出空包。
- 内层构建并行度按内存自适应(min(nproc, MemTotal/2.5GiB))并降优化级别为
  -O1 -g0,防 cc1plus 被 OOM killer 杀死(同链 mrpt-libmath build 112579 教训)。
- Release 2(上一版 2.15.20-1 依赖预检失败,无产物)。