deploy tool unchained from "grep" and support qt6
This commit is contained in:
@@ -207,10 +207,19 @@ PIString execute(const PIString & cmd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PIStringList filter(const PIString & in, const PIString & f) {
|
||||||
|
PIStringList ret, lines = in.split("\n");
|
||||||
|
for (const PIString & l: lines)
|
||||||
|
if (l.contains(f)) ret << l.trimmed();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void checkQtLib(PIString lib) {
|
void checkQtLib(PIString lib) {
|
||||||
PIString base = lib.toLowerCase(), pref, suff;
|
PIString base = lib.toLowerCase(), pref, suff;
|
||||||
if (base.startsWith("lib")) {pref += "lib"; base.cutLeft(3);}
|
if (base.startsWith("lib")) {pref += "lib"; base.cutLeft(3);}
|
||||||
if (base.startsWith("qt5")) {pref += "Qt5"; base.cutLeft(3);}
|
if (base.startsWith("qt5")) {pref += "Qt5"; base.cutLeft(3);}
|
||||||
|
if (base.startsWith("qt6")) {pref += "Qt6"; base.cutLeft(3);}
|
||||||
if (base.startsWith("qt" )) {pref += "Qt" ; base.cutLeft(2);}
|
if (base.startsWith("qt" )) {pref += "Qt" ; base.cutLeft(2);}
|
||||||
if (base.find('.') >= 0) {suff = base.right(base.size_s() - base.find('.')); base = base.left(base.find('.'));}
|
if (base.find('.') >= 0) {suff = base.right(base.size_s() - base.find('.')); base = base.left(base.find('.'));}
|
||||||
for (int i = 0; ; ++i) {
|
for (int i = 0; ; ++i) {
|
||||||
@@ -244,44 +253,34 @@ void procLdd(PIString file, bool ext_lib = false, int cur_depth = 0) {
|
|||||||
}
|
}
|
||||||
PIStringList lines;
|
PIStringList lines;
|
||||||
if (is_ldd) {
|
if (is_ldd) {
|
||||||
lines = execute(ldd + " " + file).split("\n");
|
lines = execute(ldd + " \"" + file + "\"").split("\n");
|
||||||
} else {
|
} else {
|
||||||
PIString cmd;
|
PIString cmd;
|
||||||
if (!readelf.isEmpty()) {
|
if (!readelf.isEmpty()) {
|
||||||
cmd = readelf + " -a " + file;
|
lines = filter(execute(readelf + " -a \"" + file + "\""), "Shared library:");
|
||||||
cmd += " | grep \"Shared library:\" | grep -oG \"\\[.*\\]\"";
|
for (PIString & l: lines) {
|
||||||
|
l.cutRight(1);
|
||||||
|
l.cutLeft(l.find('[') + 1);
|
||||||
|
l.trim();//.append('.').prepend('.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!objdump.isEmpty()) {
|
if (!objdump.isEmpty()) {
|
||||||
cmd = objdump + " -p " + file;
|
PIString out = execute(objdump + " -p \"" + file + "\"");
|
||||||
cmd += " | grep \"DLL Name:\"";
|
lines = filter(out, "DLL Name:");
|
||||||
lines = execute(cmd).split("\n");
|
lines << filter(out, "NEEDED");
|
||||||
cmd = objdump + " -p " + file;
|
for (PIString & l: lines) {
|
||||||
cmd += " | grep \"NEEDED\"";
|
if (l.startsWith("DLL")) l.cutLeft(9);
|
||||||
lines << execute(cmd).split("\n");
|
else l.cutLeft(6);
|
||||||
cmd.clear();
|
l.trim();//.append('.').prepend('.');
|
||||||
}
|
|
||||||
if (!otool.isEmpty()) {
|
|
||||||
cmd = otool + " -L " + file;
|
|
||||||
cmd += " | grep -o \".*(\"";
|
|
||||||
}
|
|
||||||
//piCout << cmd;
|
|
||||||
if (!cmd.isEmpty())
|
|
||||||
lines = execute(cmd).split("\n");
|
|
||||||
if (!objdump.isEmpty()) {
|
|
||||||
piForeach (PIString & l, lines) {
|
|
||||||
l.trim();
|
|
||||||
if (l.startsWith("DLL")) l.cutLeft(9).trim();
|
|
||||||
else l.cutLeft(6).trim();
|
|
||||||
l.append('.').prepend('.');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!otool.isEmpty()) {
|
if (!otool.isEmpty()) {
|
||||||
|
lines = filter(execute(otool + " -L \"" + file + "\""), "(");
|
||||||
piForeach (PIString & l, lines) {
|
piForeach (PIString & l, lines) {
|
||||||
l.trim().cutRight(1).trim();
|
l = l.left(l.find('('));
|
||||||
l.append('.').prepend('.');
|
l.trim();//.append('.').prepend('.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//piCout << "readelf:" << vs;
|
|
||||||
}
|
}
|
||||||
piForeachC (PIString & sl, lines) {
|
piForeachC (PIString & sl, lines) {
|
||||||
PIString l = sl.trimmed();
|
PIString l = sl.trimmed();
|
||||||
@@ -305,7 +304,7 @@ void procLdd(PIString file, bool ext_lib = false, int cur_depth = 0) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
l.cutLeft(1).cutRight(1).trim();
|
//l.cutLeft(1).cutRight(1).trim();
|
||||||
if (l.isEmpty()) continue;
|
if (l.isEmpty()) continue;
|
||||||
if (!otool.isEmpty()) {
|
if (!otool.isEmpty()) {
|
||||||
if (!l.startsWith("/usr/local/")) {
|
if (!l.startsWith("/usr/local/")) {
|
||||||
@@ -379,7 +378,7 @@ void procQt() {
|
|||||||
PIString qloc = l.trim();
|
PIString qloc = l.trim();
|
||||||
piCout << "Qt" << qv << "in" << qloc;
|
piCout << "Qt" << qv << "in" << qloc;
|
||||||
PIString qdir;
|
PIString qdir;
|
||||||
PIStringList suffixes({".", "..", "qt5", "../qt5"});
|
PIStringList suffixes({".", "..", "qt5", "../qt5", "qt6", "../qt6"});
|
||||||
piForeachC (PIString s, suffixes) {
|
piForeachC (PIString s, suffixes) {
|
||||||
PIString qd = qloc + "/" + s + "/plugins/";
|
PIString qd = qloc + "/" + s + "/plugins/";
|
||||||
if (piDebug) PICout(AddSpaces) << "Qt plugins root try" << qd << "...";
|
if (piDebug) PICout(AddSpaces) << "Qt plugins root try" << qd << "...";
|
||||||
@@ -392,17 +391,6 @@ void procQt() {
|
|||||||
}
|
}
|
||||||
if (qdir.isEmpty())
|
if (qdir.isEmpty())
|
||||||
break;
|
break;
|
||||||
/*#ifdef WINDOWS
|
|
||||||
if (qt_dir.isEmpty())
|
|
||||||
qdir += "/../plugins/";
|
|
||||||
else
|
|
||||||
qdir += "/plugins/";
|
|
||||||
#else
|
|
||||||
if (qt_dir.isEmpty())
|
|
||||||
qdir += "/qt5/plugins/";
|
|
||||||
else
|
|
||||||
qdir += "/plugins/";
|
|
||||||
#endif*/
|
|
||||||
piForeachC (PIString & plugin, pdirs) {
|
piForeachC (PIString & plugin, pdirs) {
|
||||||
PIStringList filters = qt_filters[plugin];
|
PIStringList filters = qt_filters[plugin];
|
||||||
piForeachC (PIString & f, filters) {
|
piForeachC (PIString & f, filters) {
|
||||||
@@ -471,9 +459,11 @@ void patchNameTool() {
|
|||||||
//PICout(DefaultControls) << "map" << f << "->" << (out_dir + frameworkName(f) + "/" + frameworkInternalPath(f));
|
//PICout(DefaultControls) << "map" << f << "->" << (out_dir + frameworkName(f) + "/" + frameworkInternalPath(f));
|
||||||
}
|
}
|
||||||
piForeach (PIString local_lib, patch_list) {
|
piForeach (PIString local_lib, patch_list) {
|
||||||
cmd = otool + " -L \"" + local_lib;
|
dlibs = filter(execute(otool + " -L \"" + local_lib + "\""), "(");
|
||||||
cmd += "\" | grep -o \".*(\"";
|
piForeach (PIString & l, dlibs) {
|
||||||
dlibs = execute(cmd).split("\n");
|
l = l.left(l.find('('));
|
||||||
|
l.trim();
|
||||||
|
}
|
||||||
if (!dlibs.isEmpty()) {
|
if (!dlibs.isEmpty()) {
|
||||||
execute("chmod +w \"" + local_lib + "\"");
|
execute("chmod +w \"" + local_lib + "\"");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user