Skip to content

Commit

Permalink
[qtbase] fix macdeployqt for symlinks
Browse files Browse the repository at this point in the history
when building for *-osx-dynamic, symlinks to handle version suffix are created for the shared libs. Macdeployqt does not preserve the symlinks, which results in multiple copies of the same library causing crashes.
  • Loading branch information
m-kuhn committed Nov 29, 2024
1 parent cd124b8 commit 99c6889
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 2 deletions.
33 changes: 33 additions & 0 deletions ports/qtbase/macdeployqt-symlinks.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
diff --git a/src/tools/macdeployqt/shared/shared.cpp b/src/tools/macdeployqt/shared/shared.cpp
index 6ff269b..caffd44 100644
--- a/src/tools/macdeployqt/shared/shared.cpp
+++ b/src/tools/macdeployqt/shared/shared.cpp
@@ -1,4 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
+
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QCoreApplication>
#include <QString>
@@ -85,7 +86,21 @@
}
}

- if (QFile::copy(from, to)) {
+ QFileInfo fromFileInfo(from);
+
+ if (fromFileInfo.isSymLink()) {
+ const QString fromSymLinkTarget = fromFileInfo.absoluteDir().relativeFilePath(fromFileInfo.symLinkTarget());
+ if (QFile::link(fromSymLinkTarget, to)) {
+ return copyFilePrintStatus(fromFileInfo.absoluteDir().absoluteFilePath(fromSymLinkTarget), QFileInfo(to).absoluteDir().absoluteFilePath(fromSymLinkTarget));
+ }
+ else {
+ LogError() << "symlink copy failed from" << from;
+ LogError() << " to" << to;
+ return false;
+ }
+
+ }
+ else if (QFile::copy(from, to)) {
QFile dest(to);
dest.setPermissions(dest.permissions() | QFile::WriteOwner | QFile::WriteUser);
LogNormal() << " copied:" << from;
1 change: 1 addition & 0 deletions ports/qtbase/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ set(${PORT}_PATCHES
fix_deploy_windows.patch
fix-link-lib-discovery.patch
fix-missing-symbol.patch
macdeployqt-symlinks.patch
)

if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
Expand Down
2 changes: 1 addition & 1 deletion ports/qtbase/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "qtbase",
"version": "6.8.0",
"port-version": 2,
"port-version": 3,
"description": "Qt Base (Core, Gui, Widgets, Network, ...)",
"homepage": "https://www.qt.io/",
"license": null,
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -7554,7 +7554,7 @@
},
"qtbase": {
"baseline": "6.8.0",
"port-version": 2
"port-version": 3
},
"qtcharts": {
"baseline": "6.8.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/q-/qtbase.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "123c3d304d12eb8957cae06ef1aacc5167a50552",
"version": "6.8.0",
"port-version": 3
},
{
"git-tree": "2fa35617d1e8e0f1ab1d7ace5e16fd91b8e6746c",
"version": "6.8.0",
Expand Down

0 comments on commit 99c6889

Please sign in to comment.