www/qt5-webengine: fix build on armv7

The build system adds the bogus option --target=arm-linux-gnueabihf to
the build when building on arm, causing all sorts of issues.  Patch that
out, then add some polyfill for API differences between ARM Linux and
ARM FreeBSD.

Approved by:	portmgr (build fix blanket)
MFH:		2025Q2
This commit is contained in:
Robert Clausecker 2025-04-26 23:14:26 +02:00
parent ae40dbd47c
commit 85ef7e6db8
5 changed files with 74 additions and 13 deletions

View file

@ -19,7 +19,7 @@
PORTNAME= webengine PORTNAME= webengine
PORTVERSION= ${QT5_VERSION}${QT5_KDE_PATCH} PORTVERSION= ${QT5_VERSION}${QT5_KDE_PATCH}
PORTREVISION= 1 PORTREVISION= 2
CATEGORIES= www CATEGORIES= www
PKGNAMEPREFIX= qt5- PKGNAMEPREFIX= qt5-

View file

@ -1,4 +1,4 @@
--- src/3rdparty/chromium/base/profiler/register_context.h.orig 2021-12-15 16:12:54 UTC --- src/3rdparty/chromium/base/profiler/register_context.h.orig 2025-03-06 09:26:10 UTC
+++ src/3rdparty/chromium/base/profiler/register_context.h +++ src/3rdparty/chromium/base/profiler/register_context.h
@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
#include <windows.h> #include <windows.h>
@ -9,7 +9,7 @@
#include <sys/ucontext.h> #include <sys/ucontext.h>
#endif #endif
@@ -190,6 +190,48 @@ inline uintptr_t& RegisterContextInstructionPointer(mc @@ -190,6 +190,61 @@ inline uintptr_t& RegisterContextInstructionPointer(mc
} }
#endif // #if defined(ARCH_CPU_ARM_FAMILY) && defined(ARCH_CPU_32_BITS) #endif // #if defined(ARCH_CPU_ARM_FAMILY) && defined(ARCH_CPU_32_BITS)
@ -54,6 +54,19 @@
+inline uintptr_t& RegisterContextInstructionPointer(mcontext_t* context) { +inline uintptr_t& RegisterContextInstructionPointer(mcontext_t* context) {
+ return AsUintPtr(&context->mc_gpregs.gp_elr); + return AsUintPtr(&context->mc_gpregs.gp_elr);
+} +}
+
+#elif defined(ARCH_CPU_ARM_FAMILY) && defined(ARCH_CPU_32_BITS)
+inline uintptr_t& RegisterContextStackPointer(mcontext_t* context) {
+ return AsUintPtr(&context->__gregs[_REG_SP]);
+}
+
+inline uintptr_t& RegisterContextFramePointer(mcontext_t* context) {
+ return AsUintPtr(&context->__gregs[_REG_FP]);
+}
+
+inline uintptr_t& RegisterContextInstructionPointer(mcontext_t* context) {
+ return AsUintPtr(&context->__gregs[_REG_PC]);
+}
+#endif +#endif
#else // #if defined(OS_WIN) #else // #if defined(OS_WIN)

View file

