From c7db3c41e6a6b60e25538aff086ac3e24c6fb985 Mon Sep 17 00:00:00 2001 From: Sirius902 <10891979+Sirius902@users.noreply.github.com> Date: Sat, 25 Oct 2025 10:55:31 -0700 Subject: [PATCH] openmw: fix build with Qt 6.10 --- ...tly-convert-QByteArray-to-const-char.patch | 122 ++++++++++++++++++ pkgs/by-name/op/openmw/package.nix | 6 + 2 files changed, 128 insertions(+) create mode 100644 pkgs/by-name/op/openmw/0001-Do-not-implicitly-convert-QByteArray-to-const-char.patch diff --git a/pkgs/by-name/op/openmw/0001-Do-not-implicitly-convert-QByteArray-to-const-char.patch b/pkgs/by-name/op/openmw/0001-Do-not-implicitly-convert-QByteArray-to-const-char.patch new file mode 100644 index 000000000000..f35c72c93b39 --- /dev/null +++ b/pkgs/by-name/op/openmw/0001-Do-not-implicitly-convert-QByteArray-to-const-char.patch @@ -0,0 +1,122 @@ +From 0de42e9a1640e74b2c94ce16ecaf7367ece5f4b0 Mon Sep 17 00:00:00 2001 +From: elsid +Date: Sun, 5 Oct 2025 23:40:17 +0200 +Subject: [PATCH] Do not implicitly convert QByteArray to const char* + +Operators supporting this conversion can be disabled via +QT_NO_CAST_FROM_BYTEARRAY breaking the build. For example: + +https://koschei.fedoraproject.org//package/openmw +https://kojipkgs.fedoraproject.org/work/tasks/5096/137735096/build.log + +Backported to OpenMW 0.49.x + +Co-authored-by: Sirius902 <10891979+Sirius902@users.noreply.github.com> +--- + apps/opencs/model/world/nestedtableproxymodel.cpp | 4 +++- + apps/opencs/view/world/util.cpp | 5 +++-- + components/files/qtconversion.cpp | 11 ++++++----- + components/vfs/qtconversion.cpp | 11 ++++++----- + 4 files changed, 18 insertions(+), 13 deletions(-) + +diff --git a/apps/opencs/model/world/nestedtableproxymodel.cpp b/apps/opencs/model/world/nestedtableproxymodel.cpp +index f542ce4def..5278710e4a 100644 +--- a/apps/opencs/model/world/nestedtableproxymodel.cpp ++++ b/apps/opencs/model/world/nestedtableproxymodel.cpp +@@ -13,7 +13,9 @@ CSMWorld::NestedTableProxyModel::NestedTableProxyModel( + { + const int parentRow = parent.row(); + +- mId = std::string(parentModel->index(parentRow, 0).data().toString().toUtf8()); ++ const QByteArray utf8 = parentModel->index(parentRow, 0).data().toString().toUtf8(); ++ ++ mId = std::string(utf8.constData(), utf8.size()); + + QAbstractProxyModel::setSourceModel(parentModel); + +diff --git a/apps/opencs/view/world/util.cpp b/apps/opencs/view/world/util.cpp +index dfb587cd96..5fd32d78b4 100644 +--- a/apps/opencs/view/world/util.cpp ++++ b/apps/opencs/view/world/util.cpp +@@ -363,11 +363,12 @@ void CSVWorld::CommandDelegate::setEditorData(QWidget* editor, const QModelIndex + { + if (!variant.isValid()) + #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +- variant = QVariant(editor->property(n).metaType(), (const void*)nullptr); ++ variant = QVariant(editor->property(n.constData()).metaType(), (const void*)nullptr); ++ editor->setProperty(n.constData(), variant); + #else + variant = QVariant(editor->property(n).userType(), (const void*)nullptr); ++ editor->setProperty(n, variant); + #endif +- editor->setProperty(n, variant); + } + } + +diff --git a/components/files/qtconversion.cpp b/components/files/qtconversion.cpp +index d56832cb78..ac7ca6ec8b 100644 +--- a/components/files/qtconversion.cpp ++++ b/components/files/qtconversion.cpp +@@ -1,8 +1,9 @@ +- + #include "qtconversion.hpp" + + #include + ++#include ++ + QString Files::pathToQString(const std::filesystem::path& path) + { + const auto tmp = path.u8string(); +@@ -17,12 +18,12 @@ QString Files::pathToQString(std::filesystem::path&& path) + + std::filesystem::path Files::pathFromQString(QStringView path) + { +- const auto tmp = path.toUtf8(); +- return std::filesystem::path{ Misc::StringUtils::stringToU8String(tmp) }; ++ const QByteArray tmp = path.toUtf8(); ++ return std::filesystem::path(Misc::StringUtils::stringToU8String(std::string_view(tmp.constData(), tmp.size()))); + } + + std::filesystem::path Files::pathFromQString(QString&& path) + { +- const auto tmp = path.toUtf8(); +- return std::filesystem::path{ Misc::StringUtils::stringToU8String(tmp) }; ++ const QByteArray tmp = path.toUtf8(); ++ return std::filesystem::path(Misc::StringUtils::stringToU8String(std::string_view(tmp.constData(), tmp.size()))); + } +diff --git a/components/vfs/qtconversion.cpp b/components/vfs/qtconversion.cpp +index 472e3dd0b4..fc8a0fb78e 100644 +--- a/components/vfs/qtconversion.cpp ++++ b/components/vfs/qtconversion.cpp +@@ -1,8 +1,9 @@ +- + #include "qtconversion.hpp" + + #include + ++#include ++ + QString VFS::Path::normalizedToQString(NormalizedView path) + { + return QString::fromUtf8(path.value().data(), path.value().size()); +@@ -15,12 +16,12 @@ QString VFS::Path::normalizedToQString(Normalized&& path) + + VFS::Path::Normalized VFS::Path::normalizedFromQString(QStringView path) + { +- const auto tmp = path.toUtf8(); +- return Normalized{ tmp }; ++ const QByteArray tmp = path.toUtf8(); ++ return Normalized(std::string_view(tmp.constData(), tmp.size())); + } + + VFS::Path::Normalized VFS::Path::normalizedFromQString(QString&& path) + { +- const auto tmp = path.toUtf8(); +- return Normalized{ tmp }; ++ const QByteArray tmp = std::move(path).toUtf8(); ++ return Normalized(std::string_view(tmp.constData(), tmp.size())); + } +-- +2.51.0 + diff --git a/pkgs/by-name/op/openmw/package.nix b/pkgs/by-name/op/openmw/package.nix index 0720f976e1c7..35a9fa87bb99 100644 --- a/pkgs/by-name/op/openmw/package.nix +++ b/pkgs/by-name/op/openmw/package.nix @@ -85,6 +85,12 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-Eyjn3jPpo0d7XENg0Ea/3MN60lZBSUAMkz1UtTiIP80="; }; + patches = [ + # https://gitlab.com/OpenMW/openmw/-/merge_requests/4941 + # FIXME: Remove after next release + ./0001-Do-not-implicitly-convert-QByteArray-to-const-char.patch + ]; + postPatch = '' sed '1i#include ' -i components/myguiplatform/myguidatamanager.cpp # gcc12 ''