2015-10-18 1:55 GMT+03:00 Vadim Zhukov <persg...@gmail.com>: > 17 окÑ. 2015 г. 13:07 полÑзоваÑÐµÐ»Ñ "Caspar Schutijser" > <cas...@schutijser.com> напиÑал: >> >> Hi ports@, >> >> I ran into the following issue regarding Qt 5 and C++11. >> >> /usr/local/lib/qt5/mkspecs/openbsd-g++/qmake.conf from the qt-5 port >> contains the following lines: >> 22 QMAKE_CXX = g++ >> ... >> 24 QMAKE_CXXFLAGS_CXX11 = -std=c++11 >> >> So when we try to compile C++11 code, qmake-qt5 tries to pass -std=c++11 >> to g++, which results in the following error: >> c11plus: error: unrecognized command line option "-std=c++11" >> >> Of course, g++ in base does not support C++11. So how are we going >> to compile C++11 code now? >> >> One possibility would be to put QMAKE_CXX = eg++ in qmake.conf, which >> would result in a RUN_DEPENDS on g++ in ports, I think. I verified that >> it works. One disadvantage of this is that people who just use Qt 5 to >> run programs (rather than compiling programs) also will have g++ from >> ports installed. >> >> What do you think? > > I think the reasoning is correct. If you want talk Qt5, you > shouldn't be forced to use ports infrastructure - especially if > you're just developing new code. You use eg++ to link with libestdc++, > because Qt5 uses it - there are no other options anyway, unfortunately. > And I don't know software that requires qmake from Qt5, but not the > Qt itself. > > But we could go in other direction. One of the things I've missed while > working on Qt5 port is COPTS/CXXOPTS support, like it's done for Qt4 already. > So we could leave g++ as is, but tell to use COPTS="std=" (or whatever) if > needed. > > $ qmake-qt5 > $ export COPTS=std=c++98 > $ make # should be fine now > > I'll be happy with any variant, but I think COPTS support should > go in anyway. So I plan to commit the diff below in the Monday, > unless there will be any objections. Please note that this patch > takes a bit different approach if comparing to Qt4: the latter > appends to qmake.conf, so some items from COPTS will get overwritten > anyway. My approach here forces COPTS/CXXOPTS be the last one in > CFLAGS/CXXFLAGS, allowing user to fully control the build if needed.
Oops, I've sent a patch with bits of 5.4.2 update sneaked in. Here is better one. -- WBR, Vadim Zhukov Index: Makefile =================================================================== RCS file: /cvs/ports/x11/qt5/Makefile,v retrieving revision 1.42 diff -u -p -r1.42 Makefile --- Makefile 4 Sep 2015 22:08:25 -0000 1.42 +++ Makefile 17 Oct 2015 22:56:48 -0000 @@ -6,7 +6,7 @@ ONLY_FOR_ARCHS = ${GCC4_ARCHS} VERSION = 5.4.1 ENGINIO_VERSION = 1.1.1 DISTNAME = qt-everywhere-opensource-src-${VERSION} -REVISION-main = 0 +REVISION-main = 1 COMMENT-main = C++ general-purpose toolkit COMMENT-examples = examples for Qt5 Index: patches/patch-qtbase_qmake_generators_unix_unixmake2_cpp =================================================================== RCS file: /cvs/ports/x11/qt5/patches/patch-qtbase_qmake_generators_unix_unixmake2_cpp,v retrieving revision 1.3 diff -u -p -r1.3 patch-qtbase_qmake_generators_unix_unixmake2_cpp --- patches/patch-qtbase_qmake_generators_unix_unixmake2_cpp 4 May 2015 10:37:01 -0000 1.3 +++ patches/patch-qtbase_qmake_generators_unix_unixmake2_cpp 17 Oct 2015 22:56:48 -0000 @@ -1,11 +1,11 @@ $OpenBSD: patch-qtbase_qmake_generators_unix_unixmake2_cpp,v 1.3 2015/05/04 10:37:01 zhuk Exp $ -1. Un-hardcode system paths. +1. Un-hardcode system paths and compiler flags. 2. Make sure some paths are listed before others, needed to make sure egcc won't pick up /usr/include before its own directories. 3. Respect OpenBSD shared library naming rules. ---- qtbase/qmake/generators/unix/unixmake2.cpp.ports.orig Tue Feb 17 07:56:37 2015 -+++ qtbase/qmake/generators/unix/unixmake2.cpp Sun May 3 17:34:28 2015 +--- qtbase/qmake/generators/unix/unixmake2.cpp.ports.orig Fri May 29 23:30:27 2015 ++++ qtbase/qmake/generators/unix/unixmake2.cpp Wed Oct 7 19:33:52 2015 @@ -75,6 +75,10 @@ UnixMakefileGenerator::writeMakefile(QTextStream &t) if (writeDummyMakefile(t)) return true; @@ -17,7 +17,14 @@ $OpenBSD: patch-qtbase_qmake_generators_ if (project->values("TEMPLATE").first() == "app" || project->values("TEMPLATE").first() == "lib" || project->values("TEMPLATE").first() == "aux") { -@@ -187,7 +191,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) +@@ -182,12 +186,12 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) + t << "DEFINES = " + << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ") + << varGlue("DEFINES","-D"," -D","") << endl; +- t << "CFLAGS = " << var("QMAKE_CFLAGS") << " $(DEFINES)\n"; +- t << "CXXFLAGS = " << var("QMAKE_CXXFLAGS") << " $(DEFINES)\n"; ++ t << "CFLAGS = " << var("QMAKE_CFLAGS") << " $(DEFINES) $(COPTS)\n"; ++ t << "CXXFLAGS = " << var("QMAKE_CXXFLAGS") << " $(DEFINES) $(CXXOPTS)\n"; t << "INCPATH ="; { QString isystem = var("QMAKE_CFLAGS_ISYSTEM"); @@ -86,7 +93,7 @@ $OpenBSD: patch-qtbase_qmake_generators_ t << "\n\t" << "-$(DEL_FILE) $(TARGET) $(TARGET0)\n\t" << var("QMAKE_LINK_SHLIB_CMD") << "\n\t"; -@@ -1199,6 +1226,11 @@ void UnixMakefileGenerator::init2() +@@ -1202,6 +1229,11 @@ void UnixMakefileGenerator::init2() project->values("TARGET_x").append("lib" + project->first("TARGET") + "." + project->first("VER_MAJ")); project->values("TARGET") = project->values("TARGET_x"); @@ -98,7 +105,7 @@ $OpenBSD: patch-qtbase_qmake_generators_ } else if (!project->isEmpty("QMAKE_AIX_SHLIB")) { project->values("TARGET_").append(project->first("QMAKE_PREFIX_STATICLIB") + project->first("TARGET") + "." + project->first("QMAKE_EXTENSION_STATICLIB")); -@@ -1391,17 +1423,27 @@ UnixMakefileGenerator::writeLibtoolFile() +@@ -1394,17 +1426,27 @@ UnixMakefileGenerator::writeLibtoolFile() t << "\n"; t << "# The name that we can dlopen(3).\n"