summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-03-02 17:30:07 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-03-02 17:30:27 +0100
commitd058d6c9df1ff866e4259ca2989ad144bb01a1e0 (patch)
treed91f8c314c20781080819d100df6a9855b30fbfd /src/tools
parent0c6312dfba960365771c64b937579a40e02ea5f7 (diff)
parent3f1805f8569337a21b72324d5edad329d5dfe872 (diff)
Merge remote-tracking branch 'origin/5.8' into 5.9
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/qwebengine_convert_dict/main.cpp31
-rw-r--r--src/tools/qwebengine_convert_dict/qwebengine_convert_dict.pro7
2 files changed, 35 insertions, 3 deletions
diff --git a/src/tools/qwebengine_convert_dict/main.cpp b/src/tools/qwebengine_convert_dict/main.cpp
index 2142b5f0d..61e26c4a3 100644
--- a/src/tools/qwebengine_convert_dict/main.cpp
+++ b/src/tools/qwebengine_convert_dict/main.cpp
@@ -120,9 +120,34 @@ int main(int argc, char *argv[])
return 1;
}
- PathService::Override(base::DIR_QT_LIBRARY_DATA,
- toFilePath(QLibraryInfo::location(QLibraryInfo::DataPath) %
- QLatin1String("/resources")));
+ bool icuDataDirFound = false;
+ QString icuDataDir = QLibraryInfo::location(QLibraryInfo::DataPath)
+ % QLatin1String("/resources");
+
+ // Try to look up the path to the ICU data directory via an environment variable
+ // (e.g. for the case when the tool is ran during build phase, and regular installed
+ // ICU data file is not available).
+ QString icuPossibleEnvDataDir = QString::fromLatin1(qgetenv("QT_WEBENGINE_ICU_DATA_DIR"));
+ if (!icuPossibleEnvDataDir.isEmpty() && QFileInfo::exists(icuPossibleEnvDataDir)) {
+ icuDataDir = icuPossibleEnvDataDir;
+ icuDataDirFound = true;
+ }
+ // Try to find the ICU data directory in the installed Qt location.
+ else if (QFileInfo::exists(icuDataDir)) {
+ icuDataDirFound = true;
+ }
+
+ if (icuDataDirFound) {
+ PathService::Override(base::DIR_QT_LIBRARY_DATA, toFilePath(icuDataDir));
+ } else {
+ QTextStream out(stdout);
+ out << "Couldn't find ICU data directory. Please check that the following path exists: "
+ << icuDataDir
+ << "\nAlternatively provide the directory path via the QT_WEBENGINE_ICU_DAT_DIR "
+ "environment variable.\n" << endl;
+ return 1;
+ }
+
base::AtExitManager exit_manager;
base::i18n::InitializeICU();
diff --git a/src/tools/qwebengine_convert_dict/qwebengine_convert_dict.pro b/src/tools/qwebengine_convert_dict/qwebengine_convert_dict.pro
index 4f0de84e3..2bdfee304 100644
--- a/src/tools/qwebengine_convert_dict/qwebengine_convert_dict.pro
+++ b/src/tools/qwebengine_convert_dict/qwebengine_convert_dict.pro
@@ -47,4 +47,11 @@ INCLUDEPATH += $$CHROMIUM_SRC_DIR
SOURCES += \
main.cpp
+# Support converting dictionaries in a prefix build, by supplying
+# the path to the ICU data file located in the Qt build path, rather
+# than the install path (which is not present at build time).
+icu_data_dir.name = QT_WEBENGINE_ICU_DATA_DIR
+icu_data_dir.value = $$OUT_PWD/../../../src/core/$$getConfigDir()
+QT_TOOL_ENV = icu_data_dir
load(qt_tool)
+QT_TOOL_ENV =