Fix hardcoded path to package data directory. It should be controlled over prefix. #56

This commit is contained in:
Roman Telezhynskyi 2020-07-11 10:52:53 +03:00
parent 073ed832c4
commit cc506e96ea
6 changed files with 32 additions and 39 deletions

View File

@ -19,6 +19,15 @@ unix{
} else {
VCOPY = $$QMAKE_COPY -u
}
# Prefix for binary file.
isEmpty(PREFIX){
PREFIX = $$DEFAULT_PREFIX
}
DATADIR = $$PREFIX/share
PKGDATADIR = $$DATADIR/valentina
DEFINES += DATADIR=\\\"$$DATADIR\\\" PKGDATADIR=\\\"$$PKGDATADIR\\\"
}
win32{

View File

@ -531,7 +531,7 @@ QString MApplication::diagramsPath() const
}
else
{
return QStringLiteral("/usr/share/valentina") + dPath;
return PKGDATADIR + dPath;
}
}
#else // Unix
@ -542,7 +542,7 @@ QString MApplication::diagramsPath() const
}
else
{
return QStringLiteral("/usr/share/valentina") + dPath;
return PKGDATADIR + dPath;
}
#endif
}

View File

@ -191,19 +191,11 @@ include(../translations.pri)
# Set "make install" command for Unix-like systems.
unix{
# Prefix for binary file.
isEmpty(PREFIX){
PREFIX = $$DEFAULT_PREFIX
}
unix:!macx{
DATADIR =$$PREFIX/share
DEFINES += DATADIR=\\\"$$DATADIR\\\" PKGDATADIR=\\\"$$PKGDATADIR\\\"
!macx{
# Path to bin file after installation
target.path = $$PREFIX/bin
rcc_diagrams.path = $$PREFIX/share/valentina/
rcc_diagrams.path = $$PKGDATADIR
rcc_diagrams.files = $${OUT_PWD}/$${DESTDIR}/diagrams.rcc
rcc_diagrams.CONFIG = no_check_exist

View File

@ -142,15 +142,7 @@ include(../translations.pri)
# Set "make install" command for Unix-like systems.
unix{
# Prefix for binary file.
isEmpty(PREFIX){
PREFIX = $$DEFAULT_PREFIX
}
unix:!macx{
DATADIR =$$PREFIX/share
DEFINES += DATADIR=\\\"$$DATADIR\\\" PKGDATADIR=\\\"$$PKGDATADIR\\\"
!macx{
# Path to bin file after installation
target.path = $$PREFIX/bin
@ -158,80 +150,80 @@ unix{
tape.files += $${OUT_PWD}/../tape/$${DESTDIR}/tape
# .desktop file
desktop.path = $$PREFIX/share/applications/
desktop.path = $$DATADIR/applications/
desktop.files += ../../../dist/$${TARGET}.desktop \
desktop.files += ../../../dist/tape.desktop
# logo
hicolor_48_apps.path = $$PREFIX/share/icons/hicolor/48x48/apps/
hicolor_48_apps.path = $$DATADIR/icons/hicolor/48x48/apps/
hicolor_48_apps.files += \
../../../share/icons/48x48/apps/$${TARGET}.png \
../../../share/icons/48x48/apps/tape.png
hicolor_48_mimetypes.path = $$PREFIX/share/icons/hicolor/48x48/mimetypes/
hicolor_48_mimetypes.path = $$DATADIR/icons/hicolor/48x48/mimetypes/
hicolor_48_mimetypes.files += \
../../../share/icons/48x48/mimetypes/application-x-valentina-pattern.png \
../../../share/icons/48x48/mimetypes/application-x-valentina-i-measurements.png \
../../../share/icons/48x48/mimetypes/application-x-valentina-s-measurements.png
hicolor_64_apps.path = $$PREFIX/share/icons/hicolor/64x64/apps/
hicolor_64_apps.path = $$DATADIR/icons/hicolor/64x64/apps/
hicolor_64_apps.files += \
../../../share/icons/64x64/apps/$${TARGET}.png \
../../../share/icons/64x64/apps/tape.png
hicolor_64_mimetypes.path = $$PREFIX/share/icons/hicolor/64x64/mimetypes/
hicolor_64_mimetypes.path = $$DATADIR/icons/hicolor/64x64/mimetypes/
hicolor_64_mimetypes.files += \
../../../share/icons/64x64/mimetypes/application-x-valentina-pattern.png \
../../../share/icons/64x64/mimetypes/application-x-valentina-i-measurements.png \
../../../share/icons/64x64/mimetypes/application-x-valentina-s-measurements.png
hicolor_128_apps.path = $$PREFIX/share/icons/hicolor/128x128/apps/
hicolor_128_apps.path = $$DATADIR/icons/hicolor/128x128/apps/
hicolor_128_apps.files += \
../../../share/icons/128x128/apps/$${TARGET}.png \
../../../share/icons/128x128/apps/tape.png
hicolor_128_mimetypes.path = $$PREFIX/share/icons/hicolor/128x128/mimetypes/
hicolor_128_mimetypes.path = $$DATADIR/icons/hicolor/128x128/mimetypes/
hicolor_128_mimetypes.files += \
../../../share/icons/128x128/mimetypes/application-x-valentina-pattern.png \
../../../share/icons/128x128/mimetypes/application-x-valentina-i-measurements.png \
../../../share/icons/128x128/mimetypes/application-x-valentina-s-measurements.png
hicolor_256_apps.path = $$PREFIX/share/icons/hicolor/256x256/apps/
hicolor_256_apps.path = $$DATADIR/icons/hicolor/256x256/apps/
hicolor_256_apps.files += \
../../../share/icons/256x256/apps/$${TARGET}.png \
../../../share/icons/256x256/apps/tape.png
hicolor_256_mimetypes.path = $$PREFIX/share/icons/hicolor/256x256/mimetypes/
hicolor_256_mimetypes.path = $$DATADIR/icons/hicolor/256x256/mimetypes/
hicolor_256_mimetypes.files += \
../../../share/icons/256x256/mimetypes/application-x-valentina-pattern.png \
../../../share/icons/256x256/mimetypes/application-x-valentina-i-measurements.png \
../../../share/icons/256x256/mimetypes/application-x-valentina-s-measurements.png
hicolor_512_apps.path = $$PREFIX/share/icons/hicolor/512x512/apps/
hicolor_512_apps.path = $$DATADIR/icons/hicolor/512x512/apps/
hicolor_512_apps.files += \
../../../share/icons/512x512/apps/$${TARGET}.png \
../../../share/icons/512x512/apps/tape.png
hicolor_512_mimetypes.path = $$PREFIX/share/icons/hicolor/512x512/mimetypes/
hicolor_512_mimetypes.path = $$DATADIR/icons/hicolor/512x512/mimetypes/
hicolor_512_mimetypes.files += \
../../../share/icons/512x512/mimetypes/application-x-valentina-pattern.png \
../../../share/icons/512x512/mimetypes/application-x-valentina-i-measurements.png \
../../../share/icons/512x512/mimetypes/application-x-valentina-s-measurements.png
# Path to translation files after installation
translations.path = $$PREFIX/share/$${TARGET}/translations/
translations.path = $$PKGDATADIR/translations/
translations.files = $$INSTALL_TRANSLATIONS
# Path to multisize measurement after installation
multisize.path = $$PREFIX/share/$${TARGET}/tables/multisize/
multisize.path = $$PKGDATADIR/tables/multisize/
multisize.files = $$INSTALL_MULTISIZE_MEASUREMENTS
# Path to templates after installation
templates.path = $$PREFIX/share/$${TARGET}/tables/templates/
templates.path = $$PKGDATADIR/tables/templates/
templates.files = $$INSTALL_STANDARD_TEMPLATES
# Path to label templates after installation
label.path = $$PREFIX/share/$${TARGET}/labels/
label.path = $$PKGDATADIR/labels/
label.files = $$INSTALL_LABEL_TEMPLATES
INSTALLS += \

View File

@ -163,7 +163,7 @@ QString VAbstractApplication::translationsPath(const QString &locale) const
}
else
{
return QStringLiteral("/usr/share/valentina/translations");
return PKGDATADIR + trPath;
}
}
#else // Unix
@ -175,7 +175,7 @@ QString VAbstractApplication::translationsPath(const QString &locale) const
}
else
{
return QStringLiteral("/usr/share/valentina/translations");
return PKGDATADIR + trPath;
}
#endif
}

View File

@ -125,7 +125,7 @@ QStringList ClearFormats(const QStringList &predefinedFormats, QStringList forma
Q_GLOBAL_STATIC_WITH_ARGS(const QString, commonIniFilename, (QLatin1String("common")))
#if !defined(Q_OS_WIN)
const QString VCommonSettings::unixStandardSharePath = QStringLiteral("/usr/share/valentina");
const QString VCommonSettings::unixStandardSharePath = PKGDATADIR;
#endif
namespace