diff options
Diffstat (limited to 'play-motion2.spec')
| -rw-r--r-- | play-motion2.spec | 173 |
1 files changed, 173 insertions, 0 deletions
diff --git a/play-motion2.spec b/play-motion2.spec new file mode 100644 index 0000000..265a063 --- /dev/null +++ b/play-motion2.spec @@ -0,0 +1,173 @@ +# topdir: play-motion2-1.8.7 +# ROS 2 humble metapackage (single repo, 3 sub-packages): +# play_motion2 (ament_cmake_auto, C++ core + embedded python module) +# play_motion2_msgs (ament_cmake, rosidl msg/srv/action) +# play_motion2_cli (ament_python, ros2cli plugin) +# Single spec builds the whole tree in dependency order; one rpm owns the +# whole /opt/ros/humble prefix with virtual Provides aliases for the sibling +# packages so dependents can resolve ros-humble-play-motion2-msgs. + +%define ros_distro humble +%define RosPkgName play-motion2 + +Name: ros-%{ros_distro}-%{RosPkgName} +Version: 1.8.7 +Release: 1%{?dist} +Summary: Play a pre-recorded motion on a robot (ROS 2) + +License: Apache-2.0 +URL: https://github.com/pal-robotics/play_motion2 +Source0: https://github.com/pal-robotics/play_motion2/archive/%{version}.tar.gz#/play-motion2-%{version}.tar.gz + +# debug subpackages are meaningless under /opt prefix +%global debug_package %{nil} +# drop brp-python-bytecompile: /opt python files would otherwise be compiled +# into the standard sitelib path +%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g') +# ROS packages do their own dependency model via ament; disable autodeps on /opt +%global __provides_exclude_from ^/opt/ros/%{ros_distro}/.*$ +%global __requires_exclude_from ^/opt/ros/%{ros_distro}/.*$ + +%global _ros_prefix /opt/ros/%{ros_distro} + +BuildRequires: cmake +BuildRequires: gcc-c++ +BuildRequires: make +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-wheel + +# ROS base environment (provides /opt/ros/humble/setup.sh) +BuildRequires: ros-%{ros_distro}-ros-workspace +# ament build tools +BuildRequires: ros-%{ros_distro}-ament-cmake +BuildRequires: ros-%{ros_distro}-ament-cmake-auto +BuildRequires: ros-%{ros_distro}-ament-cmake-python +# message generation toolchain (play_motion2_msgs) +BuildRequires: ros-%{ros_distro}-rosidl-default-generators +BuildRequires: ros-%{ros_distro}-builtin-interfaces + +# build/runtime ROS deps (from package.xml <depend>/<build_depend>) +BuildRequires: ros-%{ros_distro}-backward-ros +BuildRequires: ros-%{ros_distro}-control-msgs +BuildRequires: ros-%{ros_distro}-controller-manager-msgs +BuildRequires: ros-%{ros_distro}-lifecycle-msgs +BuildRequires: ros-%{ros_distro}-moveit-ros-planning-interface +BuildRequires: ros-%{ros_distro}-rclcpp +BuildRequires: ros-%{ros_distro}-rclcpp-action +BuildRequires: ros-%{ros_distro}-rclcpp-components +BuildRequires: ros-%{ros_distro}-rclcpp-lifecycle +BuildRequires: ros-%{ros_distro}-sensor-msgs +BuildRequires: ros-%{ros_distro}-std-msgs +BuildRequires: ros-%{ros_distro}-trajectory-msgs +# play_motion2_cli (ament_python) runtime deps needed at build for entry points +BuildRequires: ros-%{ros_distro}-rclpy +BuildRequires: ros-%{ros_distro}-ros2cli + +Requires: ros-%{ros_distro}-ros-workspace +Requires: ros-%{ros_distro}-ament-cmake +Requires: ros-%{ros_distro}-rosidl-default-runtime +Requires: ros-%{ros_distro}-backward-ros +Requires: ros-%{ros_distro}-control-msgs +Requires: ros-%{ros_distro}-controller-manager-msgs +Requires: ros-%{ros_distro}-lifecycle-msgs +Requires: ros-%{ros_distro}-moveit-ros-planning-interface +Requires: ros-%{ros_distro}-rclcpp +Requires: ros-%{ros_distro}-rclcpp-action +Requires: ros-%{ros_distro}-rclcpp-components +Requires: ros-%{ros_distro}-rclcpp-lifecycle +Requires: ros-%{ros_distro}-sensor-msgs +Requires: ros-%{ros_distro}-std-msgs +Requires: ros-%{ros_distro}-trajectory-msgs +Requires: ros-%{ros_distro}-launch +Requires: ros-%{ros_distro}-launch-ros +Requires: ros-%{ros_distro}-rclpy +Requires: ros-%{ros_distro}-ros2cli + +# Single rpm owns the whole prefix; provide virtual aliases for the sibling +# packages so dependents can resolve ros-humble-play-motion2-msgs / -cli. +Provides: ros-%{ros_distro}-play-motion2-msgs = %{version}-%{release} +Provides: ros-%{ros_distro}-play-motion2-cli = %{version}-%{release} +Provides: %{name}-devel = %{version}-%{release} +Provides: %{name}-doc = %{version}-%{release} +Provides: %{name}-runtime = %{version}-%{release} + +%description +PlayMotion2 is a tool to play and handle pre-recorded motions in ROS 2. +This package builds the full upstream repository, which contains: + * play_motion2 - the C++ motion player node and client library + * play_motion2_msgs - the Motion message and PlayMotion2 action interfaces + * play_motion2_cli - the ros2cli plugin providing the `ros2 play_motion` verb + +%prep +%autosetup -n play-motion2-%{version} + +%build +# ROS base environment (guard: some buildroots may lack setup.sh) +[ -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} +export AMENT_PREFIX_PATH=/opt/ros/%{ros_distro}${AMENT_PREFIX_PATH:+:$AMENT_PREFIX_PATH} +export CMAKE_PREFIX_PATH=/opt/ros/%{ros_distro}${CMAKE_PREFIX_PATH:+:$CMAKE_PREFIX_PATH} + +# --- 1. play_motion2_msgs (ament_cmake, rosidl) --------------------------- +# Build first: play_motion2 depends on its generated interfaces. +cd play_motion2_msgs +mkdir -p build && cd build +cmake .. \ + -DCMAKE_INSTALL_PREFIX=%{_ros_prefix} \ + -DAMENT_PREFIX_PATH=%{_ros_prefix} \ + -DCMAKE_PREFIX_PATH=%{_ros_prefix} \ + -DBUILD_TESTING=OFF \ + -UINCLUDE_INSTALL_DIR -ULIB_INSTALL_DIR -USYSCONF_INSTALL_DIR \ + -USHARE_INSTALL_PREFIX -ULIB_SUFFIX \ + -DSETUPTOOLS_DEB_LAYOUT=OFF +%__make %{?_smp_mflags} +%__make install DESTDIR=%{buildroot} +cd ../.. + +# Expose the freshly installed msgs to the subsequent packages via the +# buildroot prefix so ament_cmake_auto can find play_motion2_msgs. +export AMENT_PREFIX_PATH=%{buildroot}%{_ros_prefix}${AMENT_PREFIX_PATH:+:$AMENT_PREFIX_PATH} +export CMAKE_PREFIX_PATH=%{buildroot}%{_ros_prefix}${CMAKE_PREFIX_PATH:+:$CMAKE_PREFIX_PATH} +export PYTHONPATH=%{buildroot}%{_ros_prefix}/lib/python%{python3_version}/site-packages${PYTHONPATH:+:$PYTHONPATH} + +# --- 2. play_motion2 (ament_cmake_auto + ament_cmake_python) -------------- +cd play_motion2 +mkdir -p build && cd build +cmake .. \ + -DCMAKE_INSTALL_PREFIX=%{_ros_prefix} \ + -DAMENT_PREFIX_PATH=%{buildroot}%{_ros_prefix}:%{_ros_prefix} \ + -DCMAKE_PREFIX_PATH=%{buildroot}%{_ros_prefix}:%{_ros_prefix} \ + -DBUILD_TESTING=OFF \ + -UINCLUDE_INSTALL_DIR -ULIB_INSTALL_DIR -USYSCONF_INSTALL_DIR \ + -USHARE_INSTALL_PREFIX -ULIB_SUFFIX \ + -DSETUPTOOLS_DEB_LAYOUT=OFF +%__make %{?_smp_mflags} +%__make install DESTDIR=%{buildroot} +cd ../.. + +# --- 3. play_motion2_cli (ament_python) ----------------------------------- +cd play_motion2_cli +%{__python3} setup.py build +%{__python3} setup.py install \ + --root=%{buildroot} \ + --prefix=%{_ros_prefix} \ + --single-version-externally-managed \ + --record=installed_files.txt +cd .. + +%install +# All artifacts already installed into the buildroot during the build phase +# (dependency ordering requires earlier sub-packages to be installed before +# later ones can be configured). +: + +%files +%license LICENSE +%doc README.md +%{_ros_prefix}/ + +%changelog +* Thu Sep 24 2026 AI Importer <ai-importer@openeuler.org> - 1.8.7-1 +- Initial package for ROS 2 humble play_motion2 (1.8.7) |
