pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/x11/xplanet



Module Name:    pkgsrc
Committed By:   ng0
Date:           Sun Aug 11 15:38:22 UTC 2019

Modified Files:
        pkgsrc/x11/xplanet: Makefile distinfo
Added Files:
        pkgsrc/x11/xplanet/patches: patch-src_readConfig-fixclang.cpp

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 pkgsrc/x11/xplanet/Makefile
cvs rdiff -u -r1.21 -r1.22 pkgsrc/x11/xplanet/distinfo
cvs rdiff -u -r0 -r1.1 \
    pkgsrc/x11/xplanet/patches/patch-src_readConfig-fixclang.cpp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/x11/xplanet/Makefile
diff -u pkgsrc/x11/xplanet/Makefile:1.89 pkgsrc/x11/xplanet/Makefile:1.90
--- pkgsrc/x11/xplanet/Makefile:1.89    Sun Aug 11 13:25:21 2019
+++ pkgsrc/x11/xplanet/Makefile Sun Aug 11 15:38:22 2019
@@ -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/}
 

Index: pkgsrc/x11/xplanet/distinfo
diff -u pkgsrc/x11/xplanet/distinfo:1.21 pkgsrc/x11/xplanet/distinfo:1.22
--- pkgsrc/x11/xplanet/distinfo:1.21    Tue Feb 13 12:45:02 2018
+++ pkgsrc/x11/xplanet/distinfo Sun Aug 11 15:38:22 2019
@@ -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_addSatellite
 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

Added files:

Index: pkgsrc/x11/xplanet/patches/patch-src_readConfig-fixclang.cpp
diff -u /dev/null pkgsrc/x11/xplanet/patches/patch-src_readConfig-fixclang.cpp:1.1
--- /dev/null   Sun Aug 11 15:38:22 2019
+++ pkgsrc/x11/xplanet/patches/patch-src_readConfig-fixclang.cpp        Sun Aug 11 15:38:22 2019
@@ -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



Home | Main Index | Thread Index | Old Index