void-packages/srcpkgs/qt6-base/patches/musl-usr-path-hack.patch
2021-10-03 15:25:01 +02:00

25 lines
1,020 B
Diff

Source: @Johnnynator
Upsteam: No
Subject: Musl always returns /lib/libQt6Core.so.6 for Dl_info.dli_fname.
This also happens sometimes with qtwebengine on glibc.
This breaks qt6-webengine's search path for translations.
Using realpath instead would probably be a more correct solution.
---
diff --git qtbasesrc/corelib/global/qlibraryinfo.cpp qtbasesrc/corelib/global/qlibraryinfo.cpp
index 8bcf67e73d..28d7355310 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -558,6 +558,12 @@ static QString getRelocatablePrefix()
int result = dladdr(reinterpret_cast<void *>(&QLibraryInfo::isDebugBuild), &info);
if (result > 0 && info.dli_fname)
prefixPath = prefixFromQtCoreLibraryHelper(QString::fromLocal8Bit(info.dli_fname));
+#if 1
+ QDir preDir(prefixPath);
+ if (preDir.isRoot()) {
+ prefixPath = QStringLiteral("/usr");
+ }
+#endif
#elif defined(Q_OS_WIN)
HMODULE hModule = getWindowsModuleHandle();
const int kBufferSize = 4096;