Hi ports,
It's already well-known - x11/qt4 won't build with gcc-8's C++14 default standard. The diff i'm proposing here mostly comes from Debian [1] [2], and simply consists to make gcc-8 pose as gcc-4. While here, i've moved HOMEPAGE to https and made portcheck(1) happy by removing trailing whitespaces. Testing: - macppc: It worked well [3] with gcc-8 and gcc-4.9. As i did it 3 months ago, i've tested again the whole thing with gcc-8, and it has built x11/kde4/marble without issues. - amd64: It builds fine as well. Comments/feedback are welcome! Charlène. [1] https://sources.debian.org/patches/qt4-x11/4:4.8.7+dfsg-17/qt-everywhere-opensource-src-4.8.7-gcc6.patch/ [2] https://sources.debian.org/patches/qt4-x11/4:4.8.7+dfsg-17/fix-build-icu59.patch/ [3] https://bsd.network/@julianaito/101462113728207696 Index: Makefile =================================================================== RCS file: /cvs/ports/x11/qt4/Makefile,v retrieving revision 1.156 diff -u -p -r1.156 Makefile --- Makefile 26 Nov 2018 16:41:20 -0000 1.156 +++ Makefile 7 Apr 2019 20:59:51 -0000 @@ -25,14 +25,14 @@ PKGNAME-main = qt4-${PKGVERSION} PKGNAME-debug = qt4-debug-${PKGVERSION} FULLPKGNAME-html = qt4-html-${PKGVERSION} FULLPKGPATH-html = ${BASE_PKGPATH},-html -REVISION-main = 18 -REVISION-mysql = 5 -REVISION-postgresql = 5 -REVISION-sqlite2 = 5 -REVISION-tds = 5 -REVISION-debug = 2 -REVISION-examples = 6 -REVISION-html = 2 +REVISION-main = 19 +REVISION-mysql = 6 +REVISION-postgresql = 6 +REVISION-sqlite2 = 6 +REVISION-tds = 6 +REVISION-debug = 3 +REVISION-examples = 7 +REVISION-html = 3 # XXX qmake include parser is bogus DPB_PROPERTIES = parallel nojunk @@ -67,7 +67,7 @@ DISTNAME = qt-everywhere-opensource-src- CATEGORIES = x11 MASTER_SITES = https://download.qt.io/archive/qt/4.8/${VERSION}/ -HOMEPAGE = http://www.qt.io/ +HOMEPAGE = https://www.qt.io/ MAINTAINER = Marc Espie <[email protected]> @@ -248,6 +248,8 @@ DESTDIRNAME = INSTALL_ROOT CONFIGURE_ARGS += -platform openbsd-clang .else CONFIGURE_ARGS += -platform openbsd-g++4 +# Using gcc 4.9 default standard with gcc>=6. +CXXFLAGS += -std=gnu++98 .endif pre-patch: Index: patches/patch-configure =================================================================== RCS file: /cvs/ports/x11/qt4/patches/patch-configure,v retrieving revision 1.27 diff -u -p -r1.27 patch-configure --- patches/patch-configure 3 Jun 2015 07:28:01 -0000 1.27 +++ patches/patch-configure 7 Apr 2019 20:59:51 -0000 @@ -1,6 +1,7 @@ $OpenBSD: patch-configure,v 1.27 2015/06/03 07:28:01 dcoppa Exp $ ---- configure.orig Thu May 7 16:14:56 2015 -+++ configure Sun May 31 13:28:28 2015 +Index: configure +--- configure.orig ++++ configure @@ -918,7 +918,7 @@ CFG_SILENT=no CFG_GRAPHICS_SYSTEM=default CFG_RUNTIME_SYSTEM= @@ -37,3 +38,21 @@ $OpenBSD: patch-configure,v 1.27 2015/06 [ '!' -z "$QCONFIG_H" ] && mv -f "$QCONFIG_H" "$QMAKE_QCONFIG_H" #move qmake's qconfig.h to qconfig.h.qmake [ '!' -z "$OLD_QCONFIG_H" ] && mv -f "${OLD_QCONFIG_H}.old" "$OLD_QCONFIG_H" #put back qconfig.h [ "$QMAKE_BUILD_ERROR" = "yes" ] && exit 2 +@@ -7734,7 +7734,7 @@ case "$XPLATFORM" in + *-g++*) + # Check gcc's version + case "$(${QMAKE_CONF_COMPILER} -dumpversion)" in +- 5*|4*|3.4*) ++ 8*|6*|5*|4*|3.4*) + ;; + 3.3*) + canBuildWebKit="no" +@@ -8050,7 +8050,7 @@ g++*) + 3.*) + COMPILER_VERSION="3.*" + ;; +- 5*|4.*) ++ 8*|6*|5*|4.*) + COMPILER_VERSION="4" + ;; + *) Index: patches/patch-src_corelib_tools_tools_pri =================================================================== RCS file: patches/patch-src_corelib_tools_tools_pri diff -N patches/patch-src_corelib_tools_tools_pri --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_corelib_tools_tools_pri 7 Apr 2019 20:59:51 -0000 @@ -0,0 +1,23 @@ +$OpenBSD$ +ICU >= 59 requires C++11 for its header files. +Qt can't be compiled with -std=c++11 as a whole, so only enable +it for qlocale_icu.cpp. +Index: src/corelib/tools/tools.pri +--- src/corelib/tools/tools.pri.orig ++++ src/corelib/tools/tools.pri +@@ -102,7 +102,14 @@ contains(QT_CONFIG, zlib):include($$PWD/../../3rdparty + else:include($$PWD/../../3rdparty/zlib_dependency.pri) + + contains(QT_CONFIG,icu) { +- SOURCES += tools/qlocale_icu.cpp ++ cpp11.name = cpp11 ++ cpp11.input = SOURCES_CPP11 ++ cpp11.dependency_type = TYPE_C ++ cpp11.variable_out = OBJECTS ++ cpp11.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_IN_BASE}$${first(QMAKE_EXT_OBJ)} ++ cpp11.commands = $${QMAKE_CXX} $(CXXFLAGS) -std=c++11 $(INCPATH) -c ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} ++ QMAKE_EXTRA_COMPILERS += cpp11 ++ SOURCES_CPP11 += tools/qlocale_icu.cpp + DEFINES += QT_USE_ICU + } + Index: patches/patch-src_xmlpatterns_api_qcoloroutput_p_h =================================================================== RCS file: patches/patch-src_xmlpatterns_api_qcoloroutput_p_h diff -N patches/patch-src_xmlpatterns_api_qcoloroutput_p_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_xmlpatterns_api_qcoloroutput_p_h 7 Apr 2019 20:59:51 -0000 @@ -0,0 +1,16 @@ +$OpenBSD$ +Fix a shift overflow with ports-gcc>=6 +Index: src/xmlpatterns/api/qcoloroutput_p.h +--- src/xmlpatterns/api/qcoloroutput_p.h.orig ++++ src/xmlpatterns/api/qcoloroutput_p.h +@@ -70,8 +70,8 @@ namespace QPatternist + ForegroundShift = 10, + BackgroundShift = 20, + SpecialShift = 20, +- ForegroundMask = ((1 << ForegroundShift) - 1) << ForegroundShift, +- BackgroundMask = ((1 << BackgroundShift) - 1) << BackgroundShift ++ ForegroundMask = 0x1f << ForegroundShift, ++ BackgroundMask = 0x7 << BackgroundShift + }; + + public: Index: pkg/DESCR-main =================================================================== RCS file: /cvs/ports/x11/qt4/pkg/DESCR-main,v retrieving revision 1.3 diff -u -p -r1.3 DESCR-main --- pkg/DESCR-main 6 Nov 2011 12:44:04 -0000 1.3 +++ pkg/DESCR-main 7 Apr 2019 20:59:51 -0000 @@ -1,4 +1,4 @@ -Qt is a toolkit for building a GUI for X in C++. +Qt is a toolkit for building a GUI for X in C++. There are some user documentation files in ${QT_DOC}, but the main documentation is in the qt4-html package. @@ -15,13 +15,13 @@ should note that qt4's installation conf TrollTech's recommendations. Accordingly: - libs are separated from includes. -- moc is installed as ${PREFIX}/bin/moc4, in order not to conflict +- moc is installed as ${PREFIX}/bin/moc4, in order not to conflict with other qt versions. - uic is installed as ${PREFIX}/bin/uic4 -Generally, it's just a question of invoking +Generally, it's just a question of invoking -env MOC=moc4 UIC=uic4 configure --with-qt-includes=${PREFIX}/include/X11/qt4 +env MOC=moc4 UIC=uic4 configure --with-qt-includes=${PREFIX}/include/X11/qt4 --with-qt-libraries=${PREFIX}/lib/qt4 Or to force MOC/UIC in your make/gmake invocation: @@ -30,5 +30,5 @@ will override the Makefile contents. Warning: the qt4 library also appears under ${PREFIX}/lib, but you *must* make sure your application sees ${PREFIX}/lib/qt4 *first*, because -${PREFIX}/lib may also contain a later incarnation of Qt, in which case +${PREFIX}/lib may also contain a later incarnation of Qt, in which case the linker will pick up the most recent library.
