git-svn-id: svn://db.shs.com.ru/pip@1037 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2020-04-16 13:50:39 +00:00
parent 1829bdf666
commit 4fcf476c4d

View File

@@ -110,7 +110,7 @@ QtDep qt_deps[] = {
int depth = 5; int depth = 5;
bool fake = false, is_ldd = true, is_deps = false, need_qt = false; bool fake = false, is_ldd = true, is_deps = false, need_qt = false;
PIString ldd, readelf, objdump, otool, dpkg, nametool, out_dir, qt_dir, out_plugins_dir; PIString ldd, readelf, objdump, otool, dpkg, nametool, out_dir, qt_dir, out_plugins_dir;
PIStringList styles, lib_dirs, add_libs, platforms, sqldrivers; PIStringList styles, lib_dirs, add_libs, platforms, sqldrivers, input_files;
PISet<PIString> all_libs, miss_libs, all_deps, frameworks, framework_libs, miss_frameworks, qt_plugins, ignore_libs; PISet<PIString> all_libs, miss_libs, all_deps, frameworks, framework_libs, miss_frameworks, qt_plugins, ignore_libs;
PIMap<PIString, PIStringList> qt_filters; PIMap<PIString, PIStringList> qt_filters;
@@ -395,7 +395,7 @@ void patchNameTool() {
if (!dlibs.isEmpty()) { if (!dlibs.isEmpty()) {
execute("chmod +w \"" + local_lib + "\""); execute("chmod +w \"" + local_lib + "\"");
} }
PICout(DefaultControls) << "patch" << local_lib; piCout << "patch" << local_lib;
piForeach (PIString sys_lib, dlibs) { piForeach (PIString sys_lib, dlibs) {
sys_lib.cutRight(1).trim(); sys_lib.cutRight(1).trim();
fi.path = sys_lib; fi.path = sys_lib;
@@ -404,23 +404,28 @@ void patchNameTool() {
PIString new_path; PIString new_path;
if (all_libs.contains(fl)) { if (all_libs.contains(fl)) {
new_path = "@executable_path/../Frameworks/" + libname; new_path = "@executable_path/../Frameworks/" + libname;
PICout(DefaultControls) << " depend on lib" << fl; piCout << " depend on lib" << fl;
} }
if (frameworks.contains(fname)) { if (frameworks.contains(fname)) {
fl = findLib(fname); fl = findLib(fname);
if (fl.isEmpty()) continue; if (fl.isEmpty()) continue;
new_path = "@executable_path/../Frameworks/" + fname + "/" + frameworkInternalPath(sys_lib); new_path = "@executable_path/../Frameworks/" + fname + "/" + frameworkInternalPath(sys_lib);
PICout(DefaultControls) << " depend on framework" << fl; piCout << " depend on framework" << fl;
} }
if (!new_path.isEmpty()) { if (!new_path.isEmpty() && (sys_lib != new_path)) {
cmd = nametool + " -change \"" + sys_lib + "\""; cmd = nametool + " -change \"" + sys_lib + "\"";
cmd += " \"" + new_path + "\""; cmd += " \"" + new_path + "\"";
cmd += " \"" + local_lib + "\""; cmd += " \"" + local_lib + "\"";
//PICout(DefaultControls) << " " << cmd; //piCout << " " << cmd;
execute(cmd); execute(cmd);
} }
} }
} }
piForeach (PIString bin, input_files) {
cmd = nametool + " -add_rpath \"@executable_path/../Frameworks\"";
cmd += " \"" + bin + "\"";
execute(cmd);
}
} }
@@ -552,21 +557,20 @@ int main(int argc, char * argv[]) {
if (!cli.argumentValue("depth").isEmpty()) if (!cli.argumentValue("depth").isEmpty())
depth = cli.argumentValue("depth").toInt(); depth = cli.argumentValue("depth").toInt();
PIStringList files;
cli.optionalArguments().forEach([&](const PIString & a){ cli.optionalArguments().forEach([&](const PIString & a){
if (PIDir::isExists(a)) { if (PIDir::isExists(a)) {
PIDir(a).allEntries().forEach([&](const PIFile::FileInfo & fi){ PIDir(a).allEntries().forEach([&](const PIFile::FileInfo & fi){
if (fi.isFile()) if (fi.isFile())
files << fi.path; input_files << fi.path;
}); });
} else { } else {
if (PIFile::isExists(a)) if (PIFile::isExists(a))
files << a; input_files << a;
} }
}); });
//piCout << files; //piCout << files;
if (depth > 0) if (depth > 0)
files.forEach([&](const PIString & f){procLdd(f);}); input_files.forEach([&](const PIString & f){procLdd(f);});
piForeach (PIString & s, add_libs) { piForeach (PIString & s, add_libs) {
if (s.isEmpty()) continue; if (s.isEmpty()) continue;
piCout << s << "->" << findLib(s); piCout << s << "->" << findLib(s);