macdeployqt: Simplify code in changeInstallName

This commit is contained in:
Jonas Kvinge 2021-08-19 19:15:40 +02:00
parent 46d927291c
commit b071a4df70
1 changed files with 4 additions and 10 deletions

View File

@ -858,17 +858,11 @@ void changeInstallName(const QString &bundlePath, const FrameworkInfo &framework
} else {
deployedInstallName = framework.deployedInstallName;
}
changeInstallName(framework.installName, deployedInstallName, binary);
// Workaround for the case when the library ID name is a symlink, while the dependencies
// specified using the canonical path to the library (QTBUG-56814)
QString canonicalInstallName = QFileInfo(framework.installName).canonicalFilePath();
if (!canonicalInstallName.isEmpty() && canonicalInstallName != framework.installName) {
changeInstallName(canonicalInstallName, deployedInstallName, binary);
if (!framework.sourceFilePath.isEmpty()) {
changeInstallName(framework.sourceFilePath, deployedInstallName, binary);
}
// Homebrew workaround, resolve symlink /usr/local/opt/library to /usr/local/Cellar/library
if (framework.installName.startsWith("/usr/local/opt/") && framework.installName.count('/') >= 5) {
canonicalInstallName = QFileInfo(framework.installName.section('/', 0, 4)).canonicalFilePath() + "/" + framework.installName.section('/', 5);
changeInstallName(canonicalInstallName, deployedInstallName, binary);
if (!framework.installName.isEmpty() && framework.installName != framework.sourceFilePath) {
changeInstallName(framework.installName, deployedInstallName, binary);
}
}
}