summaryrefslogtreecommitdiff
path: root/performance-test.spec
blob: 4c5bd5ae289d581b263411a013a48a67536d356f (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
%define ros_distro humble
%define RosPkgName performance-test
%define src_version 2.3.0-1

Name:       ros-%{ros_distro}-%{RosPkgName}
Version:    2.3.0
Release:    1%{?dist}
Summary:    Tool to test performance of ROS2 and DDS data layers and communication
License:    Apache-2.0
URL:        https://gitlab.com/ApexAI/performance_test
Source0:    %{RosPkgName}-%{src_version}.tar.gz
# 离线构建外部依赖 tarball(替代 CMakeLists.txt 中 ExternalProject 的 git clone)
Source1:    https://github.com/mirror/tclap/archive/1.4.0-rc1.tar.gz#/tclap-1.4.0-rc1.tar.gz
Source2:    https://github.com/Tencent/rapidjson/archive/v1.1.0.tar.gz#/rapidjson-v1.1.0.tar.gz
Source3:    https://github.com/p-ranav/tabulate/archive/v1.4.tar.gz#/tabulate-v1.4.tar.gz
Source4:    https://github.com/r-lyeh-archived/sole/archive/1.0.2.tar.gz#/sole-1.0.2.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: cmake
BuildRequires: gcc-c++
BuildRequires: make
BuildRequires: git
BuildRequires: ros-%{ros_distro}-ament-cmake
BuildRequires: ros-%{ros_distro}-rclcpp
BuildRequires: ros-%{ros_distro}-rmw-implementation
BuildRequires: ros-%{ros_distro}-ros-environment
BuildRequires: ros-%{ros_distro}-rosidl-default-generators
BuildRequires: ros-%{ros_distro}-rosidl-default-runtime
BuildRequires: ros-%{ros_distro}-ros-workspace

# ROS 运行时 Requires(/opt/ros 被 __requires_exclude_from 豁免,必须手写)
Requires:    ros-%{ros_distro}-ros-workspace
Requires:    ros-%{ros_distro}-ament-cmake
Requires:    ros-%{ros_distro}-rclcpp
Requires:    ros-%{ros_distro}-rmw-implementation
Requires:    ros-%{ros_distro}-rosidl-default-runtime

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

%description
Tool to test performance of ROS2 and DDS data layers and communication.

%prep
%setup -q -n %{RosPkgName}-%{src_version}
cd performance_test

# 将 ExternalProject 的 git clone 改为本地 tarball(离线构建)
# 原始 patch (0-performance-test-change-cmake-download.patch) 的 tclap hunk
# 因上游 GIT_REPOSITORY URL 已从 sf.net 改为 github.com/mirror 而无法应用,
# 改用 sed 完成等效修改(4 个 ExternalProject 块统一处理)
sed -i 's|GIT_REPOSITORY https://github.com/mirror/tclap.git|URL ${CMAKE_SOURCE_DIR}/tclap-1.4.0-rc1.tar.gz|' CMakeLists.txt
sed -i 's|GIT_REPOSITORY https://github.com/Tencent/rapidjson.git|URL ${CMAKE_SOURCE_DIR}/rapidjson-v1.1.0.tar.gz|' CMakeLists.txt
sed -i 's|GIT_REPOSITORY https://github.com/p-ranav/tabulate.git|URL ${CMAKE_SOURCE_DIR}/tabulate-v1.4.tar.gz|' CMakeLists.txt
sed -i 's|GIT_REPOSITORY https://github.com/r-lyeh-archived/sole.git|URL ${CMAKE_SOURCE_DIR}/sole-1.0.2.tar.gz|' CMakeLists.txt
sed -i '/GIT_TAG/d;/GIT_SHALLOW/d' CMakeLists.txt

# 放置外部依赖 tarball 供 ExternalProject 离线提取
cp -a %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} .
cd ..

%build
# ROS 基座环境(无 ROS 依赖的 buildroot 可能没有 setup.sh,用 [ -f ] 守卫)
[ -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 performance_test
mkdir -p .obj && cd .obj
cmake .. \
  -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 \
  -DPERFORMANCE_TEST_PLUGIN="ROS2"
%make_build

%install
[ -f /opt/ros/%{ros_distro}/setup.sh ] && source /opt/ros/%{ros_distro}/setup.sh || true
cd performance_test/.obj
make install DESTDIR=%{buildroot}

%files
/opt/ros/%{ros_distro}

%changelog
* Wed Sep 23 2026 ROS SIG <ros@openeuler.org> - 2.3.0-1
- 初始打包