aboutsummaryrefslogtreecommitdiffstats
path: root/astro
diff options
context:
space:
mode:
authoradridg <adridg@FreeBSD.org>2018-01-22 03:50:46 +0800
committeradridg <adridg@FreeBSD.org>2018-01-22 03:50:46 +0800
commit80b51a4e6c93a69b65d93d1f10bcfc4efd53bf26 (patch)
treea1f71daeb7ae3e7ee4018f2ef18387ca5530a0ad /astro
parent8f398ecb8c7f4a5407de58eb6adfc0827169e06b (diff)
downloadfreebsd-ports-gnome-80b51a4e6c93a69b65d93d1f10bcfc4efd53bf26.tar.gz
freebsd-ports-gnome-80b51a4e6c93a69b65d93d1f10bcfc4efd53bf26.tar.zst
freebsd-ports-gnome-80b51a4e6c93a69b65d93d1f10bcfc4efd53bf26.zip
Fix build on aarch64 and with Clang 6. The modified patch explains
the error message and what is changed. Bump PORTREVISION because it contains a code change. kde@ bumped into this while building x11/kde4 for aarch64. Build on 12-CURRENT aarch64, 11-STABLE amd64 and 10.3 i386. Approved by: tcberner (mentor) Differential Revision: https://reviews.freebsd.org/D14008
Diffstat (limited to 'astro')
-rw-r--r--astro/xplanet/Makefile2
-rw-r--r--astro/xplanet/files/patch-src_readConfig.cpp79
2 files changed, 79 insertions, 2 deletions
diff --git a/astro/xplanet/Makefile b/astro/xplanet/Makefile
index ddfb25e39b4b..46d93e2e60c5 100644
--- a/astro/xplanet/Makefile
+++ b/astro/xplanet/Makefile
@@ -3,7 +3,7 @@
PORTNAME= xplanet
PORTVERSION= 1.3.0
-PORTREVISION= 10
+PORTREVISION= 11
CATEGORIES= astro geography
MASTER_SITES= SF
diff --git a/astro/xplanet/files/patch-src_readConfig.cpp b/astro/xplanet/files/patch-src_readConfig.cpp
index ca890c669d49..8426da519f59 100644
--- a/astro/xplanet/files/patch-src_readConfig.cpp
+++ b/astro/xplanet/files/patch-src_readConfig.cpp
@@ -1,4 +1,18 @@
---- src/readConfig.cpp.orig 2012-03-03 03:20:05 UTC
+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>
@@ -8,3 +22,66 @@
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