# OpenNI 2 is built with its own Makefile-based build system (no CMake/Meson). # The upstream platform detection only knows x86 / x86_64 / arm32 and errors # out on aarch64; Patch0 adds the aarch64 (Arm64) platform with neutral, # SSE-free flags so the library and drivers build natively on aarch64. # Patch0 routes __aarch64__ to the arch-neutral Linux-x86 platform header in # BOTH platform-detection headers: ThirdParty/.../XnPlatform.h (XnLib # internal, used by Source/*) and Include/OniPlatform.h (OpenNI public API, # used by Source/DepthUtils via OniCTypes.h). # # topdir: libopenni2-dev-2.2.0 Name: libopenni2-dev Version: 2.2.0 Release: 3%{?dist} Summary: OpenNI 2 framework for 3D sensors (development package) License: Apache-2.0 URL: https://github.com/occipital/OpenNI2 %global commit0 3b787cc8b06e4129d1c5d7daf99e04413ac42266 Source0: https://github.com/occipital/OpenNI2/archive/%{commit0}/OpenNI2-%{commit0}.tar.gz#/%{name}-%{version}.tar.gz Patch0: aarch64-support.patch Group: Development/Libraries Packager: openEuler Builder BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: make BuildRequires: libusbx-devel BuildRequires: systemd-devel Requires: libusbx%{?_isa} Requires: systemd-libs%{?_isa} %description OpenNI 2 is a framework for acquiring, processing and understanding the output of 3D sensors (depth and RGB). It exposes a C and C++ API for depth and color streams, device enumeration, recording and playback. This package is the ROS-bundled development package: it ships the core runtime library (libOpenNI2.so), the bundled device-driver plugins and the public C/C++ headers, so that dependent packages can build against OpenNI 2. %prep %autosetup -p1 %build # The upstream Makefile has no "install" target and only knows x86/x86_64/ # arm32; Patch0 makes aarch64 (Arm64) a supported native platform (no SSE, # no -march flags; NEON fast paths fall back to the scalar reference code). # # Build order matters because the top-level Makefile only declares the # cross-project dependency graph for its aggregate targets: XnLib (static # helper) must be built first, then DepthUtils (static), then the core # libOpenNI2.so, and finally the four device-driver plugins. Each stage is # a separate make invocation so -j cannot reorder the stages. # # The Java wrapper, the GLUT-based NiViewer tool and the samples are # intentionally not built: they would pull in a JDK and freeglut which this # library package does not need. export ALLOW_WARNINGS=1 make %{?_smp_mflags} ThirdParty/PSCommon/XnLib/Source make %{?_smp_mflags} Source/DepthUtils make %{?_smp_mflags} Source/Core make %{?_smp_mflags} \ Source/Drivers/DummyDevice \ Source/Drivers/OniFile \ Source/Drivers/PS1080 \ Source/Drivers/PSLink %install # No upstream "make install" target exists; install the produced artefacts # by hand. The build system names output directories after the auto-detected # platform (Arm64 on aarch64, x64 on x86_64), so locate the built tree # generically instead of hard-coding an architecture. BUILD_OUT=$(ls -d Bin/*-Release 2>/dev/null | head -n1) # Core shared library linked by every application using OpenNI 2. install -d %{buildroot}%{_libdir} install -p -m 0755 "$BUILD_OUT"/libOpenNI2.so %{buildroot}%{_libdir}/ # Device drivers are dlopen()'d at runtime. libOpenNI2.so looks for them in # /OpenNI2/Drivers (ONI_DEFAULT_DRIVERS_REPOSITORY), # so that is where they must live. install -d %{buildroot}%{_libdir}/OpenNI2/Drivers install -p -m 0755 "$BUILD_OUT"/OpenNI2/Drivers/*.so \ %{buildroot}%{_libdir}/OpenNI2/Drivers/ # Public C/C++ headers (Debian/ROS layout: /usr/include/openni2/). install -d %{buildroot}%{_includedir}/openni2 install -p -m 0644 Include/*.h %{buildroot}%{_includedir}/openni2/ %files %license LICENSE %doc README.md CHANGES.txt ReleaseNotes.txt NOTICE %{_libdir}/libOpenNI2.so %{_libdir}/OpenNI2/Drivers/ %{_includedir}/openni2/ %changelog * Thu Sep 24 2026 openEuler Builder - 2.2.0-3 - Extend aarch64-support.patch: route __aarch64__ in Include/OniPlatform.h (the OpenNI public API platform header) to the arch-neutral Linux-x86/OniPlatformLinux-x86.h, mirroring the XnPlatform.h fix from -2. The previous release fixed XnLib's XnPlatform.h so XnLib built, but Source/DepthUtils includes OniPlatform.h (via OniCTypes.h) which still hit '#error Unsupported Platform', cascading into 'uint16_t/uint8_t does not name a type' and 'expected ) before *' errors. ONI_STDCALL/__stdcall is only #define'd, never expanded on Linux (verified), so routing aarch64 to the Linux-x86 header is safe. * Thu Sep 24 2026 openEuler Builder - 2.2.0-2 - Extend aarch64-support.patch: route __aarch64__ in XnPlatform.h to the arch-neutral Linux-x86 platform header so the C++ build no longer hits '#error Unsupported Platform' and the XnChar/XnUInt32/XnUInt64 typedefs resolve. The original patch only taught the Makefile build system about aarch64 (CommonDefs.mak + Platform.Arm64); the C++ header still fell through to the unsupported-platform #error. * Thu Sep 24 2026 openEuler Builder - 2.2.0-1 - Initial package of OpenNI 2.2.0 for openEuler (aarch64 native build)