big windwos fixes

This commit is contained in:
a.yankovich 2019-09-24 15:11:30 +03:00
parent 269b297690
commit 6bf7976fc5
12 changed files with 178 additions and 95 deletions

View File

@ -375,50 +375,68 @@ void ConfigParser::initIgnoreList()
}
if (QuasarAppUtils::Params::isEndable("noLibc")) {
IgnoreData ruleUnix, ruleWin;
IgnoreData rule;
Envirement envUnix, envWin;
Envirement env;
if (!QuasarAppUtils::Params::isEndable("deploySystem-with-libc")) {
env.addEnv(recursiveInvairement(3 ,"/lib"), "", "");
env.addEnv(recursiveInvairement(3 ,"/usr/lib"), "", "");
envUnix.addEnv(recursiveInvairement("/lib", 3), "", "");
envUnix.addEnv(recursiveInvairement("/usr/lib", 3), "", "");
ruleUnix.prority = SystemLib;
ruleUnix.platform = Unix32 | Unix64;
ruleUnix.enfirement = envUnix;
rule.prority = SystemLib;
rule.platform = Unix32 | Unix64;
rule.enfirement = env;
auto addRule = [&rule](const QString & lib) {
rule.label = lib;
return rule;
auto addRuleUnix = [&ruleUnix](const QString & lib) {
ruleUnix.label = lib;
return ruleUnix;
};
_config.ignoreList.addRule(addRule("libc"));
_config.ignoreList.addRule(addRule("ld-"));
_config.ignoreList.addRule(addRule("libpthread"));
_config.ignoreList.addRule(addRule("libm"));
_config.ignoreList.addRule(addRule("libz"));
_config.ignoreList.addRule(addRule("libnsl"));
_config.ignoreList.addRule(addRule("libdl"));
_config.ignoreList.addRule(addRule("libutil"));
_config.ignoreList.addRule(addRule("libresolv"));
_config.ignoreList.addRule(addRule("libBrokenLocale"));
_config.ignoreList.addRule(addRule("libBrokenLocale"));
_config.ignoreList.addRule(addRule("libSegFault"));
_config.ignoreList.addRule(addRule("libanl"));
_config.ignoreList.addRule(addRule("libcrypt"));
_config.ignoreList.addRule(addRule("/gconv/"));
_config.ignoreList.addRule(addRule("libnss"));
_config.ignoreList.addRule(addRuleUnix("libc"));
_config.ignoreList.addRule(addRuleUnix("ld-"));
_config.ignoreList.addRule(addRuleUnix("libpthread"));
_config.ignoreList.addRule(addRuleUnix("libm"));
_config.ignoreList.addRule(addRuleUnix("libz"));
_config.ignoreList.addRule(addRuleUnix("libnsl"));
_config.ignoreList.addRule(addRuleUnix("libdl"));
_config.ignoreList.addRule(addRuleUnix("libutil"));
_config.ignoreList.addRule(addRuleUnix("libresolv"));
_config.ignoreList.addRule(addRuleUnix("libBrokenLocale"));
_config.ignoreList.addRule(addRuleUnix("libBrokenLocale"));
_config.ignoreList.addRule(addRuleUnix("libSegFault"));
_config.ignoreList.addRule(addRuleUnix("libanl"));
_config.ignoreList.addRule(addRuleUnix("libcrypt"));
_config.ignoreList.addRule(addRuleUnix("/gconv/"));
_config.ignoreList.addRule(addRuleUnix("libnss"));
}
// envWin.addEnv(recursiveInvairement("C:/Windows", 3), "", "");
// ruleWin.prority = ExtraLib;
// ruleWin.platform = Win32 | Win64;
// ruleWin.enfirement = envWin;
// auto addRuleWin = [&ruleWin](const QString & lib) {
// ruleWin.label = lib;
// return ruleWin;
// };
// _config.ignoreList.addRule(addRuleWin("kernelBase"));
// _config.ignoreList.addRule(addRuleWin("gdi32"));
// _config.ignoreList.addRule(addRuleWin("kernel32"));
// _config.ignoreList.addRule(addRuleWin("msvcrt"));
// _config.ignoreList.addRule(addRuleWin("user32"));
}
void ConfigParser::initIgnoreEnvList() {
QStringList ignoreEnvList;
// remove windows from envirement,
ignoreEnvList.push_back(":/Windows");
if (QuasarAppUtils::Params::isEndable("ignoreEnv")) {
auto ignoreList = QuasarAppUtils::Params::getStrArg("ignoreEnv").split(',');
QStringList ignoreEnvList;
for (auto &i : ignoreList) {
auto path = QFileInfo(i).absoluteFilePath();
@ -429,9 +447,10 @@ void ConfigParser::initIgnoreEnvList() {
ignoreEnvList.append(path);
}
_config.envirement.setIgnoreEnvList(ignoreEnvList);
}
_config.envirement.setIgnoreEnvList(ignoreEnvList);
}
void ConfigParser::setQmake(const QString &value) {
@ -480,7 +499,7 @@ void ConfigParser::setExtraPath(const QStringList &value) {
dir.setPath(info.absoluteFilePath());
_config.extraPaths.push_back(
QDir::fromNativeSeparators(info.absoluteFilePath()));
_config.envirement.addEnv(recursiveInvairement(0, dir), _config.appDir, _config.targetDir);
_config.envirement.addEnv(recursiveInvairement(dir), _config.appDir, _config.targetDir);
} else {
QuasarAppUtils::Params::verboseLog(i + " does not exist! and skiped");
}
@ -494,7 +513,7 @@ void ConfigParser::setExtraPlugins(const QStringList &value) {
}
}
QString ConfigParser::recursiveInvairement(int depch, QDir &dir) {
QString ConfigParser::recursiveInvairement(QDir &dir, int depch, int depchLimit ) {
char separator = ':';
@ -502,7 +521,11 @@ QString ConfigParser::recursiveInvairement(int depch, QDir &dir) {
separator = ';';
#endif
if (!dir.exists() || depch >= _config.depchLimit) {
if (depchLimit < 0) {
depchLimit = _config.depchLimit;
}
if (!dir.exists() || depch >= depchLimit) {
return dir.absolutePath();
}
@ -513,7 +536,7 @@ QString ConfigParser::recursiveInvairement(int depch, QDir &dir) {
if (!dir.cd(i.fileName())) {
continue;
}
QString temp = recursiveInvairement(depch + 1, dir);
QString temp = recursiveInvairement(dir, depch + 1);
res += (res.size())? separator + temp: temp;
dir.cdUp();
@ -524,10 +547,10 @@ QString ConfigParser::recursiveInvairement(int depch, QDir &dir) {
return res;
}
QString ConfigParser::recursiveInvairement(int depch, const QString &dir) {
QString ConfigParser::recursiveInvairement(const QString &dir, int depch) {
QDir _dir(dir);
return recursiveInvairement(depch, _dir);
return recursiveInvairement(_dir, 0, depch);
}
void ConfigParser::initEnvirement() {
@ -538,9 +561,9 @@ void ConfigParser::initEnvirement() {
if (QuasarAppUtils::Params::isEndable("deploySystem")) {
QStringList dirs;
if (!QuasarAppUtils::Params::isEndable("noLibc"))
dirs.append(getDirsRecursive("/lib", 20));
dirs.append(getDirsRecursive("/usr/lib", 20));
dirs.append(getDirsRecursive("/lib", 10));
dirs.append(getDirsRecursive("/usr/lib", 10));
for (auto &&i : dirs) {
_config.envirement.addEnv(i, _config.appDir, _config.targetDir);

View File

@ -73,8 +73,8 @@ private:
void setExtraPath(const QStringList &value);
void setExtraPlugins(const QStringList &value);
QString recursiveInvairement(int depch, QDir &dir);
QString recursiveInvairement(int depch, const QString &dir);
QString recursiveInvairement(QDir &dir, int depch = 0, int depchLimit = -1);
QString recursiveInvairement(const QString &dir, int depch);
void initEnvirement();

View File

@ -169,9 +169,9 @@ QString DeployCore::help() {
{ " | Use '-bin' flag if you want to deploy linux binary files" },
{ " -qmlDir [params] : Qml data dir. For example -qmlDir ~/my/project/qml" },
{ " deploySystem : Deploys all libs" },
{ " noLibc : Skip Deploys libc and ld-linux libs" },
{ " deploySystem-with-libc : Skip Deploys system core libs libs" },
{ " -qmake [params] : Qmake path." },
{ " | For example -qmake ~/Qt/5.11.1/gcc_64/bin/qmake" },
{ " | For example -qmake ~/Qt/5.14.0/gcc_64/bin/qmake" },
{ " -ignore [list,params] : The list of libs to ignore." },
{ " | For example -ignore libicudata.so.56,libicudata2.so.56" },
{ " -ignoreEnv [list,params] : The list of the environment to ignore" },
@ -214,7 +214,7 @@ QStringList DeployCore::helpKeys() {
"binDir",
"qmlDir",
"deploySystem",
"noLibc",
"deploySystem-with-libc",
"qmake",
"ignore",
"ignoreEnv",

View File

@ -45,9 +45,16 @@ void Envirement::addEnv(const QString &dir, const QString &appDir, const QString
auto path = QFileInfo(dir).absoluteFilePath();
for (QString i :_ignoreEnvList) {
#ifdef Q_OS_WIN
if (path.contains(i, Qt::CaseInsensitive)) {
return;
}
#else
if (path.contains(i)) {
return;
}
#endif
}
if (!appDir.isEmpty() && path.contains(appDir)) {

View File

@ -70,8 +70,7 @@ bool MetaFileManager::createRunScriptLinux(const QString &target) {
content = content.arg(QFileInfo(target).fileName());
int ld_index = DeployCore::find("ld-linux", _fileManager->getDeployedFilesStringList());
if (ld_index >= 0 && QuasarAppUtils::Params::isEndable("deploySystem") &&
!QuasarAppUtils::Params::isEndable("noLibc")) {
if (ld_index >= 0 && QuasarAppUtils::Params::isEndable("deploySystem-with-libc")) {
content = content.arg(QString("\nexport LD_PRELOAD=\"$BASE_DIR\"" + DeployCore::_config->distroStruct.getLibOutDir() + "%0\n").
arg(QFileInfo(_fileManager->getDeployedFilesStringList()[ld_index]).fileName()));

View File

@ -51,7 +51,7 @@ Key differences of this program:
| | (not recommended, as it takes great amount of computer memory) |
| version / v | Shows compiled version |
| help / h | Shows help. |
| noLibc | Skip Deploys libc and ld-linux libs |
| deploySystem-with-libc | deploy all libs libs (only linux) |
| noStrip | Skips strip step |
| noTranslations | Skips the translations files. |
| | It doesn't work without qmake and inside a snap package |
@ -133,7 +133,7 @@ Qt CQtDeployer - это приложением для извлечения вс
| | пример -runScript myApp.sh |
| allQmlDependes | Извлекает все библиотеки qml. |
| | (не рекомендуется, так как занимает много памяти) |
| noLibc | Отключает копирование libc |
| deploySystem-with-libc | Копирует все зависимости в том числе и libc |
| noStrip | Пропускает шаг strip |
| noTranslations | Пропускает файлы переводов |
| | не работает без qmake и в snap |

View File

@ -74,6 +74,7 @@ QSet<QString> Modules::qtLibs() {
"./" + DISTRO_DIR + "/translations/qtbase_ru.qm",
"./" + DISTRO_DIR + "/translations/qtbase_sk.qm",
"./" + DISTRO_DIR + "/translations/qtbase_uk.qm",
"./" + DISTRO_DIR + "/translations/qtbase_zh_TW.qm",
"./" + DISTRO_DIR + "/translations/qtdeclarative_bg.qm",
"./" + DISTRO_DIR + "/translations/qtdeclarative_da.qm",
"./" + DISTRO_DIR + "/translations/qtdeclarative_de.qm",

View File

@ -100,7 +100,7 @@ private slots:
// tested flag targetDir
void testTargetDir();
// tested flag noLibc deploySystem
// tested flag deploySystem-with-libc deploySystem
void testSystemLib();
void testMSVC();
@ -895,17 +895,21 @@ void deploytest::testIgnore() {
{
"./" + DISTRO_DIR + "/qt.conf",
"./" + DISTRO_DIR + "/QtWidgetsProject.exe",
"./" + DISTRO_DIR + "/libgcc_s_seh-1.dll",
"./" + DISTRO_DIR + "/libstdc++-6.dll",
"./" + DISTRO_DIR + "/libwinpthread-1.dll",
});
if (!TestQtDir.contains("Qt5")) {
comapareTree += {
"./" + DISTRO_DIR + "/libgcc_s_seh-1.dll",
"./" + DISTRO_DIR + "/libstdc++-6.dll",
"./" + DISTRO_DIR + "/libwinpthread-1.dll",
};
}
#endif
runTestParams({"-bin", bin, "clear" ,
"-qmake", qmake,
"-ignore", "Qt5"}, &comapareTree);
@ -956,12 +960,6 @@ void deploytest::testLibDir() {
QString bin = TestBinDir + "TestOnlyC";
QString extraPath = "/usr/lib";
#else
QString bin = TestBinDir + "TestOnlyC.exe";
QString extraPath = "/usr/lib";
#endif
auto comapareTree = utils.createTree(
{
"./" + DISTRO_DIR + "/TestOnlyC.sh",
@ -969,11 +967,24 @@ void deploytest::testLibDir() {
"./" + DISTRO_DIR + "/bin/TestOnlyC"
});
#else
QString bin = TestBinDir + "TestOnlyC.exe";
QString extraPath = "C:/Windows";
auto comapareTree = utils.createTree(
{
"./" + DISTRO_DIR + "/qt.conf",
"./" + DISTRO_DIR + "/TestOnlyC.exe"
});
#endif
runTestParams({"-bin", bin, "clear" ,
"-libDir", extraPath,
}, &comapareTree);
#ifdef Q_OS_UNIX
comapareTree = utils.createTree(
{
"./" + DISTRO_DIR + "/TestOnlyC.sh",
@ -983,6 +994,15 @@ void deploytest::testLibDir() {
"./" + DISTRO_DIR + "/lib/libgcc_s.so"
});
#else
comapareTree = utils.createTree(
{
"./" + DISTRO_DIR + "/TestOnlyC.exe",
"./" + DISTRO_DIR + "/qt.conf",
});
#endif
runTestParams({"-bin", bin, "clear" ,
"-libDir", extraPath,
@ -999,22 +1019,6 @@ void deploytest::testExtraPlugins() {
QString extraPath = "/usr/lib";
QString qmake = TestQtDir + "bin/qmake";
#else
QString bin = TestBinDir + "QtWidgetsProject.exe";
QString extraPath = "/usr/lib";
QString qmake = TestQtDir + "bin/qmake.exe";
#endif
auto comapareTree = Modules::qtLibs();
runTestParams({"-bin", bin, "clear" ,
"-qmake", qmake,
}, &comapareTree);
auto pluginTree = utils.createTree(
{
"./" + DISTRO_DIR + "/bin/qt.conf",
@ -1025,6 +1029,32 @@ void deploytest::testExtraPlugins() {
});
#else
QString bin = TestBinDir + "QtWidgetsProject.exe";
QString extraPath = "/usr/lib";
QString qmake = TestQtDir + "bin/qmake.exe";
auto pluginTree = utils.createTree(
{
"./" + DISTRO_DIR + "/qt.conf",
"./" + DISTRO_DIR + "/plugins/sqldrivers/qsqlite.dll",
"./" + DISTRO_DIR + "/plugins/sqldrivers/qsqlmysql.dll",
"./" + DISTRO_DIR + "/plugins/sqldrivers/qsqlodbc.dll",
"./" + DISTRO_DIR + "/plugins/sqldrivers/qsqlpsql.dll",
"./" + DISTRO_DIR + "/Qt5Sql.dll",
});
#endif
auto comapareTree = Modules::qtLibs();
runTestParams({"-bin", bin, "clear" ,
"-qmake", qmake,
}, &comapareTree);
comapareTree = comapareTree + pluginTree;
@ -1038,18 +1068,20 @@ void deploytest::testTargetDir() {
#ifdef Q_OS_UNIX
QString bin = TestBinDir + "TestOnlyC";
#else
QString bin = TestBinDir + "TestOnlyC.exe";
#endif
auto comapareTree = utils.createTree(
{"./" + DISTRO_DIR + "Z/bin/TestOnlyC",
"./" + DISTRO_DIR + "Z/bin/qt.conf",
"./" + DISTRO_DIR + "Z/TestOnlyC.sh"});
#else
QString bin = TestBinDir + "TestOnlyC.exe";
auto comapareTree = utils.createTree(
{"./" + DISTRO_DIR + "Z/TestOnlyC.exe",
"./" + DISTRO_DIR + "Z/qt.conf"});
#endif
runTestParams({"-bin", bin, "clear" ,
"-targetDir", "./" + DISTRO_DIR + "Z"
}, &comapareTree);
@ -1061,12 +1093,6 @@ void deploytest::testSystemLib() {
#ifdef Q_OS_UNIX
QString bin = TestBinDir + "TestOnlyC";
#else
QString bin = TestBinDir + "TestOnlyC.exe";
#endif
auto comapareTree = utils.createTree(
{
"./" + DISTRO_DIR + "/TestOnlyC.sh",
@ -1079,6 +1105,19 @@ void deploytest::testSystemLib() {
"./" + DISTRO_DIR + "/lib/libstdc++.so"
});
#else
QString bin = TestBinDir + "TestOnlyC.exe";
auto comapareTree = utils.createTree(
{
"./" + DISTRO_DIR + "/TestOnlyC.exe",
"./" + DISTRO_DIR + "/libgcc_s_seh-1.dll",
"./" + DISTRO_DIR + "/libstdc++-6.dll",
"./" + DISTRO_DIR + "/libwinpthread-1.dll",
"./" + DISTRO_DIR + "/qt.conf",
});
#endif
runTestParams({"-bin", bin, "clear" ,
"deploySystem"
}, &comapareTree, true);
@ -1093,6 +1132,9 @@ void deploytest::testSystemLib() {
file.close();
QVERIFY(runScript.contains("export LD_PRELOAD="));
#endif
#ifdef Q_OS_UNIX
comapareTree = utils.createTree(
{
@ -1102,11 +1144,19 @@ void deploytest::testSystemLib() {
"./" + DISTRO_DIR + "/lib/libgcc_s.so",
"./" + DISTRO_DIR + "/lib/libstdc++.so"
});
#else
comapareTree = utils.createTree(
{
"./" + DISTRO_DIR + "/TestOnlyC.exe",
"./" + DISTRO_DIR + "/qt.conf",
});
#endif
runTestParams({"-bin", bin, "clear" ,
"deploySystem", "noLibc"
runTestParams({"-bin", bin, "clear" , "deploySystem-with-libc"
}, &comapareTree, true);
#ifdef Q_OS_UNIX
file.setFileName("./" + DISTRO_DIR + "/TestOnlyC.sh");
QVERIFY(file.open(QIODevice::ReadOnly));
@ -1115,9 +1165,8 @@ void deploytest::testSystemLib() {
file.close();
QVERIFY(!runScript.contains("export LD_PRELOAD="));
#endif
}
QTEST_APPLESS_MAIN(deploytest)

View File

@ -2,6 +2,7 @@ TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt
CONFIG += release
SOURCES += \
main.cpp

View File

@ -1,5 +1,6 @@
QT += quick
CONFIG += c++17
CONFIG += release
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings

View File

@ -23,6 +23,7 @@ DEFINES += QT_DEPRECATED_WARNINGS
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
CONFIG += c++17
CONFIG += release
SOURCES += \
main.cpp \

View File

@ -1,4 +1,5 @@
requires(qtConfig(accessibility))
CONFIG += release
TEMPLATE = app
TARGET = quicknanobrowser