summaryrefslogtreecommitdiff
path: root/kuka-event-broadcaster.spec
blob: 3fc28cb9649ff7c1cc531b9d5f656a934ddddba5 (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
%define ros_distro humble
%define RosPkgName kuka-event-broadcaster

# GitHub archive full-sha tarball 解压根目录为纯 commit SHA,与 autosetup -n
# 难以稳定匹配;改用本地 %%{RosPkgName}-%%{version}.tar.gz(submit_fix 经
# tar --transform 重打包 sources/,目录名统一为 %%{RosPkgName}-%%{version}),
# 与同 monorepo 各 sibling 包(kuka-controllers 等)一致。
# commit 为 kuka_drivers humble 分支 HEAD,留作溯源。
%global commit 3adea8cf8b356144558f69374a168a70c2356304

Name:       ros-%{ros_distro}-%{RosPkgName}
Version:    1.1.0
Release:    1%{?dist}
Summary:    Broadcaster of hardware events of KUKA robots
License:    Apache-2.0
URL:        https://github.com/kroshu/kuka_drivers
Source0:    %{RosPkgName}-%{version}.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}/.*$

# 依赖来源:package.xml <buildtool_depend> + <depend>,逐条在 ros-projects.list /
# ros-upstream.list 核实——controller-interface / pluginlib 为 rosdistro 真实包且
# SIG 源已有;kuka-drivers-core 为同 monorepo sibling,同 COPR project 内构建。
# package.xml 的 <depend> 同时承担 build 与 run 语义,故 BuildRequires / Requires 各写一遍。
BuildRequires: ros-%{ros_distro}-ament-cmake
BuildRequires: ros-%{ros_distro}-controller-interface
BuildRequires: ros-%{ros_distro}-pluginlib
BuildRequires: ros-%{ros_distro}-kuka-drivers-core
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: make

# /opt/ros 被 __requires_exclude_from 豁免、autodeps 扫不到,运行时 Requires 必须手写。
# ros-workspace 提供 /opt/ros/<distro>/setup.sh 与环境 hooks,装上即环境就绪(所有 ROS 包强制)。
Requires:      ros-%{ros_distro}-ros-workspace
Requires:      ros-%{ros_distro}-ament-cmake
Requires:      ros-%{ros_distro}-controller-interface
Requires:      ros-%{ros_distro}-pluginlib
Requires:      ros-%{ros_distro}-kuka-drivers-core

# 单包策略:ROS 包严禁拆实体子包(主包 %%files 整树拥有 /opt/ros/<distro> 时
# 必与 devel 子包路径重叠致安装事务冲突),改用虚拟 Provides 兼容依赖方
Provides:      %{name}-devel = %{version}-%{release}
Provides:      %{name}-doc = %{version}-%{release}
Provides:      %{name}-runtime = %{version}-%{release}

%description
Broadcaster of hardware events of KUKA robots. Part of the kuka_drivers stack
for ROS 2 (humble). This package builds the kuka_event_broadcaster pluginlib
plugin (a ros2_control controller) from the kuka_drivers monorepo
(subdirectory controllers/kuka_event_broadcaster).

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

%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 子目录 controllers/kuka_event_broadcaster
cd controllers/kuka_event_broadcaster
# 显式 out-of-source 构建,规避 openEuler %%cmake 宏位置参数解析源码目录的坑
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_build

%install
cd controllers/kuka_event_broadcaster/.obj
make install DESTDIR=%{buildroot}

%files
# 整树拥有 /opt/ros/<distro>,对"装了没打包"类错误免疫
/opt/ros/%{ros_distro}

%changelog
* Wed Sep 23 2026 openEuler ROS SIG <ros@openeuler.org> - 1.1.0-1
- Initial package for kuka-event-broadcaster (ROS 2 humble)