summaryrefslogtreecommitdiff
path: root/net-irc/quassel/files
diff options
context:
space:
mode:
Diffstat (limited to 'net-irc/quassel/files')
-rw-r--r--net-irc/quassel/files/quassel-0.12.5-qt511.patch67
-rw-r--r--net-irc/quassel/files/quassel-0.13.1-qt5.14.patch118
2 files changed, 118 insertions, 67 deletions
diff --git a/net-irc/quassel/files/quassel-0.12.5-qt511.patch b/net-irc/quassel/files/quassel-0.12.5-qt511.patch
deleted file mode 100644
index c46eee8e29b8..000000000000
--- a/net-irc/quassel/files/quassel-0.12.5-qt511.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-commit 0cc8e1431feb739d0727f0131c87a7ecbe336a81
-Author: Manuel Nickschas <sputnick@quassel-irc.org>
-Date: Thu May 3 23:19:34 2018 +0200
-
- cmake: Fix build with Qt 5.11
-
- Qt 5.11 removes the qt5_use_modules function, so add a copy. If
- present, the Qt-provided function will be used instead.
-
- Closes GH-355.
-
-diff --git a/cmake/QuasselMacros.cmake b/cmake/QuasselMacros.cmake
-index 652c0042..d77ba1cf 100644
---- a/cmake/QuasselMacros.cmake
-+++ b/cmake/QuasselMacros.cmake
-@@ -5,6 +5,9 @@
- # The qt4_use_modules function was taken from CMake's Qt4Macros.cmake:
- # (C) 2005-2009 Kitware, Inc.
- #
-+# The qt5_use_modules function was taken from Qt 5.10.1 (and modified):
-+# (C) 2005-2011 Kitware, Inc.
-+#
- # Redistribution and use is allowed according to the terms of the BSD license.
- # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-@@ -43,6 +46,41 @@ function(qt4_use_modules _target _link_type)
- endforeach()
- endfunction()
-
-+# Qt 5.11 removed the qt5_use_modules function, so we need to provide it until we can switch to a modern CMake version.
-+# If present, the Qt-provided version will be used automatically instead.
-+function(qt5_use_modules _target _link_type)
-+ if (NOT TARGET ${_target})
-+ message(FATAL_ERROR "The first argument to qt5_use_modules must be an existing target.")
-+ endif()
-+ if ("${_link_type}" STREQUAL "LINK_PUBLIC" OR "${_link_type}" STREQUAL "LINK_PRIVATE" )
-+ set(_qt5_modules ${ARGN})
-+ set(_qt5_link_type ${_link_type})
-+ else()
-+ set(_qt5_modules ${_link_type} ${ARGN})
-+ endif()
-+
-+ if ("${_qt5_modules}" STREQUAL "")
-+ message(FATAL_ERROR "qt5_use_modules requires at least one Qt module to use.")
-+ endif()
-+ foreach(_module ${_qt5_modules})
-+ if (NOT Qt5${_module}_FOUND)
-+ find_package(Qt5${_module} PATHS "${_Qt5_COMPONENT_PATH}" NO_DEFAULT_PATH)
-+ if (NOT Qt5${_module}_FOUND)
-+ message(FATAL_ERROR "Can not use \"${_module}\" module which has not yet been found.")
-+ endif()
-+ endif()
-+ target_link_libraries(${_target} ${_qt5_link_type} ${Qt5${_module}_LIBRARIES})
-+ set_property(TARGET ${_target} APPEND PROPERTY INCLUDE_DIRECTORIES ${Qt5${_module}_INCLUDE_DIRS})
-+ set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS ${Qt5${_module}_COMPILE_DEFINITIONS})
-+ if (Qt5_POSITION_INDEPENDENT_CODE
-+ AND (CMAKE_VERSION VERSION_LESS 2.8.12
-+ AND (NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
-+ OR CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)))
-+ set_property(TARGET ${_target} PROPERTY POSITION_INDEPENDENT_CODE ${Qt5_POSITION_INDEPENDENT_CODE})
-+ endif()
-+ endforeach()
-+endfunction()
-+
- # Some wrappers for simplifying dual-Qt support
-
- function(qt_use_modules)
diff --git a/net-irc/quassel/files/quassel-0.13.1-qt5.14.patch b/net-irc/quassel/files/quassel-0.13.1-qt5.14.patch
new file mode 100644
index 000000000000..f0305ea53ce7
--- /dev/null
+++ b/net-irc/quassel/files/quassel-0.13.1-qt5.14.patch
@@ -0,0 +1,118 @@
+commit c90702bdbc43fc542d7df6d5ec4b321912ca0035
+Author: Manuel Nickschas <sputnick@quassel-irc.org>
+Date: Tue Jan 7 18:34:54 2020 +0100
+
+ common: Disable enum type stream operators for Qt >= 5.14
+
+ Starting from version 5.14, Qt provides stream operators for enum
+ types, which collide with the ones we ship in types.h. Disable
+ Quassel's stream operators when compiling against Qt 5.14 or later.
+
+ Add a unit test that ensures that enum serialization honors the width
+ of the underlying type.
+
+diff --git a/src/common/types.h b/src/common/types.h
+index 467d9fb2..c4b9f364 100644
+--- a/src/common/types.h
++++ b/src/common/types.h
+@@ -140,6 +140,7 @@ Q_DECLARE_METATYPE(QHostAddress)
+ typedef QList<MsgId> MsgIdList;
+ typedef QList<BufferId> BufferIdList;
+
++#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
+ /**
+ * Catch-all stream serialization operator for enum types.
+ *
+@@ -169,6 +170,7 @@ QDataStream &operator>>(QDataStream &in, T &value) {
+ value = static_cast<T>(v);
+ return in;
+ }
++#endif
+
+ // Exceptions
+
+diff --git a/src/common/typestest.cpp b/src/common/typestest.cpp
+new file mode 100644
+index 00000000..04031c29
+--- /dev/null
++++ b/src/common/typestest.cpp
+@@ -0,0 +1,79 @@
++/***************************************************************************
++ * Copyright (C) 2005-2020 by the Quassel Project *
++ * devel@quassel-irc.org *
++ * *
++ * This program is free software; you can redistribute it and/or modify *
++ * it under the terms of the GNU General Public License as published by *
++ * the Free Software Foundation; either version 2 of the License, or *
++ * (at your option) version 3. *
++ * *
++ * This program is distributed in the hope that it will be useful, *
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
++ * GNU General Public License for more details. *
++ * *
++ * You should have received a copy of the GNU General Public License *
++ * along with this program; if not, write to the *
++ * Free Software Foundation, Inc., *
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
++ ***************************************************************************/
++
++#include <cstdint>
++
++#include <QByteArray>
++#include <QDataStream>
++#include <QObject>
++
++#include "testglobal.h"
++#include "types.h"
++
++using namespace ::testing;
++
++class EnumHolder
++{
++ Q_GADGET
++
++public:
++ enum class Enum16 : uint16_t {};
++ enum class Enum32 : uint32_t {};
++
++ enum class EnumQt16 : uint16_t {};
++ Q_ENUM(EnumQt16)
++ enum class EnumQt32 : uint32_t {};
++ Q_ENUM(EnumQt32)
++};
++
++// Verify that enums are (de)serialized as their underlying type
++TEST(TypesTest, enumSerialization)
++{
++ QByteArray data;
++ QDataStream out(&data, QIODevice::WriteOnly);
++
++ // Serialize
++ out << EnumHolder::Enum16(0xabcd);
++ ASSERT_THAT(data.size(), Eq(2));
++ out << EnumHolder::Enum32(0x123456);
++ ASSERT_THAT(data.size(), Eq(6));
++ out << EnumHolder::EnumQt16(0x4321);
++ ASSERT_THAT(data.size(), Eq(8));
++ out << EnumHolder::Enum32(0xfedcba);
++ ASSERT_THAT(data.size(), Eq(12));
++ ASSERT_THAT(out.status(), Eq(QDataStream::Status::Ok));
++
++ // Deserialize
++ QDataStream in(data);
++ EnumHolder::Enum16 enum16;
++ EnumHolder::Enum32 enum32;
++ EnumHolder::EnumQt16 enumQt16;
++ EnumHolder::EnumQt32 enumQt32;
++ in >> enum16 >> enum32 >> enumQt16 >> enumQt32;
++ ASSERT_THAT(in.status(), Eq(QDataStream::Status::Ok));
++ EXPECT_TRUE(in.atEnd());
++
++ EXPECT_THAT((int)enum16, Eq(0xabcd));
++ EXPECT_THAT((int)enum32, Eq(0x123456));
++ EXPECT_THAT((int)enumQt16, Eq(0x4321));
++ EXPECT_THAT((int)enumQt32, Eq(0xfedcba));
++}
++
++#include "typestest.moc"