From 1f25708c4ff011c19722714009dd92f84c733323 Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Thu, 22 Oct 2026 03:29:55 +0000 Subject: automatic import of ros-humble-openni2-camera --- .gitignore | 1 + openni2-aarch64-support.patch | 44 +++++++++++++++++++++++++++ openni2-camera.spec | 70 ++++++++++++++++++++++++++++++++++++++----- sources | 1 + 4 files changed, 109 insertions(+), 7 deletions(-) create mode 100644 openni2-aarch64-support.patch diff --git a/.gitignore b/.gitignore index 40a9f56..36a4fba 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /openni2-camera-2.0.3-1.tar.gz +/OpenNI2-2.2.0.33.tar.gz diff --git a/openni2-aarch64-support.patch b/openni2-aarch64-support.patch new file mode 100644 index 0000000..8718ce9 --- /dev/null +++ b/openni2-aarch64-support.patch @@ -0,0 +1,44 @@ +diff -ruN '--exclude=.git' '--exclude=.github' ./ThirdParty/PSCommon/BuildSystem/CommonDefs.mak ../OpenNI2-patched/ThirdParty/PSCommon/BuildSystem/CommonDefs.mak +--- a/ThirdParty/PSCommon/BuildSystem/CommonDefs.mak 2026-10-22 03:13:34.628894060 +0000 ++++ b/ThirdParty/PSCommon/BuildSystem/CommonDefs.mak 2026-10-22 03:24:42.065885094 +0000 +@@ -18,6 +18,8 @@ + HOST_PLATFORM = x86 + else ifneq (,$(findstring arm,$(MACHINE))) + HOST_PLATFORM = Arm ++else ifneq (,$(findstring aarch64,$(MACHINE))) ++ HOST_PLATFORM = Aarch64 + else + DUMMY:=$(error Can't determine host platform) + endif +diff -ruN '--exclude=.git' '--exclude=.github' ./ThirdParty/PSCommon/BuildSystem/Platform.Aarch64 ../OpenNI2-patched/ThirdParty/PSCommon/BuildSystem/Platform.Aarch64 +--- a/ThirdParty/PSCommon/BuildSystem/Platform.Aarch64 1970-01-01 00:00:00.000000000 +0000 ++++ b/ThirdParty/PSCommon/BuildSystem/Platform.Aarch64 2026-10-22 03:24:42.068885103 +0000 +@@ -0,0 +1,4 @@ ++ifeq "$(CFG)" "Release" ++ CFLAGS += -O3 -fno-tree-pre -fno-strict-aliasing ++ CFLAGS += -ftree-vectorize -ffast-math -funsafe-math-optimizations ++endif +diff -ruN '--exclude=.git' '--exclude=.github' ./ThirdParty/PSCommon/XnLib/Include/Linux-Aarch64/XnPlatformLinux-Aarch64.h ../OpenNI2-patched/ThirdParty/PSCommon/XnLib/Include/Linux-Aarch64/XnPlatformLinux-Aarch64.h +--- a/ThirdParty/PSCommon/XnLib/Include/Linux-Aarch64/XnPlatformLinux-Aarch64.h 1970-01-01 00:00:00.000000000 +0000 ++++ b/ThirdParty/PSCommon/XnLib/Include/Linux-Aarch64/XnPlatformLinux-Aarch64.h 2026-10-22 03:24:42.069885106 +0000 +@@ -0,0 +1,8 @@ ++#ifndef _XN_PLATFORM_LINUX_AARCH64_H_ ++#define _XN_PLATFORM_LINUX_AARCH64_H_ ++#include "../Linux-x86/XnPlatformLinux-x86.h" ++#undef XN_PLATFORM ++#undef XN_PLATFORM_STRING ++#define XN_PLATFORM XN_PLATFORM_LINUX_ARM ++#define XN_PLATFORM_STRING "Linux-Aarch64" ++#endif +diff -ruN '--exclude=.git' '--exclude=.github' ./ThirdParty/PSCommon/XnLib/Include/XnPlatform.h ../OpenNI2-patched/ThirdParty/PSCommon/XnLib/Include/XnPlatform.h +--- a/ThirdParty/PSCommon/XnLib/Include/XnPlatform.h 2026-10-22 03:13:34.655894141 +0000 ++++ b/ThirdParty/PSCommon/XnLib/Include/XnPlatform.h 2026-10-22 03:24:42.077885129 +0000 +@@ -51,6 +51,8 @@ + #include "Android-Arm/XnPlatformAndroid-Arm.h" + #elif (__linux__ && (i386 || __x86_64__)) + #include "Linux-x86/XnPlatformLinux-x86.h" ++#elif (__linux__ && __aarch64__) ++#include "Linux-Aarch64/XnPlatformLinux-Aarch64.h" + #elif (__linux__ && __arm__) + #include "Linux-Arm/XnPlatformLinux-Arm.h" + #elif _ARC diff --git a/openni2-camera.spec b/openni2-camera.spec index 699ea0b..7c08d23 100644 --- a/openni2-camera.spec +++ b/openni2-camera.spec @@ -1,14 +1,17 @@ %define ros_distro humble %define RosPkgName openni2-camera %define src_version 2.0.3-1 +%define openni2_version 2.2.0.33 Name: ros-%{ros_distro}-%{RosPkgName} Version: 2.0.3 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Drivers for the Asus Xtion and Primesense Devices License: BSD URL: https://github.com/ros-drivers/openni2_camera/tree/iron Source0: %{RosPkgName}-%{src_version}.tar.gz +Source1: OpenNI2-%{openni2_version}.tar.gz +Patch0: openni2-aarch64-support.patch %global debug_package %{nil} %global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g') @@ -16,6 +19,8 @@ Source0: %{RosPkgName}-%{src_version}.tar.gz %global __requires_exclude_from ^/opt/ros/%{ros_distro}/.*$ BuildRequires: cmake +BuildRequires: libusbx-devel +BuildRequires: systemd-devel BuildRequires: ros-%{ros_distro}-ament-cmake BuildRequires: ros-%{ros_distro}-builtin-interfaces BuildRequires: ros-%{ros_distro}-camera-info-manager @@ -27,7 +32,6 @@ BuildRequires: ros-%{ros_distro}-rosidl-default-generators BuildRequires: ros-%{ros_distro}-rosidl-default-runtime BuildRequires: ros-%{ros_distro}-sensor-msgs BuildRequires: pkgconfig -BuildRequires: libopenni2-dev Requires: ros-%{ros_distro}-ros-workspace Requires: ros-%{ros_distro}-ament-cmake @@ -39,23 +43,52 @@ Requires: ros-%{ros_distro}-rclcpp Requires: ros-%{ros_distro}-rclcpp-components Requires: ros-%{ros_distro}-rosidl-default-runtime Requires: ros-%{ros_distro}-sensor-msgs -Requires: libopenni2-dev +Requires: libusbx +Requires: systemd-libs -Provides: %{name}-devel = %{version}-%{release} -Provides: %{name}-doc = %{version}-%{release} -Provides: %{name}-runtime = %{version}-%{release} +Provides: libopenni2-devel = %{openni2_version} +Provides: libopenni2-dev = %{openni2_version} %description Drivers for the Asus Xtion and Primesense Devices. For using a kinect with ROS, try the %prep -%autosetup -n %{RosPkgName}-%{src_version} +%setup -q -n %{RosPkgName}-%{src_version} -a1 +cd OpenNI2-%{openni2_version} +patch -p1 < %{_sourcedir}/openni2-aarch64-support.patch +cd .. %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} + +# Build vendored OpenNI2 SDK (libopenni2 not available in openEuler repos) +cd OpenNI2-%{openni2_version} +make Source/Core %{?_smp_mflags} +OPENNI2_PREFIX=%{_builddir}/openni2_install +mkdir -p $OPENNI2_PREFIX/lib $OPENNI2_PREFIX/include/openni2 $OPENNI2_PREFIX/lib/pkgconfig +cp Bin/*/Release/libOpenNI2.so $OPENNI2_PREFIX/lib/ +cp Include/*.h $OPENNI2_PREFIX/include/openni2/ +cat > $OPENNI2_PREFIX/lib/pkgconfig/libopenni2.pc << PCEOF +prefix=$OPENNI2_PREFIX +exec_prefix=\${prefix} +libdir=\${exec_prefix}/lib +includedir=\${prefix}/include/openni2 + +Name: libopenni2 +Description: OpenNI2 framework +Version: %{openni2_version} +Libs: -L\${libdir} -lOpenNI2 +Cflags: -I\${includedir} +PCEOF +cp $OPENNI2_PREFIX/lib/pkgconfig/libopenni2.pc $OPENNI2_PREFIX/lib/pkgconfig/openni2.pc +export PKG_CONFIG_PATH=$OPENNI2_PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH +export LD_LIBRARY_PATH=$OPENNI2_PREFIX/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} +cd .. + +# Build openni2_camera ROS package cd openni2_camera mkdir -p .obj && cd .obj %cmake3 \ @@ -76,9 +109,32 @@ cd openni2_camera cd .obj make install DESTDIR=%{buildroot} +# Install vendored OpenNI2 library and headers +cd ../.. +mkdir -p %{buildroot}/%{_libdir} +mkdir -p %{buildroot}/%{_includedir}/openni2 +cp OpenNI2-%{openni2_version}/Bin/*/Release/libOpenNI2.so %{buildroot}/%{_libdir}/ +cp OpenNI2-%{openni2_version}/Include/*.h %{buildroot}/%{_includedir}/openni2/ + +# Install OpenNI2 drivers if available +mkdir -p %{buildroot}/%{_libdir}/OpenNI2/Drivers +for drv in OpenNI2-%{openni2_version}/Bin/*/Release/libPS*.so \ + OpenNI2-%{openni2_version}/Bin/*/Release/libOniFile.so \ + OpenNI2-%{openni2_version}/Bin/*/Release/libDummyDevice.so; do + [ -f "$drv" ] && cp "$drv" %{buildroot}/%{_libdir}/OpenNI2/Drivers/ || true +done + %files /opt/ros/%{ros_distro} +%{_libdir}/libOpenNI2.so +%{_libdir}/OpenNI2 +%{_includedir}/openni2 %changelog +* Thu Oct 22 2026 ai-importer - 2.0.3-2 +- Vendor OpenNI2 SDK (libopenni2 not available in openEuler) +- Add aarch64 platform support to OpenNI2 build system +- Replace libopenni2-dev BuildRequires/Requires with vendored library + * Thu Oct 22 2026 ai-importer - 2.0.3-1 - Initial import (ROS batch) diff --git a/sources b/sources index 41f4571..4591d6c 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ +7baede66c4207b2220d5fb1ad1936810 OpenNI2-2.2.0.33.tar.gz 8365768b5296d96b0f2cf8e3bb204840 openni2-camera-2.0.3-1.tar.gz -- cgit v1.2.3