summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--aarch64-support.patch33
-rw-r--r--libopenni2-dev.spec97
-rw-r--r--sources1
4 files changed, 132 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..207490a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/libopenni2-dev-2.2.0.tar.gz
diff --git a/aarch64-support.patch b/aarch64-support.patch
new file mode 100644
index 0000000..e34967a
--- /dev/null
+++ b/aarch64-support.patch
@@ -0,0 +1,33 @@
+diff --git a/ThirdParty/PSCommon/BuildSystem/CommonDefs.mak b/ThirdParty/PSCommon/BuildSystem/CommonDefs.mak
+index dd88b04..7454e8a 100644
+--- a/ThirdParty/PSCommon/BuildSystem/CommonDefs.mak
++++ b/ThirdParty/PSCommon/BuildSystem/CommonDefs.mak
+@@ -16,6 +16,8 @@ else ifneq (,$(findstring i686,$(MACHINE)))
+ HOST_PLATFORM = x86
+ else ifneq (,$(findstring i386,$(MACHINE)))
+ HOST_PLATFORM = x86
++else ifneq (,$(findstring aarch64,$(MACHINE)))
++ HOST_PLATFORM = Arm64
+ else ifneq (,$(findstring arm,$(MACHINE)))
+ HOST_PLATFORM = Arm
+ else
+diff --git a/ThirdParty/PSCommon/BuildSystem/Platform.Arm64 b/ThirdParty/PSCommon/BuildSystem/Platform.Arm64
+new file mode 100644
+index 0000000..2eb8966
+--- /dev/null
++++ b/ThirdParty/PSCommon/BuildSystem/Platform.Arm64
+@@ -0,0 +1,14 @@
++# Platform.Arm64 - native aarch64 build (added for openEuler aarch64)
++#
++# OpenNI 2.2.0 predates aarch64; this platform file intentionally defines
++# NO architecture-specific compiler flags (no SSE, no -march=armv7-a) and
++# relies on the toolchain defaults. NEON fast paths in the drivers are gated
++# behind XN_NEON (only set by the old arm32 Platform.Arm) and therefore fall
++# back to the scalar reference implementations on aarch64.
++#
++# Disable the GLUT-based NiViewer tool to avoid pulling in OpenGL/freeglut.
++export GLUT_SUPPORTED=0
++
++# 2014-era C++ sources: build against gnu++14 to stay clear of C++17
++# removals (dynamic exception specifications, the register keyword, etc.).
++CFLAGS += -std=gnu++14
diff --git a/libopenni2-dev.spec b/libopenni2-dev.spec
new file mode 100644
index 0000000..002c513
--- /dev/null
+++ b/libopenni2-dev.spec
@@ -0,0 +1,97 @@
+# 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: 1%{?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 <builder@openeuler.org>
+
+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
+# <directory-of-libOpenNI2.so>/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 <builder@openeuler.org> - 2.2.0-1
+- Initial package of OpenNI 2.2.0 for openEuler (aarch64 native build)
diff --git a/sources b/sources
new file mode 100644
index 0000000..d87fd95
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+17db5637ce3de6109205891461fa8e41 libopenni2-dev-2.2.0.tar.gz