Skip to content

Commit 55f3b17

Browse files
author
宋文武
committed
gnu: grantlee: Fix build on i686-linux.
This fixes a test (formatfiltertest07) failure on i686-linux. See also <steveire/grantlee#85>. * gnu/packages/patches/grantlee-fix-i586-precision.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. * gnu/packages/qt.scm (grantlee)[source]: Add patch.
1 parent 1a02365 commit 55f3b17

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

Diff for: gnu/local.mk

+1
Original file line numberDiff line numberDiff line change
@@ -1316,6 +1316,7 @@ dist_patch_DATA = \
13161316
%D%/packages/patches/gpm-glibc-2.26.patch \
13171317
%D%/packages/patches/gpodder-disable-updater.patch \
13181318
%D%/packages/patches/gpsbabel-fix-i686-test.patch \
1319+
%D%/packages/patches/grantlee-fix-i586-precision.patch \
13191320
%D%/packages/patches/grep-timing-sensitive-test.patch \
13201321
%D%/packages/patches/grfcodec-gcc-compat.patch \
13211322
%D%/packages/patches/gromacs-tinyxml2.patch \
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
From 13094b78a790786030a468453c2b3ead4c7fd9cf Mon Sep 17 00:00:00 2001
2+
From: Fabian Vogt <[email protected]>
3+
Date: Sun, 13 Nov 2022 14:01:21 +0100
4+
Subject: [PATCH] Fix formatting of some larger file sizes on 32bit x86
5+
6+
With the x87 FPU available, GCC uses long double precision for some variables.
7+
Due to the function call passing a double, some comparisons break down.
8+
That resulted in "1.00 YB" being printed as "1000.00 ZB" instead.
9+
10+
Fixes #85
11+
---
12+
templates/lib/util.cpp | 7 +++++++
13+
1 file changed, 7 insertions(+)
14+
15+
diff --git a/templates/lib/util.cpp b/templates/lib/util.cpp
16+
index 504674a7..a0381c59 100644
17+
--- a/templates/lib/util.cpp
18+
+++ b/templates/lib/util.cpp
19+
@@ -23,6 +23,7 @@
20+
#include "metaenumvariable_p.h"
21+
#include "metatype.h"
22+
23+
+#include <cfloat>
24+
#include <QtCore/QStringList>
25+
26+
QString Grantlee::unescapeStringLiteral(const QString &input)
27+
@@ -212,7 +213,13 @@ std::pair<qreal, QString> Grantlee::calcFileSize(qreal size, int unitSystem,
28+
bool found = false;
29+
int count = 0;
30+
const qreal baseVal = (_unitSystem == 10) ? 1000.0F : 1024.0F;
31+
+#if FLT_EVAL_METHOD == 2
32+
+ // Avoid that this is treated as long double, as the increased
33+
+ // precision breaks the comparison below.
34+
+ volatile qreal current = 1.0F;
35+
+#else
36+
qreal current = 1.0F;
37+
+#endif
38+
int units = decimalUnits.size();
39+
while (!found && (count < units)) {
40+
current *= baseVal;

Diff for: gnu/packages/qt.scm

+2-1
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,8 @@ applications on Wayland.")
320320
(commit (string-append "v" version))))
321321
(file-name (git-file-name name version))
322322
(sha256
323-
(base32 "1ipnkdi8wgv519mvwa5zxlz20wipbypyfixjv2qdfd9vl1pznwvs"))))
323+
(base32 "1ipnkdi8wgv519mvwa5zxlz20wipbypyfixjv2qdfd9vl1pznwvs"))
324+
(patches (search-patches "grantlee-fix-i586-precision.patch"))))
324325
(native-inputs
325326
;; Optional: lcov and cccc, both are for code coverage
326327
(list doxygen))

0 commit comments

Comments
 (0)