From 97b8ba862bcfb47da1670247c231f38d6d14e840 Mon Sep 17 00:00:00 2001 From: atehxx Date: Fri, 30 Dec 2016 14:06:20 +0100 Subject: [PATCH 1/3] Update shared.cpp Fixed few paths to Web Engine resources as where they seem to be in 5.7.1 --- shared/shared.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/shared/shared.cpp b/shared/shared.cpp index 7332cb3..b04162d 100644 --- a/shared/shared.cpp +++ b/shared/shared.cpp @@ -894,23 +894,23 @@ void deployPlugins(const AppDirInfo &appDirInfo, const QString &pluginSourcePath sourcePath = pluginSourcePath + "/../libexec/QtWebEngineProcess"; destinationPath = pluginDestinationPath + "/../libexec/QtWebEngineProcess"; copyFilePrintStatus(sourcePath, destinationPath); - sourcePath = pluginSourcePath + "/../libexec/qtwebengine_resources.pak"; + sourcePath = pluginSourcePath + "/../resources/qtwebengine_resources.pak"; destinationPath = pluginDestinationPath + "/../resources/qtwebengine_resources.pak"; copyFilePrintStatus(sourcePath, destinationPath); - sourcePath = pluginSourcePath + "/../libexec/qtwebengine_devtools_resources.pak"; + sourcePath = pluginSourcePath + "/../resources/qtwebengine_devtools_resources.pak"; destinationPath = pluginDestinationPath + "/../resources/qtwebengine_devtools_resources.pak"; copyFilePrintStatus(sourcePath, destinationPath); - sourcePath = pluginSourcePath + "/../libexec/qtwebengine_resources_100p.pak"; + sourcePath = pluginSourcePath + "/../resources/qtwebengine_resources_100p.pak"; destinationPath = pluginDestinationPath + "/../resources/qtwebengine_resources_100p.pak"; copyFilePrintStatus(sourcePath, destinationPath); - sourcePath = pluginSourcePath + "/../libexec/qtwebengine_resources_200p.pak"; + sourcePath = pluginSourcePath + "/../resources/qtwebengine_resources_200p.pak"; destinationPath = pluginDestinationPath + "/../resources/qtwebengine_resources_200p.pak"; copyFilePrintStatus(sourcePath, destinationPath); - sourcePath = pluginSourcePath + "/../libexec/icudtl.dat"; + sourcePath = pluginSourcePath + "/../resources/icudtl.dat"; destinationPath = pluginDestinationPath + "/../resources/icudtl.dat"; copyFilePrintStatus(sourcePath, destinationPath); - sourcePath = pluginSourcePath + "/../libexec/qtwebengine_locales"; - destinationPath = pluginDestinationPath + "/../resources/"; + sourcePath = pluginSourcePath + "/../libexec/qtwebengine_locales"; // TODO: this is actually here ../translations/qtwebengine_locales + destinationPath = pluginDestinationPath + "/../resources/"; // TODO: find where to put it recursiveCopy(sourcePath, destinationPath); } From 92e02657d94cd00312ad7592c73578d8af1cb40f Mon Sep 17 00:00:00 2001 From: Manio Date: Mon, 30 Jan 2017 17:47:38 +0100 Subject: [PATCH 2/3] Update shared.h Add new function --- shared/shared.h | 1 + 1 file changed, 1 insertion(+) diff --git a/shared/shared.h b/shared/shared.h index 60c0fd9..736f920 100644 --- a/shared/shared.h +++ b/shared/shared.h @@ -112,6 +112,7 @@ QString copyLibrary(const LibraryInfo &library, const QString path); DeploymentInfo deployQtLibraries(const QString &appDirPath, const QStringList &additionalExecutables); DeploymentInfo deployQtLibraries(QList 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); bool deployQmlImports(const QString &appDirPath, DeploymentInfo deploymentInfo, QStringList &qmlDirs); void changeIdentification(const QString &id, const QString &binaryPath); From 959ef98726795336f20d9e6870459727df96ac59 Mon Sep 17 00:00:00 2001 From: Manio Date: Mon, 30 Jan 2017 17:50:28 +0100 Subject: [PATCH 3/3] Update shared.cpp Final improvement to Qt WebEngine resources location --- shared/shared.cpp | 70 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 54 insertions(+), 16 deletions(-) diff --git a/shared/shared.cpp b/shared/shared.cpp index b04162d..3d77b87 100644 --- a/shared/shared.cpp +++ b/shared/shared.cpp @@ -889,28 +889,42 @@ void deployPlugins(const AppDirInfo &appDirInfo, const QString &pluginSourcePath // especially since stuff that is supposed to come from resources actually // seems to come in libexec in the upstream Qt binary distribution if (containsHowOften(deploymentInfo.deployedLibraries, "libQt5WebEngineCore")) { - QDir().mkpath(appDirInfo.path + "/resources"); - QDir().mkpath(appDirInfo.path + "/libexec"); - sourcePath = pluginSourcePath + "/../libexec/QtWebEngineProcess"; - destinationPath = pluginDestinationPath + "/../libexec/QtWebEngineProcess"; + // Find directories with needed files: + QString qtLibexecPath = qtToBeBundledInfo.value("QT_INSTALL_LIBEXECS"); + QString qtDataPath = qtToBeBundledInfo.value("QT_INSTALL_DATA"); + QString qtTranslationsPath = qtToBeBundledInfo.value("QT_INSTALL_TRANSLATIONS"); + // create destination directories: + QString dstLibexec = appDirInfo.path + "/libexec"; + QString dstResources = appDirInfo.path + "/resources"; + QString dstTranslations = appDirInfo.path + "/translations"; + QDir().mkpath(dstLibexec); + QDir().mkpath(dstResources); + QDir().mkpath(dstTranslations); + // WebEngine executable: + sourcePath = QDir::cleanPath(qtLibexecPath + "/QtWebEngineProcess"); + destinationPath = QDir::cleanPath(dstLibexec + "/QtWebEngineProcess"); copyFilePrintStatus(sourcePath, destinationPath); - sourcePath = pluginSourcePath + "/../resources/qtwebengine_resources.pak"; - destinationPath = pluginDestinationPath + "/../resources/qtwebengine_resources.pak"; + // put qt.conf file next to browser process so it can also make use of our local Qt resources + createQtConfForQtWebEngineProcess(dstLibexec); + // Resources: + sourcePath = QDir::cleanPath(qtDataPath + "/resources/qtwebengine_resources.pak"); + destinationPath = QDir::cleanPath(dstResources + "/qtwebengine_resources.pak"); copyFilePrintStatus(sourcePath, destinationPath); - sourcePath = pluginSourcePath + "/../resources/qtwebengine_devtools_resources.pak"; - destinationPath = pluginDestinationPath + "/../resources/qtwebengine_devtools_resources.pak"; + sourcePath = QDir::cleanPath(qtDataPath + "/resources/qtwebengine_devtools_resources.pak"); + destinationPath = QDir::cleanPath(dstResources + "/qtwebengine_devtools_resources.pak"); copyFilePrintStatus(sourcePath, destinationPath); - sourcePath = pluginSourcePath + "/../resources/qtwebengine_resources_100p.pak"; - destinationPath = pluginDestinationPath + "/../resources/qtwebengine_resources_100p.pak"; + sourcePath = QDir::cleanPath(qtDataPath + "/resources/qtwebengine_resources_100p.pak"); + destinationPath = QDir::cleanPath(dstResources + "/qtwebengine_resources_100p.pak"); copyFilePrintStatus(sourcePath, destinationPath); - sourcePath = pluginSourcePath + "/../resources/qtwebengine_resources_200p.pak"; - destinationPath = pluginDestinationPath + "/../resources/qtwebengine_resources_200p.pak"; + sourcePath = QDir::cleanPath(qtDataPath + "/resources/qtwebengine_resources_200p.pak"); + destinationPath = QDir::cleanPath(dstResources + "/qtwebengine_resources_200p.pak"); copyFilePrintStatus(sourcePath, destinationPath); - sourcePath = pluginSourcePath + "/../resources/icudtl.dat"; - destinationPath = pluginDestinationPath + "/../resources/icudtl.dat"; + sourcePath = QDir::cleanPath(qtDataPath + "/resources/icudtl.dat"); + destinationPath = QDir::cleanPath(dstResources + "/icudtl.dat"); copyFilePrintStatus(sourcePath, destinationPath); - sourcePath = pluginSourcePath + "/../libexec/qtwebengine_locales"; // TODO: this is actually here ../translations/qtwebengine_locales - destinationPath = pluginDestinationPath + "/../resources/"; // TODO: find where to put it + // Translations: + sourcePath = QDir::cleanPath(qtTranslationsPath + "/qtwebengine_locales"); + destinationPath = QDir::cleanPath(dstTranslations + "/qtwebengine_locales"); recursiveCopy(sourcePath, destinationPath); } @@ -964,6 +978,30 @@ void createQtConf(const QString &appDirPath) } } +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) { AppDirInfo applicationBundle;