git-svn-id: svn://db.shs.com.ru/pip@1022 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -47,41 +47,42 @@ void usage() {
|
|||||||
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>] "
|
"[-p <qt_plugins>] [-s <search_path>] [--ignore <libs>] [-S <styles>] "
|
||||||
"[-l <ldd>] [-D <dpkg>] [-L <readelf> | -W <objdump> | -M <otool>] "
|
"[-l <ldd>] [-D <dpkg>] [-L <readelf> | -W <objdump> | -M <otool>] "
|
||||||
"[-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>] -o <out_path> <file> [<file2> ...]\"" << NewLine;
|
"[-P <platforms>] [--qt-plugins <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 << "-d <depth> " << Green << "- maximum dependepcies depth, default 5";
|
piCout << "--name-tool <path> " << Green << "- \"install_name_tool\" path, default \"install_name_tool\"";
|
||||||
|
piCout << "-d <depth> " << Green << "- maximum dependepcies depth, default 5";
|
||||||
//piCout << "-Q, --Qt-force " << Green << "- force add Qt root dir, default takes from \"qmake -v\"";
|
//piCout << "-Q, --Qt-force " << Green << "- force add Qt root dir, default takes from \"qmake -v\"";
|
||||||
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 << "-C, --Conf " << Green << "- make \"qt.conf\"";
|
//piCout << "-C, --Conf " << Green << "- make \"qt.conf\"";
|
||||||
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 << "";
|
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>/plugins\"";
|
piCout << "-p <qt_plugins> " << Green << "- path for Qt plugins, default \"<out_path>/plugins\"";
|
||||||
piCout << "--dependencies " << Green << "- search dependencies by <dpkg>, print them and copy missing libraries";
|
piCout << "--dependencies " << Green << "- search dependencies by <dpkg>, print them and copy missing libraries";
|
||||||
piCout << "--prefix <text> " << Green << "- print <text> before dependencies";
|
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 {
|
||||||
@@ -108,7 +109,7 @@ QtDep qt_deps[] = {
|
|||||||
|
|
||||||
int depth = 5;
|
int depth = 5;
|
||||||
bool fake = false, is_ldd = true, is_deps = false, need_qt = false;
|
bool fake = false, is_ldd = true, is_deps = false, need_qt = false;
|
||||||
PIString ldd, readelf, objdump, otool, dpkg, out_dir, qt_dir, out_plugins_dir;
|
PIString ldd, readelf, objdump, otool, dpkg, nametool, out_dir, qt_dir, out_plugins_dir;
|
||||||
PIStringList styles, lib_dirs, add_libs, platforms, sqldrivers;
|
PIStringList styles, lib_dirs, add_libs, platforms, sqldrivers;
|
||||||
PISet<PIString> all_libs, miss_libs, all_deps, frameworks, miss_frameworks, qt_plugins, ignore_libs;
|
PISet<PIString> all_libs, miss_libs, all_deps, frameworks, miss_frameworks, qt_plugins, ignore_libs;
|
||||||
PIMap<PIString, PIStringList> qt_filters;
|
PIMap<PIString, PIStringList> qt_filters;
|
||||||
@@ -358,6 +359,31 @@ bool procDpkg(const PIString & l) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void patchNameTool() {
|
||||||
|
if (nametool.isEmpty()) return;
|
||||||
|
PIVector<PIString> clibs = all_libs.toVector();
|
||||||
|
PIString ll, cmd;
|
||||||
|
PIStringList dlibs;
|
||||||
|
piForeach (PIString l, clibs) {
|
||||||
|
PIFile::FileInfo fi;
|
||||||
|
fi.path = l;
|
||||||
|
ll = out_dir + fi.name();
|
||||||
|
cmd = otool + " -L " + ll;
|
||||||
|
cmd += " | grep -o \".*(\"";
|
||||||
|
dlibs = execute(cmd).split("\n");
|
||||||
|
piForeach (PIString dl, dlibs) {
|
||||||
|
dl.cutRight(1).trim();
|
||||||
|
if (!all_libs.contains(dl)) continue;
|
||||||
|
cmd = nametool + " -change \"" + l + "\"";
|
||||||
|
cmd += " \"@executable_path/../Frameworks/" + fi.name() + "\"";
|
||||||
|
cmd += " \"" + ll + "\"";
|
||||||
|
piCout << cmd;
|
||||||
|
execute(cmd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char * argv[]) {
|
int main(int argc, char * argv[]) {
|
||||||
PICLI cli(argc, argv);
|
PICLI cli(argc, argv);
|
||||||
//piCout << cli.rawArguments();
|
//piCout << cli.rawArguments();
|
||||||
@@ -379,6 +405,7 @@ int main(int argc, char * argv[]) {
|
|||||||
cli.addArgument("Lreadelf", true);
|
cli.addArgument("Lreadelf", true);
|
||||||
cli.addArgument("Wobjdump", true);
|
cli.addArgument("Wobjdump", true);
|
||||||
cli.addArgument("Motool", true);
|
cli.addArgument("Motool", true);
|
||||||
|
cli.addArgument("name-tool", PIChar('\0'), true);
|
||||||
cli.addArgument("Dpkg", true);
|
cli.addArgument("Dpkg", true);
|
||||||
cli.addArgument("depth", true);
|
cli.addArgument("depth", true);
|
||||||
cli.addArgument("qtdir", true);
|
cli.addArgument("qtdir", true);
|
||||||
@@ -401,11 +428,15 @@ int main(int argc, char * argv[]) {
|
|||||||
readelf = cli.argumentValue("Lreadelf");
|
readelf = cli.argumentValue("Lreadelf");
|
||||||
objdump = cli.argumentValue("Wobjdump");
|
objdump = cli.argumentValue("Wobjdump");
|
||||||
otool = cli.argumentValue("Motool");
|
otool = cli.argumentValue("Motool");
|
||||||
|
nametool = cli.argumentValue("name-tool");
|
||||||
|
if (nametool.isEmpty())
|
||||||
|
nametool = "install_name_tool";
|
||||||
dpkg = cli.argumentValue("Dpkg");
|
dpkg = cli.argumentValue("Dpkg");
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
readelf.replaceAll("/", "\\");
|
readelf.replaceAll("/", "\\");
|
||||||
objdump.replaceAll("/", "\\");
|
objdump.replaceAll("/", "\\");
|
||||||
otool.replaceAll("/", "\\");
|
otool.replaceAll("/", "\\");
|
||||||
|
nametool.replaceAll("/", "\\");
|
||||||
dpkg.replaceAll("/", "\\");
|
dpkg.replaceAll("/", "\\");
|
||||||
#endif
|
#endif
|
||||||
if (dpkg.isEmpty())
|
if (dpkg.isEmpty())
|
||||||
@@ -529,6 +560,9 @@ int main(int argc, char * argv[]) {
|
|||||||
miss_frameworks << f;
|
miss_frameworks << f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!otool.isEmpty())
|
||||||
|
patchNameTool();
|
||||||
|
|
||||||
if (is_deps) {
|
if (is_deps) {
|
||||||
PICout(PICoutManipulators::AddNone) << cli.argumentValue("prefix");
|
PICout(PICoutManipulators::AddNone) << cli.argumentValue("prefix");
|
||||||
PICout(PICoutManipulators::AddNewLine) << PIStringList(all_deps.toVector()).join(", ");
|
PICout(PICoutManipulators::AddNewLine) << PIStringList(all_deps.toVector()).join(", ");
|
||||||
|
|||||||
Reference in New Issue
Block a user