Skip to content

Commit

Permalink
converters/wkhtmltopdf: Fix build with gcc10
Browse files Browse the repository at this point in the history
The patch is accepted from Debian:
https://salsa.debian.org/qt-kde-team/qt/qt4-x11/commit/0d4a3dd61ccb156dee556c214dbe91c04d44a717

Still keep it DEPRECATED and see how it builds on 13.X series.

PR:		269313
Reported by:	r.quakkelaar@quaras.nl
Approved by:	portmgr (just-fix-it)
  • Loading branch information
5u623l20 committed Nov 20, 2023
1 parent 1a0193c commit 3f47a0b
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 61 deletions.
44 changes: 0 additions & 44 deletions converters/php83-mbstring/files/patch-config.m4

This file was deleted.

5 changes: 1 addition & 4 deletions converters/wkhtmltopdf/Makefile
Expand Up @@ -57,7 +57,7 @@ MAKE_ARGS= INSTALL_ROOT="${STAGEDIR}${PREFIX}"
.include <bsd.port.pre.mk>

.if ${ARCH} == "i386" || ${ARCH} == "powerpc" || ${CHOSEN_COMPILER_TYPE} == gcc
USE_GCC= 8
USE_GCC= 10
.endif

pre-patch:
Expand All @@ -69,8 +69,6 @@ post-patch:
-e 's|/usr/X11R6/include|${LOCALBASE}/include/X11|g' \
-e 's|/usr/X11R6/lib|${LOCALBASE}/lib|g' \
${PATCH_WRKSRC}/mkspecs/freebsd-g++/qmake.conf
${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
${PATCH_WRKSRC}/mkspecs/common/gcc-base.conf
${REINPLACE_CMD} -e "s|gcc|${CC}|g" -e "s|g++|${CXX}|g" \
${PATCH_WRKSRC}/mkspecs/common/g++-base.conf
${REINPLACE_CMD} -e "s|share/man|man|g" \
Expand All @@ -85,7 +83,6 @@ post-patch:
${XARGS} ${REINPLACE_CMD} -E 's|register ([a-zA-Z])|\1|g'
.endif


post-build:
cd ${WRKSRC}/build/app && ${SETENV} ${MAKE_ENV} \
../qt/bin/qmake ../../wkhtmltopdf.pro && \
Expand Down
11 changes: 0 additions & 11 deletions converters/wkhtmltopdf/files/patch-mkspecs_common_gcc-base.conf

This file was deleted.

@@ -1,5 +1,5 @@
--- src/3rdparty/webkit/Source/JavaScriptCore/wtf/Platform.h.orig 2020-11-08 17:05:56.503694000 +0100
+++ src/3rdparty/webkit/Source/JavaScriptCore/wtf/Platform.h 2020-11-08 17:06:42.105176000 +0100
--- src/3rdparty/webkit/Source/JavaScriptCore/wtf/Platform.h.orig 2018-05-29 06:56:52 UTC
+++ src/3rdparty/webkit/Source/JavaScriptCore/wtf/Platform.h
@@ -1003,7 +1003,9 @@
|| CPU(SPARC64) \
|| CPU(S390X) \
Expand Down
40 changes: 40 additions & 0 deletions converters/wkhtmltopdf/files/patch-src_corelib_global_qglobal.h
@@ -0,0 +1,40 @@
--- src/corelib/global/qglobal.h.orig 2023-11-20 11:36:42 UTC
+++ src/corelib/global/qglobal.h
@@ -2482,22 +2482,32 @@ typedef uint Flags;

#endif /* Q_NO_TYPESAFE_FLAGS */

-#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && !defined(Q_CC_RVCT)
+#if (defined(Q_CC_GNU) && !defined(Q_CC_RVCT))
/* make use of typeof-extension */
template <typename T>
class QForeachContainer {
public:
- inline QForeachContainer(const T& t) : c(t), brk(0), i(c.begin()), e(c.end()) { }
+ inline QForeachContainer(const T& t) : c(t), i(c.begin()), e(c.end()), control(1) { }
const T c;
int brk;
typename T::const_iterator i, e;
+ int control;
};

+// Explanation of the control word:
+// - it's initialized to 1
+// - that means both the inner and outer loops start
+// - if there were no breaks, at the end of the inner loop, it's set to 0, which
+// causes it to exit (the inner loop is run exactly once)
+// - at the end of the outer loop, it's inverted, so it becomes 1 again, allowing
+// the outer loop to continue executing
+// - if there was a break inside the inner loop, it will exit with control still
+// set to 1; in that case, the outer loop will invert it to 0 and will exit too
#define Q_FOREACH(variable, container) \
for (QForeachContainer<__typeof__(container)> _container_(container); \
- !_container_.brk && _container_.i != _container_.e; \
- __extension__ ({ ++_container_.brk; ++_container_.i; })) \
- for (variable = *_container_.i;; __extension__ ({--_container_.brk; break;}))
+ _container_.control && _container_.i != _container_.e; \
+ ++_container_.i, _container_.control ^= 1) \
+ for (variable = *_container_.i; _container_.control; _container_.control = 0)

#else

0 comments on commit 3f47a0b

Please sign in to comment.