commit b9bc5ba22e46ec6710de7ee831ba47f28fe49ccb
Author: Jakub Bogusz <[email protected]>
Date:   Mon Mar 16 17:04:40 2020 +0100

    - added defines patch (fix platform ifdefs, adjust to work in C++ with 
cleaner namespace, i.e. no i386 macro)
    - added nowarn,c++ patches (build fixes), turn off more warnings to build 
with gcc 7+
    - disable javadoc for now, fails with Java 8+
    - rel 4

 OpenNI2-c++.patch     | 71 +++++++++++++++++++++++++++++++++++++++
 OpenNI2-defines.patch | 14 ++++++++
 OpenNI2-nowarn.patch  | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++
 OpenNI2.spec          | 15 +++++++--
 4 files changed, 189 insertions(+), 3 deletions(-)
---
diff --git a/OpenNI2.spec b/OpenNI2.spec
index 2e44196..f9855d0 100644
--- a/OpenNI2.spec
+++ b/OpenNI2.spec
@@ -14,7 +14,8 @@ Summary(pl.UTF-8):    Szkielet OpenNI2 do urządzeń służących 
interakcji z natu
 Name:          OpenNI2
 Version:       2.2.0.33
 %define        subver  beta2
-Release:       0.%{subver}.3
+%define        rel     4
+Release:       0.%{subver}.%{rel}
 License:       Apache v2.0
 Group:         Libraries
 Source0:       
https://github.com/occipital/OpenNI2/archive/2.2-%{subver}/%{name}-%{version}.tar.gz
@@ -25,6 +26,9 @@ Patch2:               %{name}-link.patch
 Patch3:                %{name}-paths.patch
 Patch4:                %{name}-soname.patch
 Patch5:                %{name}-norpath.patch
+Patch6:                %{name}-defines.patch
+Patch7:                %{name}-nowarn.patch
+Patch8:                %{name}-c++.patch
 URL:           http://structure.io/openni
 BuildRequires: OpenGL-devel
 BuildRequires: OpenGL-glut-devel >= 3
@@ -126,9 +130,13 @@ Interfejs Javy do OpenNI2.
 %patch3 -p1
 %patch4 -p1
 %patch5 -p1
+%patch6 -p1
+%patch7 -p1
+%patch8 -p1
 
 %build
-export CFLAGS="%{rpmcflags} -Wno-unused-local-typedefs -Wno-enum-compare"
+export CFLAGS="%{rpmcflags} -Wno-unused-local-typedefs -Wno-enum-compare 
-Wno-unused-local-typedefs -Wno-misleading-indentation"
+export CXXFLAGS="%{rpmcxxflags} -Wno-unused-local-typedefs -Wno-enum-compare 
-Wno-unused-local-typedefs -Wno-misleading-indentation"
 %{__make} \
        CFG=Release \
        CXX="%{__cxx}" \
@@ -141,7 +149,8 @@ export CFLAGS="%{rpmcflags} -Wno-unused-local-typedefs 
-Wno-enum-compare"
 cd Source/Documentation
 doxygen Doxyfile
 %if %{with java}
-javadoc -d java $(find ../../Wrappers/java/OpenNI.java/src/org/openni -type f)
+# fails with "unknown tag" errors since Java 8
+#javadoc -d java $(find ../../Wrappers/java/OpenNI.java/src/org/openni -type f)
 %endif
 %endif
 
diff --git a/OpenNI2-c++.patch b/OpenNI2-c++.patch
new file mode 100644
index 0000000..fac7412
--- /dev/null
+++ b/OpenNI2-c++.patch
@@ -0,0 +1,71 @@
+Avoid redefining std::equivalent.
+--- OpenNI2-2.2-beta2/ThirdParty/GL/glh/glh_linear.h.orig      2013-11-12 
15:12:23.000000000 +0100
++++ OpenNI2-2.2-beta2/ThirdParty/GL/glh/glh_linear.h   2020-03-16 
06:17:00.475443933 +0100
+@@ -77,7 +77,7 @@
+ #define     GLH_EPSILON         GLH_REAL(10e-6)
+ #define     GLH_PI              GLH_REAL(3.1415926535897932384626433832795)   
 
