deploy_tool qt-plugins-dir

This commit is contained in:
2021-04-18 16:59:47 +03:00
parent 2b28a46aae
commit dd080ed5e0

View File

@@ -64,46 +64,46 @@ void usage() {
piCout << "\"*=\" disable optional plugins."; piCout << "\"*=\" disable optional plugins.";
piCout << ""; piCout << "";
piCout << Green << Bold << "Usage:" << Default << "\"deploy_tool [-hvfC] [--dependencies [--prefix <text>]] " piCout << Green << Bold << "Usage:" << Default << "\"deploy_tool [-hvfC] [--dependencies [--prefix <text>]] "
"[-p <qt_plugins>] [-s <search_path>] [--ignore <libs>] [-S <styles>] " "[--qt-plugins-dir <d>] [-s <search_path>] [--ignore <libs>] [-S <styles>] "
"[-l <ldd>] [-D <dpkg>] [--dpkg-workdir <d>] [-L <readelf> | -W <objdump> | -M <otool>] " "[-l <ldd>] [-D <dpkg>] [--dpkg-workdir <d>] [-L <readelf> | -W <objdump> | -M <otool>] "
"[--name-tool <pathS>] [-d <depth>] [-q <qtdir>] [-a <add_libs>] [-S <styles>] " "[--name-tool <pathS>] [-d <depth>] [-q <qtdir>] [-a <add_libs>] [-S <styles>] "
"[-P <platforms>] [--qt-plugins <d>] [--qt-modules <l>] [--qt-conf-dir <d>] -o <out_path> <file> [<file2> ...]\"" << NewLine; "[-P <platforms>] [--qt-plugins <d>] [--qt-modules <l>] [--qt-conf-dir <d>] -o <out_path> <file> [<file2> ...]\"" << NewLine;
piCout << Green << Bold << "Details:"; piCout << Green << Bold << "Details:";
piCout << Bold << "Debug control"; piCout << Bold << "Debug control";
piCout << "-h, --help " << Green << "- display this message and exit"; piCout << "-h, --help " << Green << "- display this message and exit";
piCout << "-v, --verbose " << Green << "- be verbose"; piCout << "-v, --verbose " << Green << "- be verbose";
piCout << ""; piCout << "";
piCout << Bold << "Processing control"; piCout << Bold << "Processing control";
piCout << "-f, --fake " << Green << "- don`t copy, only print"; piCout << "-f, --fake " << Green << "- don`t copy, only print";
piCout << "-s <search_path> " << Green << "- set search pathes for system libraries, may be separated by \"" DELIM "\", default \"/usr/lib\""; piCout << "-s <search_path> " << Green << "- set search pathes for system libraries, may be separated by \"" DELIM "\", default \"/usr/lib\"";
piCout << "--ignore <libs> " << Green << "- ignore libraries names, may be separated by \"" DELIM "\", default \"\""; piCout << "--ignore <libs> " << Green << "- ignore libraries names, may be separated by \"" DELIM "\", default \"\"";
piCout << "-l <ldd> " << Green << "- \"ldd\" path, default \"/usr/bin/ldd\""; piCout << "-l <ldd> " << Green << "- \"ldd\" path, default \"/usr/bin/ldd\"";
piCout << "-L <readelf> " << Green << "- \"readelf\" path, overrides \"ldd\""; piCout << "-L <readelf> " << Green << "- \"readelf\" path, overrides \"ldd\"";
piCout << "-W <objdump> " << Green << "- \"objdump\" path, overrides \"ldd\""; piCout << "-W <objdump> " << Green << "- \"objdump\" path, overrides \"ldd\"";
piCout << "-M <otool> " << Green << "- \"otool\" path, overrides \"ldd\""; piCout << "-M <otool> " << Green << "- \"otool\" path, overrides \"ldd\"";
piCout << "-D <dpkg> " << Green << "- \"dpkg\" path, default \"/usr/bin/dpkg\""; piCout << "-D <dpkg> " << Green << "- \"dpkg\" path, default \"/usr/bin/dpkg\"";
piCout << "--dpkg-workdir <d> " << Green << "- dpkg \"admindir\" path, default \"\""; piCout << "--dpkg-workdir <d> " << Green << "- dpkg \"admindir\" path, default \"\"";
piCout << "--name-tool <path> " << Green << "- \"install_name_tool\" path, default \"install_name_tool\""; piCout << "--name-tool <path> " << Green << "- \"install_name_tool\" path, default \"install_name_tool\"";
piCout << "--strip <path> " << Green << "- \"strip\" path, default \"strip\""; piCout << "--strip <path> " << Green << "- \"strip\" path, default \"strip\"";
piCout << "-d <depth> " << Green << "- maximum dependepcies depth, default 8"; piCout << "-d <depth> " << Green << "- maximum dependepcies depth, default 8";
piCout << ""; piCout << "";
piCout << Bold << "Qt control"; piCout << Bold << "Qt control";
piCout << "-q <qtdir> " << Green << "- path where Qt root dir, default takes from \"qmake -v\""; piCout << "-q <qtdir> " << Green << "- path where Qt root dir, default takes from \"qmake -v\"";
piCout << "-S <styles> " << Green << "- set Qt styles (e.g. \"oxygen,breeze\"), default \"*\""; piCout << "-S <styles> " << Green << "- set Qt styles (e.g. \"oxygen,breeze\"), default \"*\"";
piCout << "-P <platforms> " << Green << "- set Qt platforms (e.g. \"win,mini\"), default by host system"; piCout << "-P <platforms> " << Green << "- set Qt platforms (e.g. \"win,mini\"), default by host system";
piCout << "--qt-plugins <d> " << Green << "- set Qt plugins description"; piCout << "--qt-plugins <d> " << Green << "- set Qt plugins description";
piCout << "--qt-modules <list>" << Green << "- additional Qt modules, may be separated by \"" DELIM "\" (e.g. \"Sql" DELIM "Xml\")"; piCout << "--qt-modules <list> " << Green << "- additional Qt modules, may be separated by \"" DELIM "\" (e.g. \"Sql" DELIM "Xml\")";
piCout << "--qt-conf-dir <dir>" << Green << "- dir where place \"qt.conf\", if empty place to out_path";
piCout << ""; piCout << "";
piCout << Bold << "Output control"; piCout << Bold << "Output control";
piCout << "-o <out_path> " << Green << "- path for libraries copy to"; piCout << "-o <out_path> " << Green << "- path for libraries copy to";
piCout << "-p <qt_plugins> " << Green << "- path for Qt plugins, default \"<out_path>\""; piCout << "--qt-plugins-dir <d>" << Green << "- dir where place Qt plugins, default \"<out_path>\"";
piCout << "--dependencies " << Green << "- search dependencies by <dpkg>, print them and copy missing libraries"; piCout << "--qt-conf-dir <dir> " << Green << "- dir where place \"qt.conf\", default \"<out_path>\"";
piCout << "--prefix <text> " << Green << "- print <text> before dependencies"; piCout << "--dependencies " << Green << "- search dependencies by <dpkg>, print them and copy missing libraries";
piCout << "--prefix <text> " << Green << "- print <text> before dependencies";
piCout << ""; piCout << "";
piCout << Bold << "Input control"; piCout << Bold << "Input control";
piCout << "<file> ... " << Green << "- executable to process"; piCout << "<file> ... " << Green << "- executable to process";
piCout << "-a <add_libs> " << Green << "- additional libs, separated by \"" DELIM "\". Libraries will be searched in <search_path>"; piCout << "-a <add_libs> " << Green << "- additional libs, separated by \"" DELIM "\". Libraries will be searched in <search_path>";
} }
struct QtDep { struct QtDep {
@@ -130,8 +130,8 @@ QtDep qt_deps[] = {
int depth = 8; int depth = 8;
bool fake = false, is_ldd = true, is_deps = false, need_qt = false, make_qt_format = true; bool fake = false, is_ldd = true, is_deps = false, need_qt = false, make_qt_format = true;
PIString ldd, readelf, objdump, otool, dpkg, nametool, strip, out_dir, qt_dir, out_plugins_dir, dpkg_workdir; PIString ldd, readelf, objdump, otool, dpkg, nametool, strip, out_dir, qt_dir, dpkg_workdir;
PIString qt_pref, qt_suff, qt_conf_dir; PIString qt_pref, qt_suff, qt_conf_dir, qt_plugins_dir;
PIStringList styles, lib_dirs, add_libs, platforms, sqldrivers, input_files, plugin_libs, qt_add_libs; PIStringList styles, lib_dirs, add_libs, platforms, sqldrivers, input_files, plugin_libs, qt_add_libs;
PISet<PIString> all_libs, miss_libs, all_deps, frameworks, framework_libs, miss_frameworks, qt_plugins, ignore_libs, qt_libs; PISet<PIString> all_libs, miss_libs, all_deps, frameworks, framework_libs, miss_frameworks, qt_plugins, ignore_libs, qt_libs;
PIMap<PIString, PIStringList> qt_filters; PIMap<PIString, PIStringList> qt_filters;
@@ -346,7 +346,7 @@ void procQt() {
PIStringList vsl = vs.split("\n"); PIStringList vsl = vs.split("\n");
PIStringList pdirs = qt_plugins.toVector(); PIStringList pdirs = qt_plugins.toVector();
if (!fake) if (!fake)
PIDir(out_plugins_dir).make(true); PIDir(qt_plugins_dir).make(true);
piForeach (PIString l, vsl) { piForeach (PIString l, vsl) {
if (l.trim().contains("Qt version")) { if (l.trim().contains("Qt version")) {
l.cutLeft(l.find("Qt version") + 10).trim(); l.cutLeft(l.find("Qt version") + 10).trim();
@@ -383,8 +383,8 @@ void procQt() {
PIStringList filters = qt_filters[plugin]; PIStringList filters = qt_filters[plugin];
piForeachC (PIString & f, filters) { piForeachC (PIString & f, filters) {
if (f.isEmpty()) continue; if (f.isEmpty()) continue;
copyWildcard(qdir + plugin + "/" + f, out_plugins_dir + plugin); copyWildcard(qdir + plugin + "/" + f, qt_plugins_dir + plugin);
PIVector<PIFile::FileInfo> copied = PIDir(out_plugins_dir + plugin).entries(); PIVector<PIFile::FileInfo> copied = PIDir(qt_plugins_dir + plugin).entries();
piForeachC (PIFile::FileInfo & fi, copied) { piForeachC (PIFile::FileInfo & fi, copied) {
if (fi.isFile()) { if (fi.isFile()) {
procLdd(fi.path); procLdd(fi.path);
@@ -500,7 +500,6 @@ int main(int argc, char * argv[]) {
cli.addArgument("dependencies", PIChar('\0')); cli.addArgument("dependencies", PIChar('\0'));
cli.addArgument("prefix", PIChar('\0'), true); cli.addArgument("prefix", PIChar('\0'), true);
cli.addArgument("output", true); cli.addArgument("output", true);
cli.addArgument("pqt_out_plugins", true);
cli.addArgument("search_path", true); cli.addArgument("search_path", true);
cli.addArgument("ignore", PIChar('\0'), true); cli.addArgument("ignore", PIChar('\0'), true);
cli.addArgument("Styles", true); cli.addArgument("Styles", true);
@@ -508,6 +507,7 @@ int main(int argc, char * argv[]) {
cli.addArgument("qt-plugins", PIChar('\0'), true); cli.addArgument("qt-plugins", PIChar('\0'), true);
cli.addArgument("qt-modules", PIChar('\0'), true); cli.addArgument("qt-modules", PIChar('\0'), true);
cli.addArgument("qt-conf-dir", PIChar('\0'), true); cli.addArgument("qt-conf-dir", PIChar('\0'), true);
cli.addArgument("qt-plugins-dir", PIChar('\0'), true);
cli.addArgument("ldd", true); cli.addArgument("ldd", true);
cli.addArgument("Lreadelf", true); cli.addArgument("Lreadelf", true);
cli.addArgument("Wobjdump", true); cli.addArgument("Wobjdump", true);
@@ -554,13 +554,6 @@ int main(int argc, char * argv[]) {
#endif #endif
if (dpkg.isEmpty()) if (dpkg.isEmpty())
dpkg = "/usr/bin/dpkg"; dpkg = "/usr/bin/dpkg";
out_plugins_dir = out_dir;
if (!out_plugins_dir.endsWith("/")) out_plugins_dir.append('/');
if (!cli.argumentValue("pqt_out_plugins").isEmpty()) {
out_plugins_dir = cli.argumentValue("pqt_out_plugins");
if (!out_plugins_dir.endsWith("/"))
out_plugins_dir.append('/');
}
int etcnt = 0; int etcnt = 0;
if (!readelf.isEmpty()) ++etcnt; if (!readelf.isEmpty()) ++etcnt;
if (!objdump.isEmpty()) ++etcnt; if (!objdump.isEmpty()) ++etcnt;
@@ -584,7 +577,6 @@ int main(int argc, char * argv[]) {
if (ldd.isEmpty()) ldd = "/usr/bin/ldd"; if (ldd.isEmpty()) ldd = "/usr/bin/ldd";
out_dir.replaceAll("//", "/"); out_dir.replaceAll("//", "/");
out_plugins_dir.replaceAll("//", "/");
for (int i = 0; ; ++i) { for (int i = 0; ; ++i) {
if (qt_deps[i].lib.isEmpty()) break; if (qt_deps[i].lib.isEmpty()) break;
@@ -618,6 +610,11 @@ int main(int argc, char * argv[]) {
qt_conf_dir = cli.argumentValue("qt-conf-dir").trim(); qt_conf_dir = cli.argumentValue("qt-conf-dir").trim();
if (qt_conf_dir.isEmpty()) qt_conf_dir = out_dir; if (qt_conf_dir.isEmpty()) qt_conf_dir = out_dir;
if (!qt_conf_dir.endsWith("/")) qt_conf_dir += "/"; if (!qt_conf_dir.endsWith("/")) qt_conf_dir += "/";
qt_plugins_dir = cli.argumentValue("qt-plugins-dir").trim();
if (qt_plugins_dir.isEmpty()) qt_plugins_dir = out_dir;
if (!qt_plugins_dir.endsWith("/")) qt_plugins_dir += "/";
qt_conf_dir.replaceAll("//", "/");
qt_plugins_dir.replaceAll("//", "/");
need_qt = !qt_add_libs.isEmpty(); need_qt = !qt_add_libs.isEmpty();
auto it = qt_filters.makeIterator(); auto it = qt_filters.makeIterator();
@@ -684,7 +681,9 @@ int main(int argc, char * argv[]) {
if (!ldd.isEmpty() || !readelf.isEmpty()) { // qt.conf for Linux if (!ldd.isEmpty() || !readelf.isEmpty()) { // qt.conf for Linux
PIFile qtc(qt_conf_dir + "qt.conf", PIIODevice::ReadWrite); PIFile qtc(qt_conf_dir + "qt.conf", PIIODevice::ReadWrite);
qtc.clear(); qtc.clear();
qtc << "[Paths]\n\tPlugins = lib/\n\tTranslations = lang/\n"; PIString pp = PIDir(qt_conf_dir).relative(qt_plugins_dir);
piCout << pp;
qtc << "[Paths]\n\tPlugins = " << pp << "\n\tTranslations = lang/\n";
} }
} }
} }