From e2b421a5b66ce2009822c5fc1c66da33de6fdeb9 Mon Sep 17 00:00:00 2001 From: Samuli Piippo Date: Thu, 13 Feb 2020 12:20:45 +0200 Subject: [PATCH] Fix example build --- ...-after-string-data-changes-in-qtbase.patch | 113 ++++++++++++++++++ recipes-qt/qt6/qtscxml_git.bb | 4 + ...cing-deprecated-ssl-protocol-version.patch | 36 ++++++ recipes-qt/qt6/qtwebsockets_git.bb | 4 + 4 files changed, 157 insertions(+) create mode 100644 recipes-qt/qt6/qtscxml/0001-Fix-compilation-after-string-data-changes-in-qtbase.patch create mode 100644 recipes-qt/qt6/qtwebsockets/0001-Stop-forcing-deprecated-ssl-protocol-version.patch diff --git a/recipes-qt/qt6/qtscxml/0001-Fix-compilation-after-string-data-changes-in-qtbase.patch b/recipes-qt/qt6/qtscxml/0001-Fix-compilation-after-string-data-changes-in-qtbase.patch new file mode 100644 index 0000000..c94913e --- /dev/null +++ b/recipes-qt/qt6/qtscxml/0001-Fix-compilation-after-string-data-changes-in-qtbase.patch @@ -0,0 +1,113 @@ +From 8be22a883cc9af0c7198fd298a790c7630290d39 Mon Sep 17 00:00:00 2001 +From: Simon Hausmann +Date: Fri, 24 Jan 2020 13:13:15 +0100 +Subject: [PATCH] Fix compilation after string data changes in qtbase + +Adjust the moc copied code to generate the same byte arrays for string +literals and simplified the unicode string tables to just store offsets +and size so that we can use QString::fromRawData (just like in +qtdeclarative). + +Change-Id: Id19c165454451192e0764b5d889a1275e92417ac +Reviewed-by: Ulf Hermann +--- + tools/qscxmlc/data.t | 10 ++++------ + tools/qscxmlc/generator.cpp | 13 +++++-------- + tools/qscxmlc/scxmlcppdumper.cpp | 4 ++-- + 3 files changed, 11 insertions(+), 16 deletions(-) + +diff --git a/tools/qscxmlc/data.t b/tools/qscxmlc/data.t +index 3926507..4bcb76b 100644 +--- a/tools/qscxmlc/data.t ++++ b/tools/qscxmlc/data.t +@@ -33,7 +33,9 @@ struct ${classname}::Data: private QScxmlTableData { + { + Q_ASSERT(id >= QScxmlExecutableContent::NoString); Q_ASSERT(id < ${stringCount}); + if (id == QScxmlExecutableContent::NoString) return QString(); +- return QString({static_cast(strings.data + id)}); ++ const auto dataOffset = strings.offsetsAndSize[id * 2]; ++ const auto dataSize = strings.offsetsAndSize[id * 2 + 1]; ++ return QString::fromRawData(reinterpret_cast(&strings.stringdata[dataOffset]), dataSize); + } + + const qint32 *stateMachineTable() const override final +@@ -82,7 +84,7 @@ struct ${classname}::Data: private QScxmlTableData { + static QScxmlExecutableContent::ForeachInfo foreaches[]; + static const qint32 theStateMachineTable[]; + static struct Strings { +- QArrayData data[${stringCount}]; ++ const uint offsetsAndSize[${stringCount} * 2]; + qunicodechar stringdata[${stringdataSize}]; + } strings; + }; +@@ -120,10 +122,6 @@ QScxmlExecutableContent::ForeachInfo ${classname}::Data::foreaches[] = { + ${foreaches} + }; + +-#define STR_LIT(idx, ofs, len) \ +- Q_STATIC_STRING_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ +- qptrdiff(offsetof(Strings, stringdata) + ofs * sizeof(qunicodechar) - idx * sizeof(QArrayData)) \ +- ) + ${classname}::Data::Strings ${classname}::Data::strings = {{ + ${strLits} + },{ +diff --git a/tools/qscxmlc/generator.cpp b/tools/qscxmlc/generator.cpp +index 59047cf..220170a 100644 +--- a/tools/qscxmlc/generator.cpp ++++ b/tools/qscxmlc/generator.cpp +@@ -249,7 +249,7 @@ void Generator::generateCode() + // + const int constCharArraySizeLimit = 65535; + fprintf(out, "struct qt_meta_stringdata_%s_t {\n", qualifiedClassNameIdentifier.constData()); +- fprintf(out, " QByteArrayData data[%d];\n", strings.size()); ++ fprintf(out, " const uint offsetsAndSize[%d];\n", strings.size()*2); + { + int stringDataLength = 0; + int stringDataCounter = 0; +@@ -273,11 +273,8 @@ void Generator::generateCode() + // stringdata.stringdata member, and 2) the stringdata.data index of the + // QByteArrayData being defined. This calculation relies on the + // QByteArrayData::data() implementation returning simply "this + offset". +- fprintf(out, "#define QT_MOC_LITERAL(idx, ofs, len) \\\n" +- " Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \\\n" +- " qptrdiff(offsetof(qt_meta_stringdata_%s_t, stringdata0) + ofs \\\n" +- " - idx * sizeof(QByteArrayData)) \\\n" +- " )\n", ++ fprintf(out, "#define QT_MOC_LITERAL(ofs, len) \\\n" ++ " uint(offsetof(qt_meta_stringdata_%s_t, stringdata0) + ofs), len \n", + qualifiedClassNameIdentifier.constData()); + + fprintf(out, "static const qt_meta_stringdata_%s_t qt_meta_stringdata_%s = {\n", +@@ -287,7 +284,7 @@ void Generator::generateCode() + int idx = 0; + for (int i = 0; i < strings.size(); ++i) { + const QByteArray &str = strings.at(i); +- fprintf(out, "QT_MOC_LITERAL(%d, %d, %d)", i, idx, str.length()); ++ fprintf(out, "QT_MOC_LITERAL(%d, %d)", idx, str.length()); + if (i != strings.size() - 1) + fputc(',', out); + const QByteArray comment = str.length() > 32 ? str.left(29) + "..." : str; +@@ -519,7 +516,7 @@ void Generator::generateCode() + fprintf(out, " { &%s::staticMetaObject, ", purestSuperClass.constData()); + else + fprintf(out, " { nullptr, "); +- fprintf(out, "qt_meta_stringdata_%s.data,\n" ++ fprintf(out, "qt_meta_stringdata_%s.offsetsAndSize,\n" + " qt_meta_data_%s, ", qualifiedClassNameIdentifier.constData(), + qualifiedClassNameIdentifier.constData()); + if (hasStaticMetaCall) +diff --git a/tools/qscxmlc/scxmlcppdumper.cpp b/tools/qscxmlc/scxmlcppdumper.cpp +index 1aca09e..fa6359e 100644 +--- a/tools/qscxmlc/scxmlcppdumper.cpp ++++ b/tools/qscxmlc/scxmlcppdumper.cpp +@@ -267,8 +267,8 @@ void generateTables(const GeneratedTableData &td, Replacements &replacements) + return QString(); + + const int length = strings.at(idx).size(); +- const QString str = QStringLiteral("STR_LIT(%1, %2, %3)").arg( +- QString::number(idx), QString::number(ucharCount), QString::number(length)); ++ const QString str = QStringLiteral("%1, %2").arg( ++ QString::number(ucharCount), QString::number(length)); + ucharCount += length + 1; + return str; + }); diff --git a/recipes-qt/qt6/qtscxml_git.bb b/recipes-qt/qt6/qtscxml_git.bb index 30f274a..b49afda 100644 --- a/recipes-qt/qt6/qtscxml_git.bb +++ b/recipes-qt/qt6/qtscxml_git.bb @@ -10,6 +10,10 @@ inherit qt6-cmake include recipes-qt/qt6/qt6-git.inc include recipes-qt/qt6/qt6.inc +SRC_URI += "\ + file://0001-Fix-compilation-after-string-data-changes-in-qtbase.patch \ +" + DEPENDS += "qtbase qtdeclarative qtscxml-native" BBCLASSEXTEND += "native nativesdk" diff --git a/recipes-qt/qt6/qtwebsockets/0001-Stop-forcing-deprecated-ssl-protocol-version.patch b/recipes-qt/qt6/qtwebsockets/0001-Stop-forcing-deprecated-ssl-protocol-version.patch new file mode 100644 index 0000000..78c040e --- /dev/null +++ b/recipes-qt/qt6/qtwebsockets/0001-Stop-forcing-deprecated-ssl-protocol-version.patch @@ -0,0 +1,36 @@ +From e3d919e215d987ec8f912c7cec05ba502d4c3f0b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= +Date: Thu, 16 Jan 2020 15:25:46 +0100 +Subject: [PATCH] Stop forcing deprecated ssl protocol version + +Change-Id: I422a2498bb940f801484d3f2e6e5d59edd637514 +Reviewed-by: Timur Pocheptsov +--- + examples/websockets/sslechoserver/sslechoserver.cpp | 1 - + tests/auto/websockets/qwebsocketserver/tst_qwebsocketserver.cpp | 1 - + 2 files changed, 2 deletions(-) + +diff --git a/examples/websockets/sslechoserver/sslechoserver.cpp b/examples/websockets/sslechoserver/sslechoserver.cpp +index 00bc6c1..5dc41e0 100644 +--- a/examples/websockets/sslechoserver/sslechoserver.cpp ++++ b/examples/websockets/sslechoserver/sslechoserver.cpp +@@ -77,7 +77,6 @@ SslEchoServer::SslEchoServer(quint16 port, QObject *parent) : + sslConfiguration.setPeerVerifyMode(QSslSocket::VerifyNone); + sslConfiguration.setLocalCertificate(certificate); + sslConfiguration.setPrivateKey(sslKey); +- sslConfiguration.setProtocol(QSsl::TlsV1SslV3); + m_pWebSocketServer->setSslConfiguration(sslConfiguration); + + if (m_pWebSocketServer->listen(QHostAddress::Any, port)) +diff --git a/tests/auto/websockets/qwebsocketserver/tst_qwebsocketserver.cpp b/tests/auto/websockets/qwebsocketserver/tst_qwebsocketserver.cpp +index c40bb01..a56594c 100644 +--- a/tests/auto/websockets/qwebsocketserver/tst_qwebsocketserver.cpp ++++ b/tests/auto/websockets/qwebsocketserver/tst_qwebsocketserver.cpp +@@ -604,7 +604,6 @@ static void setupSecureServer(QWebSocketServer *secureServer) + sslConfiguration.setPeerVerifyMode(QSslSocket::VerifyNone); + sslConfiguration.setLocalCertificate(certificate); + sslConfiguration.setPrivateKey(sslKey); +- sslConfiguration.setProtocol(QSsl::TlsV1SslV3); + secureServer->setSslConfiguration(sslConfiguration); + } + #endif diff --git a/recipes-qt/qt6/qtwebsockets_git.bb b/recipes-qt/qt6/qtwebsockets_git.bb index c74369c..479ad0c 100644 --- a/recipes-qt/qt6/qtwebsockets_git.bb +++ b/recipes-qt/qt6/qtwebsockets_git.bb @@ -11,6 +11,10 @@ inherit qt6-cmake include recipes-qt/qt6/qt6-git.inc include recipes-qt/qt6/qt6.inc +SRC_URI += "\ + file://0001-Stop-forcing-deprecated-ssl-protocol-version.patch \ +" + PACKAGECONFIG ?= "translations" DEPENDS += "qtbase qtdeclarative"