Revert "No longer generate qt.conf since we use qt_prfxpath now"

Possible workaround for #98, #99, #122

This reverts commit 5df50f332b.
This commit is contained in:
probonopd
2017-05-25 12:51:53 +02:00
parent 85b2b44f34
commit b0cb33c9de
3 changed files with 74 additions and 0 deletions
+1
View File
@@ -395,6 +395,7 @@ int main(int argc, char **argv)
if (deploymentInfo.pluginPath.isEmpty()) if (deploymentInfo.pluginPath.isEmpty())
deploymentInfo.pluginPath = QDir::cleanPath(deploymentInfo.qtPath + "/../plugins"); deploymentInfo.pluginPath = QDir::cleanPath(deploymentInfo.qtPath + "/../plugins");
deployPlugins(appDirPath, deploymentInfo); deployPlugins(appDirPath, deploymentInfo);
createQtConf(appDirPath);
} }
if (runStripEnabled) if (runStripEnabled)
+71
View File
@@ -1104,6 +1104,8 @@ void deployPlugins(const AppDirInfo &appDirInfo, const QString &pluginSourcePath
sourcePath = QDir::cleanPath(qtLibexecPath + "/QtWebEngineProcess"); sourcePath = QDir::cleanPath(qtLibexecPath + "/QtWebEngineProcess");
destinationPath = QDir::cleanPath(dstLibexec + "/QtWebEngineProcess"); destinationPath = QDir::cleanPath(dstLibexec + "/QtWebEngineProcess");
copyFilePrintStatus(sourcePath, destinationPath); copyFilePrintStatus(sourcePath, destinationPath);
// put qt.conf file next to browser process so it can also make use of our local Qt resources
createQtConfForQtWebEngineProcess(dstLibexec);
// Resources: // Resources:
sourcePath = QDir::cleanPath(qtDataPath + "/resources/qtwebengine_resources.pak"); sourcePath = QDir::cleanPath(qtDataPath + "/resources/qtwebengine_resources.pak");
destinationPath = QDir::cleanPath(dstResources + "/qtwebengine_resources.pak"); destinationPath = QDir::cleanPath(dstResources + "/qtwebengine_resources.pak");
@@ -1149,6 +1151,75 @@ void deployPlugins(const AppDirInfo &appDirInfo, const QString &pluginSourcePath
} }
} }
void createQtConf(const QString &appDirPath)
{
// Set Plugins and imports paths. These are relative to QCoreApplication::applicationDirPath()
// which is where the main executable resides; see http://doc.qt.io/qt-5/qt-conf.html
QByteArray contents = "# Generated by linuxdeployqt\n"
"# https://github.com/probonopd/linuxdeployqt/\n"
"[Paths]\n"
"Plugins = plugins\n"
"Imports = qml\n"
"Qml2Imports = qml\n";
// Workaround for: https://github.com/probonopd/linuxdeployqt/issues/75
if(fhsLikeMode == true){
QByteArray contents = "# Generated by linuxdeployqt\n"
"# https://github.com/probonopd/linuxdeployqt/\n"
"[Paths]\n"
"Prefix = ../../\n"
"Plugins = plugins\n"
"Imports = qml\n"
"Qml2Imports = qml\n";
}
QString filePath = appDirPath + "/"; // Is picked up when placed next to the main executable
QString fileName = QDir::cleanPath(appBinaryPath + "/../qt.conf");
QDir().mkpath(filePath);
QFile qtconf(fileName);
if (qtconf.exists() && !alwaysOwerwriteEnabled) {
LogWarning() << fileName << "already exists, will not overwrite.";
LogWarning() << "To make sure the plugins are loaded from the correct location,";
LogWarning() << "please make sure qt.conf contains the following lines:";
LogWarning() << "[Paths]";
LogWarning() << " Plugins = plugins";
return;
}
qtconf.open(QIODevice::WriteOnly);
if (qtconf.write(contents) != -1) {
LogNormal() << "Created configuration file:" << fileName;
LogNormal() << "This file sets the plugin search path to" << appDirPath + "/plugins";
}
}
void createQtConfForQtWebEngineProcess(const QString &appDirPath)
{
QByteArray contents = "# Generated by linuxdeployqt\n"
"# https://github.com/probonopd/linuxdeployqt/\n"
"[Paths]\n"
"Prefix = ../\n";
QString filePath = appDirPath + "/";
QString fileName = filePath + "qt.conf";
QDir().mkpath(filePath);
QFile qtconf(fileName);
if (qtconf.exists() && !alwaysOwerwriteEnabled) {
LogWarning() << fileName << "already exists, will not overwrite.";
return;
}
qtconf.open(QIODevice::WriteOnly);
if (qtconf.write(contents) != -1) {
LogNormal() << "Created configuration file for Qt WebEngine process:" << fileName;
LogNormal() << "This file sets the prefix option to parent directory of browser process executable";
}
}
void deployPlugins(const QString &appDirPath, DeploymentInfo deploymentInfo) void deployPlugins(const QString &appDirPath, DeploymentInfo deploymentInfo)
{ {
AppDirInfo applicationBundle; AppDirInfo applicationBundle;
+2
View File
@@ -114,6 +114,8 @@ QList<LibraryInfo> getQtLibraries(const QStringList &lddLines, const QString &ap
QString copyLibrary(const LibraryInfo &library, const QString path); QString copyLibrary(const LibraryInfo &library, const QString path);
DeploymentInfo deployQtLibraries(const QString &appDirPath, const QStringList &additionalExecutables); DeploymentInfo deployQtLibraries(const QString &appDirPath, const QStringList &additionalExecutables);
DeploymentInfo deployQtLibraries(QList<LibraryInfo> libraries,const QString &bundlePath, const QStringList &binaryPaths, bool useLoaderPath); DeploymentInfo deployQtLibraries(QList<LibraryInfo> libraries,const QString &bundlePath, const QStringList &binaryPaths, bool useLoaderPath);
void createQtConf(const QString &appDirPath);
void createQtConfForQtWebEngineProcess(const QString &appDirPath);
void deployPlugins(const QString &appDirPath, DeploymentInfo deploymentInfo); void deployPlugins(const QString &appDirPath, DeploymentInfo deploymentInfo);
bool deployQmlImports(const QString &appDirPath, DeploymentInfo deploymentInfo, QStringList &qmlDirs); bool deployQmlImports(const QString &appDirPath, DeploymentInfo deploymentInfo, QStringList &qmlDirs);
void changeIdentification(const QString &id, const QString &binaryPath); void changeIdentification(const QString &id, const QString &binaryPath);