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 Dec 19, 2024
1 parent 2dc91c6 commit c531684
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 1 deletion.
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 @@ -22,6 +22,7 @@ set(${PORT}_PATCHES
fix-host-aliasing.patch
fix_deploy_windows.patch
fix-link-lib-discovery.patch
macdeployqt-symlinks.patch
)

if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
Expand Down
1 change: 1 addition & 0 deletions ports/qtbase/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "qtbase",
"version": "6.8.1",
"port-version": 1,
"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 @@ -7566,7 +7566,7 @@
},
"qtbase": {
"baseline": "6.8.1",
"port-version": 0
"port-version": 1
},
"qtcharts": {
"baseline": "6.8.1",
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": "aca356b06f62fc44f51769ef5418230a385e3c7f",
"version": "6.8.1",
"port-version": 1
},
{
"git-tree": "15eabae75af5ff861ffa692ff8072aca9af30fad",
"version": "6.8.1",
Expand Down

0 comments on commit c531684

Please sign in to comment.