package: qtwebkit: support riscv

Signed-off-by: Andy Hu <andy.hu@starfivetech.com>
This commit is contained in:
Andy Hu
2023-07-24 11:20:59 +08:00
parent 2c1e4a5861
commit 69a5fdf298
3 changed files with 243 additions and 0 deletions
@@ -0,0 +1,122 @@
From 9770a62d43bce6381fe9d047146eb271be3c5ce1 Mon Sep 17 00:00:00 2001
From: Andy Hu <andy.hu@starfivetech.com>
Date: Wed, 12 Jul 2023 12:31:50 +0800
Subject: [PATCH 2/2] fix the compile gobject issue
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
/space/code/visionfive_qtwebkit/work/buildroot_initramfs/host/riscv64-buildroot-linux-gnu/sysroot/usr/include/glib-2.0/glib/gmacros.h:247:24: error: expected unqualified-id before typename
247 | #define glib_typeof(t) typename std::remove_reference<decltype (t)>::type
| ^~~~~~~~
/space/code/visionfive_qtwebkit/work/buildroot_initramfs/host/riscv64-buildroot-linux-gnu/sysroot/usr/include/glib-2.0/gobject/gobject.h:524:34: note: in expansion of macro glib_typeof
524 | #define g_object_ref_sink(Obj) ((glib_typeof (Obj)) (g_object_ref_sink) (Obj))
| ^~~~~~~~~~~
../WTF/wtf/gobject/GRefPtr.h:32:21: note: in expansion of macro g_object_ref_sink
32 | extern C gpointer g_object_ref_sink(gpointer);
---
Source/WTF/wtf/dtoa/strtod.cc | 13 ++++++++++---
Source/WTF/wtf/gobject/GRefPtr.h | 6 ++++--
include/QtWebKit/QtWebKit | 1 +
3 files changed, 15 insertions(+), 5 deletions(-)
mode change 100644 => 100755 Source/WTF/wtf/dtoa/strtod.cc
diff --git a/Source/WTF/wtf/dtoa/strtod.cc b/Source/WTF/wtf/dtoa/strtod.cc
old mode 100644
new mode 100755
index 5f63b22a..5270c3e5
--- a/Source/WTF/wtf/dtoa/strtod.cc
+++ b/Source/WTF/wtf/dtoa/strtod.cc
@@ -38,11 +38,13 @@
namespace WTF {
namespace double_conversion {
-
+
+#if defined(DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS)
// 2^53 = 9007199254740992.
// Any integer with at most 15 decimal digits will hence fit into a double
// (which has a 53bit significand) without loss of precision.
static const int kMaxExactDoubleIntegerDecimalDigits = 15;
+#endif
// 2^64 = 18446744073709551616 > 10^19
static const int kMaxUint64DecimalDigits = 19;
@@ -58,7 +60,7 @@ namespace double_conversion {
// 2^64 = 18446744073709551616
static const uint64_t kMaxUint64 = UINT64_2PART_C(0xFFFFFFFF, FFFFFFFF);
-
+#if defined(DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS)
static const double exact_powers_of_ten[] = {
1.0, // 10^0
10.0,
@@ -86,6 +88,7 @@ namespace double_conversion {
10000000000000000000000.0
};
static const int kExactPowersOfTenSize = ARRAY_SIZE(exact_powers_of_ten);
+#endif
// Maximum number of significant digits in the decimal representation.
// In fact the value is 772 (see conversions.cc), but to give us some margin
@@ -177,6 +180,9 @@ namespace double_conversion {
int exponent,
double* result) {
#if !defined(DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS)
+ UNUSED_PARAM(trimmed);
+ UNUSED_PARAM(exponent);
+ UNUSED_PARAM(result);
// On x86 the floating-point stack can be 64 or 80 bits wide. If it is
// 80 bits wide (as is the case on Linux) then double-rounding occurs and the
// result is not accurate.
@@ -184,7 +190,7 @@ namespace double_conversion {
// Note that the ARM simulator is compiled for 32bits. It therefore exhibits
// the same problem.
return false;
-#endif
+#else
if (trimmed.length() <= kMaxExactDoubleIntegerDecimalDigits) {
int read_digits;
// The trimmed input fits into a double.
@@ -222,6 +228,7 @@ namespace double_conversion {
}
}
return false;
+#endif
}
diff --git a/Source/WTF/wtf/gobject/GRefPtr.h b/Source/WTF/wtf/gobject/GRefPtr.h
index 6c50f4da..2715df86 100644
--- a/Source/WTF/wtf/gobject/GRefPtr.h
+++ b/Source/WTF/wtf/gobject/GRefPtr.h
@@ -25,11 +25,13 @@
#if USE(GLIB)
+#include <glib-object.h>
+
#include <wtf/RefPtr.h>
#include <algorithm>
-extern "C" void g_object_unref(gpointer);
-extern "C" gpointer g_object_ref_sink(gpointer);
+//extern "C" void g_object_unref(gpointer);
+//extern "C" gpointer g_object_ref_sink(gpointer);
namespace WTF {
diff --git a/include/QtWebKit/QtWebKit b/include/QtWebKit/QtWebKit
index 9bc17d32..8b162a5f 100644
--- a/include/QtWebKit/QtWebKit
+++ b/include/QtWebKit/QtWebKit
@@ -10,5 +10,6 @@
#include "qwebpluginfactory.h"
#include "qwebsecurityorigin.h"
#include "qwebsettings.h"
+#include "util.h"
#include "qtwebkitversion.h"
#endif
--
2.41.0