+ 
+-#define     equivalent(a,b)     (((a < b + GLH_EPSILON) && (a > b - 
GLH_EPSILON)) ? true : false)
++#define     glh_equivalent(a,b)     (((a < b + GLH_EPSILON) && (a > b - 
GLH_EPSILON)) ? true : false)
+ 
+ namespace glh
+ {
+@@ -1093,7 +1093,7 @@
+ 
+         real norm = q[0] * q[0] + q[1] * q[1] + q[2] * q[2] + q[3] * q[3];
+ 
+-        s = (equivalent(norm,GLH_ZERO)) ? GLH_ZERO : ( GLH_TWO / norm );
++        s = (glh_equivalent(norm,GLH_ZERO)) ? GLH_ZERO : ( GLH_TWO / norm );
+ 
+         xs = q[0] * s;
+         ys = q[1] * s;
+@@ -1194,7 +1194,7 @@
+             theta *= real(0.5);
+             real sin_theta = real(sin(theta));
+ 
+-            if (!equivalent(sqnorm,GLH_ONE)) 
++            if (!glh_equivalent(sqnorm,GLH_ONE)) 
+               sin_theta /= real(sqrt(sqnorm));
+             x = sin_theta * axis.v[0];
+             y = sin_theta * axis.v[1];
+@@ -1216,14 +1216,14 @@
+ 
+         alpha = p1.dot(p2);
+ 
+-        if(equivalent(alpha,GLH_ONE))
++        if(glh_equivalent(alpha,GLH_ONE))
+         { 
+             *this = identity(); 
+             return *this; 
+         }
+ 
+         // ensures that the anti-parallel case leads to a positive dot
+-        if(equivalent(alpha,-GLH_ONE))
++        if(glh_equivalent(alpha,-GLH_ONE))
+         {
+             vec3 v;
+ 
+@@ -1280,7 +1280,7 @@
+     void normalize()
+     {
+         real rnorm = GLH_ONE / real(sqrt(w * w + x * x + y * y + z * z));
+-        if (equivalent(rnorm, GLH_ZERO))
++        if (glh_equivalent(rnorm, GLH_ZERO))
+             return;
+         x *= rnorm;
+         y *= rnorm;
+@@ -1439,10 +1439,10 @@
+     inline
+     bool operator == ( const quaternion & q1, const quaternion & q2 )
+     {
+-        return (equivalent(q1.x, q2.x) &&
+-                      equivalent(q1.y, q2.y) &&
+-                      equivalent(q1.z, q2.z) &&
+-                      equivalent(q1.w, q2.w) );
++        return (glh_equivalent(q1.x, q2.x) &&
++                      glh_equivalent(q1.y, q2.y) &&
++                      glh_equivalent(q1.z, q2.z) &&
++                      glh_equivalent(q1.w, q2.w) );
+     }
+ 
+     inline
diff --git a/OpenNI2-defines.patch b/OpenNI2-defines.patch
new file mode 100644
index 0000000..c56b13e
--- /dev/null
+++ b/OpenNI2-defines.patch
@@ -0,0 +1,14 @@
+--- OpenNI2-2.2-beta2/Include/OniPlatform.h.orig       2013-11-12 
15:12:23.000000000 +0100
++++ OpenNI2-2.2-beta2/Include/OniPlatform.h    2020-03-15 20:52:18.458998563 
+0100
+@@ -37,9 +37,9 @@
+ #     include "Win32/OniPlatformWin32.h"
+ #elif defined (ANDROID) && defined (__arm__)
+ #     include "Android-Arm/OniPlatformAndroid-Arm.h"
+-#elif (__linux__ && (i386 || __x86_64__))
++#elif (defined(__linux__) && (defined(__i386__) || defined(__x86_64__)))
+ #     include "Linux-x86/OniPlatformLinux-x86.h"
+-#elif (__linux__ && __arm__)
++#elif (defined(__linux__) && defined(__arm__))
+ #     include "Linux-Arm/OniPlatformLinux-Arm.h"
+ #elif _ARC
+ #     include "ARC/OniPlaformARC.h"
diff --git a/OpenNI2-nowarn.patch b/OpenNI2-nowarn.patch
new file mode 100644
index 0000000..a82d862
--- /dev/null
+++ b/OpenNI2-nowarn.patch
@@ -0,0 +1,92 @@
+Avoid:
+"error: array subscript is below array bounds [-Werror=array-bounds]"
+"directive writing ... bytes into a region of size ... 
[-Werror=format-overflow=]"
+"error: ... may be used uninitialized in this function 
[-Werror=maybe-uninitialized]"
+--- OpenNI2-2.2-beta2/Source/Drivers/PS1080/Formats/XnFormatsMirror.cpp.orig   
2013-11-12 15:12:23.000000000 +0100
++++ OpenNI2-2.2-beta2/Source/Drivers/PS1080/Formats/XnFormatsMirror.cpp        
2020-03-15 21:05:31.154704162 +0100
+@@ -43,7 +43,6 @@
+       XnUInt8* pSrcEnd = pSrc + nBufferSize;
+       XnUInt8* pDest = NULL;
+       XnUInt8* pDestVal = &pLineBuffer[0] + nLineSize - 1;
+-      XnUInt8* pDestEnd = &pLineBuffer[0] - 1;
+ 
+       if (nLineSize > XN_MIRROR_MAX_LINE_SIZE)
+       {
+@@ -55,7 +54,7 @@
+               xnOSMemCopy(pLineBuffer, pSrc, nLineSize);
+ 
+               pDest = pDestVal;
+-              while (pDest != pDestEnd)
++              while (pDest >= pLineBuffer)
+               {
+                       *pSrc = *pDest;
+ 
+@@ -76,7 +75,6 @@
+       XnUInt16* pSrcEnd = pSrc + nBufferSize / sizeof(XnUInt16);
+       XnUInt16* pDest = NULL;
+       XnUInt16* pDestVal = &pLineBuffer[0] + nLineSize - 1;
+-      XnUInt16* pDestEnd = &pLineBuffer[0] - 1;
+       XnUInt16 nMemCpyLineSize = (XnUInt16)(nLineSize * sizeof(XnUInt16));
+       XnUInt16 nValue;
+ 
+@@ -90,7 +88,7 @@
+               xnOSMemCopy(pLineBuffer, pSrc, nMemCpyLineSize);
+ 
+               pDest = pDestVal;
+-              while (pDest != pDestEnd)
++              while (pDest >= pLineBuffer)
+               {
+                       nValue = pDest[0];
+                       pSrc[0] = nValue;
+@@ -112,7 +110,6 @@
+       XnUInt8* pSrcEnd = pSrc + nBufferSize;
+       XnUInt8* pDest = NULL;
+       XnUInt8* pDestVal = &pLineBuffer[0] + nLineSize * 3 - 1;
+-      XnUInt8* pDestEnd = &pLineBuffer[0] - 1;
+       XnUInt16 nMemCpyLineSize = (XnUInt16)(nLineSize * 3);
+ 
+       if (nMemCpyLineSize > XN_MIRROR_MAX_LINE_SIZE)
+@@ -125,7 +122,7 @@
+               xnOSMemCopy(pLineBuffer, pSrc, nMemCpyLineSize);
+ 
+               pDest = pDestVal;
+-              while (pDest != pDestEnd)
++              while (pDest >= pLineBuffer)
+               {
+                       *pSrc = *(pDest-2);
+                       *(pSrc+1) = *(pDest-1);
+--- 
OpenNI2-2.2-beta2/Source/Drivers/PS1080/Sensor/XnFrameStreamProcessor.h.orig    
   2013-11-12 15:12:23.000000000 +0100
++++ OpenNI2-2.2-beta2/Source/Drivers/PS1080/Sensor/XnFrameStreamProcessor.h    
2020-03-15 21:15:21.744837994 +0100
+@@ -170,8 +170,8 @@
+       /* A pointer to the triple frame buffer of this stream. */
+       XnFrameBufferManager* m_pTripleBuffer;
+ 
+-      XnChar m_csInDumpMask[100];
+-      XnChar m_csInternalDumpMask[100];
++      XnChar m_csInDumpMask[220];
++      XnChar m_csInternalDumpMask[220];
+       XnDumpFile* m_InDump;
+       XnDumpFile* m_InternalDump;
+       XnBool m_bFrameCorrupted;
+--- 
OpenNI2-2.2-beta2/Source/Drivers/PS1080/Sensor/XnSensorFirmwareParams.cpp.orig  
   2013-11-12 15:12:23.000000000 +0100
++++ OpenNI2-2.2-beta2/Source/Drivers/PS1080/Sensor/XnSensorFirmwareParams.cpp  
2020-03-15 21:21:18.092907491 +0100
+@@ -262,7 +262,7 @@
+       nRetVal = m_AllFirmwareParams.Set(&Property, param);
+       XN_IS_STATUS_OK(nRetVal);
+ 
+-      XnChar csNewName[XN_DEVICE_MAX_STRING_LENGTH];
++      XnChar csNewName[XN_DEVICE_MAX_STRING_LENGTH + 10];
+       sprintf(csNewName, "%s (%d)", Property.GetName(), nFirmwareParam);
+ 
+       Property.UpdateName("Firmware", csNewName);
+--- OpenNI2-2.2-beta2/Source/Tools/NiViewer/Device.cpp.orig    2013-11-12 
15:12:23.000000000 +0100
++++ OpenNI2-2.2-beta2/Source/Tools/NiViewer/Device.cpp 2020-03-15 
22:01:52.709718040 +0100
+@@ -364,7 +364,7 @@
+ 
+ void toggleCloseRange(int )
+ {
+-      bool bCloseRange;
++      bool bCloseRange = false;
+       g_depthStream.getProperty(XN_STREAM_PROPERTY_CLOSE_RANGE, &bCloseRange);
+ 
+       bCloseRange = !bCloseRange;
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/OpenNI2.git/commitdiff/b9bc5ba22e46ec6710de7ee831ba47f28fe49ccb

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to