summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2023-01-05 23:49:11 -0600
committerZach van Rijn <me@zv.io>2023-01-06 05:59:09 +0000
commitfc4df5a4b79d327309147c6201fcb9eab1d8623a (patch)
treebceb49ee4a1d025094369aad5bc9f0875764a356
parentaa91db8a4fba145b02ee44dc16664c615a3def77 (diff)
downloadpackages-fc4df5a4b79d327309147c6201fcb9eab1d8623a.tar.gz
packages-fc4df5a4b79d327309147c6201fcb9eab1d8623a.tar.bz2
packages-fc4df5a4b79d327309147c6201fcb9eab1d8623a.tar.xz
packages-fc4df5a4b79d327309147c6201fcb9eab1d8623a.zip
user/grantlee: Use x87 math properly
Reported upstream by SuSE maintainer, though the way this works does sort of bother me since this sort of code really shouldn't depend on precision if written properly.. Fixes: #954
-rw-r--r--user/grantlee/APKBUILD7
-rw-r--r--user/grantlee/x87fpu.patch42
2 files changed, 47 insertions, 2 deletions
diff --git a/user/grantlee/APKBUILD b/user/grantlee/APKBUILD
index f1dca5388..df8bad208 100644
--- a/user/grantlee/APKBUILD
+++ b/user/grantlee/APKBUILD
@@ -12,7 +12,9 @@ depends_dev="qt5-qtbase-dev"
makedepends="cmake $depends_dev qt5-qtscript-dev doxygen graphviz
qt5-qtdeclarative-dev"
subpackages="$pkgname-dev $pkgname-doc"
-source="https://github.com/steveire/$pkgname/releases/download/v$pkgver/$pkgname-$pkgver.tar.gz"
+source="https://github.com/steveire/$pkgname/releases/download/v$pkgver/$pkgname-$pkgver.tar.gz
+ x87fpu.patch
+ "
build() {
if [ "$CBUILD" != "$CHOST" ]; then
@@ -39,4 +41,5 @@ package() {
mv "$builddir"/apidox "$pkgdir"/usr/share/doc/grantlee/
}
-sha512sums="dc7192fe0553954fffc3e2c584e4fdd80fc1f22d25846cacc5f2dcd1db2673ca62464c8492a4ed3bfc9dfc3e62ef13322809dd29bd56fa4a3a153a8d373ddde5 grantlee-5.3.1.tar.gz"
+sha512sums="dc7192fe0553954fffc3e2c584e4fdd80fc1f22d25846cacc5f2dcd1db2673ca62464c8492a4ed3bfc9dfc3e62ef13322809dd29bd56fa4a3a153a8d373ddde5 grantlee-5.3.1.tar.gz
+b515403727416ef91037e5774a78e4b477e4e99da0c58e53f3099a6f8558c25244416acabd2bde529aafa509c4a61c54761d39fdaceb756bc4b638ccc3285607 x87fpu.patch"
diff --git a/user/grantlee/x87fpu.patch b/user/grantlee/x87fpu.patch
new file mode 100644
index 000000000..f439bf1f1
--- /dev/null
+++ b/user/grantlee/x87fpu.patch
@@ -0,0 +1,42 @@
+Upstream-URL: https://github.com/steveire/grantlee/pull/86
+
+From 7e34ffaff40fc085a15bb0ffabb5f247795581fd Mon Sep 17 00:00:00 2001
+From: Fabian Vogt <fabian@ritter-vogt.de>
+Date: Sun, 13 Nov 2022 14:01:21 +0100
+Subject: [PATCH] Fix formatting of some larger file sizes on 32bit x86
+
+With the x87 FPU available, GCC uses long double precision for some variables.
+Due to the function call passing a double, some comparisons break down.
+That resulted in "1.00 YB" being printed as "1000.00 ZB" instead.
+
+Fixes #85
+---
+ templates/lib/util.cpp | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/templates/lib/util.cpp b/templates/lib/util.cpp
+index 504674a7..5924cdf5 100644
+--- a/templates/lib/util.cpp
++++ b/templates/lib/util.cpp
+@@ -23,6 +23,7 @@
+ #include "metaenumvariable_p.h"
+ #include "metatype.h"
+
++#include <cfloat>
+ #include <QtCore/QStringList>
+
+ QString Grantlee::unescapeStringLiteral(const QString &input)
+@@ -212,7 +213,13 @@ std::pair<qreal, QString> Grantlee::calcFileSize(qreal size, int unitSystem,
+ bool found = false;
+ int count = 0;
+ const qreal baseVal = (_unitSystem == 10) ? 1000.0F : 1024.0F;
++#if FLT_EVAL_METHOD == 2
++ // Avoid that this is treated as long double, as the increased
++ // precision breaks the comparison below.
++ volatile qreal current = 1.0F;
++#else
+ qreal current = 1.0F;
++#endif
+ int units = decimalUnits.size();
+ while (!found && (count < units)) {
+ current *= baseVal;