From b42b0c7fae8860fc46b9a9f4d937f4d8066f2daf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20R=C4=99korajski?= Date: Sat, 14 Sep 2019 23:30:59 +0200 Subject: [PATCH] - fix building with gcc9 and -std=c++11 to stop polluting everything with gnu++98 - rel 23 --- cxx11.patch | 123 ++++++++++++++++++++++++++++++++++++++++++++ gcc9-qforeach.patch | 64 +++++++++++++++++++++++ gcc9.patch | 11 ++++ mysql-link.patch | 11 ++++ qt4.spec | 14 +++-- 5 files changed, 220 insertions(+), 3 deletions(-) create mode 100644 cxx11.patch create mode 100644 gcc9-qforeach.patch create mode 100644 gcc9.patch create mode 100644 mysql-link.patch diff --git a/cxx11.patch b/cxx11.patch new file mode 100644 index 0000000..3ee7cac --- /dev/null +++ b/cxx11.patch @@ -0,0 +1,123 @@ +--- qt-everywhere-opensource-src-4.8.7/src/3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h~ 2015-05-07 16:14:48.000000000 +0200 ++++ qt-everywhere-opensource-src-4.8.7/src/3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h 2019-09-14 17:24:05.875744690 +0200 +@@ -170,8 +170,8 @@ + + // GCC's libstdc++ 20070724 and later supports C++ TR1 type_traits in the std namespace. + // VC10 (VS2010) and later support C++ TR1 type_traits in the std::tr1 namespace. +- template struct HasTrivialConstructor : public std::tr1::has_trivial_constructor { }; +- template struct HasTrivialDestructor : public std::tr1::has_trivial_destructor { }; ++ template struct HasTrivialConstructor : public std::is_trivially_constructible { }; ++ template struct HasTrivialDestructor : public std::is_trivially_destructible { }; + + #else + +--- qt-everywhere-opensource-src-4.8.7/src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashTable.h~ 2015-05-07 16:14:48.000000000 +0200 ++++ qt-everywhere-opensource-src-4.8.7/src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashTable.h 2019-09-14 20:25:57.045375344 +0200 +@@ -257,7 +257,7 @@ + + using std::swap; + +-#if !COMPILER(MSVC) && !OS(QNX) && !defined(_LIBCPP_VERSION) ++#if 0 && !COMPILER(MSVC) && !OS(QNX) && !defined(_LIBCPP_VERSION) + // The Dinkumware C++ library (used by MSVC and QNX) and clang's libc++ have a swap for pairs defined. + + // swap pairs by component, in case of pair members that specialize swap +--- qt-everywhere-opensource-src-4.8.7/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.h~ 2015-05-07 16:14:48.000000000 +0200 ++++ qt-everywhere-opensource-src-4.8.7/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.h 2019-09-14 18:06:14.575659781 +0200 +@@ -317,7 +317,7 @@ + TransitionTable* transitionTable = new TransitionTable; + setTransitionTable(transitionTable); + if (existingTransition) +- add(StructureTransitionTableHash::Key(RefPtr(existingTransition->m_nameInPrevious.get()), existingTransition->m_attributesInPrevious), existingTransition, existingTransition->m_specificValueInPrevious); ++ add(StructureTransitionTableHash::Key(RefPtr(existingTransition->m_nameInPrevious.get()), +existingTransition->m_attributesInPrevious), existingTransition, existingTransition->m_specificValueInPrevious); + } + } // namespace JSC + +--- qt-everywhere-opensource-src-4.8.7/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.cpp~ 2015-05-07 16:14:48.000000000 +0200 ++++ qt-everywhere-opensource-src-4.8.7/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.cpp 2019-09-14 18:05:24.248994834 +0200 +@@ -157,7 +157,7 @@ + { + if (m_previous) { + if (m_nameInPrevious) +- m_previous->table.remove(StructureTransitionTableHash::Key(RefPtr(m_nameInPrevious.get()), m_attributesInPrevious), m_specificValueInPrevious); ++ m_previous->table.remove(StructureTransitionTableHash::Key(RefPtr(m_nameInPrevious.get()), +m_attributesInPrevious), m_specificValueInPrevious); + else + m_previous->table.removeAnonymousSlotTransition(m_anonymousSlotsInPrevious); + +@@ -280,7 +280,7 @@ + continue; + } + structure->m_nameInPrevious->ref(); +- PropertyMapEntry entry(structure->m_nameInPrevious.get(), structure->m_offset, structure->m_attributesInPrevious, structure->m_specificValueInPrevious, ++m_propertyTable->lastIndexUsed); ++ PropertyMapEntry entry(structure->m_nameInPrevious.get(), structure->m_offset, +structure->m_attributesInPrevious, structure->m_specificValueInPrevious, ++m_propertyTable->lastIndexUsed); + insertIntoPropertyMapHashTable(entry); + } + } +--- qt-everywhere-opensource-src-4.8.7/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexCompiler.cpp~ 2015-05-07 16:14:47.000000000 +0200 ++++ qt-everywhere-opensource-src-4.8.7/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexCompiler.cpp 2019-09-14 18:26:54.518951294 +0200 +@@ -719,7 +719,7 @@ + + constructor.setupOffsets(); + +- return false; ++ return nullptr; + }; + + +--- qt-everywhere-opensource-src-4.8.7/src/3rdparty/webkit/Source/JavaScriptCore/wtf/TypeTraits.h~ 2015-05-07 16:14:45.000000000 +0200 ++++ qt-everywhere-opensource-src-4.8.7/src/3rdparty/webkit/Source/JavaScriptCore/wtf/TypeTraits.h 2019-09-14 18:23:03.718959093 +0200 +@@ -183,8 +183,8 @@ + + // GCC's libstdc++ 20070724 and later supports C++ TR1 type_traits in the std namespace. + // VC10 (VS2010) and later support C++ TR1 type_traits in the std::tr1 namespace. +- template struct HasTrivialConstructor : public std::tr1::has_trivial_constructor { }; +- template struct HasTrivialDestructor : public std::tr1::has_trivial_destructor { }; ++ template struct HasTrivialConstructor : public std::is_trivially_constructible { }; ++ template struct HasTrivialDestructor : public std::is_trivially_destructible { }; + + #else + +--- qt-everywhere-opensource-src-4.8.7/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashSet.h~ 2015-05-07 16:14:45.000000000 +0200 ++++ qt-everywhere-opensource-src-4.8.7/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashSet.h 2019-09-14 18:32:15.168940587 +0200 +@@ -188,7 +188,8 @@ + #if COMPILER(MSVC) && _MSC_VER >= 1700 + return iterator_const_cast(m_impl.add(value)); + #else +- return m_impl.add(value); ++ pair p = m_impl.add(value); ++ return pair(iterator(p.first), p.second); + #endif + } + +@@ -201,7 +202,8 @@ + #if COMPILER(MSVC) && _MSC_VER >= 1700 + return iterator_const_cast(m_impl.template addPassingHashCode(value, value)); + #else +- return m_impl.template addPassingHashCode(value, value); ++ pair p = m_impl.template addPassingHashCode(value, value); ++ return pair(iterator(p.first), p.second); + #endif + } + +--- qt-everywhere-opensource-src-4.8.7/src/3rdparty/webkit/Source/WebCore/dom/Element.cpp~ 2015-05-07 16:14:47.000000000 +0200 ++++ qt-everywhere-opensource-src-4.8.7/src/3rdparty/webkit/Source/WebCore/dom/Element.cpp 2019-09-14 18:39:17.915592915 +0200 +@@ -1080,7 +1080,7 @@ + { + // Ref currentStyle in case it would otherwise be deleted when setRenderStyle() is called. + RefPtr currentStyle(renderStyle()); +- bool hasParentStyle = parentNodeForRenderingAndStyle() ? parentNodeForRenderingAndStyle()->renderStyle() : false; ++ bool hasParentStyle = parentNodeForRenderingAndStyle() ? bool(parentNodeForRenderingAndStyle()->renderStyle()) : false; + bool hasDirectAdjacentRules = currentStyle && currentStyle->childrenAffectedByDirectAdjacentRules(); + bool hasIndirectAdjacentRules = currentStyle && currentStyle->childrenAffectedByForwardPositionalRules(); + +--- qt-everywhere-opensource-src-4.8.7/src/plugins/accessible/widgets/itemviews.cpp~ 2015-05-07 16:14:48.000000000 +0200 ++++ qt-everywhere-opensource-src-4.8.7/src/plugins/accessible/widgets/itemviews.cpp 2019-09-14 18:37:01.048930870 +0200 +@@ -393,7 +393,7 @@ + QModelIndex index = view()->model()->index(0, column, view()->rootIndex()); + if (!index.isValid() || view()->selectionMode() & QAbstractItemView::NoSelection) + return false; +- view()->selectionModel()->select(index, QItemSelectionModel::Columns & QItemSelectionModel::Deselect); ++ view()->selectionModel()->select(index, QItemSelectionModel::Columns | QItemSelectionModel::Deselect); + return true; + } + diff --git a/gcc9-qforeach.patch b/gcc9-qforeach.patch new file mode 100644 index 0000000..ae54cdb --- /dev/null +++ b/gcc9-qforeach.patch @@ -0,0 +1,64 @@ +From c35a3f519007af44c3b364b9af86f6a336f6411b Mon Sep 17 00:00:00 2001 +From: Thiago Macieira +Date: Tue, 11 Feb 2014 16:17:46 -0800 +Subject: [PATCH] Redo the Q_FOREACH loop control without GCC statement + expressions + +It's possible to do without them, which probably makes the number of +supported compilers a lot bigger: they just need to support decltype() +or __typeof__. + +That includes the Intel compiler. The old code was also apparently +working, but no one had realized the old workaround for some old version +was still in place. + +The loop overhead is more or less the same. I have not done benchmarks, +but inspection of the generated assembly shows more or less the same +number of instructions. + +Change-Id: I32d499c84a6ddd19d994b49f17a469acb5c3a3f1 +Reviewed-by: Olivier Goffart +Reviewed-by: Marc Mutz + +Backported to Qt 4 + +--- a/src/corelib/global/qglobal.h ++++ b/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 + 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 + diff --git a/gcc9.patch b/gcc9.patch new file mode 100644 index 0000000..787cd7d --- /dev/null +++ b/gcc9.patch @@ -0,0 +1,11 @@ +--- qt-everywhere-opensource-src-4.8.7/configure~ 2019-09-14 20:06:01.000000000 +0200 ++++ qt-everywhere-opensource-src-4.8.7/configure 2019-09-14 20:40:44.545345003 +0200 +@@ -7753,7 +7753,7 @@ + *-g++*) + # Check gcc's version + case "$(${QMAKE_CONF_COMPILER} -dumpversion)" in +- 8*|7*|6*|5*|4*|3.4*) ++ 9*|8*|7*|6*|5*|4*|3.4*) + ;; + 3.3*) + canBuildWebKit="no" diff --git a/mysql-link.patch b/mysql-link.patch new file mode 100644 index 0000000..a460923 --- /dev/null +++ b/mysql-link.patch @@ -0,0 +1,11 @@ +--- qt-everywhere-opensource-src-4.8.7/src/sql/drivers/mysql/qsql_mysql.pri~ 2015-05-07 16:14:48.000000000 +0200 ++++ qt-everywhere-opensource-src-4.8.7/src/sql/drivers/mysql/qsql_mysql.pri 2019-09-14 15:53:51.542585322 +0200 +@@ -4,7 +4,7 @@ + unix { + isEmpty(QT_LFLAGS_MYSQL) { + !contains(LIBS, .*mysqlclient.*):!contains(LIBS, .*mysqld.*) { +- use_libmysqlclient_r:LIBS += -lmysqlclient_r ++ use_libmysqlclient_r:LIBS += -lmysqlclient + else:LIBS += -lmysqlclient + } + } else { diff --git a/qt4.spec b/qt4.spec index 8a40730..c742741 100644 --- a/qt4.spec +++ b/qt4.spec @@ -63,7 +63,7 @@ Summary(pl.UTF-8): Biblioteka Qt do tworzenia GUI Summary(pt_BR.UTF-8): Estrutura para rodar aplicações GUI Qt Name: qt4 Version: 4.8.7 -Release: 22 +Release: 23 License: LGPL v2.1 or GPL v3.0 Group: X11/Libraries Source0: http://download.qt-project.org/official_releases/qt/4.8/%{version}/qt-everywhere-opensource-src-%{version}.tar.gz @@ -128,6 +128,10 @@ Patch46: qt-everywhere-opensource-src-4.8.3-qdbusconnection_no_debug.patch Patch47: qt-everywhere-opensource-src-4.8.2--assistant-crash.patch Patch48: qt-everywhere-opensource-src-4.8.0-QTBUG-22037.patch Patch49: icu59.patch +Patch50: mysql-link.patch +Patch51: gcc9.patch +Patch52: gcc9-qforeach.patch +Patch53: cxx11.patch URL: http://qt-project.org/ %{?with_ibase:BuildRequires: Firebird-devel} %{?with_openvg:BuildRequires: Mesa-libOpenVG-devel} @@ -1566,6 +1570,10 @@ Programas exemplo para o Qt versão. %patch47 -p1 %patch48 -p1 %patch49 -p1 +%patch50 -p1 +%patch51 -p1 +%patch52 -p1 +%patch53 -p1 %{__sed} -i -e 's,usr/X11R6/,usr/g,' mkspecs/linux-g++-64/qmake.conf \ mkspecs/common/linux.conf @@ -1577,9 +1585,9 @@ Programas exemplo para o Qt versão. s|QMAKE_LINK.*=.*g++|QMAKE_LINK\t\t= %{__cxx}|; s|QMAKE_LINK_SHLIB.*=.*g++|QMAKE_LINK_SHLIB\t= %{__cxx}|; s|QMAKE_CFLAGS_RELEASE.*|QMAKE_CFLAGS_RELEASE\t+= %{rpmcppflags} %{rpmcflags}|; - s|QMAKE_CXXFLAGS_RELEASE.*|QMAKE_CXXFLAGS_RELEASE\t+= %{rpmcppflags} %{rpmcxxflags} -std=gnu++98|; + s|QMAKE_CXXFLAGS_RELEASE.*|QMAKE_CXXFLAGS_RELEASE\t+= %{rpmcppflags} %{rpmcxxflags}|; s|QMAKE_CFLAGS_DEBUG.*|QMAKE_CFLAGS_DEBUG\t+= %{debugcflags}|; - s|QMAKE_CXXFLAGS_DEBUG.*|QMAKE_CXXFLAGS_DEBUG\t+= %{debugcflags} -std=gnu++98|; + s|QMAKE_CXXFLAGS_DEBUG.*|QMAKE_CXXFLAGS_DEBUG\t+= %{debugcflags}|; ' mkspecs/common/g++-base.conf %{__sed} -i -e ' -- 2.44.0