diff options
author | Morten Johan Sørvig <morten.sorvig@qt.io> | 2020-09-22 16:33:55 +0200 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2020-10-05 13:48:44 +0200 |
commit | ee8a9a0c7e7f69bece49fa410cd8e6866c1cc706 (patch) | |
tree | ebdc60e77a6346f8082daf320229a5f0e9a50366 | |
parent | f06517c8c235984f75a647d95b92cb52c60615f7 (diff) |
Remove macchangeqt from Qt 6
This is macdeployqt’s lesser known cousin, which implemented
support for changing which Qt build an app would load.
Today, this can be accomplished by changing the LC_RPATH
loader command, or by writing a small script which
automates the necessary otool usage.
Change-Id: I01d8e3f89551d2becc2865be68728ca57870ac9c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
-rw-r--r-- | src/macdeployqt/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/macdeployqt/macchangeqt/CMakeLists.txt | 13 | ||||
-rw-r--r-- | src/macdeployqt/macchangeqt/macchangeqt.pro | 5 | ||||
-rw-r--r-- | src/macdeployqt/macchangeqt/main.cpp | 63 | ||||
-rw-r--r-- | src/macdeployqt/macdeployqt.pro | 2 | ||||
-rw-r--r-- | src/macdeployqt/shared/shared.cpp | 32 | ||||
-rw-r--r-- | src/macdeployqt/shared/shared.h | 3 |
7 files changed, 1 insertions, 118 deletions
diff --git a/src/macdeployqt/CMakeLists.txt b/src/macdeployqt/CMakeLists.txt index e7f8e753e..cbce4e4ca 100644 --- a/src/macdeployqt/CMakeLists.txt +++ b/src/macdeployqt/CMakeLists.txt @@ -4,4 +4,3 @@ if(NOT QT_FEATURE_macdeployqt) return() endif() add_subdirectory(macdeployqt) -add_subdirectory(macchangeqt) diff --git a/src/macdeployqt/macchangeqt/CMakeLists.txt b/src/macdeployqt/macchangeqt/CMakeLists.txt deleted file mode 100644 index d6fe040d0..000000000 --- a/src/macdeployqt/macchangeqt/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -# Generated from macchangeqt.pro. - -##################################################################### -## macchangeqt App: -##################################################################### - -qt_internal_add_app(macchangeqt - SOURCES - ../shared/shared.cpp - main.cpp - PUBLIC_LIBRARIES - ${FWCoreFoundation} -) diff --git a/src/macdeployqt/macchangeqt/macchangeqt.pro b/src/macdeployqt/macchangeqt/macchangeqt.pro deleted file mode 100644 index bf195f89a..000000000 --- a/src/macdeployqt/macchangeqt/macchangeqt.pro +++ /dev/null @@ -1,5 +0,0 @@ -SOURCES += main.cpp ../shared/shared.cpp -QT = core -LIBS += -framework CoreFoundation - -load(qt_app) diff --git a/src/macdeployqt/macchangeqt/main.cpp b/src/macdeployqt/macchangeqt/main.cpp deleted file mode 100644 index 803012383..000000000 --- a/src/macdeployqt/macchangeqt/main.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "../shared/shared.h" - -int main(int argc, char **argv) -{ - // useDebugLibs should always be false because even if set all Qt - // libraries inside a binary to point to debug versions, as soon as - // one of them loads a Qt plugin, the plugin itself will load the - // release version of Qt, and as such, the app will crash. - bool useDebugLibs = false; - - int optionsSpecified = 0; - for (int i = 2; i < argc; ++i) { - QByteArray argument = QByteArray(argv[i]); - if (argument.startsWith(QByteArray("-verbose="))) { - LogDebug() << "Argument found:" << argument; - optionsSpecified++; - int index = argument.indexOf("="); - bool ok = false; - int number = argument.mid(index+1).toInt(&ok); - if (!ok) - LogError() << "Could not parse verbose level"; - else - logLevel = number; - } - } - - if (argc != (3 + optionsSpecified)) { - qDebug() << "Changeqt: changes which Qt frameworks an application links against."; - qDebug() << "Usage: changeqt app-bundle qt-dir <-verbose=[0-3]>"; - return 0; - } - - const QString appPath = QString::fromLocal8Bit(argv[1]); - const QString qtPath = QString::fromLocal8Bit(argv[2]); - changeQtFrameworks(appPath, qtPath, useDebugLibs); -} diff --git a/src/macdeployqt/macdeployqt.pro b/src/macdeployqt/macdeployqt.pro index eb2c8dbd7..961b08202 100644 --- a/src/macdeployqt/macdeployqt.pro +++ b/src/macdeployqt/macdeployqt.pro @@ -3,4 +3,4 @@ QT_FOR_CONFIG += tools-private requires(qtConfig(macdeployqt)) TEMPLATE = subdirs -SUBDIRS = macdeployqt macchangeqt +SUBDIRS = macdeployqt diff --git a/src/macdeployqt/shared/shared.cpp b/src/macdeployqt/shared/shared.cpp index 8b15245ba..e72ca8e4a 100644 --- a/src/macdeployqt/shared/shared.cpp +++ b/src/macdeployqt/shared/shared.cpp @@ -1353,38 +1353,6 @@ bool deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInf return true; } -void changeQtFrameworks(const QList<FrameworkInfo> frameworks, const QStringList &binaryPaths, const QString &absoluteQtPath) -{ - LogNormal() << "Changing" << binaryPaths << "to link against"; - LogNormal() << "Qt in" << absoluteQtPath; - QString finalQtPath = absoluteQtPath; - - if (!absoluteQtPath.startsWith("/Library/Frameworks")) - finalQtPath += "/lib/"; - - foreach (FrameworkInfo framework, frameworks) { - const QString oldBinaryId = framework.installName; - const QString newBinaryId = finalQtPath + framework.frameworkName + framework.binaryPath; - foreach (const QString &binary, binaryPaths) - changeInstallName(oldBinaryId, newBinaryId, binary); - } -} - -void changeQtFrameworks(const QString appPath, const QString &qtPath, bool useDebugLibs) -{ - const QString appBinaryPath = findAppBinary(appPath); - const QStringList libraryPaths = findAppLibraries(appPath); - const QList<FrameworkInfo> frameworks = getQtFrameworksForPaths(QStringList() << appBinaryPath << libraryPaths, appPath, getBinaryRPaths(appBinaryPath, true), useDebugLibs); - if (frameworks.isEmpty()) { - LogWarning(); - LogWarning() << "Could not find any _external_ Qt frameworks to change in" << appPath; - return; - } else { - const QString absoluteQtPath = QDir(qtPath).absolutePath(); - changeQtFrameworks(frameworks, QStringList() << appBinaryPath << libraryPaths, absoluteQtPath); - } -} - void codesignFile(const QString &identity, const QString &filePath) { if (!runCodesign) diff --git a/src/macdeployqt/shared/shared.h b/src/macdeployqt/shared/shared.h index ab28360d5..15ff08430 100644 --- a/src/macdeployqt/shared/shared.h +++ b/src/macdeployqt/shared/shared.h @@ -111,9 +111,6 @@ public: inline QDebug operator<<(QDebug debug, const ApplicationBundleInfo &info); -void changeQtFrameworks(const QString appPath, const QString &qtPath, bool useDebugLibs); -void changeQtFrameworks(const QList<FrameworkInfo> frameworks, const QStringList &binaryPaths, const QString &qtPath); - OtoolInfo findDependencyInfo(const QString &binaryPath); FrameworkInfo parseOtoolLibraryLine(const QString &line, const QString &appBundlePath, const QSet<QString> &rpaths, bool useDebugLibs); QString findAppBinary(const QString &appBundlePath); |