From d466a3c75fed7b26243d22f306043035d13e09f8 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Mon, 15 Apr 2019 14:08:06 +0200 Subject: [PATCH 1/6] Don't set debian/ubuntu specific paths in prject file --- libnymea-core/libnymea-core.pro | 2 +- libnymea/libnymea.pro | 2 +- nymea.pri | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libnymea-core/libnymea-core.pro b/libnymea-core/libnymea-core.pro index 6c542eb4..f8d4c3a3 100644 --- a/libnymea-core/libnymea-core.pro +++ b/libnymea-core/libnymea-core.pro @@ -7,7 +7,7 @@ QT += sql INCLUDEPATH += $$top_srcdir/libnymea LIBS += -L$$top_builddir/libnymea/ -lnymea -lssl -lcrypto -lavahi-common -lavahi-client -lnymea-mqtt -target.path = /usr/lib/$$system('dpkg-architecture -q DEB_HOST_MULTIARCH') +target.path = /usr/lib/ INSTALLS += target # icons for the webserver diff --git a/libnymea/libnymea.pro b/libnymea/libnymea.pro index 2e1b544b..b7b0ac9b 100644 --- a/libnymea/libnymea.pro +++ b/libnymea/libnymea.pro @@ -8,7 +8,7 @@ DEFINES += LIBNYMEA_LIBRARY QMAKE_LFLAGS += -fPIC -target.path = /usr/lib/$$system('dpkg-architecture -q DEB_HOST_MULTIARCH') +target.path = /usr/lib/ INSTALLS += target # Avahi libs diff --git a/nymea.pri b/nymea.pri index dfd7162c..d25c25a8 100644 --- a/nymea.pri +++ b/nymea.pri @@ -2,7 +2,7 @@ NYMEA_VERSION_STRING=$$system('dpkg-parsechangelog | sed -n -e "s/^Version: //p"') # Install path for plugins -NYMEA_PLUGINS_PATH=/usr/lib/$$system('dpkg-architecture -q DEB_HOST_MULTIARCH')/nymea/plugins/ +NYMEA_PLUGINS_PATH=/usr/lib/nymea/plugins/ # define protocol versions JSON_PROTOCOL_VERSION_MAJOR=2 From 366c2e515b91d36adc5ab0a2e3ef81880e4b092b Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Mon, 15 Apr 2019 22:26:12 +0200 Subject: [PATCH 2/6] update dpkg structure to install files as before --- debian/libnymea1-dev.install.in | 2 +- debian/libnymea1.install.in | 4 +--- debian/nymea-tests.install.in | 2 +- debian/nymead.install.in | 5 +---- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/debian/libnymea1-dev.install.in b/debian/libnymea1-dev.install.in index 5176a5df..5b94457f 100644 --- a/debian/libnymea1-dev.install.in +++ b/debian/libnymea1-dev.install.in @@ -1,4 +1,4 @@ -usr/lib/@DEB_HOST_MULTIARCH@/libnymea.so +usr/lib/libnymea*.so usr/lib/@DEB_HOST_MULTIARCH@/ usr/include/nymea/* usr/include/nymea usr/bin/nymea-generateplugininfo usr/bin libnymea/plugin/plugin.pri usr/include/nymea/ diff --git a/debian/libnymea1.install.in b/debian/libnymea1.install.in index bc80c121..9211e1dd 100644 --- a/debian/libnymea1.install.in +++ b/debian/libnymea1.install.in @@ -1,3 +1 @@ -usr/lib/@DEB_HOST_MULTIARCH@/libnymea.so.1 -usr/lib/@DEB_HOST_MULTIARCH@/libnymea.so.1.0 -usr/lib/@DEB_HOST_MULTIARCH@/libnymea.so.1.0.0 +usr/lib/libnymea.so.* usr/lib/@DEB_HOST_MULTIARCH@/ diff --git a/debian/nymea-tests.install.in b/debian/nymea-tests.install.in index 7b9977c6..054cd231 100644 --- a/debian/nymea-tests.install.in +++ b/debian/nymea-tests.install.in @@ -1,2 +1,2 @@ usr/tests/* usr/lib/@DEB_HOST_MULTIARCH@/nymea/tests -usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/libnymea_devicepluginmock.so +usr/lib/nymea/plugins/libnymea_devicepluginmock.so usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/libnymea_devicepluginmock.so diff --git a/debian/nymead.install.in b/debian/nymead.install.in index 92384b71..58218375 100644 --- a/debian/nymead.install.in +++ b/debian/nymead.install.in @@ -1,8 +1,5 @@ usr/bin/nymead -usr/lib/@DEB_HOST_MULTIARCH@/libnymea-core.so -usr/lib/@DEB_HOST_MULTIARCH@/libnymea-core.so.1 -usr/lib/@DEB_HOST_MULTIARCH@/libnymea-core.so.1.0 -usr/lib/@DEB_HOST_MULTIARCH@/libnymea-core.so.1.0.0 +usr/lib/libnymea-core.so.* usr/lib/@DEB_HOST_MULTIARCH@/ data/systemd/nymead.service /lib/systemd/system/ data/logrotate/nymead /etc/logrotate.d/ data/dbus-1/io.guh.nymead.conf /etc/dbus-1/system.d/ From ad4c2acbfc8fd8e63f688871c96b17d041c8f3b6 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Tue, 16 Apr 2019 23:29:58 +0200 Subject: [PATCH 3/6] Also drop hardcoded NYMEA_PLUGINS_PATH from .pro file --- libnymea/devicemanager.cpp | 9 ++++----- libnymea/translator.cpp | 7 +------ nymea.pri | 6 +----- nymea.pro | 1 - plugins/plugins.pri | 2 +- 5 files changed, 7 insertions(+), 18 deletions(-) diff --git a/libnymea/devicemanager.cpp b/libnymea/devicemanager.cpp index 0c4eb13b..c2738282 100644 --- a/libnymea/devicemanager.cpp +++ b/libnymea/devicemanager.cpp @@ -245,14 +245,13 @@ QStringList DeviceManager::pluginSearchDirs() if (!envPath.isEmpty()) { searchDirs << QString(envPath).split(':'); } + + foreach (QString libraryPath, QCoreApplication::libraryPaths()) { + searchDirs << libraryPath.replace("qt5", "nymea"); + } searchDirs << QCoreApplication::applicationDirPath() + "/../lib/nymea/plugins"; searchDirs << QCoreApplication::applicationDirPath() + "/../plugins/"; searchDirs << QCoreApplication::applicationDirPath() + "/../../../plugins/"; - searchDirs << QString("%1").arg(NYMEA_PLUGINS_PATH); - QString snapDir = QString::fromUtf8(qgetenv("SNAP")); - if (!snapDir.isEmpty()) { - searchDirs << QString("%1%2").arg(snapDir).arg(NYMEA_PLUGINS_PATH); - } return searchDirs; } diff --git a/libnymea/translator.cpp b/libnymea/translator.cpp index 69c31d0b..af62f129 100644 --- a/libnymea/translator.cpp +++ b/libnymea/translator.cpp @@ -85,12 +85,7 @@ void Translator::loadTranslator(DevicePlugin *plugin, const QLocale &locale) } else { QString pluginId = plugin->pluginId().toString().remove(QRegExp("[{}]")); - QStringList searchDirs = QString(qgetenv("NYMEA_PLUGINS_PATH")).split(':'); - searchDirs << QCoreApplication::applicationDirPath() + "/../lib/nymea/plugins"; - searchDirs << QCoreApplication::applicationDirPath() + "/../plugins/"; - searchDirs << QCoreApplication::applicationDirPath() + "/../../../plugins/"; - - foreach (const QString &pluginPath, searchDirs) { + foreach (const QString &pluginPath, m_deviceManager->pluginSearchDirs()) { if (translator->load(locale, pluginId, "-", QDir(pluginPath + "/translations/").absolutePath(), ".qm")) { qCDebug(dcTranslations()) << "* Loaded translation" << locale.name() << "for plugin" << plugin->pluginName() << "from" << QDir(pluginPath + "/translations/").absolutePath(); loaded = true; diff --git a/nymea.pri b/nymea.pri index d25c25a8..3a1a78eb 100644 --- a/nymea.pri +++ b/nymea.pri @@ -1,9 +1,6 @@ # Parse and export NYMEA_VERSION_STRING NYMEA_VERSION_STRING=$$system('dpkg-parsechangelog | sed -n -e "s/^Version: //p"') -# Install path for plugins -NYMEA_PLUGINS_PATH=/usr/lib/nymea/plugins/ - # define protocol versions JSON_PROTOCOL_VERSION_MAJOR=2 JSON_PROTOCOL_VERSION_MINOR=0 @@ -15,8 +12,7 @@ COPYRIGHT_YEAR_TO=2019 DEFINES += NYMEA_VERSION_STRING=\\\"$${NYMEA_VERSION_STRING}\\\" \ JSON_PROTOCOL_VERSION=\\\"$${JSON_PROTOCOL_VERSION_MAJOR}.$${JSON_PROTOCOL_VERSION_MINOR}\\\" \ REST_API_VERSION=\\\"$${REST_API_VERSION}\\\" \ - COPYRIGHT_YEAR_STRING=\\\"$${COPYRIGHT_YEAR_FROM}-$${COPYRIGHT_YEAR_TO}\\\" \ - NYMEA_PLUGINS_PATH=\\\"$${NYMEA_PLUGINS_PATH}\\\" + COPYRIGHT_YEAR_STRING=\\\"$${COPYRIGHT_YEAR_FROM}-$${COPYRIGHT_YEAR_TO}\\\" QT *= network websockets bluetooth dbus diff --git a/nymea.pro b/nymea.pro index fc6a7443..3713aa3e 100644 --- a/nymea.pro +++ b/nymea.pro @@ -58,7 +58,6 @@ message("Copyright $${COPYRIGHT_YEAR_FROM} - $${COPYRIGHT_YEAR_TO}") message("Building nymea version $${NYMEA_VERSION_STRING}") message("JSON-RPC API version $${JSON_PROTOCOL_VERSION_MAJOR}.$${JSON_PROTOCOL_VERSION_MINOR}") message("REST API version $${REST_API_VERSION}") -message("Plugin path $${NYMEA_PLUGINS_PATH}") message("Source directory: $${top_srcdir}") message("Build directory: $${top_builddir}") message("Translations: $${TRANSLATIONS}") diff --git a/plugins/plugins.pri b/plugins/plugins.pri index 0938aec8..3b83e3c6 100644 --- a/plugins/plugins.pri +++ b/plugins/plugins.pri @@ -34,5 +34,5 @@ PRE_TARGETDEPS += compiler_plugininfo_make_all compiler_externplugininfo_make_al QMAKE_EXTRA_COMPILERS += plugininfo externplugininfo # Install plugin -target.path = $$NYMEA_PLUGINS_PATH +target.path = /usr/lib/nymea/plugins/ INSTALLS += target From 3ff10e288115c37e62b7ec72a2276844f09052ea Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Wed, 17 Apr 2019 15:08:53 +0200 Subject: [PATCH 4/6] Properly fix install paths --- debian/libnymea1-dev.install.in | 3 ++- debian/libnymea1.install.in | 4 +++- debian/nymea-tests.install.in | 2 +- debian/nymead.install.in | 4 +++- libnymea-core/libnymea-core.pro | 2 +- libnymea/libnymea.pro | 2 +- plugins/plugins.pri | 2 +- 7 files changed, 12 insertions(+), 7 deletions(-) diff --git a/debian/libnymea1-dev.install.in b/debian/libnymea1-dev.install.in index 5b94457f..2038eeef 100644 --- a/debian/libnymea1-dev.install.in +++ b/debian/libnymea1-dev.install.in @@ -1,4 +1,5 @@ -usr/lib/libnymea*.so usr/lib/@DEB_HOST_MULTIARCH@/ +usr/lib/@DEB_HOST_MULTIARCH@/libnymea.so +usr/lib/@DEB_HOST_MULTIARCH@/libnymea-core.so usr/include/nymea/* usr/include/nymea usr/bin/nymea-generateplugininfo usr/bin libnymea/plugin/plugin.pri usr/include/nymea/ diff --git a/debian/libnymea1.install.in b/debian/libnymea1.install.in index 9211e1dd..bc80c121 100644 --- a/debian/libnymea1.install.in +++ b/debian/libnymea1.install.in @@ -1 +1,3 @@ -usr/lib/libnymea.so.* usr/lib/@DEB_HOST_MULTIARCH@/ +usr/lib/@DEB_HOST_MULTIARCH@/libnymea.so.1 +usr/lib/@DEB_HOST_MULTIARCH@/libnymea.so.1.0 +usr/lib/@DEB_HOST_MULTIARCH@/libnymea.so.1.0.0 diff --git a/debian/nymea-tests.install.in b/debian/nymea-tests.install.in index 054cd231..7b9977c6 100644 --- a/debian/nymea-tests.install.in +++ b/debian/nymea-tests.install.in @@ -1,2 +1,2 @@ usr/tests/* usr/lib/@DEB_HOST_MULTIARCH@/nymea/tests -usr/lib/nymea/plugins/libnymea_devicepluginmock.so usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/libnymea_devicepluginmock.so +usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/libnymea_devicepluginmock.so diff --git a/debian/nymead.install.in b/debian/nymead.install.in index 58218375..672a4bd3 100644 --- a/debian/nymead.install.in +++ b/debian/nymead.install.in @@ -1,5 +1,7 @@ usr/bin/nymead -usr/lib/libnymea-core.so.* usr/lib/@DEB_HOST_MULTIARCH@/ +usr/lib/@DEB_HOST_MULTIARCH@/libnymea-core.so.1 +usr/lib/@DEB_HOST_MULTIARCH@/libnymea-core.so.1.0 +usr/lib/@DEB_HOST_MULTIARCH@/libnymea-core.so.1.0.0 data/systemd/nymead.service /lib/systemd/system/ data/logrotate/nymead /etc/logrotate.d/ data/dbus-1/io.guh.nymead.conf /etc/dbus-1/system.d/ diff --git a/libnymea-core/libnymea-core.pro b/libnymea-core/libnymea-core.pro index f8d4c3a3..b7a4adf1 100644 --- a/libnymea-core/libnymea-core.pro +++ b/libnymea-core/libnymea-core.pro @@ -7,7 +7,7 @@ QT += sql INCLUDEPATH += $$top_srcdir/libnymea LIBS += -L$$top_builddir/libnymea/ -lnymea -lssl -lcrypto -lavahi-common -lavahi-client -lnymea-mqtt -target.path = /usr/lib/ +target.path = $$[QT_INSTALL_LIBS] INSTALLS += target # icons for the webserver diff --git a/libnymea/libnymea.pro b/libnymea/libnymea.pro index b7b0ac9b..d4f9fbda 100644 --- a/libnymea/libnymea.pro +++ b/libnymea/libnymea.pro @@ -8,7 +8,7 @@ DEFINES += LIBNYMEA_LIBRARY QMAKE_LFLAGS += -fPIC -target.path = /usr/lib/ +target.path = $$[QT_INSTALL_LIBS] INSTALLS += target # Avahi libs diff --git a/plugins/plugins.pri b/plugins/plugins.pri index 3b83e3c6..fd6d752f 100644 --- a/plugins/plugins.pri +++ b/plugins/plugins.pri @@ -34,5 +34,5 @@ PRE_TARGETDEPS += compiler_plugininfo_make_all compiler_externplugininfo_make_al QMAKE_EXTRA_COMPILERS += plugininfo externplugininfo # Install plugin -target.path = /usr/lib/nymea/plugins/ +target.path = $$[QT_INSTALL_LIBS]/nymea/plugins/ INSTALLS += target From 024613b9fc4353e4d7905692a22ca1aadbffd0bd Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Tue, 23 Apr 2019 21:43:20 +0200 Subject: [PATCH 5/6] Add support for pkg-config --- debian/libnymea1-dev.install.in | 1 + libnymea/libnymea.pro | 39 +++++++++++++++++---------------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/debian/libnymea1-dev.install.in b/debian/libnymea1-dev.install.in index 2038eeef..8ddc9e8a 100644 --- a/debian/libnymea1-dev.install.in +++ b/debian/libnymea1-dev.install.in @@ -3,3 +3,4 @@ usr/lib/@DEB_HOST_MULTIARCH@/libnymea-core.so usr/include/nymea/* usr/include/nymea usr/bin/nymea-generateplugininfo usr/bin libnymea/plugin/plugin.pri usr/include/nymea/ +usr/lib/@DEB_HOST_MULTIARCH@/nymea.pc usr/lib/@DEB_HOST_MULTIARCH@/pkgconfig/ diff --git a/libnymea/libnymea.pro b/libnymea/libnymea.pro index d4f9fbda..d5401e59 100644 --- a/libnymea/libnymea.pro +++ b/libnymea/libnymea.pro @@ -8,10 +8,6 @@ DEFINES += LIBNYMEA_LIBRARY QMAKE_LFLAGS += -fPIC -target.path = $$[QT_INSTALL_LIBS] -INSTALLS += target - -# Avahi libs LIBS += -lavahi-common -lavahi-client HEADERS += devicemanager.h \ @@ -35,11 +31,6 @@ HEADERS += devicemanager.h \ network/oauth2.h \ network/avahi/qtavahiservicebrowser.h \ network/avahi/avahiserviceentry.h \ - #network/avahi/qtavahiclient.h \ - #network/avahi/qt-watch.h \ - #network/avahi/qtavahiservice.h \ - #network/avahi/qtavahiservice_p.h \ - #network/avahi/qtavahiservicebrowser_p.h \ hardware/bluetoothlowenergy/bluetoothlowenergydevice.h \ hardware/bluetoothlowenergy/bluetoothdiscoveryreply.h \ hardware/bluetoothlowenergy/bluetoothlowenergymanager.h \ @@ -74,7 +65,7 @@ HEADERS += devicemanager.h \ nymeadbusservice.h \ network/mqtt/mqttprovider.h \ network/mqtt/mqttchannel.h \ - translator.h + translator.h SOURCES += devicemanager.cpp \ loggingcategories.cpp \ @@ -95,11 +86,6 @@ SOURCES += devicemanager.cpp \ network/oauth2.cpp \ network/avahi/avahiserviceentry.cpp \ network/avahi/qtavahiservicebrowser.cpp \ - #network/avahi/qt-watch.cpp \ - #network/avahi/qtavahiclient.cpp \ - #network/avahi/qtavahiservice.cpp \ - #network/avahi/qtavahiservice_p.cpp \ - #network/avahi/qtavahiservicebrowser_p.cpp \ hardware/bluetoothlowenergy/bluetoothlowenergymanager.cpp \ hardware/bluetoothlowenergy/bluetoothlowenergydevice.cpp \ hardware/bluetoothlowenergy/bluetoothdiscoveryreply.cpp \ @@ -134,9 +120,14 @@ SOURCES += devicemanager.cpp \ nymeadbusservice.cpp \ network/mqtt/mqttprovider.cpp \ network/mqtt/mqttchannel.cpp \ - translator.cpp + translator.cpp +RESOURCES += \ + interfaces/interfaces.qrc + +## Install instructions + # install plugininfo python script for libnymea-dev generateplugininfo.files = $$top_srcdir/plugins/nymea-generateplugininfo generateplugininfo.path = /usr/bin @@ -145,11 +136,21 @@ INSTALLS += generateplugininfo # install header file with relative subdirectory for(header, HEADERS) { - path = /usr/include/nymea/$${dirname(header)} + path = $${PREFIX}/include/nymea/$${dirname(header)} eval(headers_$${path}.files += $${header}) eval(headers_$${path}.path = $${path}) eval(INSTALLS *= headers_$${path}) } -RESOURCES += \ - interfaces/interfaces.qrc +# define install target +target.path = $$[QT_INSTALL_LIBS] +INSTALLS += target + +# Create pkgconfig file +CONFIG += create_pc create_prl no_install_prl +QMAKE_PKGCONFIG_NAME = libnymea +QMAKE_PKGCONFIG_DESCRIPTION = nymea development library +QMAKE_PKGCONFIG_PREFIX = $${PREFIX} +QMAKE_PKGCONFIG_LIBDIR = $$target.path +QMAKE_PKGCONFIG_INCDIR = /usr/include/nymea +QMAKE_PKGCONFIG_VERSION = $$NYMEA_VERSION_STRING From 93229fb9a0bf0bf3c2559b09cf135359c05fee30 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Thu, 2 May 2019 11:31:06 +0200 Subject: [PATCH 6/6] Drop libnymea-core.so from installation... it's not needed --- debian/libnymea1-dev.install.in | 1 - debian/rules | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/libnymea1-dev.install.in b/debian/libnymea1-dev.install.in index 8ddc9e8a..e3c0e18f 100644 --- a/debian/libnymea1-dev.install.in +++ b/debian/libnymea1-dev.install.in @@ -1,5 +1,4 @@ usr/lib/@DEB_HOST_MULTIARCH@/libnymea.so -usr/lib/@DEB_HOST_MULTIARCH@/libnymea-core.so usr/include/nymea/* usr/include/nymea usr/bin/nymea-generateplugininfo usr/bin libnymea/plugin/plugin.pri usr/include/nymea/ diff --git a/debian/rules b/debian/rules index ba66a033..b011dc3a 100755 --- a/debian/rules +++ b/debian/rules @@ -40,6 +40,8 @@ override_dh_auto_build: make -j$(DEB_PARALLEL_JOBS) $(MAKE_TARGETS) override_dh_install: $(PREPROCESS_FILES:.in=) + # libnymea-core isn't public api... delete dev lib and just keep runtime libs. + rm $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libnymea-core.so dh_install --fail-missing # installing the documentation as there is no extra install target cp -a $(CURDIR)/doc/html $(CURDIR)/debian/nymea-doc/usr/share/doc/nymea/ || true