diff options
author | SCG82 <scg082+github@gmail.com> | 2020-10-08 12:20:19 +0300 |
---|---|---|
committer | SCG82 <scg082+github@gmail.com> | 2020-10-08 12:20:19 +0300 |
commit | dd677cec46b1eb8f096906d71c67572de491e8c2 (patch) | |
tree | 1aaa3529760f7e6be4396ec5497d2cab7cf4d350 | |
parent | c418a0cb2db37136326345ddf58a69c47fbe411b (diff) |
Ignore system libraries (fix for macOS 11)
-rw-r--r-- | src/DylibBundler.cpp | 3 | ||||
-rw-r--r-- | src/Settings.cpp | 10 | ||||
-rw-r--r-- | src/Settings.h | 3 |
3 files changed, 14 insertions, 2 deletions
diff --git a/src/DylibBundler.cpp b/src/DylibBundler.cpp index bb811dc..0eda069 100644 --- a/src/DylibBundler.cpp +++ b/src/DylibBundler.cpp @@ -252,6 +252,7 @@ void collectDependencies(std::string filename) // trim useless info, keep only library name std::string dep_path = lines[n].substr(1, lines[n].rfind(" (") - 1); + if (Settings::isSystemLibrary(dep_path)) continue; if (isRpath(dep_path)) { collectRpathsForFilename(filename); @@ -261,6 +262,7 @@ void collectDependencies(std::string filename) } deps_collected[filename] = true; } + void collectSubDependencies() { // print status to user @@ -290,6 +292,7 @@ void collectSubDependencies() // trim useless info, keep only library name std::string dep_path = lines[n].substr(1, lines[n].rfind(" (") - 1); + if (Settings::isSystemLibrary(dep_path)) continue; if (isRpath(dep_path)) { collectRpathsForFilename(searchFilenameInRpaths(dep_path)); diff --git a/src/Settings.cpp b/src/Settings.cpp index 5a74e0b..50f5221 100644 --- a/src/Settings.cpp +++ b/src/Settings.cpp @@ -76,6 +76,14 @@ void ignore_prefix(std::string prefix) prefixes_to_ignore.push_back(prefix); } +bool isSystemLibrary(std::string prefix) +{ + if(prefix.find("/usr/lib/") == 0) return true; + if(prefix.find("/System/Library/") == 0) return true; + + return false; +} + bool isPrefixIgnored(std::string prefix) { const int prefix_amount = prefixes_to_ignore.size(); @@ -91,7 +99,7 @@ bool isPrefixBundled(std::string prefix) { if(prefix.find(".framework") != std::string::npos) return false; if(prefix.find("@executable_path") != std::string::npos) return false; - if(prefix.compare("/usr/lib/") == 0) return false; + if(isSystemLibrary(prefix)) return false; if(isPrefixIgnored(prefix)) return false; return true; diff --git a/src/Settings.h b/src/Settings.h index f1e7040..512a8f6 100644 --- a/src/Settings.h +++ b/src/Settings.h @@ -29,7 +29,8 @@ THE SOFTWARE. namespace Settings { - + +bool isSystemLibrary(std::string prefix); bool isPrefixBundled(std::string prefix); bool isPrefixIgnored(std::string prefix); void ignore_prefix(std::string prefix); |