u_setDataDirectory to define path to ICU data.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-11-28 16:42:06 +02:00
parent 866a801f38
commit 50b929ea48
9 changed files with 38 additions and 12 deletions

View File

@ -43,9 +43,7 @@ int main(int argc, char *argv[])
Q_INIT_RESOURCE(flags); Q_INIT_RESOURCE(flags);
Q_INIT_RESOURCE(style); Q_INIT_RESOURCE(style);
QT_REQUIRE_VERSION(argc, argv, "5.4.0")// clazy:exclude=qstring-arg,qstring-allocations #if defined(APPIMAGE) && defined(Q_OS_LINUX)
#if defined(APPIMAGE)
/* When deploying with AppImage based on OpenSuse, the ICU library has a hardcoded path to the icudt*.dat file. /* When deploying with AppImage based on OpenSuse, the ICU library has a hardcoded path to the icudt*.dat file.
* This prevents the library from using shared in memory data. There are few ways to resolve this issue. According * This prevents the library from using shared in memory data. There are few ways to resolve this issue. According
* to documentation we can either use ICU_DATA environment variable or the function u_setDataDirectory(). * to documentation we can either use ICU_DATA environment variable or the function u_setDataDirectory().
@ -53,6 +51,8 @@ int main(int argc, char *argv[])
VAbstractApplication::SetICUData(argc, argv); VAbstractApplication::SetICUData(argc, argv);
#endif #endif
QT_REQUIRE_VERSION(argc, argv, "5.4.0")// clazy:exclude=qstring-arg,qstring-allocations
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
VAbstractApplication::WinAttachConsole(); VAbstractApplication::WinAttachConsole();
#endif #endif
@ -64,8 +64,6 @@ int main(int argc, char *argv[])
MApplication app(argc, argv); MApplication app(argc, argv);
app.InitOptions(); app.InitOptions();
qDebug() << "ICU_DATA: " << qgetenv("ICU_DATA");
if (FvUpdater::IsStaledTestBuild()) if (FvUpdater::IsStaledTestBuild())
{ {
qWarning() << QApplication::translate("Tape", qWarning() << QApplication::translate("Tape",

View File

@ -430,6 +430,10 @@ else:unix: LIBS += -L$${OUT_PWD}/../../libs/vpropertyexplorer/$${DESTDIR} -lvpro
INCLUDEPATH += $${PWD}/../../libs/vpropertyexplorer INCLUDEPATH += $${PWD}/../../libs/vpropertyexplorer
DEPENDPATH += $${PWD}/../../libs/vpropertyexplorer DEPENDPATH += $${PWD}/../../libs/vpropertyexplorer
contains(DEFINES, APPIMAGE) {
unix:!macx: LIBS += -licudata -licui18n -licuuc
}
noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols
# do nothing # do nothing
} else { } else {

View File

@ -47,9 +47,7 @@ int main(int argc, char *argv[])
Q_INIT_RESOURCE(toolicon); Q_INIT_RESOURCE(toolicon);
Q_INIT_RESOURCE(style); Q_INIT_RESOURCE(style);
QT_REQUIRE_VERSION(argc, argv, "5.4.0")// clazy:exclude=qstring-arg,qstring-allocations #if defined(APPIMAGE) && defined(Q_OS_LINUX)
#if defined(APPIMAGE)
/* When deploying with AppImage based on OpenSuse, the ICU library has a hardcoded path to the icudt*.dat file. /* When deploying with AppImage based on OpenSuse, the ICU library has a hardcoded path to the icudt*.dat file.
* This prevents the library from using shared in memory data. There are few ways to resolve this issue. According * This prevents the library from using shared in memory data. There are few ways to resolve this issue. According
* to documentation we can either use ICU_DATA environment variable or the function u_setDataDirectory(). * to documentation we can either use ICU_DATA environment variable or the function u_setDataDirectory().
@ -57,6 +55,8 @@ int main(int argc, char *argv[])
VAbstractApplication::SetICUData(argc, argv); VAbstractApplication::SetICUData(argc, argv);
#endif #endif
QT_REQUIRE_VERSION(argc, argv, "5.4.0")// clazy:exclude=qstring-arg,qstring-allocations
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
VAbstractApplication::WinAttachConsole(); VAbstractApplication::WinAttachConsole();
#endif #endif
@ -73,8 +73,6 @@ int main(int argc, char *argv[])
VApplication app(argc, argv); VApplication app(argc, argv);
app.InitOptions(); app.InitOptions();
qDebug() << "ICU_DATA: " << qgetenv("ICU_DATA");
if (FvUpdater::IsStaledTestBuild()) if (FvUpdater::IsStaledTestBuild())
{ {
qWarning() << QApplication::translate("Valentina", qWarning() << QApplication::translate("Valentina",

View File

@ -682,6 +682,10 @@ else:unix: LIBS += -L$${OUT_PWD}/../../libs/vpropertyexplorer/$${DESTDIR} -lvpro
INCLUDEPATH += $${PWD}/../../libs/vpropertyexplorer INCLUDEPATH += $${PWD}/../../libs/vpropertyexplorer
DEPENDPATH += $${PWD}/../../libs/vpropertyexplorer DEPENDPATH += $${PWD}/../../libs/vpropertyexplorer
contains(DEFINES, APPIMAGE) {
unix:!macx: LIBS += -licudata -licui18n -licuuc
}
noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols
# do nothing # do nothing
} else { } else {

View File

@ -49,9 +49,14 @@
# include <unistd.h> # include <unistd.h>
#endif #endif
#if defined(APPIMAGE) && defined(Q_OS_LINUX)
# include "unicode/putil.h"
#endif
namespace namespace
{ {
QString ApplicationFilePath(int &argc, char **argv) #if defined(APPIMAGE) && defined(Q_OS_LINUX)
QString ApplicationFilePath(const int &argc, char **argv)
{ {
if (argc) if (argc)
{ {
@ -109,6 +114,7 @@ QString ApplicationFilePath(int &argc, char **argv)
#endif #endif
return QString(); return QString();
} }
#endif // defined(APPIMAGE) && defined(Q_OS_LINUX)
} }
const QString VAbstractApplication::patternMessageSignature = QStringLiteral("[PATTERN MESSAGE]"); const QString VAbstractApplication::patternMessageSignature = QStringLiteral("[PATTERN MESSAGE]");
@ -340,6 +346,7 @@ bool VAbstractApplication::IsPatternMessage(const QString &message) const
return VAbstractApplication::ClearMessage(message).startsWith(patternMessageSignature); return VAbstractApplication::ClearMessage(message).startsWith(patternMessageSignature);
} }
#if defined(APPIMAGE) && defined(Q_OS_LINUX)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VAbstractApplication::SetICUData(int &argc, char **argv) void VAbstractApplication::SetICUData(int &argc, char **argv)
{ {
@ -348,8 +355,9 @@ void VAbstractApplication::SetICUData(int &argc, char **argv)
* to documentation we can either use ICU_DATA environment variable or the function u_setDataDirectory(). * to documentation we can either use ICU_DATA environment variable or the function u_setDataDirectory().
*/ */
const QString appDirPath = QFileInfo(ApplicationFilePath(argc, argv)).path(); const QString appDirPath = QFileInfo(ApplicationFilePath(argc, argv)).path();
qputenv("ICU_DATA", QString(appDirPath + QStringLiteral("/../share/icu")).toUtf8()); u_setDataDirectory(QString(appDirPath + QStringLiteral("/../share/icu")).toUtf8());
} }
#endif // defined(Q_OS_LINUX)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)

