git: 6e1435185574 - main - converters/wkhtmltopdf: fix build on armv7

From: Robert Clausecker <fuz_at_FreeBSD.org>
Date: Wed, 04 Oct 2023 20:03:04 UTC
The branch main has been updated by fuz:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6e1435185574836bea45bf9dab35b81b64fc158f

commit 6e1435185574836bea45bf9dab35b81b64fc158f
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2023-10-03 23:40:18 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2023-10-04 20:01:38 +0000

    converters/wkhtmltopdf: fix build on armv7
    
    Import an old QT4 patch to fix the build.
    
    Obtained from:  b0d780b0342270fef8bd26b4ae301d18467f5d04
    MFH:            2023Q4
---
 converters/wkhtmltopdf/Makefile                    |  1 -
 ...orm_graphics_filters_arm_FEGaussianBlurNEON.cpp | 11 ++++++++
 ...latform_graphics_filters_arm_FELightingNEON.cpp | 16 ++++++++++++
 .../files/patch-src_gui_kernel_qx11embed__x11.cpp  | 29 ++++++++++++++++++++++
 4 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/converters/wkhtmltopdf/Makefile b/converters/wkhtmltopdf/Makefile
index 95a2d2c62c0f..1fcd2ec5c1fc 100644
--- a/converters/wkhtmltopdf/Makefile
+++ b/converters/wkhtmltopdf/Makefile
@@ -13,7 +13,6 @@ LICENSE_FILE=	${WRKSRC}/LICENSE
 DEPRECATED=	Upstream abandoned the project
 EXPIRATION_DATE=	2024-06-30
 BROKEN_armv6=		fails to build: error: Not supported ARM architecture
-BROKEN_armv7=		fails to build: error: invalid operand for instruction
 BROKEN_mips64=		fails to link: undefined reference to __sync_add_and_fetch_4
 
 RUN_DEPENDS=	webfonts>=0:x11-fonts/webfonts
