git-svn-id: svn://db.shs.com.ru/libs@868 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2020-03-20 07:47:31 +00:00
parent d3b1a0070c
commit ec4289811a

View File

@@ -31,9 +31,9 @@ void usage() {
piCout << "";
piCout << "Copy all dependencies of <file> to directory <out_path>";
piCout << "If <file> depend on QtCore library, then copy all basic Qt plugins, ";
piCout << "<styles> and <platform>";
piCout << "<styles> and <platforms>";
piCout << "";
piCout << Green << Bold << "Usage:" << Default << "\"deploy_tool [-hvfC] <-o <out_path> | --dependencies [--prefix <text>] > [-p <qt_plugins>] [-s <search_path>] [-S <styles>] [-l <ldd>] [-D <dpkg>] [-L <readelf> | -W <objdump> | -M <otool>] [-d <depth>] [-q <qtdir>] [-a <add_libs>] [-S <styles>] [-P <platforms>] <file>\"" << NewLine;
piCout << Green << Bold << "Usage:" << Default << "\"deploy_tool [-hvfC] [--dependencies [--prefix <text>]] [-p <qt_plugins>] [-s <search_path>] [-S <styles>] [-l <ldd>] [-D <dpkg>] [-L <readelf> | -W <objdump> | -M <otool>] [-d <depth>] [-q <qtdir>] [-a <add_libs>] [-S <styles>] [-P <platforms>] -o <out_path> <file> [<file2> ...]\"" << NewLine;
piCout << Green << Bold << "Details:";
piCout << Bold << "Debug control";
piCout << "-h " << Green << "- display this message and exit";
@@ -55,11 +55,11 @@ void usage() {
piCout << Bold << "Output control";
piCout << "-o <out_path> " << Green << "- path for libraries copy to";
piCout << "-p <qt_plugins> " << Green << "- path for Qt plugins, default \"<out_path>/plugins\"";
piCout << "--dependencies " << Green << "- don`t copy, only search dependencies by <dpkg> and print them";
piCout << "--dependencies " << Green << "- search dependencies by <dpkg>, print them and copy missing libraries";
piCout << "--prefix <text> " << Green << "- print <text> before dependencies";
piCout << "";
piCout << Bold << "Input control";
piCout << "<file> " << Green << "- executable to process";
piCout << "<file> ... " << Green << "- executable to process";
piCout << "-S <styles> " << Green << "- add Qt styles (e.g. \"oxygen,breeze\"), default \"\"";
piCout << "-P <platforms> " << Green << "- add Qt platforms (e.g. \"win,mini\"), default by host system";
piCout << "-a <add_libs> " << Green << "- additional libs, separated by \";\"";
@@ -281,7 +281,7 @@ void procQt() {
}
void procDpkg(const PIString & l) {
bool procDpkg(const PIString & l) {
PIString vs, cmd = dpkg + " -S " + l + " 2> /dev/null";
FILE * fp = popen(cmd.dataAscii(), "r");
if (fp) {
@@ -299,8 +299,10 @@ void procDpkg(const PIString & l) {
vs = vs.left(vs.find(":"));
if (!vs.isEmpty())
all_deps << vs;
} else
piCout << "No dep on" << l;
return true;
}
//piCout << "No dep on" << l;
return false;
}
@@ -327,8 +329,7 @@ int main(int argc, char * argv[]) {
cli.addArgument("depth", true);
cli.addArgument("qtdir", true);
cli.addArgument("add_libs", true);
is_deps = cli.hasArgument("dependencies");
if (cli.hasArgument("help") || (cli.argumentValue("output").isEmpty() && !is_deps) || (cli.optionalArguments().size_s() != 1)) {
if (cli.hasArgument("help") || cli.argumentValue("output").isEmpty() || (cli.optionalArguments().size_s() < 1)) {
usage();
return 0;
}
@@ -336,6 +337,7 @@ int main(int argc, char * argv[]) {
fake = cli.hasArgument("fake");
piDebug = cli.hasArgument("verbose");
is_deps = cli.hasArgument("dependencies");
PIString bin = cli.optionalArguments()[0];
out_dir = cli.argumentValue("output");
lib_dirs = cli.argumentValue("search_path").split(";");
@@ -373,7 +375,7 @@ int main(int argc, char * argv[]) {
if (!out_dir.endsWith("/")) out_dir += "/";
if (ldd.isEmpty()) ldd = "/usr/bin/ldd";
styles = cli.argumentValue("Styles").split(",");
if (!fake && !is_deps)
if (!fake)
PIDir(out_dir).make();
if (!cli.argumentValue("depth").isEmpty())
depth = cli.argumentValue("depth").toInt();
@@ -396,9 +398,10 @@ int main(int argc, char * argv[]) {
#ifdef WINDOWS
l.replaceAll("/", "\\");
#endif
bool need_cp = true;
if (is_deps)
procDpkg(l);
else {
need_cp = !procDpkg(l);
if (need_cp) {
piCout << "copy" << l;
if (!fake)
system(cmd_copy + "\"" + l + "\" \"" + out_dir + "\"" + cmd_suffix);