# 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. # # 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-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 * Mon Sep 28 2026 openEuler Builder - 2.2.0-3 - Extend aarch64-support.patch: add __aarch64__ branch to the public API header Include/OniPlatform.h (same pattern as the XnPlatform.h fix in -2). The previous round only patched the XnLib internal header XnPlatform.h; the public OniPlatform.h still had no __aarch64__ branch, so DepthUtils.cpp (which includes OniCTypes.h -> OniPlatform.h) hit '#error Unsupported Platform' and ONI_CALLBACK_TYPE/uint*_t stayed undefined. * Mon Sep 28 2026 openEuler Builder - 2.2.0-2 - Extend aarch64-support.patch: add __aarch64__ branch to XnPlatform.h so the C/C++ platform-abstraction header includes the Linux-x86 types header (XnChar, XnUInt32, XN_INVALID_FILE_HANDLE, ...). The previous patch only handled the Makefile-level platform detection; the C preprocessor still hit "#error Unsupported Platform" and every type stayed undefined. * Thu Sep 24 2026 openEuler Builder - 2.2.0-1 - Initial package of OpenNI 2.2.0 for openEuler (aarch64 native build)