summaryrefslogtreecommitdiff
path: root/ament-cmake.spec
blob: da7a2e4d84f44993b543826235cf88094a6df739 (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# ament_cmake: ROS 2 build system (ament_cmake build type)
# Multi-package metapackage - builds all sub-packages in dependency order
# topdir: ament-cmake-1.3.14
# Installs to /opt/ros/humble (ROS standard prefix)

%global debug_package %{nil}
%global __provides_exclude_from ^/opt/ros/humble/.*$
%global __requires_exclude_from ^/opt/ros/humble/.*$
# Strip brp-python-bytecompile (ROS Python files under /opt are not standard sitelib)
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')

Name:           ament-cmake
Version:        1.3.14
Release:        1%{?dist}
Summary:        The entry point package for the ament buildsystem in CMake

License:        Apache-2.0
URL:            https://github.com/ament/ament_cmake
Source0:        https://github.com/ament/ament_cmake/archive/1.3.14.tar.gz#/ament-cmake-1.3.14.tar.gz

BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  make
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-catkin_pkg
BuildRequires:  ros-humble-ament-package
BuildRequires:  ros-humble-ros-workspace

Requires:       ros-humble-ament-package
Requires:       ros-humble-ros-workspace

%description
The entry point package for the ament buildsystem in CMake.
This package provides CMake modules, macros, and Python scripts for
building ROS 2 packages with the ament build system. It bundles all
ament_cmake_* sub-packages (core, python, test, export_*, etc.) from
the ament_cmake repository.

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

%build
# Source ROS environment if available (provides PYTHONPATH, AMENT_PREFIX_PATH)
[ -f /opt/ros/humble/setup.sh ] && source /opt/ros/humble/setup.sh || true
export PYTHONPATH=/opt/ros/humble/lib/python%{python3_version}/site-packages${PYTHONPATH:+:$PYTHONPATH}
export PKG_CONFIG_PATH=/opt/ros/humble/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}

ROSPREFIX=/opt/ros/humble
BROSEROOT=%{buildroot}/opt/ros/humble
export AMENT_PREFIX_PATH=${BROSEROOT}:${ROSPREFIX}
export CMAKE_PREFIX_PATH=${BROSEROOT}:${ROSPREFIX}

CMAKE_FLAGS="\
  -DCMAKE_INSTALL_PREFIX=${ROSPREFIX} \
  -DAMENT_PREFIX_PATH=${ROSPREFIX} \
  -DCMAKE_PREFIX_PATH=${ROSPREFIX} \
  -DSETUPTOOLS_DEB_LAYOUT=OFF \
  -DBUILD_TESTING=OFF \
  -UINCLUDE_INSTALL_DIR \
  -ULIB_INSTALL_DIR \
  -USYSCONF_INSTALL_DIR \
  -USHARE_INSTALL_PREFIX \
  -ULIB_SUFFIX"

# Build and install a single sub-package to buildroot
build_one() {
  pkg=$1
  echo "=== Building ${pkg} ==="
  cd "${pkg}"
  mkdir -p build
  cd build
  cmake ${CMAKE_FLAGS} ..
  cmake --build .
  DESTDIR=%{buildroot} cmake --install .
  cd ../..
}

# Layer 0: ament_cmake_core (self-contained, uses own cmake modules from source)
build_one ament_cmake_core

# Layer 1: packages depending only on ament_cmake_core
for pkg in \
  ament_cmake_export_definitions \
  ament_cmake_export_dependencies \
  ament_cmake_export_include_directories \
  ament_cmake_export_interfaces \
  ament_cmake_export_libraries \
  ament_cmake_export_link_flags \
  ament_cmake_export_targets \
  ament_cmake_gen_version_h \
  ament_cmake_gmock \
  ament_cmake_gtest \
  ament_cmake_include_directories \
  ament_cmake_libraries \
  ament_cmake_nose \
  ament_cmake_python \
  ament_cmake_target_dependencies \
  ament_cmake_version
do
  build_one "${pkg}"
done

# Layer 2: packages with intra-repo cross-dependencies
# (ament_cmake_pytest needs ament_cmake_test, so test must come first)
for pkg in \
  ament_cmake_test \
  ament_cmake_google_benchmark \
  ament_cmake_vendor_package \
  ament_cmake_pytest
do
  build_one "${pkg}"
done

# Layer 3: ament_cmake (metapackage, re-exports sub-package dependencies)
build_one ament_cmake

# Layer 4: ament_cmake_auto (needs ament_cmake + ament_cmake_gmock + ament_cmake_gtest)
build_one ament_cmake_auto

%install
# All sub-packages already installed to buildroot/opt/ros/humble during build phase

%files
/opt/ros/humble/

%changelog
* Thu Oct 08 2026 openEuler Builder <builder@openeuler.org> - 1.3.14-1
- Initial package