diff --git a/converters/wkhtmltopdf/files/patch-src_3rdparty_webkit_Source_WebCore_platform_graphics_filters_arm_FEGaussianBlurNEON.cpp b/converters/wkhtmltopdf/files/patch-src_3rdparty_webkit_Source_WebCore_platform_graphics_filters_arm_FEGaussianBlurNEON.cpp
new file mode 100644
index 000000000000..ded07e4bb198
--- /dev/null
+++ b/converters/wkhtmltopdf/files/patch-src_3rdparty_webkit_Source_WebCore_platform_graphics_filters_arm_FEGaussianBlurNEON.cpp
@@ -0,0 +1,11 @@
+--- src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/arm/FEGaussianBlurNEON.cpp.orig	2023-10-03 22:33:30 UTC
++++ src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/arm/FEGaussianBlurNEON.cpp
+@@ -285,7 +285,7 @@ TOSTRING(neonDrawAlphaChannelGaussianBlur) ":" NL
+     "vmov.u32 " REMAINING_STRIDES_R ", " REMAINING_STRIDES_S0 NL
+     // Early return for 0 strides.
+     "cmp " REMAINING_STRIDES_R ", #0" NL
+-    "ldmeqia sp!, {r4-r8, r10, r11, pc}" NL
++    "ldmiaeq sp!, {r4-r8, r10, r11, pc}" NL
+ 
+     // Initialize the sum variable.
+     "vmov.u32 " SUM_Q ", #0" NL
diff --git a/converters/wkhtmltopdf/files/patch-src_3rdparty_webkit_Source_WebCore_platform_graphics_filters_arm_FELightingNEON.cpp b/converters/wkhtmltopdf/files/patch-src_3rdparty_webkit_Source_WebCore_platform_graphics_filters_arm_FELightingNEON.cpp
new file mode 100644
index 000000000000..4397f3ac2e80
--- /dev/null
+++ b/converters/wkhtmltopdf/files/patch-src_3rdparty_webkit_Source_WebCore_platform_graphics_filters_arm_FELightingNEON.cpp
@@ -0,0 +1,16 @@
+--- src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/arm/FELightingNEON.cpp.orig	2023-10-03 22:30:40 UTC
++++ src/3rdparty/webkit/Source/WebCore/platform/graphics/filters/arm/FELightingNEON.cpp
+@@ -398,11 +398,11 @@ TOSTRING(neonDrawLighting) ":" NL
+     "vmin.f32 " TMP2_D0 ", " TMP2_D0 ", " CONST_ONE_HI_D NL
+     "vmul.f32 " TMP3_Q ", " COLOR_Q ", " TMP2_D0 "[1]" NL
+     "vcvt.u32.f32 " TMP3_Q ", " TMP3_Q NL
+-    "vmov.u32 r2, r3, " TMP3_S0 ", " TMP3_S1 NL
++    "vmov r2, r3, " TMP3_S0 ", " TMP3_S1 NL
+     // The color values are stored in-place.
+     "strb r2, [" PIXELS_R ", #-11]" NL
+     "strb r3, [" PIXELS_R ", #-10]" NL
+-    "vmov.u32 r2, " TMP3_S2 NL
++    "vmov r2, " TMP3_S2 NL
+     "strb r2, [" PIXELS_R ", #-9]" NL
+ 
+     // Continue to the next pixel.
diff --git a/converters/wkhtmltopdf/files/patch-src_gui_kernel_qx11embed__x11.cpp b/converters/wkhtmltopdf/files/patch-src_gui_kernel_qx11embed__x11.cpp
new file mode 100644
index 000000000000..7091bedefde3
--- /dev/null
+++ b/converters/wkhtmltopdf/files/patch-src_gui_kernel_qx11embed__x11.cpp
@@ -0,0 +1,29 @@
+--- src/gui/kernel/qx11embed_x11.cpp.orig	2023-10-03 21:02:05 UTC
++++ src/gui/kernel/qx11embed_x11.cpp
+@@ -483,7 +483,7 @@ QX11EmbedWidget::QX11EmbedWidget(QWidget *parent)
+                     | ExposureMask | StructureNotifyMask
+                     | SubstructureNotifyMask | PropertyChangeMask);
+ 
+-    long data[] = {XEMBED_VERSION, XEMBED_MAPPED};
++    long data[] = {static_cast<long>(XEMBED_VERSION), XEMBED_MAPPED};
+     XChangeProperty(x11Info().display(), internalWinId(), ATOM(_XEMBED_INFO),
+                     ATOM(_XEMBED_INFO), 32, PropModeReplace,
+                     (unsigned char*) data, 2);
+@@ -1578,7 +1578,7 @@ void QX11EmbedContainer::showEvent(QShowEvent *)
+ {
+     Q_D(QX11EmbedContainer);
+     if (d->client) {
+-        long data[] = {XEMBED_VERSION, XEMBED_MAPPED};
++        long data[] = {static_cast<long>(XEMBED_VERSION), XEMBED_MAPPED};
+ 	XChangeProperty(x11Info().display(), d->client, ATOM(_XEMBED_INFO), ATOM(_XEMBED_INFO), 32,
+ 			PropModeReplace, (unsigned char *) data, 2);
+     }
+@@ -1594,7 +1594,7 @@ void QX11EmbedContainer::hideEvent(QHideEvent *)
+ {
+     Q_D(QX11EmbedContainer);
+     if (d->client) {
+-        long data[] = {XEMBED_VERSION, XEMBED_MAPPED};
++        long data[] = {static_cast<long>(XEMBED_VERSION), XEMBED_MAPPED};
+ 	XChangeProperty(x11Info().display(), d->client, ATOM(_XEMBED_INFO), ATOM(_XEMBED_INFO), 32,
+ 			PropModeReplace, (unsigned char *) data, 2);
+     }