Control: tags + patch
Control: tags + pending

This turned out to be a little tricker than expected. While the
tray-monitor code itself only needed a tiny adjustment to compile
against Qt5, getting the actual binary into the package needed more
work.

Upstream is using libtool to link and install the binary. Starting with
Qt 5.9, however, qmake no longer allows to override the install program
by setting QMAKE_INSTALL_PROGRAM. See [1].

So without any adjustments, the libtool wrapper script ends up being
installed instead of the real binary.

As there does not seem to be a away to integrate libtool and qmake
anymore, I went the plain qmake way.

Note that upstream switched to cmake in 18.2 which already checks for
Qt5, so this patch can be dropped once 18.2 lands in Debian.

[1] https://lists.qt-project.org/pipermail/development/2017-July/030478.html

-- 
ceterum censeo microsoftem esse delendam
diff --git a/autoconf/configure.in b/autoconf/configure.in
index 28bb3ae51..a291f7f76 100644
--- a/autoconf/configure.in
+++ b/autoconf/configure.in
@@ -402,7 +402,7 @@ AC_ARG_ENABLE(traymonitor,
    AC_HELP_STRING([--enable-traymonitor], [enable build of traymonitor @<:@default=no@:>@]),
    [
        if test x$enableval = xyes; then
-          AC_DEFINE(HAVE_TRAYMONITOR, 1, [Define to 1 if tray-monitor Qt4 GUI support should be enabled])
+          AC_DEFINE(HAVE_TRAYMONITOR, 1, [Define to 1 if tray-monitor Qt5 GUI support should be enabled])
           support_traymonitor=yes
        fi
    ]
@@ -411,13 +411,13 @@ AC_ARG_ENABLE(traymonitor,
 TRAY_MONITOR_DIR=
 DEBIAN_CONTROL_TRAYMONITOR=/dev/null
 if test x$support_traymonitor = xyes; then
-   abc=`$PKGCONFIG --atleast-version=4.6 QtGui`
+   abc=`$PKGCONFIG --atleast-version=5.0 Qt5Gui`
    pkg=$?
    if test $pkg = 0; then
       TRAY_MONITOR_DIR=src/qt-tray-monitor
       DEBIAN_CONTROL_TRAYMONITOR=./debian/control.bareos-traymonitor
    else
-      AC_MSG_ERROR(Unable to find suitable Qt4 installation needed by tray-monitor)
+      AC_MSG_ERROR(Unable to find suitable Qt5 installation needed by tray-monitor)
    fi
 fi
 
diff --git a/src/qt-tray-monitor/tray-monitor.pro.in b/src/qt-tray-monitor/tray-monitor.pro.in
index c0351293a..9011bae49 100644
--- a/src/qt-tray-monitor/tray-monitor.pro.in
+++ b/src/qt-tray-monitor/tray-monitor.pro.in
@@ -15,9 +15,12 @@ CONFIG( debug, debug|release )  {
    CONFIG += release
 }
 
-QMAKE_LIBDIR += ../lib
+QMAKE_LIBDIR += ../lib/.libs/
 QMAKE_CXXFLAGS += @JANSSON_INC@
-LIBS         += -lbareoscfg -lbareos
+QMAKE_LFLAGS += '-Wl,-rpath,/usr/lib/bareos'
+LIBS         += -lbareoscfg -lbareos -ljansson
+
+QT += widgets
 
 bins.path            = /$(DESTDIR)@bindir@
 bins.files           = bareos-tray-monitor
@@ -43,10 +46,6 @@ TARGET       = bareos-tray-monitor
 DEPENDPATH  += .
 INCLUDEPATH += ../include .. .
 
-LIBTOOL_LINK = @QMAKE_LIBTOOL@ --silent --tag=CXX --mode=link
-LIBTOOL_INSTALL = @QMAKE_LIBTOOL@ --silent --mode=install
-QMAKE_LINK   = $${LIBTOOL_LINK} $(CXX)
-QMAKE_INSTALL_PROGRAM = $${LIBTOOL_INSTALL} install -m @SBINPERM@ -p
 QMAKE_CLEAN += .libs/* bareos-tray-monitor release/bareos-tray-monitor
 
 RESOURCES    = main.qrc
diff --git a/src/qt-tray-monitor/traymenu.cpp b/src/qt-tray-monitor/traymenu.cpp
index 9e2ef06f8..1f840f92b 100644
--- a/src/qt-tray-monitor/traymenu.cpp
+++ b/src/qt-tray-monitor/traymenu.cpp
@@ -47,7 +47,7 @@ void TrayMenu::createAction(QString objName, QString text, QWidget* mainWindow)
    const QString& translate = QApplication::translate("TrayMonitor",
                                                        text.toUtf8(),
                                                        0,
-                                                       QApplication::UnicodeUTF8);
+                                                       0);
 
    QAction *action = new QAction(translate, mainWindow);
 

Attachment: pgpGRDda5vKEI.pgp
Description: OpenPGP digital signature

Reply via email to