From dd080ed5e02aca267851eefc3ce116108a8b6dec Mon Sep 17 00:00:00 2001 From: peri4 Date: Sun, 18 Apr 2021 16:59:47 +0300 Subject: [PATCH] deploy_tool qt-plugins-dir --- utils/deploy_tool/main.cpp | 83 +++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 42 deletions(-) diff --git a/utils/deploy_tool/main.cpp b/utils/deploy_tool/main.cpp index f3f8075b..5f222844 100644 --- a/utils/deploy_tool/main.cpp +++ b/utils/deploy_tool/main.cpp @@ -64,46 +64,46 @@ void usage() { piCout << "\"*=\" disable optional plugins."; piCout << ""; piCout << Green << Bold << "Usage:" << Default << "\"deploy_tool [-hvfC] [--dependencies [--prefix ]] " - "[-p ] [-s ] [--ignore ] [-S ] " + "[--qt-plugins-dir ] [-s ] [--ignore ] [-S ] " "[-l ] [-D ] [--dpkg-workdir ] [-L | -W | -M ] " "[--name-tool ] [-d ] [-q ] [-a ] [-S ] " "[-P ] [--qt-plugins ] [--qt-modules ] [--qt-conf-dir ] -o [ ...]\"" << NewLine; piCout << Green << Bold << "Details:"; piCout << Bold << "Debug control"; - piCout << "-h, --help " << Green << "- display this message and exit"; - piCout << "-v, --verbose " << Green << "- be verbose"; + piCout << "-h, --help " << Green << "- display this message and exit"; + piCout << "-v, --verbose " << Green << "- be verbose"; piCout << ""; piCout << Bold << "Processing control"; - piCout << "-f, --fake " << Green << "- don`t copy, only print"; - piCout << "-s " << Green << "- set search pathes for system libraries, may be separated by \"" DELIM "\", default \"/usr/lib\""; - piCout << "--ignore " << Green << "- ignore libraries names, may be separated by \"" DELIM "\", default \"\""; - piCout << "-l " << Green << "- \"ldd\" path, default \"/usr/bin/ldd\""; - piCout << "-L " << Green << "- \"readelf\" path, overrides \"ldd\""; - piCout << "-W " << Green << "- \"objdump\" path, overrides \"ldd\""; - piCout << "-M " << Green << "- \"otool\" path, overrides \"ldd\""; - piCout << "-D " << Green << "- \"dpkg\" path, default \"/usr/bin/dpkg\""; - piCout << "--dpkg-workdir " << Green << "- dpkg \"admindir\" path, default \"\""; - piCout << "--name-tool " << Green << "- \"install_name_tool\" path, default \"install_name_tool\""; - piCout << "--strip " << Green << "- \"strip\" path, default \"strip\""; - piCout << "-d " << Green << "- maximum dependepcies depth, default 8"; + piCout << "-f, --fake " << Green << "- don`t copy, only print"; + piCout << "-s " << Green << "- set search pathes for system libraries, may be separated by \"" DELIM "\", default \"/usr/lib\""; + piCout << "--ignore " << Green << "- ignore libraries names, may be separated by \"" DELIM "\", default \"\""; + piCout << "-l " << Green << "- \"ldd\" path, default \"/usr/bin/ldd\""; + piCout << "-L " << Green << "- \"readelf\" path, overrides \"ldd\""; + piCout << "-W " << Green << "- \"objdump\" path, overrides \"ldd\""; + piCout << "-M " << Green << "- \"otool\" path, overrides \"ldd\""; + piCout << "-D " << Green << "- \"dpkg\" path, default \"/usr/bin/dpkg\""; + piCout << "--dpkg-workdir " << Green << "- dpkg \"admindir\" path, default \"\""; + piCout << "--name-tool " << Green << "- \"install_name_tool\" path, default \"install_name_tool\""; + piCout << "--strip " << Green << "- \"strip\" path, default \"strip\""; + piCout << "-d " << Green << "- maximum dependepcies depth, default 8"; piCout << ""; piCout << Bold << "Qt control"; - piCout << "-q " << Green << "- path where Qt root dir, default takes from \"qmake -v\""; - piCout << "-S " << Green << "- set Qt styles (e.g. \"oxygen,breeze\"), default \"*\""; - piCout << "-P " << Green << "- set Qt platforms (e.g. \"win,mini\"), default by host system"; - piCout << "--qt-plugins " << Green << "- set Qt plugins description"; - piCout << "--qt-modules " << Green << "- additional Qt modules, may be separated by \"" DELIM "\" (e.g. \"Sql" DELIM "Xml\")"; - piCout << "--qt-conf-dir " << Green << "- dir where place \"qt.conf\", if empty place to out_path"; + piCout << "-q " << Green << "- path where Qt root dir, default takes from \"qmake -v\""; + piCout << "-S " << Green << "- set Qt styles (e.g. \"oxygen,breeze\"), default \"*\""; + piCout << "-P " << Green << "- set Qt platforms (e.g. \"win,mini\"), default by host system"; + piCout << "--qt-plugins " << Green << "- set Qt plugins description"; + piCout << "--qt-modules " << Green << "- additional Qt modules, may be separated by \"" DELIM "\" (e.g. \"Sql" DELIM "Xml\")"; piCout << ""; piCout << Bold << "Output control"; - piCout << "-o " << Green << "- path for libraries copy to"; - piCout << "-p " << Green << "- path for Qt plugins, default \"\""; - piCout << "--dependencies " << Green << "- search dependencies by , print them and copy missing libraries"; - piCout << "--prefix " << Green << "- print before dependencies"; + piCout << "-o " << Green << "- path for libraries copy to"; + piCout << "--qt-plugins-dir " << Green << "- dir where place Qt plugins, default \"\""; + piCout << "--qt-conf-dir " << Green << "- dir where place \"qt.conf\", default \"\""; + 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 << "-a " << Green << "- additional libs, separated by \"" DELIM "\". Libraries will be searched in "; + piCout << " ... " << Green << "- executable to process"; + piCout << "-a " << Green << "- additional libs, separated by \"" DELIM "\". Libraries will be searched in "; } struct QtDep { @@ -130,8 +130,8 @@ QtDep qt_deps[] = { int depth = 8; 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 qt_pref, qt_suff, qt_conf_dir; +PIString ldd, readelf, objdump, otool, dpkg, nametool, strip, out_dir, qt_dir, dpkg_workdir; +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; PISet all_libs, miss_libs, all_deps, frameworks, framework_libs, miss_frameworks, qt_plugins, ignore_libs, qt_libs; PIMap qt_filters; @@ -346,7 +346,7 @@ void procQt() { PIStringList vsl = vs.split("\n"); PIStringList pdirs = qt_plugins.toVector(); if (!fake) - PIDir(out_plugins_dir).make(true); + PIDir(qt_plugins_dir).make(true); piForeach (PIString l, vsl) { if (l.trim().contains("Qt version")) { l.cutLeft(l.find("Qt version") + 10).trim(); @@ -383,8 +383,8 @@ void procQt() { PIStringList filters = qt_filters[plugin]; piForeachC (PIString & f, filters) { if (f.isEmpty()) continue; - copyWildcard(qdir + plugin + "/" + f, out_plugins_dir + plugin); - PIVector copied = PIDir(out_plugins_dir + plugin).entries(); + copyWildcard(qdir + plugin + "/" + f, qt_plugins_dir + plugin); + PIVector copied = PIDir(qt_plugins_dir + plugin).entries(); piForeachC (PIFile::FileInfo & fi, copied) { if (fi.isFile()) { procLdd(fi.path); @@ -500,7 +500,6 @@ int main(int argc, char * argv[]) { cli.addArgument("dependencies", PIChar('\0')); cli.addArgument("prefix", PIChar('\0'), true); cli.addArgument("output", true); - cli.addArgument("pqt_out_plugins", true); cli.addArgument("search_path", true); cli.addArgument("ignore", PIChar('\0'), 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-modules", 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("Lreadelf", true); cli.addArgument("Wobjdump", true); @@ -554,13 +554,6 @@ int main(int argc, char * argv[]) { #endif if (dpkg.isEmpty()) 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; if (!readelf.isEmpty()) ++etcnt; if (!objdump.isEmpty()) ++etcnt; @@ -584,7 +577,6 @@ int main(int argc, char * argv[]) { if (ldd.isEmpty()) ldd = "/usr/bin/ldd"; out_dir.replaceAll("//", "/"); - out_plugins_dir.replaceAll("//", "/"); for (int i = 0; ; ++i) { 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(); if (qt_conf_dir.isEmpty()) qt_conf_dir = out_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(); auto it = qt_filters.makeIterator(); @@ -684,7 +681,9 @@ int main(int argc, char * argv[]) { if (!ldd.isEmpty() || !readelf.isEmpty()) { // qt.conf for Linux PIFile qtc(qt_conf_dir + "qt.conf", PIIODevice::ReadWrite); 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"; } } }