diff --git a/deploy_tool/main.cpp b/deploy_tool/main.cpp index 147a7f0..bd5df2d 100644 --- a/deploy_tool/main.cpp +++ b/deploy_tool/main.cpp @@ -31,9 +31,9 @@ void usage() { piCout << ""; piCout << "Copy all dependencies of to directory "; piCout << "If depend on QtCore library, then copy all basic Qt plugins, "; - piCout << " and "; + piCout << " and "; piCout << ""; - piCout << Green << Bold << "Usage:" << Default << "\"deploy_tool [-hvfC] <-o | --dependencies [--prefix ] > [-p ] [-s ] [-S ] [-l ] [-D ] [-L | -W | -M ] [-d ] [-q ] [-a ] [-S ] [-P ] \"" << NewLine; + piCout << Green << Bold << "Usage:" << Default << "\"deploy_tool [-hvfC] [--dependencies [--prefix ]] [-p ] [-s ] [-S ] [-l ] [-D ] [-L | -W | -M ] [-d ] [-q ] [-a ] [-S ] [-P ] -o [ ...]\"" << 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 " << Green << "- path for libraries copy to"; piCout << "-p " << Green << "- path for Qt plugins, default \"/plugins\""; - piCout << "--dependencies " << Green << "- don`t copy, only search dependencies by and print them"; + piCout << "--dependencies " << Green << "- search dependencies by , print them and copy missing libraries"; piCout << "--prefix " << Green << "- print before dependencies"; piCout << ""; piCout << Bold << "Input control"; - piCout << " " << Green << "- executable to process"; + piCout << " ... " << Green << "- executable to process"; piCout << "-S " << Green << "- add Qt styles (e.g. \"oxygen,breeze\"), default \"\""; piCout << "-P " << Green << "- add Qt platforms (e.g. \"win,mini\"), default by host system"; piCout << "-a " << 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);