summaryrefslogtreecommitdiff
path: root/aruco-markers.spec
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2026-10-12 10:51:44 +0000
committerCoprDistGit <infra@openeuler.org>2026-10-12 10:51:44 +0000
commit0ea95015c451870650bc17980ef5965a57b6c931 (patch)
tree9473f6713dc712edd2f36684df9645fc9c521926 /aruco-markers.spec
parentebb3b8dc8c1df0501327eb2d3d6e47f4aa9ce4d3 (diff)
automatic import of ros-humble-aruco-markers
Diffstat (limited to 'aruco-markers.spec')
-rw-r--r--aruco-markers.spec55
1 files changed, 53 insertions, 2 deletions
diff --git a/aruco-markers.spec b/aruco-markers.spec
index 1859983..8891033 100644
--- a/aruco-markers.spec
+++ b/aruco-markers.spec
@@ -4,7 +4,7 @@
Name: ros-%{ros_distro}-%{RosPkgName}
Version: 0.0.3
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: A ros2 node for detecting aruco markers in camera images
License: MIT
URL: https://github.com/namo-robotics/aruco_markers/tree/humble
@@ -16,6 +16,7 @@ Source0: %{RosPkgName}-%{src_version}.tar.gz
%global __requires_exclude_from ^/opt/ros/%{ros_distro}/.*$
BuildRequires: cmake
+BuildRequires: gcc-c++
BuildRequires: ros-%{ros_distro}-ament-cmake
BuildRequires: ros-%{ros_distro}-cv-bridge
BuildRequires: ros-%{ros_distro}-geometry-msgs
@@ -46,12 +47,59 @@ A ros2 node for detecting aruco markers in camera images
%prep
%autosetup -n %{RosPkgName}-%{src_version}
+# openEuler opencv 4.5.2 lacks the aruco contrib module; bundle from opencv_contrib 4.5.2
+sed -i 's/find_package(OpenCV REQUIRED COMPONENTS core imgproc aruco)/find_package(OpenCV REQUIRED COMPONENTS core imgproc)/' aruco_markers/CMakeLists.txt
%build
[ -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 aruco_markers
+
+# Build bundled opencv_contrib aruco module as static library
+# openEuler opencv 4.5.2 does not include aruco contrib (headers or library)
+ARUCO_DIR=%{_builddir}/%{RosPkgName}-%{src_version}/opencv_contrib_aruco
+ARUCO_BUILD=%{_builddir}/aruco_build
+ARUCO_INC=%{_builddir}/aruco_include
+mkdir -p "$ARUCO_BUILD" "$ARUCO_INC/opencv2/aruco"
+cd "$ARUCO_BUILD"
+g++ -c -O2 -g -fPIC -std=c++14 \
+ -I/usr/include/opencv4 \
+ -I"$ARUCO_DIR/include" \
+ -I"$ARUCO_DIR/src" \
+ "$ARUCO_DIR/src/aruco.cpp" \
+ "$ARUCO_DIR/src/dictionary.cpp" \
+ "$ARUCO_DIR/src/charuco.cpp" \
+ "$ARUCO_DIR/src/apriltag_quad_thresh.cpp" \
+ "$ARUCO_DIR/src/zmaxheap.cpp"
+ar rcs libaruco_contrib.a *.o
+rm -f *.o
+cp "$ARUCO_DIR/include/opencv2/aruco.hpp" "$ARUCO_INC/opencv2/"
+cp "$ARUCO_DIR/include/opencv2/aruco/"*.hpp "$ARUCO_INC/opencv2/aruco/"
+
+# Patch CMakeLists.txt to use bundled aruco headers and static library
+export ARUCO_INC ARUCO_DIR ARUCO_BUILD
+cd %{_builddir}/%{RosPkgName}-%{src_version}/aruco_markers
+python3 << 'PYEOF'
+import os
+inc = os.environ["ARUCO_INC"]
+src_dir = os.environ["ARUCO_DIR"] + "/src"
+lib = os.environ["ARUCO_BUILD"] + "/libaruco_contrib.a"
+with open("CMakeLists.txt") as f:
+ c = f.read()
+c = c.replace(
+ "target_link_libraries(aruco_markers_lib ${OpenCV_LIBRARIES})",
+ "target_link_libraries(aruco_markers_lib ${OpenCV_LIBRARIES} " + lib + ")\n"
+ "target_include_directories(aruco_markers_lib PUBLIC " + inc + " " + src_dir + ")"
+)
+c = c.replace(
+ "target_link_libraries(aruco_markers aruco_markers_lib ${OpenCV_LIBRARIES})",
+ "target_link_libraries(aruco_markers aruco_markers_lib ${OpenCV_LIBRARIES} " + lib + ")\n"
+ "target_include_directories(aruco_markers PUBLIC " + inc + " " + src_dir + ")"
+)
+with open("CMakeLists.txt", "w") as f:
+ f.write(c)
+PYEOF
+
mkdir -p .obj && cd .obj
%cmake3 \
-DCMAKE_INSTALL_PREFIX="/opt/ros/%{ros_distro}" \
@@ -75,5 +123,8 @@ make install DESTDIR=%{buildroot}
/opt/ros/%{ros_distro}
%changelog
+* Mon Oct 12 2026 ai-importer <ai-importer@openeuler.org> - 0.0.3-2
+- Bundle opencv_contrib 4.5.2 aruco module (openEuler opencv lacks it)
+
* Mon Oct 12 2026 ai-importer <ai-importer@openeuler.org> - 0.0.3-1
- Initial import (ROS batch)