# 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 # # The upstream Makefile builds Release with -O2 -DNDEBUG and deliberately no # -g, so the produced .so files carry no DWARF debug info. mock's # find-debuginfo therefore cannot emit any source mapping, leaving # debugsourcefiles.list empty, which rpmbuild treats as a hard # "Empty %files file" error. Disable the debug/debugsource subpackages: # there are no symbols to ship anyway, so nothing useful is lost. %define debug_package %{nil} Name: libopenni2-dev Version: 2.2.0 Release: 5%{?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-5 - Disable the debug/debugsource subpackages with %%define debug_package %%{nil}. Build 113193 finally compiled, linked and installed all artefacts (libOpenNI2.so + the four driver plugins + headers) on aarch64, but the build then failed at debuginfo packaging with "error: Empty %%files file .../debugsourcefiles.list". Root cause: the upstream Makefile builds Release with -O2 -DNDEBUG and no -g, so the .so files carry no DWARF symbols (the gdb-add-index stage logged "No debugging symbols" for all five .so files); find-debuginfo can't emit any source mapping, leaving debugsourcefiles.list empty. As there are no symbols to ship anyway, disabling the debug subpackages loses nothing and resolves the hard error. This is a no-op on any other arch / chroot (a global spec macro). * Mon Sep 28 2026 openEuler Builder - 2.2.0-4 - Fix aarch64-support.patch: the Include/OniPlatform.h hunk header was miscounted (@@ -42,6 +42,10 @@ claimed 6 context / 10 total lines but the body actually has 5 context + 4 added = 9 lines). GNU patch rejected the hunk at %prep ("1 out of 1 hunk FAILED -- saving rejects to OniPlatform.h.rej") so build 113192 never reached %build. Corrected the header to @@ -42,5 +42,9 @@; the aarch64 branch insertion is unchanged and applies cleanly (verified locally). The hunk content is __aarch64__-guarded so this is a no-op on any other arch. * 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)