Skip to content

Commit

Permalink
[qtcontacts-sqlite] Use macros, not hardcoded paths. JB#50027
Browse files Browse the repository at this point in the history
Signed-off-by: Matti Kosola <matti.kosola@jolla.com>
  • Loading branch information
mkosola committed Jun 8, 2020
1 parent 8d56179 commit cd6037c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
2 changes: 2 additions & 0 deletions config.pri
Expand Up @@ -7,3 +7,5 @@ packagesExist(mlite5) {
DEFINES += HAS_MLITE
PKGCONFIG += mlite5
}

DEFINES += CONTACTS_DATABASE_PATH=\"\\\"$$[QT_INSTALL_LIBS]/qtcontacts-sqlite-qt5/\\\"\"
7 changes: 2 additions & 5 deletions rpm/qtcontacts-sqlite-qt5.spec
Expand Up @@ -2,9 +2,8 @@ Name: qtcontacts-sqlite-qt5
Version: 0.2.36
Release: 0
Summary: SQLite-based plugin for QtPIM Contacts
Group: System/Plugins
License: BSD
URL: https://git.merproject.org/mer-core/qtcontacts-sqlite
URL: https://git.sailfishos.org/mer-core/qtcontacts-sqlite
Source0: %{name}-%{version}.tar.gz
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Sql)
Expand All @@ -22,7 +21,6 @@ Requires: qt5-plugin-sqldriver-sqlite

%package tests
Summary: Unit tests for qtcontacts-sqlite-qt5
Group: System/Libraries
BuildRequires: pkgconfig(Qt5Test)
Requires: %{name} = %{version}-%{release}

Expand All @@ -36,7 +34,6 @@ This package contains unit tests for the qtcontacts-sqlite-qt5 library.

%package extensions
Summary: QtContacts extension headers for qtcontacts-sqlite-qt5
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}

%description extensions
Expand All @@ -52,7 +49,7 @@ This package contains extension headers for the qtcontacts-sqlite-qt5 library.
%setup -q -n %{name}-%{version}

%build
%qmake5 "VERSION=%{version}"
%qmake5 "VERSION=%{version}" "PKGCONFIG_LIB=%{_lib}"
make %{?_smp_mflags}

%install
Expand Down
2 changes: 1 addition & 1 deletion src/engine/contactsdatabase.cpp
Expand Up @@ -2770,7 +2770,7 @@ static QVector<QtContactsSqliteExtensions::DisplayLabelGroupGenerator*> initiali
QVector<QtContactsSqliteExtensions::DisplayLabelGroupGenerator*> generators;
QByteArray pluginsPathEnv = qgetenv("QTCONTACTS_SQLITE_PLUGIN_PATH");
const QString pluginsPath = pluginsPathEnv.isEmpty() ?
QStringLiteral("/usr/lib/qtcontacts-sqlite-qt5/") :
CONTACTS_DATABASE_PATH :
QString::fromUtf8(pluginsPathEnv);
QDir pluginDir(pluginsPath);
const QStringList pluginNames = pluginDir.entryList();
Expand Down
8 changes: 7 additions & 1 deletion src/engine/engine.pro
Expand Up @@ -19,6 +19,12 @@ packagesExist(mlite5) {
warning("mlite not available. Display label groups will be generated from last name.")
}

# This should be passed on qmake command line
isEmpty(PKGCONFIG_LIB) {
PKGCONFIG_LIB = lib
message("PKGCONFIG_LIB is unset, assuming $$PKGCONFIG_LIB")
}

# we hardcode this for Qt4 as there's no GenericDataLocation offered by QDesktopServices
DEFINES += 'QTCONTACTS_SQLITE_PRIVILEGED_DIR=\'\"privileged\"\''
DEFINES += 'QTCONTACTS_SQLITE_DATABASE_DIR=\'\"Contacts/qtcontacts-sqlite\"\''
Expand Down Expand Up @@ -70,7 +76,7 @@ headers.files = ../extensions/*
headers.depends = ../extensions/*
INSTALLS += headers

pkgconfig.path = $${PREFIX}/lib/pkgconfig
pkgconfig.path = $${PREFIX}/$${PKGCONFIG_LIB}/pkgconfig
pkgconfig.files = ../$${PACKAGENAME}.pc
INSTALLS += pkgconfig

Expand Down
2 changes: 1 addition & 1 deletion tests/auto/displaylabelgroups/testplugin/testplugin.pro
Expand Up @@ -8,5 +8,5 @@ TARGET = $$qtLibraryTarget(testdlgg)
PLUGIN_TYPE = contacts_dlgg
DESTDIR = $${PLUGIN_TYPE}
PKGCONFIG += Qt5Contacts
target.path = /usr/lib/qtcontacts-sqlite-qt5/
target.path = $$[QT_INSTALL_LIBS]/qtcontacts-sqlite-qt5/
INSTALLS += target

0 comments on commit cd6037c

Please sign in to comment.