diff --git a/src/DylibBundler.cpp b/src/DylibBundler.cpp index c3e041b..07bdb15 100644 --- a/src/DylibBundler.cpp +++ b/src/DylibBundler.cpp @@ -37,17 +37,24 @@ THE SOFTWARE. std::vector deps; +std::map > deps_per_file; +std::map deps_collected; std::set rpaths; std::map > rpaths_per_file; void changeLibPathsOnFile(std::string file_to_fix) { + if (deps_collected.find(file_to_fix) == deps_collected.end()) + { + collectDependencies(file_to_fix); + } std::cout << "\n* Fixing dependencies on " << file_to_fix.c_str() << std::endl; - const int dep_amount = deps.size(); + std::vector deps_in_file = deps_per_file[file_to_fix]; + const int dep_amount = deps_in_file.size(); for(int n=0; n deps_in_file = deps_per_file[filename]; + bool in_deps_per_file = false; + const int deps_in_file_amount = deps_in_file.size(); + for(int n=0; n& lines) // split output tokenize(output, "\n", &lines); + deps_collected[filename] = true; } @@ -216,7 +235,7 @@ void collectDependencies(std::string filename) collectRpathsForFilename(filename); } - addDependency(dep_path); + addDependency(dep_path, filename); } } void collectSubDependencies() @@ -248,12 +267,14 @@ void collectSubDependencies() // trim useless info, keep only library name std::string dep_path = lines[n].substr(1, lines[n].rfind(" (") - 1); + std::string full_path = dep_path; if (isRpath(dep_path)) { - collectRpathsForFilename(searchFilenameInRpaths(dep_path)); + full_path = searchFilenameInRpaths(dep_path); + collectRpathsForFilename(full_path); } - addDependency(dep_path); + addDependency(dep_path, full_path); }//next }//next