@ -1,4 +1,4 @@
--- src/3rdparty/chromium/build/config/compiler/BUILD.gn.orig 2023-11-09 11:32:20 UTC --- src/3rdparty/chromium/build/config/compiler/BUILD.gn.orig 2025-03-06 09:26:10 UTC
+++ src/3rdparty/chromium/build/config/compiler/BUILD.gn +++ src/3rdparty/chromium/build/config/compiler/BUILD.gn
@@ -134,7 +134,7 @@ declare_args() { @@ -134,7 +134,7 @@ declare_args() {
# #
@ -53,7 +53,18 @@
} }
} }
@@ -796,7 +797,7 @@ config("compiler_cpu_abi") { @@ -782,10 +783,6 @@ config("compiler_cpu_abi") {
]
}
} else if (current_cpu == "arm") {
- if (is_clang && !is_android && !is_nacl) {
- cflags += [ "--target=arm-linux-gnueabihf" ]
- ldflags += [ "--target=arm-linux-gnueabihf" ]
- }
if (!is_nacl) {
cflags += [
"-march=$arm_arch",
@@ -796,7 +793,7 @@ config("compiler_cpu_abi") {
cflags += [ "-mtune=$arm_tune" ] cflags += [ "-mtune=$arm_tune" ]
} }
} else if (current_cpu == "arm64") { } else if (current_cpu == "arm64") {
@ -62,7 +73,7 @@
cflags += [ "--target=aarch64-linux-gnu" ] cflags += [ "--target=aarch64-linux-gnu" ]
ldflags += [ "--target=aarch64-linux-gnu" ] ldflags += [ "--target=aarch64-linux-gnu" ]
} }
@@ -1149,7 +1150,7 @@ config("compiler_deterministic") { @@ -1149,7 +1146,7 @@ config("compiler_deterministic") {
"-Xclang", "-Xclang",
".", ".",
] ]
@ -71,7 +82,7 @@
# We don't use clang -cc1as on Windows (yet? https://crbug.com/762167) # We don't use clang -cc1as on Windows (yet? https://crbug.com/762167)
asmflags = [ "-Wa,-fdebug-compilation-dir,." ] asmflags = [ "-Wa,-fdebug-compilation-dir,." ]
} }
@@ -1535,6 +1536,10 @@ config("default_warnings") { @@ -1535,6 +1532,10 @@ config("default_warnings") {
# which we no longer use. Check if it makes sense to remove # which we no longer use. Check if it makes sense to remove
# this as well. http://crbug.com/316352 # this as well. http://crbug.com/316352
"-Wno-unneeded-internal-declaration", "-Wno-unneeded-internal-declaration",
@ -82,7 +93,7 @@
] ]
# use_xcode_clang only refers to the iOS toolchain, host binaries use # use_xcode_clang only refers to the iOS toolchain, host binaries use
@@ -1551,7 +1556,7 @@ config("default_warnings") { @@ -1551,7 +1552,7 @@ config("default_warnings") {
cflags += [ "-Wno-nonportable-include-path" ] cflags += [ "-Wno-nonportable-include-path" ]
} }
@ -91,7 +102,7 @@
# Flags NaCl (Clang 3.7) and Xcode 9.2 (Clang clang-900.0.39.2) do not # Flags NaCl (Clang 3.7) and Xcode 9.2 (Clang clang-900.0.39.2) do not
# recognize. # recognize.
cflags += [ cflags += [
@@ -1725,7 +1730,7 @@ config("no_chromium_code") { @@ -1725,7 +1726,7 @@ config("no_chromium_code") {
# suppressing them individually, we just blanket suppress them here. # suppressing them individually, we just blanket suppress them here.
"-Wno-unused-variable", "-Wno-unused-variable",
] ]
@ -100,7 +111,7 @@
cflags += [ cflags += [
# TODO(https://crbug.com/1031169): Clean up and enable. # TODO(https://crbug.com/1031169): Clean up and enable.
"-Wno-misleading-indentation", "-Wno-misleading-indentation",
@@ -1803,7 +1808,7 @@ config("thin_archive") { @@ -1803,7 +1804,7 @@ config("thin_archive") {
# Mac and iOS use the mac-specific "libtool" command, not ar, which doesn't # Mac and iOS use the mac-specific "libtool" command, not ar, which doesn't
# have a "thin archive" mode (it does accept -T, but it means truncating # have a "thin archive" mode (it does accept -T, but it means truncating
# archive names to 16 characters, which is not what we want). # archive names to 16 characters, which is not what we want).
@ -109,7 +120,7 @@
arflags = [ "-T" ] arflags = [ "-T" ]
} else if (is_win && use_lld) { } else if (is_win && use_lld) {
arflags = [ "/llvmlibthin" ] arflags = [ "/llvmlibthin" ]
@@ -2344,7 +2349,7 @@ config("symbols") { @@ -2344,7 +2345,7 @@ config("symbols") {
# flag, so we can use use -g1 for pnacl and nacl-clang compiles. # flag, so we can use use -g1 for pnacl and nacl-clang compiles.
# gcc nacl is is_nacl && !is_clang, pnacl and nacl-clang are && is_clang. # gcc nacl is is_nacl && !is_clang, pnacl and nacl-clang are && is_clang.
if (!is_nacl || is_clang) { if (!is_nacl || is_clang) {
@ -118,7 +129,7 @@
} }
# TODO(https://crbug.com/1050118): Investigate missing debug info on mac. # TODO(https://crbug.com/1050118): Investigate missing debug info on mac.
@@ -2386,7 +2391,7 @@ config("symbols") { @@ -2386,7 +2387,7 @@ config("symbols") {
# DWARF info may be corrupt; offsets in a range list entry are in different # DWARF info may be corrupt; offsets in a range list entry are in different
# sections" there. Maybe just a bug in nacl_switch_32.S. # sections" there. Maybe just a bug in nacl_switch_32.S.
if (!is_apple && !is_nacl && current_cpu != "x86" && if (!is_apple && !is_nacl && current_cpu != "x86" &&

View file

@ -0,0 +1,14 @@
--- src/3rdparty/chromium/third_party/dav1d/libdav1d/src/arm/cpu.c.orig 2025-04-26 20:32:56 UTC
+++ src/3rdparty/chromium/third_party/dav1d/libdav1d/src/arm/cpu.c
@@ -84,10 +84,7 @@ COLD unsigned dav1d_get_cpu_flags_arm(void) {
unsigned flags = 0;
#if defined(__ARM_NEON) || defined(__APPLE__) || defined(_WIN32) || ARCH_AARCH64
flags |= DAV1D_ARM_CPU_FLAG_NEON;
-#elif defined(HAVE_GETAUXVAL) && ARCH_ARM
- unsigned long hw_cap = getauxval(AT_HWCAP);
- flags |= (hw_cap & NEON_HWCAP) ? DAV1D_ARM_CPU_FLAG_NEON : 0;
-#elif defined(HAVE_ELF_AUX_INFO) && ARCH_ARM
+#elif defined(__FreeBSD__) && ARCH_ARM
unsigned long hw_cap = 0;
elf_aux_info(AT_HWCAP, &hw_cap, sizeof(hw_cap));
flags |= (hw_cap & NEON_HWCAP) ? DAV1D_ARM_CPU_FLAG_NEON : 0;

View file

@ -1,4 +1,4 @@
--- src/3rdparty/chromium/third_party/skia/src/core/SkCpu.cpp.orig 2021-12-15 16:12:54 UTC --- src/3rdparty/chromium/third_party/skia/src/core/SkCpu.cpp.orig 2025-03-06 09:26:10 UTC
+++ src/3rdparty/chromium/third_party/skia/src/core/SkCpu.cpp +++ src/3rdparty/chromium/third_party/skia/src/core/SkCpu.cpp
@@ -72,6 +72,23 @@ @@ -72,6 +72,23 @@
return features; return features;
@ -24,3 +24,26 @@
#elif defined(SK_CPU_ARM64) && __has_include(<sys/auxv.h>) #elif defined(SK_CPU_ARM64) && __has_include(<sys/auxv.h>)
#include <sys/auxv.h> #include <sys/auxv.h>
@@ -110,6 +127,22 @@
|| 0 == memcmp(kMongoose3, buf, SK_ARRAY_COUNT(buf))) {
features &= ~(SkCpu::ASIMDHP);
}
+ }
+ return features;
+ }
+
+#elif defined(SK_CPU_ARM32) && defined(__FreeBSD__)
+ #include <sys/auxv.h>
+
+ static uint32_t read_cpu_features() {
+ uint32_t features = 0;
+ unsigned long hwcaps = 0;
+
+ elf_aux_info(AT_HWCAP, &hwcaps, sizeof hwcaps);
+
+ if (hwcaps & HWCAP_NEON ) {
+ features |= SkCpu::NEON;
+ if (hwcaps & HWCAP_VFPv4) { features |= SkCpu::NEON_FMA|SkCpu::VFP_FP16; }
}
return features;
}