View File

@ -129,7 +129,9 @@ public:
static const QString patternMessageSignature; static const QString patternMessageSignature;
bool IsPatternMessage(const QString &message) const; bool IsPatternMessage(const QString &message) const;
#if defined(APPIMAGE) && defined(Q_OS_LINUX)
static void SetICUData(int &argc, char ** argv); static void SetICUData(int &argc, char ** argv);
#endif
protected: protected:
QUndoStack *undoStack; QUndoStack *undoStack;

View File

@ -188,6 +188,10 @@ else:unix: LIBS += -L$${OUT_PWD}/../../libs/vpropertyexplorer/$${DESTDIR} -lvpro
INCLUDEPATH += $${PWD}/../../libs/vpropertyexplorer INCLUDEPATH += $${PWD}/../../libs/vpropertyexplorer
DEPENDPATH += $${PWD}/../../libs/vpropertyexplorer DEPENDPATH += $${PWD}/../../libs/vpropertyexplorer
contains(DEFINES, APPIMAGE) {
unix:!macx: LIBS += -licudata -licui18n -licuuc
}
TAPE_TEST_FILES += \ TAPE_TEST_FILES += \
tst_tape/keiko.vit \ tst_tape/keiko.vit \
tst_tape/empty.vit \ tst_tape/empty.vit \

View File

@ -163,3 +163,7 @@ else:unix: LIBS += -L$${OUT_PWD}/../../libs/qmuparser/$${DESTDIR} -lqmuparser
INCLUDEPATH += $${PWD}/../../libs/qmuparser INCLUDEPATH += $${PWD}/../../libs/qmuparser
DEPENDPATH += $${PWD}/../../libs/qmuparser DEPENDPATH += $${PWD}/../../libs/qmuparser
contains(DEFINES, APPIMAGE) {
unix:!macx: LIBS += -licudata -licui18n -licuuc
}

View File

@ -226,6 +226,10 @@ else:unix: LIBS += -L$${OUT_PWD}/../../libs/vpropertyexplorer/$${DESTDIR} -lvpro
INCLUDEPATH += $${PWD}/../../libs/vpropertyexplorer INCLUDEPATH += $${PWD}/../../libs/vpropertyexplorer
DEPENDPATH += $${PWD}/../../libs/vpropertyexplorer DEPENDPATH += $${PWD}/../../libs/vpropertyexplorer
contains(DEFINES, APPIMAGE) {
unix:!macx: LIBS += -licudata -licui18n -licuuc
}
DATA_RESOURCE = share/test_data.qrc # External Binary Resource DATA_RESOURCE = share/test_data.qrc # External Binary Resource
!exists($${OUT_PWD}/$${DESTDIR}/test_data.rcc) { !exists($${OUT_PWD}/$${DESTDIR}/test_data.rcc) {