summaryrefslogtreecommitdiff
path: root/x11/xplanet
diff options
context:
space:
mode:
authorng0 <ng0@pkgsrc.org>2019-08-11 15:38:22 +0000
committerng0 <ng0@pkgsrc.org>2019-08-11 15:38:22 +0000
commit78cc19819b949c79610802ecaf174a68102e3b62 (patch)
tree478659c1f122ba892651b277274b6a7842459bac /x11/xplanet
parentf297ee0d3f18533344144231a55ce85432283527 (diff)
downloadpkgsrc-78cc19819b949c79610802ecaf174a68102e3b62.tar.gz
xplanet: fix the failing build with clang on NetBSD.
On recent NetBSD with clang, the build of xplanet was failing as described in PR pkg/54454. This patch taken from FreeBSD fixes the build. This closes PR pkg/54454. Revbump as the code was changed.
Diffstat (limited to 'x11/xplanet')
-rw-r--r--x11/xplanet/Makefile4
-rw-r--r--x11/xplanet/distinfo3
-rw-r--r--x11/xplanet/patches/patch-src_readConfig-fixclang.cpp90
3 files changed, 94 insertions, 3 deletions
diff --git a/x11/xplanet/Makefile b/x11/xplanet/Makefile
index 0829ce46c98..3f7b7c12b77 100644
--- a/x11/xplanet/Makefile
+++ b/x11/xplanet/Makefile
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.89 2019/08/11 13:25:21 wiz Exp $
+# $NetBSD: Makefile,v 1.90 2019/08/11 15:38:22 ng0 Exp $
DISTNAME= xplanet-1.3.0
-PKGREVISION= 6
+PKGREVISION= 7
CATEGORIES= x11
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=xplanet/}
diff --git a/x11/xplanet/distinfo b/x11/xplanet/distinfo
index 67f25055a24..957de6675f8 100644
--- a/x11/xplanet/distinfo
+++ b/x11/xplanet/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.21 2018/02/13 12:45:02 ryoon Exp $
+$NetBSD: distinfo,v 1.22 2019/08/11 15:38:22 ng0 Exp $
SHA1 (xplanet-1.3.0.tar.gz) = 7c5208b501b441a0184cbb334a5658d0309d7dac
RMD160 (xplanet-1.3.0.tar.gz) = b5ba6239019669668aeb7f63391aa850cc3dd8b7
@@ -10,4 +10,5 @@ SHA1 (patch-src_libannotate_addSatellites.cpp) = 7c8976a3e88ebac7e4d9b59a38f98f8
SHA1 (patch-src_libimage_gif.c) = 6c107bd1f733fe82f2b88af8ad778e0fe5aea5bd
SHA1 (patch-src_libmultiple_RayleighScattering.cpp) = 3a64033dc0c6915c9cd2eed2e506dd4c802138c9
SHA1 (patch-src_libmultiple_drawStars.cpp) = b6a3f3995f4f1ac77660fdad64524ef6a48c4d50
+SHA1 (patch-src_readConfig-fixclang.cpp) = 642e56513e0ae9ebba18ccc653cb089858a18637
SHA1 (patch-src_readConfig.cpp) = c1a46209dfcbb6a37b6c7ff90f633a6450fbd5d9
diff --git a/x11/xplanet/patches/patch-src_readConfig-fixclang.cpp b/x11/xplanet/patches/patch-src_readConfig-fixclang.cpp
new file mode 100644
index 00000000000..308a8c9b18f
--- /dev/null
+++ b/x11/xplanet/patches/patch-src_readConfig-fixclang.cpp
@@ -0,0 +1,90 @@
+$NetBSD: patch-src_readConfig-fixclang.cpp,v 1.1 2019/08/11 15:38:22 ng0 Exp $
+This patch has been imported from FreeBSD ports, written by adridg.
+
+The later chunks (using i2b) are compile fixes on aarch64 (presumably with
+clang6 as well). Typical error message reads
+
+ readConfig.cpp:407:54: error: non-constant-expression cannot be narrowed
+ from type 'int' to 'unsigned char' in initializer list [-Wc++11-narrowing]
+ unsigned char color[3] = { r & 0xff, g & 0xff, b & 0xff };
+ ^~~~~~~~
+ readConfig.cpp:407:54: note: insert an explicit cast to silence this issue
+ unsigned char color[3] = { r & 0xff, g & 0xff, b & 0xff };
+ ^~~~~~~~
+ static_cast<unsigned char>( )
+
+Since it happens in a half-dozen places, introduce a trivial helper function.
+
+--- src/readConfig.cpp.orig 2018-01-21 16:58:09 UTC
++++ src/readConfig.cpp
+@@ -4,6 +4,7 @@
+ #include <fstream>
+ #include <sstream>
+ #include <string>
++#include <clocale>
+ using namespace std;
+
+ #include "body.h"
+@@ -20,6 +21,8 @@ using namespace std;
+ static PlanetProperties *defaultProperties;
+ static PlanetProperties *currentProperties;
+
++static inline unsigned char i2b( int x ) { return static_cast<unsigned int>(x) & 0xffU; }
++
+ static void
+ readConfig(const char *line, PlanetProperties *planetProperties[])
+ {
+@@ -49,7 +52,7 @@ readConfig(const char *line, PlanetPrope
+ int r, g, b;
+ if (sscanf(returnString, "%d,%d,%d", &r, &g, &b) == 3)
+ {
+- unsigned char color[3] = { r & 0xff, g & 0xff, b & 0xff };
++ unsigned char color[3] = { i2b(r), i2b(g), i2b(b) };
+ currentProperties->ArcColor(color);
+ }
+ else
+@@ -179,7 +182,7 @@ readConfig(const char *line, PlanetPrope
+ int r, g, b;
+ if (sscanf(returnString, "%d,%d,%d", &r, &g, &b) == 3)
+ {
+- unsigned char color[3] = { r & 0xff, g & 0xff, b & 0xff };
++ unsigned char color[3] = { i2b(r), i2b(g), i2b(b) };
+ currentProperties->Color(color);
+ }
+ else
+@@ -244,7 +247,7 @@ readConfig(const char *line, PlanetPrope
+ int r, g, b;
+ if (sscanf(returnString, "%d,%d,%d", &r, &g, &b) == 3)
+ {
+- unsigned char color[3] = { r & 0xff, g & 0xff, b & 0xff };
++ unsigned char color[3] = { i2b(r), i2b(g), i2b(b) };
+ currentProperties->GridColor(color);
+ }
+ else
+@@ -296,7 +299,7 @@ readConfig(const char *line, PlanetPrope
+ int r, g, b;
+ if (sscanf(returnString, "%d,%d,%d", &r, &g, &b) == 3)
+ {
+- unsigned char color[3] = { r & 0xff, g & 0xff, b & 0xff };
++ unsigned char color[3] = { i2b(r), i2b(g), i2b(b) };
+ currentProperties->MarkerColor(color);
+ }
+ else
+@@ -403,7 +406,7 @@ readConfig(const char *line, PlanetPrope
+ int r, g, b;
+ if (sscanf(returnString, "%d,%d,%d", &r, &g, &b) == 3)
+ {
+- unsigned char color[3] = { r & 0xff, g & 0xff, b & 0xff };
++ unsigned char color[3] = { i2b(r), i2b(g), i2b(b) };
+ currentProperties->OrbitColor(color);
+ }
+ else
+@@ -473,7 +476,7 @@ readConfig(const char *line, PlanetPrope
+ int r, g, b;
+ if (sscanf(returnString, "%d,%d,%d", &r, &g, &b) == 3)
+ {
+- unsigned char color[3] = { r & 0xff, g & 0xff, b & 0xff };
++ unsigned char color[3] = { i2b(r), i2b(g), i2b(b) };
+ currentProperties->TextColor(color);
+ }
+ else