summaryrefslogtreecommitdiff
path: root/kuka-control-mode-handler.spec
blob: a6da3996623324b80cd13e80993efac841faf7fd (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
%define ros_distro humble
%define RosPkgName kuka-control-mode-handler
%global commit 3adea8cf8b356144558f69374a168a70c2356304

Name:       ros-%{ros_distro}-%{RosPkgName}
Version:    1.1.0
Release:    1%{?dist}
Summary:    Controller for setting the control mode of KUKA robots in runtime
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 <depend> + <buildtool_depend>,逐条在 ros-projects.list /
# ros-upstream.list 核实(controller-interface / pluginlib 为 rosdistro 真实包,
# kuka-drivers-core 为同 monorepo sibling,同 COPR project 内构建)
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 必须手写
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

# 单包策略:严禁拆实体子包,主包 %files 整树拥有 /opt/ros/<distro>
Provides:      %{name}-devel = %{version}-%{release}
Provides:      %{name}-doc = %{version}-%{release}
Provides:      %{name}-runtime = %{version}-%{release}

%description
Controller for setting the control mode of KUKA robots at runtime. Part of the
kuka_drivers stack for ROS 2 (humble). This package builds the
kuka_control_mode_handler pluginlib plugin (a ros2_control controller) from
the kuka_drivers monorepo (subdirectory controllers/kuka_control_mode_handler).

%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_control_mode_handler
cd controllers/kuka_control_mode_handler
# 显式 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_control_mode_handler/.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-control-mode-handler (ROS 2 humble)