From b6dc294e667648c3eeaf4d6f97bd175990b0ae30 Mon Sep 17 00:00:00 2001 From: SCG82 Date: Sun, 29 Dec 2019 15:51:16 -0800 Subject: [PATCH] handle qt plugins from latest version. refine algorithm to run qt plugin fixer if any new deps are found when checking sub-deps --- src/Dependency.cpp | 4 +-- src/DylibBundler.cpp | 63 +++++++++++++++++++++++++++----------------- src/main.cpp | 1 - 3 files changed, 41 insertions(+), 27 deletions(-) diff --git a/src/Dependency.cpp b/src/Dependency.cpp index f46d93b..c51e4fe 100644 --- a/src/Dependency.cpp +++ b/src/Dependency.cpp @@ -177,10 +177,10 @@ bool Dependency::mergeIfSameAs(Dependency& dep2) void Dependency::print() { - std::cout << "\n* " << filename << " from " << prefix << "\n"; + std::cout << "\n* " << filename << " from " << prefix << std::endl; for (size_t n=0; n " << symlinks[n] << "\n"; + std::cout << " symlink --> " << symlinks[n] << std::endl; } } diff --git a/src/DylibBundler.cpp b/src/DylibBundler.cpp index 608418c..df1e01e 100644 --- a/src/DylibBundler.cpp +++ b/src/DylibBundler.cpp @@ -23,6 +23,7 @@ std::set frameworks; std::set rpaths; std::map> rpaths_per_file; std::map rpath_to_fullpath; +bool qt_plugins_called = false; void initRpaths() { @@ -42,8 +43,9 @@ void changeLibPathsOnFile(std::string file_to_fix) std::cout << "* Fixing dependencies on " << file_to_fix << "\n"; const int dep_amount = deps_per_file[file_to_fix].size(); - for (size_t n=0; n::iterator it = frameworks.begin(); it != frameworks.end(); ++it) { @@ -436,6 +447,10 @@ void copyQtPlugins() qtPositioningFound = true; if (framework.find("QtLocation") != std::string::npos) qtLocationFound = true; + if (framework.find("TextToSpeech") != std::string::npos) + qtTextToSpeechFound = true; + if (framework.find("WebView") != std::string::npos) + qtWebViewFound = true; } if (!qtCoreFound) @@ -450,13 +465,15 @@ void copyQtPlugins() std::string prefix = filePrefix(framework_root); std::string qt_prefix = filePrefix(prefix.substr(0, prefix.size()-1)); std::string qt_plugins_prefix = qt_prefix + "plugins/"; - mkdir(dest + plugin); - copyFile(qt_plugins_prefix + plugin, dest); - std::vector files = lsDir(dest + plugin+"/"); - for (const auto& file : files) { - Settings::addFileToFix(dest + plugin+"/"+file); - collectDependencies(dest + plugin+"/"+file); - changeId(dest + plugin+"/"+file, "@rpath/" + plugin+"/"+file); + if (fileExists(qt_plugins_prefix + plugin)) { + mkdir(dest + plugin); + copyFile(qt_plugins_prefix + plugin, dest); + std::vector files = lsDir(dest + plugin+"/"); + for (const auto& file : files) { + Settings::addFileToFix(dest + plugin+"/"+file); + collectDependencies(dest + plugin+"/"+file); + changeId(dest + plugin+"/"+file, "@rpath/" + plugin+"/"+file); + } } }; @@ -473,8 +490,13 @@ void copyQtPlugins() fixupPlugin("printsupport"); fixupPlugin("styles"); fixupPlugin("imageformats"); + fixupPlugin("iconengines"); if (!qtSvgFound) systemp("rm -f " + dest + "imageformats/libqsvg.dylib"); + if (qtGuiFound) { + fixupPlugin("platforminputcontexts"); + fixupPlugin("virtualkeyboard"); + } if (qtNetworkFound) fixupPlugin("bearer"); if (qtSqlFound) @@ -493,17 +515,10 @@ void copyQtPlugins() fixupPlugin("position"); if (qtLocationFound) fixupPlugin("geoservices"); + if (qtTextToSpeechFound) + fixupPlugin("texttospeech"); + if (qtWebViewFound) + fixupPlugin("webview"); - if (Settings::verboseOutput()) { - std::cout << "(post qt) # OF FILES: " << Settings::filesToFixCount() << std::endl; - std::cout << "(post qt) # OF DEPS: " << deps.size() << std::endl; - } - - // TODO: evaluate deps of Qt plugins to see if this can be skipped collectSubDependencies(); - - if (Settings::verboseOutput()) { - std::cout << "(post qt, post sub) # OF FILES: " << Settings::filesToFixCount() << std::endl; - std::cout << "(post qt, post sub) # OF DEPS: " << deps.size() << std::endl; - } } diff --git a/src/main.cpp b/src/main.cpp index 89a5a74..cdeb241 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -133,7 +133,6 @@ int main (int argc, char * const argv[]) collectDependencies(Settings::fileToFix(n)); collectSubDependencies(); - copyQtPlugins(); doneWithDeps_go(); return 0;