summaryrefslogtreecommitdiff
path: root/fss-bringup.spec
blob: 5420dccd6ed84f1767ea61004963c84d3e215d97 (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
# ROS spec:fss-bringup
# FastSwarmSim monorepo 中的集成 launch 包,ament_cmake 形态,纯数据/launch 包
# 严格遵循 /app/.claude/skills/build-rpm/spec-rules-ros.md

%define ros_distro humble
%define RosPkgName fss-bringup

Name:       ros-%{ros_distro}-%{RosPkgName}
Version:    0.1.2
Release:    1%{?dist}
Summary:    Integrated launch files for FastSwarmSim.
License:    BSD-3-Clause
URL:        https://github.com/shupx/FastSwarmSim

# 构建系统从本地 sources/ 打 tarball,根目录名 = Source0 文件名去扩展名
# = %{commit}(纯完整 SHA,非 GitHub 归档的 FastSwarmSim-<SHA>;§2 build550/551)
%global commit 673ba44eaa1a4054747775ee1f1cdd3a8b8a9bbc
Source0:    https://github.com/shupx/FastSwarmSim/archive/%{commit}.tar.gz

# debug 子包无意义(/opt 前缀,strip/debugedit 路径非常规),SIG 模板统一关闭
%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: ros-%{ros_distro}-ament-cmake

# 运行时 Requires(ROS 特有,必须手写):/opt/ros 被 __requires_exclude_from 豁免、
# autodeps 扫不到,少了这些 Requires 装上后环境不就绪
Requires: ros-%{ros_distro}-ros-workspace
Requires: ros-%{ros_distro}-ament-cmake
# package.xml <exec_depend>:同 session 同 COPR project 构建的兄弟包
Requires: ros-%{ros_distro}-fss-px4-sim
Requires: ros-%{ros_distro}-fss-sensing
Requires: ros-%{ros_distro}-fss-time
# package.xml <exec_depend>:官方 ROS 包(ros-projects/ros-upstream 清单已核对)
Requires: ros-%{ros_distro}-launch
Requires: ros-%{ros_distro}-launch-ros
Requires: ros-%{ros_distro}-rviz2

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

%description
Integrated launch files for FastSwarmSim. This package provides launch files and
RViz configuration for the FastSwarmSim multi-drone simulation stack, built for
the ROS 2 %{ros_distro} distribution and installed under /opt/ros/%{ros_distro}.

%prep
%autosetup -n %{commit}

%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/fss_bringup;显式 out-of-source 构建
# (避免 spec 顶层直接 %cmake 的位置参数坑——openEuler %cmake 宏带位置
# 参数时会错误解析源码目录,build 444 实踩)
cd src/fss_bringup
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 \
  ..
make %{?_smp_mflags}

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

%files
# 整树拥有:对「装了没打包」类错误免疫(SIG 模板标准做法)
/opt/ros/%{ros_distro}

%changelog
* Wed Sep 30 2026 Peixuan Shu <shupeixuan@qq.com> - 0.1.2-1
- Initial RPM package of fss-bringup for openEuler ROS %{ros_distro}