Saturday, July 27, 2019

[macppc, arm64] Unbreak graphics/openscenegraph

> http://build-failures.rhaalovely.net/powerpc/2019-07-14/graphics/openscenegraph.log
> http://build-failures.rhaalovely.net/aarch64/2019-07-12/graphics/openscenegraph.log

Typical narrowing error... once type specifiers are used properly, it
builds without issues [0] on macppc (and amd64 isn't broken).

While here, i've removed the -std=c++11 block, as expected we don't need
that anymore with gcc-8.

Comments/feedback are welcome,

Charlène.


[0] https://bin.charlenew.xyz/openscenegraph.log.gz


Index: Makefile
===================================================================
RCS file: /cvs/ports/graphics/openscenegraph/Makefile,v
retrieving revision 1.17
diff -u -p -u -p -r1.17 Makefile
--- Makefile 12 Jul 2019 20:47:05 -0000 1.17
+++ Makefile 27 Jul 2019 19:37:29 -0000
@@ -9,7 +9,7 @@ GH_ACCOUNT = openscenegraph
GH_PROJECT = OpenSceneGraph
GH_TAGNAME = OpenSceneGraph-$V
DISTNAME = openscenegraph-${V}
-REVISION = 3
+REVISION = 4

SUBST_VARS += V

@@ -67,9 +67,3 @@ CONFIGURE_ARGS = -DDESIRED_QT_VERSION=5
NO_TEST = Yes

.include <bsd.port.mk>
-
-# fix error: #error Must have C++11 or newer.
-# XXX this should be retried once moving to ports-gcc>=8
-.if ${CHOSEN_COMPILER} == "ports-gcc"
-CONFIGURE_ENV += CXXFLAGS="${CXXFLAGS} -std=c++11"
-.endif
Index: patches/patch-src_osgDB_ConvertBase64_cpp
===================================================================
RCS file: patches/patch-src_osgDB_ConvertBase64_cpp
diff -N patches/patch-src_osgDB_ConvertBase64_cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_osgDB_ConvertBase64_cpp 27 Jul 2019 19:37:29 -0000
@@ -0,0 +1,16 @@
+$OpenBSD$
+
+Fix narrowing errors on archs where char is unsigned by default (ppc, arm)
+
+Index: src/osgDB/ConvertBase64.cpp
+--- src/osgDB/ConvertBase64.cpp.orig
++++ src/osgDB/ConvertBase64.cpp
+@@ -28,7 +28,7 @@ namespace osgDB
+
+ int base64_decode_value(char value_in)
+ {
+- static const char decoding[] = {62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-2,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51};
++ static const signed char decoding[] = {62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-2,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51};
+ static const char decoding_size = sizeof(decoding);
+ value_in -= 43;
+ if (value_in < 0 || value_in > decoding_size) return -1;
Index: patches/patch-src_osgPlugins_osgjs_Base64
===================================================================
RCS file: patches/patch-src_osgPlugins_osgjs_Base64
diff -N patches/patch-src_osgPlugins_osgjs_Base64
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_osgPlugins_osgjs_Base64 27 Jul 2019 19:37:29 -0000
@@ -0,0 +1,16 @@
+$OpenBSD$
+
+ppc, arm: from_table is actually signed, and has to be declared as such
+
+Index: src/osgPlugins/osgjs/Base64
+--- src/osgPlugins/osgjs/Base64.orig
++++ src/osgPlugins/osgjs/Base64
+@@ -61,7 +61,7 @@ namespace base64
+ extern const char* to_table;
+ extern const char* to_table_end;
+
+- extern const char* from_table;
++ extern const signed char* from_table;
+
+
+ template <class InputIterator, class OutputIterator>
Index: patches/patch-src_osgPlugins_osgjs_Base64_cpp
===================================================================
RCS file: patches/patch-src_osgPlugins_osgjs_Base64_cpp
diff -N patches/patch-src_osgPlugins_osgjs_Base64_cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_osgPlugins_osgjs_Base64_cpp 27 Jul 2019 19:37:29 -0000
@@ -0,0 +1,24 @@
+$OpenBSD$
+
+Fix narrowing errors on archs where char is unsigned by default (ppc, arm)
+
+Index: src/osgPlugins/osgjs/Base64.cpp
+--- src/osgPlugins/osgjs/Base64.cpp.orig
++++ src/osgPlugins/osgjs/Base64.cpp
+@@ -18,7 +18,7 @@ namespace base64
+ const char* to_table_end =
+ _to_table + sizeof(_to_table);
+
+- const char _from_table[128] =
++ const signed char _from_table[128] =
+ {
+ -1, -1, -1, -1, -1, -1, -1, -1, // 0
+ -1, -1, -1, -1, -1, -1, -1, -1, // 8
+@@ -37,6 +37,6 @@ namespace base64
+ 41, 42, 43, 44, 45, 46, 47, 48, // 112
+ 49, 50, 51, -1, -1, -1, -1, -1 // 120
+ };
+- const char* from_table = _from_table;
++ const signed char* from_table = _from_table;
+ }
+

No comments:

Post a Comment