Skip to contentSkip to conversation

Port ofono-phonesim to Qt5

PATCH Superseded Jonah Brüchert 3 participants 28 messages Oct 27, 2019 – Nov 12, 2019 Kbuild

lore
Share & tools
lore
#0 lore raw

Dear ofono maintainers,

This is the minimal set of patches required to port ofono phonesim to Qt5, based on previous work from openembedded (https://layers.openembedded.org/layerindex/recipe

The original patches from openembedded have been preserved in order to keep authorship information.

In order to ease porting to the upcoming Qt6, I have prepared additional refactoring patches, which port away from deprecated APIs and make use of c++11 features like override to make finding porting issues less difficult. I'll send those in a seperate email if there is interest.

Kind regards,
Jonah

#1 lore raw

PATCH 1/7 Port to qt5

From: Simon Busch <[email protected]>

---
 Makefile.am         | 2 +-
 configure.ac        | 6 +++---
 src/control.cpp     | 4 ++--
 src/qsimcommand.cpp | 2 +-
 src/qsmsmessage.cpp | 2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)
Makefile.am +1 -1
index 2a6fccf..8c99b04 100644
@@ -46,7 +46,7 @@ nodist_src_phonesim_SOURCES = src/ui_controlbase.h \
 
 src_phonesim_LDADD = $(QT_LIBS)
 
-AM_CXXFLAGS = -Wall $(QT_CFLAGS)
+AM_CXXFLAGS = -Wall $(QT_CFLAGS) -fPIC -fPIE
 
 AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src
 
configure.ac +3 -3
index e0152f0..253aa27 100644
@@ -22,18 +22,18 @@ AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization],
 	fi
 ])
 
-PKG_CHECK_MODULES(QT, QtCore QtGui QtXml QtNetwork QtScript QtDBus, dummy=yes,
+PKG_CHECK_MODULES(QT, Qt5Core Qt5Gui Qt5Xml Qt5Network Qt5Script Qt5DBus Qt5Widgets, dummy=yes,
 						AC_MSG_ERROR(Qt is required))
 AC_SUBST(QT_CFLAGS)
 AC_SUBST(QT_LIBS)
 
 AC_MSG_CHECKING(for moc)
-MOC="`$PKG_CONFIG --variable=moc_location QtCore`"
+MOC="`$PKG_CONFIG --variable=host_bins Qt5Core`/moc"
 AC_SUBST(MOC)
 AC_MSG_RESULT($MOC)
 
 AC_MSG_CHECKING(for uic)
-UIC="`$PKG_CONFIG --variable=uic_location QtCore`"
+UIC="`$PKG_CONFIG --variable=host_bins Qt5Core`/uic"
 AC_SUBST(UIC)
 AC_MSG_RESULT($UIC)
 
src/control.cpp +2 -2
index e1838a6..5eb82f1 100644
@@ -22,7 +22,7 @@
 #include <qslider.h>
 #include <qcheckbox.h>
 #include <qcombobox.h>
-#include <QtGui/qmessagebox.h>
+#include <qmessagebox.h>
 #include <qfiledialog.h>
 #include <Qt>
 #include <qbuffer.h>
@@ -31,7 +31,7 @@
 #include <QFileInfo>
 #include <QFile>
 #include <QDir>
-#include <QtGui/QHeaderView>
+#include <QHeaderView>
 
 #define TWO_BYTE_MAX 65535
 #define FOUR_CHAR 4
src/qsimcommand.cpp +1 -1
index 97e0b28..672ffb9 100644
@@ -3764,7 +3764,7 @@ void QSimCommand::addExtensionField( int tag, const QByteArray& value )
 QSimCommandPrivate *QSimCommand::dwrite()
 {
     // If we are the only user of the private object, return it as-is.
-    if ( d->ref == 1 )
+    if ( d->ref.load() == 1 )
         return d;
 
     // Create a new private object and copy the current contents into it.
src/qsmsmessage.cpp +1 -1
index c2eeb29..54885bd 100644
@@ -365,7 +365,7 @@ QSMSMessage::~QSMSMessage()
 QSMSMessagePrivate *QSMSMessage::dwrite()
 {
     // If we are the only user of the private object, return it as-is.
-    if ( d->ref == 1 )
+    if ( d->ref.load() == 1 )
         return d;
 
     // Create a new private object and copy the current contents into it.

--
2.23.0

#2 lore raw

PATCH 2/7 Fix random build failure

In reply to Jonah Brüchert

From: Martin Jansa <[email protected]>

uic and moc doesn't create output directory automatically and it could be missing when uic is executed before gcc creates any object files as src/*.o

OE @ ~/build/wpb/webos-ports/tmp-glibc/work/i586-webos-linux/phonesim/1.20-r0/build $ rm -rf src/

OE @ ~/build/wpb/webos-ports/tmp-glibc/work/i586-webos-linux/phonesim/1.20-r0/build $ /OE/build/wpb/webos-ports/tmp-glibc/sysroots/x86_64-linux/usr/bin/qt5/uic ../phonesim-1.20/src/controlbase.ui -o src/ui_controlbase.h Could not create output file

Fixes phonesim randomly failing with:
OE @ ~/build/wpb/webos-ports/tmp-glibc/work/i586-webos-linux/phonesim/1.20-r0/build $ cat ../temp/log.do_compile
DEBUG: SITE files ['endian-little', 'bit-32', 'ix86-common', 'common-linux', 'common-glibc', 'i586-linux', 'common']
DEBUG: Executing shell function do_compile
NOTE: make -j 9
/OE/build/wpb/webos-ports/tmp-glibc/sysroots/x86_64-linux/usr/bin/qt5/uic ../phonesim-1.20/src/controlbase.ui -o src/ui_controlbase.h /OE/build/wpb/webos-ports/tmp-glibc/sysroots/x86_64-linux/usr/bin/qt5/moc ../phonesim-1.20/src/control.h -o src/moc_control.cpp /OE/build/wpb/webos-ports/tmp-glibc/sysroots/x86_64-linux/usr/bin/qt5/moc ../phonesim-1.20/src/phonesim.h -o src/moc_phonesim.cpp /OE/build/wpb/webos-ports/tmp-glibc/sysroots/x86_64-linux/usr/bin/qt5/moc ../phonesim-1.20/src/hardwaremanipulator.h -o src/moc_hardwaremanipulator.cpp /OE/build/wpb/webos-ports/tmp-glibc/sysroots/x86_64-linux/usr/bin/qt5/moc ../phonesim-1.20/src/callmanager.h -o src/moc_callmanager.cpp /OE/build/wpb/webos-ports/tmp-glibc/sysroots/x86_64-linux/usr/bin/qt5/moc ../phonesim-1.20/src/simfilesystem.h -o src/moc_simfilesystem.cpp /OE/build/wpb/webos-ports/tmp-glibc/sysroots/x86_64-linux/usr/bin/qt5/moc ../phonesim-1.20/src/simapplication.h -o src/moc_simapplication.cpp Could not create output file
Makefile:977: recipe for target 'src/ui_controlbase.h' failed
make: *** [src/ui_controlbase.h] Error 1
make: *** Waiting for unfinished jobs....
WARNING: /OE/build/wpb/webos-ports/tmp-glibc/work/i586-webos-linux/phonesim/1.20-r0/temp/run.do_compile.3359:1 exit 1 from 'exit 1'
ERROR: oe_runmake failed
ERROR: Function failed: do_compile (log file is located at /OE/build/wpb/webos-ports/tmp-glibc/work/i586-webos-linux/phonesim/1.20-r0/temp/log.do_compile.3359)

---
 Makefile.am | 2 ++
 1 file changed, 2 insertions(+)
Makefile.am +2 -0
index 8c99b04..59fb421 100644
@@ -67,6 +67,7 @@ QT_V_MOC_  = $(QT_V_MOC_$(AM_DEFAULT_VERBOSITY))
 QT_V_MOC_0 = @echo "  MOC     " $@;
 
 src/moc_%.cpp: src/%.h
+	$(MKDIR_P) src
 	$(QT_V_MOC)$(MOC) $< -o $@
 
 QT_V_UIC   = $(QT_V_UIC_$(V))
@@ -74,4 +75,5 @@ QT_V_UIC_  = $(QT_V_UIC_$(AM_DEFAULT_VERBOSITY))
 QT_V_UIC_0 = @echo "  UIC     " $@;
 
 src/ui_%.h: src/%.ui
+	$(MKDIR_P) src
 	$(QT_V_UIC)$(UIC) $< -o $@

--
2.23.0

#3 lore raw

PATCH 3/7 configure.ac: use gnu++11 to fix build with Qt 5.7

In reply to Jonah Brüchert

From: Martin Jansa <[email protected]>

---
 configure.ac | 4 ++++
 1 file changed, 4 insertions(+)
configure.ac +4 -0
index 253aa27..4eb969a 100644
@@ -24,6 +24,10 @@ AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization],
 
 PKG_CHECK_MODULES(QT, Qt5Core Qt5Gui Qt5Xml Qt5Network Qt5Script Qt5DBus Qt5Widgets, dummy=yes,
 						AC_MSG_ERROR(Qt is required))
+
+# Needed for Qt 5.7
+CXXFLAGS="$CXXFLAGS --std=gnu++11"
+
 AC_SUBST(QT_CFLAGS)
 AC_SUBST(QT_LIBS)
 

--
2.23.0

#4 lore raw

PATCH 4/7 Fix build with Qt 5.8

In reply to Jonah Brüchert

From: Martin Jansa <[email protected]>

../phonesim-1.20/src/qsmsmessage.cpp: In member function 'QCBSMessage QCBSDeliverMessage::unpack(QTextCodec*)':
../phonesim-1.20/src/qsmsmessage.cpp:2598:40: error: ambiguous overload for 'operator==' (operand types are 'QCharRef' and 'char')

                          text[len - 1] == '\0' ) ) {
                          ~~~~~~~~~~~~~~^~~~~~~
In file included from ../phonesim-1.20/src/qsmsmessage.h:23:0,
                 from ../phonesim-1.20/src/qsmsmessage.cpp:22:
/OE/build/owpb/webos-ports/tmp-glibc/work/i586-webos-linux/phonesim/1.20-r0/recipe-sysroot/usr/include/qt5/QtCore/qstring.h:1632:13: note: candidate: bool operator==(QChar, const QStringRef&)
 inline bool operator==(QChar lhs, const QStringRef &rhs) Q_DECL_NOTHROW
             ^~~~~~~~
/OE/build/owpb/webos-ports/tmp-glibc/work/i586-webos-linux/phonesim/1.20-r0/recipe-sysroot/usr/include/qt5/QtCore/qstring.h:1613:13: note: candidate: bool operator==(QChar, const QString&)
 inline bool operator==(QChar lhs, const QString &rhs) Q_DECL_NOTHROW
             ^~~~~~~~
In file included from /OE/build/owpb/webos-ports/tmp-glibc/work/i586-webos-linux/phonesim/1.20-r0/recipe-sysroot/usr/include/qt5/QtCore/qstring.h:48:0,
                 from ../phonesim-1.20/src/qsmsmessage.h:23,
                 from ../phonesim-1.20/src/qsmsmessage.cpp:22:
/OE/build/owpb/webos-ports/tmp-glibc/work/i586-webos-linux/phonesim/1.20-r0/recipe-sysroot/usr/include/qt5/QtCore/qchar.h:573:30: note: candidate: constexpr bool operator==(QChar, QChar)
 Q_DECL_CONSTEXPR inline bool operator==(QChar c1, QChar c2) Q_DECL_NOTHROW { return c1.ucs == c2.ucs; }
                              ^~~~~~~~

make: *** [Makefile:583: src/qsmsmessage.o] Error 1

---
 src/qsmsmessage.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
src/qsmsmessage.cpp +2 -2
index 54885bd..63d6952 100644
@@ -2594,8 +2594,8 @@ QCBSMessage QCBSDeliverMessage::unpack(QTextCodec *codec)
     QString text = userData
         ( (QSMSDataCodingScheme)scheme, codec, headers, false, true );
     len = text.length();
-    while ( len > 0 && ( text[len - 1] == '\r' || text[len - 1] == '\n' ||
-                         text[len - 1] == '\0' ) ) {
+    while ( len > 0 && ( text.at(len - 1) == QChar ('\r') || text.at(len - 1) == QChar ('\n') ||
+                         text.at(len - 1) == QChar ('\0') ) ) {
         --len;
     }
     m.setText( text.left( len ) );

--
2.23.0

#5 lore raw

PATCH 5/7 configure.ac: fix checking for host_bins variable

In reply to Jonah Brüchert

From: Martin Jansa <[email protected]>

$PKG_CONFIG --variable=host_bins Qt5Core
returns absolute path without the prefix to sysroot when cross compiling

Before https://github.com/meta-qt5/meta-qt5/commit/b716195f609de6547cfdfadfd4fd25292a6bbf09
this will return:

pkg-config --variable=host_bins Qt5Core
/usr/bin/qt5

which is bad, but is replaced with ${OE_QMAKE_PATH_EXTERNAL_HOST_BINS} in the generated Makefile after configure as in:
https://github.com/webOS-ports/meta-webos-ports/blob/e4283e7906e3fbd2e0bcffcd317d2d1a9e2ebcd5/meta-luneos/recipes-connectivity/ofono/phonesim_1.20.bb#L22

but with empty QT_DIR_NAME the returned value is:
pkg-config --variable=host_bins Qt5Core
/usr/bin

and these 2 replaces fail, causing
make: /usr/bin/uic: Command not found

Use PKG_CHECK_VAR for host_bins which we can override with OE_QMAKE_PATH_EXTERNAL_HOST_BINS from the environment and the generated Mafile will be correct right away.

---
 configure.ac | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
configure.ac +7 -2
index 4eb969a..e339691 100644
@@ -31,13 +31,18 @@ CXXFLAGS="$CXXFLAGS --std=gnu++11"
 AC_SUBST(QT_CFLAGS)
 AC_SUBST(QT_LIBS)
 
+AC_MSG_CHECKING(for Qt5 host_bins)
+PKG_CHECK_VAR(QMAKE_PATH_HOST_BINS, Qt5Core, host_bins)
+AC_SUBST(QMAKE_PATH_HOST_BINS)
+AC_MSG_RESULT($QMAKE_PATH_HOST_BINS)
+
 AC_MSG_CHECKING(for moc)
-MOC="`$PKG_CONFIG --variable=host_bins Qt5Core`/moc"
+MOC="$QMAKE_PATH_HOST_BINS/moc"
 AC_SUBST(MOC)
 AC_MSG_RESULT($MOC)
 
 AC_MSG_CHECKING(for uic)
-UIC="`$PKG_CONFIG --variable=host_bins Qt5Core`/uic"
+UIC="$QMAKE_PATH_HOST_BINS/uic"
 AC_SUBST(UIC)
 AC_MSG_RESULT($UIC)
 

--
2.23.0

#6 lore raw

PATCH 6/7 Make Qt detect fPIC flag correctly

In reply to Jonah Brüchert
---
 Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile.am +1 -1
index 59fb421..74cf657 100644
@@ -46,7 +46,7 @@ nodist_src_phonesim_SOURCES = src/ui_controlbase.h \
 
 src_phonesim_LDADD = $(QT_LIBS)
 
-AM_CXXFLAGS = -Wall $(QT_CFLAGS) -fPIC -fPIE
+AM_CXXFLAGS = -Wall $(QT_CFLAGS) -fPIC
 
 AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src
 

--
2.23.0

#7 lore raw

PATCH 7/7 Fix handling of incoming connections

In reply to Jonah Brüchert

The function has changed from: void incomingConnection(int s)
to: void incomingConnection(qintptr s) in Qt5

See https://doc.qt.io/qt-5/sourcebreaks.html#changes-to-qt-network

This caused our implementation of incomingConnection() of QTcpServer not to be called anymore.

---
 src/server.cpp | 2 +-
 src/server.h   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
src/server.cpp +1 -1
index cd68969..62487ee 100644
@@ -44,7 +44,7 @@ void PhoneSimServer::setHardwareManipulator(HardwareManipulatorFactory *f)
         f->setRuleFile(filename);
 }
 
-void PhoneSimServer::incomingConnection(int s)
+void PhoneSimServer::incomingConnection(qintptr s)
 {
   SimRules *sr = new SimRules(s, this, filename, fact);
     sr->setPhoneNumber(QString::number(phonenumber));
src/server.h +1 -1
index 5915cc1..8fc5cfc 100644
@@ -40,7 +40,7 @@ public:
     SimRules *rules() const { return currentRules; }
 
 protected:
-    void incomingConnection(int s);
+    void incomingConnection(qintptr s) override;
 
 private:
     QString filename;

--
2.23.0

#9 lore raw

Hello devs, Hi Jonah!

I'm also interested in upstreaming Qt5 support, but I'm still not managed to setup git send-email.
I pushed my Qt5 fixes to a branch on github [1] and there is one 'must-have' patch: [2].
Without that patch, phonesim doesn't work on 64-bit platforms.

[1] https://github.com/Kaffeine/phonesim/commits/upstreaming
[2] https://github.com/Kaffeine/phonesim/commit/33ce5700c6352db731ec6859fdd1fdefc6671e16

Quoted 7 lines · Jonah Brüchert

The proper url is of course
https://layers.openembedded.org/layerindex/recipe/32381/. Sorry for the truncated one in the first mail.
_______________________________________________
ofono mailing list -- ofono(a)ofono.org
To unsubscribe send an email to ofono-leave(a)ofono.org

#10 lore raw

Hi Alexander,

It's also the first time I use git send-email, but I'd include your patch in the next revision of this patchset if you want.

I spent quite some time looking for existing Qt5 work on phonesim, but seemingly failed to find your repository. Hopefully we'll be able to avoid the duplication if this patch is accepted.

Quoted 21 lines

Hello devs, Hi Jonah!

I'm also interested in upstreaming Qt5 support, but I'm still not managed to setup git send-email.
I pushed my Qt5 fixes to a branch on github [1] and there is one 'must-have' patch: [2].
Without that patch, phonesim doesn't work on 64-bit platforms.

[1] https://github.com/Kaffeine/phonesim/commits/upstreaming
[2] https://github.com/Kaffeine/phonesim/commit/33ce5700c6352db731ec6859fdd1fdefc6671e16

Quoted 6 lines · Jonah Brüchert

The proper url is of course
https://layers.openembedded.org/layerindex/recipe/32381/. Sorry for the truncated one in the first mail.
_______________________________________________
ofono mailing list -- ofono(a)ofono.org
To unsubscribe send an email to ofono-leave(a)ofono.org

_______________________________________________
ofono mailing list -- ofono(a)ofono.org
To unsubscribe send an email to ofono-leave(a)ofono.org

#11 lore raw

This is a revised set of patches including Alexander's patches, which replace one of my own patches.

#12 lore raw

PATCH v2 1/8 Port to qt5

From: Simon Busch <[email protected]>

---
 Makefile.am         | 2 +-
 configure.ac        | 6 +++---
 src/control.cpp     | 4 ++--
 src/qsimcommand.cpp | 2 +-
 src/qsmsmessage.cpp | 2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)
Makefile.am +1 -1
index 2a6fccf..8c99b04 100644
@@ -46,7 +46,7 @@ nodist_src_phonesim_SOURCES = src/ui_controlbase.h \
 
 src_phonesim_LDADD = $(QT_LIBS)
 
-AM_CXXFLAGS = -Wall $(QT_CFLAGS)
+AM_CXXFLAGS = -Wall $(QT_CFLAGS) -fPIC -fPIE
 
 AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src
 
configure.ac +3 -3
index e0152f0..253aa27 100644
@@ -22,18 +22,18 @@ AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization],
 	fi
 ])
 
-PKG_CHECK_MODULES(QT, QtCore QtGui QtXml QtNetwork QtScript QtDBus, dummy=yes,
+PKG_CHECK_MODULES(QT, Qt5Core Qt5Gui Qt5Xml Qt5Network Qt5Script Qt5DBus Qt5Widgets, dummy=yes,
 						AC_MSG_ERROR(Qt is required))
 AC_SUBST(QT_CFLAGS)
 AC_SUBST(QT_LIBS)
 
 AC_MSG_CHECKING(for moc)
-MOC="`$PKG_CONFIG --variable=moc_location QtCore`"
+MOC="`$PKG_CONFIG --variable=host_bins Qt5Core`/moc"
 AC_SUBST(MOC)
 AC_MSG_RESULT($MOC)
 
 AC_MSG_CHECKING(for uic)
-UIC="`$PKG_CONFIG --variable=uic_location QtCore`"
+UIC="`$PKG_CONFIG --variable=host_bins Qt5Core`/uic"
 AC_SUBST(UIC)
 AC_MSG_RESULT($UIC)
 
src/control.cpp +2 -2
index e1838a6..5eb82f1 100644
@@ -22,7 +22,7 @@
 #include <qslider.h>
 #include <qcheckbox.h>
 #include <qcombobox.h>
-#include <QtGui/qmessagebox.h>
+#include <qmessagebox.h>
 #include <qfiledialog.h>
 #include <Qt>
 #include <qbuffer.h>
@@ -31,7 +31,7 @@
 #include <QFileInfo>
 #include <QFile>
 #include <QDir>
-#include <QtGui/QHeaderView>
+#include <QHeaderView>
 
 #define TWO_BYTE_MAX 65535
 #define FOUR_CHAR 4
src/qsimcommand.cpp +1 -1
index 97e0b28..672ffb9 100644
@@ -3764,7 +3764,7 @@ void QSimCommand::addExtensionField( int tag, const QByteArray& value )
 QSimCommandPrivate *QSimCommand::dwrite()
 {
     // If we are the only user of the private object, return it as-is.
-    if ( d->ref == 1 )
+    if ( d->ref.load() == 1 )
         return d;
 
     // Create a new private object and copy the current contents into it.
src/qsmsmessage.cpp +1 -1
index c2eeb29..54885bd 100644
@@ -365,7 +365,7 @@ QSMSMessage::~QSMSMessage()
 QSMSMessagePrivate *QSMSMessage::dwrite()
 {
     // If we are the only user of the private object, return it as-is.
-    if ( d->ref == 1 )
+    if ( d->ref.load() == 1 )
         return d;
 
     // Create a new private object and copy the current contents into it.

--
2.23.0

#13 lore raw

Re: [PATCH phonesim v2 1/8] Port to qt5

Hi Jonah,

Quoted 4 lines · Jonah Brüchert

From: Simon Busch <[email protected]>

We don't use Signed-off-by, so please drop this in the future.

Quoted 8 lines
---
  Makefile.am         | 2 +-
  configure.ac        | 6 +++---
  src/control.cpp     | 4 ++--
  src/qsimcommand.cpp | 2 +-
  src/qsmsmessage.cpp | 2 +-
  5 files changed, 8 insertions(+), 8 deletions(-)

In general we prefer the commits to be separated out between build changes and actual code changes.

Makefile.am nodist_src_phonesim_SOURCES = src/ui_controlbase.h \ · line 49

Quoted 10 lines
Makefile.am +1 -1
index 2a6fccf..8c99b04 100644
@@ -46,7 +46,7 @@ nodist_src_phonesim_SOURCES = src/ui_controlbase.h \
 
  src_phonesim_LDADD = $(QT_LIBS)
 
-AM_CXXFLAGS = -Wall $(QT_CFLAGS)
+AM_CXXFLAGS = -Wall $(QT_CFLAGS) -fPIC -fPIE

You set -fPIE here but remove it in patch 6. Do you want to squash these two together?

Makefile.am nodist_src_phonesim_SOURCES = src/ui_controlbase.h \ · line 52

Quoted 3 lines
Makefile.am +0 -0
  AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src
 

Regards,
-Denis

#14 lore raw

Re: [PATCH phonesim v2 1/8] Port to qt5

Hi,

first of all, thanks for the review!

The current structure of the commits is purely for historical reasons, since this is a collection of patches by different people that are all required for the Qt5 port. The Signed-off-by exist for the same reason, because the people who originally did the affected patches used them.

If you want I can squash them together and group the changes into a commit by content, not by author.

Am 29.10.19 um 17:06 schrieb Denis Kenzior:

Quoted 42 lines

Hi Jonah,

Quoted 4 lines · Jonah Brüchert

From: Simon Busch <[email protected]>

We don't use Signed-off-by, so please drop this in the future.

Quoted 8 lines

---
  Makefile.am         | 2 +-
  configure.ac        | 6 +++---
  src/control.cpp     | 4 ++--
  src/qsimcommand.cpp | 2 +-
  src/qsmsmessage.cpp | 2 +-

  5 files changed, 8 insertions(+), 8 deletions(-)

In general we prefer the commits to be separated out between build changes and actual code changes.

Makefile.am nodist_src_phonesim_SOURCES = src/ui_controlbase.h \ · line 49

Quoted 10 lines
Makefile.am +1 -1
index 2a6fccf..8c99b04 100644
@@ -46,7 +46,7 @@ nodist_src_phonesim_SOURCES = src/ui_controlbase.h \
 
   src_phonesim_LDADD = $(QT_LIBS)
 
-AM_CXXFLAGS = -Wall $(QT_CFLAGS)
+AM_CXXFLAGS = -Wall $(QT_CFLAGS) -fPIC -fPIE

You set -fPIE here but remove it in patch 6.  Do you want to squash these two together?

Quoted 3 lines

  AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src

Regards,
-Denis

#15 lore raw

Re: [PATCH phonesim v2 1/8] Port to qt5

Hi Jonah,

Quoted 8 lines · Jonah Brüchert

Hi,

first of all, thanks for the review!

The current structure of the commits is purely for historical reasons, since this is a collection of patches by different people that are all required for the Qt5 port. The Signed-off-by exist for the same reason, because the people who originally did the affected patches used them.

Right, but this is sort of irrelevant for phonesim repo itself. I'm fine upgrading to Qt5, but lets structure the commits properly in a logical manner.

Quoted 3 lines

If you want I can squash them together and group the changes into a commit by content, not by author.

That would be preferred. And if you feel obliged to, feel free to make use of Co-Authored-By tags. I'm fine accepting those.

Regards,
-Denis

#16 lore raw

PATCH v3 1/2 Port to qt5

From: Simon Busch <[email protected]>

---
 Makefile.am         |  4 +++-
 configure.ac        | 15 ++++++++++++---
 src/control.cpp     |  4 ++--
 src/phonesim.cpp    |  2 +-
 src/phonesim.h      |  2 +-
 src/qsimcommand.cpp |  2 +-
 src/qsmsmessage.cpp |  6 +++---
 src/server.cpp      |  2 +-
 src/server.h        |  2 +-
 9 files changed, 25 insertions(+), 14 deletions(-)
Makefile.am +3 -1
index 2a6fccf..74cf657 100644
@@ -46,7 +46,7 @@ nodist_src_phonesim_SOURCES = src/ui_controlbase.h \
 
 src_phonesim_LDADD = $(QT_LIBS)
 
-AM_CXXFLAGS = -Wall $(QT_CFLAGS)
+AM_CXXFLAGS = -Wall $(QT_CFLAGS) -fPIC
 
 AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src
 
@@ -67,6 +67,7 @@ QT_V_MOC_  = $(QT_V_MOC_$(AM_DEFAULT_VERBOSITY))
 QT_V_MOC_0 = @echo "  MOC     " $@;
 
 src/moc_%.cpp: src/%.h
+	$(MKDIR_P) src
 	$(QT_V_MOC)$(MOC) $< -o $@
 
 QT_V_UIC   = $(QT_V_UIC_$(V))
@@ -74,4 +75,5 @@ QT_V_UIC_  = $(QT_V_UIC_$(AM_DEFAULT_VERBOSITY))
 QT_V_UIC_0 = @echo "  UIC     " $@;
 
 src/ui_%.h: src/%.ui
+	$(MKDIR_P) src
 	$(QT_V_UIC)$(UIC) $< -o $@
configure.ac +12 -3
index e0152f0..e339691 100644
@@ -22,18 +22,27 @@ AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization],
 	fi
 ])
 
-PKG_CHECK_MODULES(QT, QtCore QtGui QtXml QtNetwork QtScript QtDBus, dummy=yes,
+PKG_CHECK_MODULES(QT, Qt5Core Qt5Gui Qt5Xml Qt5Network Qt5Script Qt5DBus Qt5Widgets, dummy=yes,
 						AC_MSG_ERROR(Qt is required))
+
+# Needed for Qt 5.7
+CXXFLAGS="$CXXFLAGS --std=gnu++11"
+
 AC_SUBST(QT_CFLAGS)
 AC_SUBST(QT_LIBS)
 
+AC_MSG_CHECKING(for Qt5 host_bins)
+PKG_CHECK_VAR(QMAKE_PATH_HOST_BINS, Qt5Core, host_bins)
+AC_SUBST(QMAKE_PATH_HOST_BINS)
+AC_MSG_RESULT($QMAKE_PATH_HOST_BINS)
+
 AC_MSG_CHECKING(for moc)
-MOC="`$PKG_CONFIG --variable=moc_location QtCore`"
+MOC="$QMAKE_PATH_HOST_BINS/moc"
 AC_SUBST(MOC)
 AC_MSG_RESULT($MOC)
 
 AC_MSG_CHECKING(for uic)
-UIC="`$PKG_CONFIG --variable=uic_location QtCore`"
+UIC="$QMAKE_PATH_HOST_BINS/uic"
 AC_SUBST(UIC)
 AC_MSG_RESULT($UIC)
 
src/control.cpp +2 -2
index e1838a6..5eb82f1 100644
@@ -22,7 +22,7 @@
 #include <qslider.h>
 #include <qcheckbox.h>
 #include <qcombobox.h>
-#include <QtGui/qmessagebox.h>
+#include <qmessagebox.h>
 #include <qfiledialog.h>
 #include <Qt>
 #include <qbuffer.h>
@@ -31,7 +31,7 @@
 #include <QFileInfo>
 #include <QFile>
 #include <QDir>
-#include <QtGui/QHeaderView>
+#include <QHeaderView>
 
 #define TWO_BYTE_MAX 65535
 #define FOUR_CHAR 4
src/phonesim.cpp +1 -1
index 0e446f6..f14281b 100644
@@ -516,7 +516,7 @@ static bool readXmlFile( SimXmlHandler *handler, const QString& filename )
     return !reader.hasError();
 }
 
-SimRules::SimRules( int fd, QObject *p,  const QString& filename, HardwareManipulatorFactory *hmf )
+SimRules::SimRules(qintptr fd, QObject *p,  const QString& filename, HardwareManipulatorFactory *hmf )
     : QTcpSocket(p)
 {
     setSocketDescriptor(fd);
src/phonesim.h +1 -1
index c8bcaad..466f88d 100644
@@ -247,7 +247,7 @@ class SimRules : public QTcpSocket
 {
     Q_OBJECT
 public:
-    SimRules(int fd, QObject *parent, const QString& filename, HardwareManipulatorFactory *hmf );
+    SimRules(qintptr fd, QObject *parent, const QString& filename, HardwareManipulatorFactory *hmf );
     ~SimRules() {}
 
     // get the variable value for.
src/qsimcommand.cpp +1 -1
index 97e0b28..672ffb9 100644
@@ -3764,7 +3764,7 @@ void QSimCommand::addExtensionField( int tag, const QByteArray& value )
 QSimCommandPrivate *QSimCommand::dwrite()
 {
     // If we are the only user of the private object, return it as-is.
-    if ( d->ref == 1 )
+    if ( d->ref.load() == 1 )
         return d;
 
     // Create a new private object and copy the current contents into it.
src/qsmsmessage.cpp +3 -3
index c2eeb29..63d6952 100644
@@ -365,7 +365,7 @@ QSMSMessage::~QSMSMessage()
 QSMSMessagePrivate *QSMSMessage::dwrite()
 {
     // If we are the only user of the private object, return it as-is.
-    if ( d->ref == 1 )
+    if ( d->ref.load() == 1 )
         return d;
 
     // Create a new private object and copy the current contents into it.
@@ -2594,8 +2594,8 @@ QCBSMessage QCBSDeliverMessage::unpack(QTextCodec *codec)
     QString text = userData
         ( (QSMSDataCodingScheme)scheme, codec, headers, false, true );
     len = text.length();
-    while ( len > 0 && ( text[len - 1] == '\r' || text[len - 1] == '\n' ||
-                         text[len - 1] == '\0' ) ) {
+    while ( len > 0 && ( text.at(len - 1) == QChar ('\r') || text.at(len - 1) == QChar ('\n') ||
+                         text.at(len - 1) == QChar ('\0') ) ) {
         --len;
     }
     m.setText( text.left( len ) );
src/server.cpp +1 -1
index cd68969..62487ee 100644
@@ -44,7 +44,7 @@ void PhoneSimServer::setHardwareManipulator(HardwareManipulatorFactory *f)
         f->setRuleFile(filename);
 }
 
-void PhoneSimServer::incomingConnection(int s)
+void PhoneSimServer::incomingConnection(qintptr s)
 {
   SimRules *sr = new SimRules(s, this, filename, fact);
     sr->setPhoneNumber(QString::number(phonenumber));
src/server.h +1 -1
index 5915cc1..3342a90 100644
@@ -40,7 +40,7 @@ public:
     SimRules *rules() const { return currentRules; }
 
 protected:
-    void incomingConnection(int s);
+    void incomingConnection(qintptr s);
 
 private:
     QString filename;

--
2.23.0

#17 lore raw

PATCH v3 2/2 Use override at least in server header

From: Alexander Akulich <[email protected]>

---
 src/server.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
src/server.h +3 -3
index 3342a90..9175359 100644
@@ -32,15 +32,15 @@ class HardwareManipulatorFactory;
 class PhoneSimServer : public QTcpServer
 {
 public:
-    PhoneSimServer(const QString &, quint16 port, QObject *parent = 0);
-    ~PhoneSimServer();
+    PhoneSimServer(const QString &, quint16 port, QObject *parent = nullptr);
+    ~PhoneSimServer() override;
 
     void setHardwareManipulator(HardwareManipulatorFactory *f);
 
     SimRules *rules() const { return currentRules; }
 
 protected:
-    void incomingConnection(qintptr s);
+    void incomingConnection(qintptr s) override;
 
 private:
     QString filename;

--
2.23.0

#18 lore raw

Re: [PATCH phonesim v3 1/2] Port to qt5

In reply to Jonah Brüchert

Hi Jonah,

Quoted 5 lines · Jonah Brüchert

From: Simon Busch <[email protected]>

Quoted 12 lines
---
  Makefile.am         |  4 +++-
  configure.ac        | 15 ++++++++++++---
  src/control.cpp     |  4 ++--
  src/phonesim.cpp    |  2 +-
  src/phonesim.h      |  2 +-
  src/qsimcommand.cpp |  2 +-
  src/qsmsmessage.cpp |  6 +++---
  src/server.cpp      |  2 +-
  src/server.h        |  2 +-
  9 files changed, 25 insertions(+), 14 deletions(-)

Sorry for the delay. Took me a bit to sort out Qt5 on my VM. Anyway, the changes look fine to me and things still appear to work. So I went ahead and pushed both of these patches out.

Regards,
-Denis

#19 lore raw

Re: [PATCH phonesim v3 1/2] Port to qt5

Hi Denis,

Thank you very much for applying the patches!

As mentioned earlier I have worked on a few additional commits to completely replace all deprecated Qt APIs.

This is not strictly required until Qt6 is released, but will basically allow to run on Qt6 right when it's released with just a few build system changes.

If you are interested, just let me know when you have time to review those as adding those patches is obviously not urgent.

In addition I added a cmake build system which allowed me to work with Qt's QtCreator IDE, but I can very well understand if you don't want to switch the build system and would leave that patch out.

I pushed the patches to KDE's GitLab instance
https://invent.kde.org/jbbgameich/ofono-phonesim/commits/master for now, but would of course send them to the mailing list for review later.

Kind regards,

Jonah

Quoted 30 lines

Hi Jonah,

Quoted 15 lines · Jonah Brüchert

From: Simon Busch <[email protected]>

---
  Makefile.am         |  4 +++-
  configure.ac        | 15 ++++++++++++---
  src/control.cpp     |  4 ++--
  src/phonesim.cpp    |  2 +-
  src/phonesim.h      |  2 +-
  src/qsimcommand.cpp |  2 +-
  src/qsmsmessage.cpp |  6 +++---
  src/server.cpp      |  2 +-
  src/server.h        |  2 +-

Quoted 2 lines
  9 files changed, 25 insertions(+), 14 deletions(-)

Sorry for the delay.  Took me a bit to sort out Qt5 on my VM. Anyway, the changes look fine to me and things still appear to work.  So I went ahead and pushed both of these patches out.

Regards,
-Denis
_______________________________________________
ofono mailing list -- ofono(a)ofono.org
To unsubscribe send an email to ofono-leave(a)ofono.org

#20 lore raw

Re: [PATCH phonesim v3 1/2] Port to qt5

Hi Jonah,

No top posting please :)

Quoted 7 lines · Jonah Brüchert

Hi Denis,

Thank you very much for applying the patches!

As mentioned earlier I have worked on a few additional commits to completely replace all deprecated Qt APIs.

Quoted 6 lines

This is not strictly required until Qt6 is released, but will basically allow to run on Qt6 right when it's released with just a few build system changes.

If you are interested, just let me know when you have time to review those as adding those patches is obviously not urgent.

Go ahead and send these in.

Quoted 4 lines

In addition I added a cmake build system which allowed me to work with Qt's QtCreator IDE, but I can very well understand if you don't want to switch the build system and would leave that patch out.

I'm not really in charge of the build system. That is Marcel you'd need to convince. He doesn't much like cmake though.

Quoted 5 lines

I pushed the patches to KDE's GitLab instance
https://invent.kde.org/jbbgameich/ofono-phonesim/commits/master for now, but would of course send them to the mailing list for review later.

Having them on the list would be good.

Regards,
-Denis

#21 lore raw

PATCH v2 2/8 Fix random build failure

In reply to Jonah Brüchert

From: Martin Jansa <[email protected]>

uic and moc doesn't create output directory automatically and it could be missing when uic is executed before gcc creates any object files as src/*.o

OE @ ~/build/wpb/webos-ports/tmp-glibc/work/i586-webos-linux/phonesim/1.20-r0/build $ rm -rf src/

OE @ ~/build/wpb/webos-ports/tmp-glibc/work/i586-webos-linux/phonesim/1.20-r0/build $ /OE/build/wpb/webos-ports/tmp-glibc/sysroots/x86_64-linux/usr/bin/qt5/uic ../phonesim-1.20/src/controlbase.ui -o src/ui_controlbase.h Could not create output file

Fixes phonesim randomly failing with:
OE @ ~/build/wpb/webos-ports/tmp-glibc/work/i586-webos-linux/phonesim/1.20-r0/build $ cat ../temp/log.do_compile
DEBUG: SITE files ['endian-little', 'bit-32', 'ix86-common', 'common-linux', 'common-glibc', 'i586-linux', 'common']
DEBUG: Executing shell function do_compile
NOTE: make -j 9
/OE/build/wpb/webos-ports/tmp-glibc/sysroots/x86_64-linux/usr/bin/qt5/uic ../phonesim-1.20/src/controlbase.ui -o src/ui_controlbase.h /OE/build/wpb/webos-ports/tmp-glibc/sysroots/x86_64-linux/usr/bin/qt5/moc ../phonesim-1.20/src/control.h -o src/moc_control.cpp /OE/build/wpb/webos-ports/tmp-glibc/sysroots/x86_64-linux/usr/bin/qt5/moc ../phonesim-1.20/src/phonesim.h -o src/moc_phonesim.cpp /OE/build/wpb/webos-ports/tmp-glibc/sysroots/x86_64-linux/usr/bin/qt5/moc ../phonesim-1.20/src/hardwaremanipulator.h -o src/moc_hardwaremanipulator.cpp /OE/build/wpb/webos-ports/tmp-glibc/sysroots/x86_64-linux/usr/bin/qt5/moc ../phonesim-1.20/src/callmanager.h -o src/moc_callmanager.cpp /OE/build/wpb/webos-ports/tmp-glibc/sysroots/x86_64-linux/usr/bin/qt5/moc ../phonesim-1.20/src/simfilesystem.h -o src/moc_simfilesystem.cpp /OE/build/wpb/webos-ports/tmp-glibc/sysroots/x86_64-linux/usr/bin/qt5/moc ../phonesim-1.20/src/simapplication.h -o src/moc_simapplication.cpp Could not create output file
Makefile:977: recipe for target 'src/ui_controlbase.h' failed
make: *** [src/ui_controlbase.h] Error 1
make: *** Waiting for unfinished jobs....
WARNING: /OE/build/wpb/webos-ports/tmp-glibc/work/i586-webos-linux/phonesim/1.20-r0/temp/run.do_compile.3359:1 exit 1 from 'exit 1'
ERROR: oe_runmake failed
ERROR: Function failed: do_compile (log file is located at /OE/build/wpb/webos-ports/tmp-glibc/work/i586-webos-linux/phonesim/1.20-r0/temp/log.do_compile.3359)

---
 Makefile.am | 2 ++
 1 file changed, 2 insertions(+)
Makefile.am +2 -0
index 8c99b04..59fb421 100644
@@ -67,6 +67,7 @@ QT_V_MOC_  = $(QT_V_MOC_$(AM_DEFAULT_VERBOSITY))
 QT_V_MOC_0 = @echo "  MOC     " $@;
 
 src/moc_%.cpp: src/%.h
+	$(MKDIR_P) src
 	$(QT_V_MOC)$(MOC) $< -o $@
 
 QT_V_UIC   = $(QT_V_UIC_$(V))
@@ -74,4 +75,5 @@ QT_V_UIC_  = $(QT_V_UIC_$(AM_DEFAULT_VERBOSITY))
 QT_V_UIC_0 = @echo "  UIC     " $@;
 
 src/ui_%.h: src/%.ui
+	$(MKDIR_P) src
 	$(QT_V_UIC)$(UIC) $< -o $@

--
2.23.0

#22 lore raw

PATCH v2 3/8 configure.ac: use gnu++11 to fix build with Qt 5.7

In reply to Jonah Brüchert

From: Martin Jansa <[email protected]>

---
 configure.ac | 4 ++++
 1 file changed, 4 insertions(+)
configure.ac +4 -0
index 253aa27..4eb969a 100644
@@ -24,6 +24,10 @@ AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization],
 
 PKG_CHECK_MODULES(QT, Qt5Core Qt5Gui Qt5Xml Qt5Network Qt5Script Qt5DBus Qt5Widgets, dummy=yes,
 						AC_MSG_ERROR(Qt is required))
+
+# Needed for Qt 5.7
+CXXFLAGS="$CXXFLAGS --std=gnu++11"
+
 AC_SUBST(QT_CFLAGS)
 AC_SUBST(QT_LIBS)
 

--
2.23.0

#23 lore raw

PATCH v2 4/8 Fix build with Qt 5.8

In reply to Jonah Brüchert

From: Martin Jansa <[email protected]>

../phonesim-1.20/src/qsmsmessage.cpp: In member function 'QCBSMessage QCBSDeliverMessage::unpack(QTextCodec*)':
../phonesim-1.20/src/qsmsmessage.cpp:2598:40: error: ambiguous overload for 'operator==' (operand types are 'QCharRef' and 'char')

                          text[len - 1] == '\0' ) ) {
                          ~~~~~~~~~~~~~~^~~~~~~
In file included from ../phonesim-1.20/src/qsmsmessage.h:23:0,
                 from ../phonesim-1.20/src/qsmsmessage.cpp:22:
/OE/build/owpb/webos-ports/tmp-glibc/work/i586-webos-linux/phonesim/1.20-r0/recipe-sysroot/usr/include/qt5/QtCore/qstring.h:1632:13: note: candidate: bool operator==(QChar, const QStringRef&)
 inline bool operator==(QChar lhs, const QStringRef &rhs) Q_DECL_NOTHROW
             ^~~~~~~~
/OE/build/owpb/webos-ports/tmp-glibc/work/i586-webos-linux/phonesim/1.20-r0/recipe-sysroot/usr/include/qt5/QtCore/qstring.h:1613:13: note: candidate: bool operator==(QChar, const QString&)
 inline bool operator==(QChar lhs, const QString &rhs) Q_DECL_NOTHROW
             ^~~~~~~~
In file included from /OE/build/owpb/webos-ports/tmp-glibc/work/i586-webos-linux/phonesim/1.20-r0/recipe-sysroot/usr/include/qt5/QtCore/qstring.h:48:0,
                 from ../phonesim-1.20/src/qsmsmessage.h:23,
                 from ../phonesim-1.20/src/qsmsmessage.cpp:22:
/OE/build/owpb/webos-ports/tmp-glibc/work/i586-webos-linux/phonesim/1.20-r0/recipe-sysroot/usr/include/qt5/QtCore/qchar.h:573:30: note: candidate: constexpr bool operator==(QChar, QChar)
 Q_DECL_CONSTEXPR inline bool operator==(QChar c1, QChar c2) Q_DECL_NOTHROW { return c1.ucs == c2.ucs; }
                              ^~~~~~~~

make: *** [Makefile:583: src/qsmsmessage.o] Error 1

---
 src/qsmsmessage.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
src/qsmsmessage.cpp +2 -2
index 54885bd..63d6952 100644
@@ -2594,8 +2594,8 @@ QCBSMessage QCBSDeliverMessage::unpack(QTextCodec *codec)
     QString text = userData
         ( (QSMSDataCodingScheme)scheme, codec, headers, false, true );
     len = text.length();
-    while ( len > 0 && ( text[len - 1] == '\r' || text[len - 1] == '\n' ||
-                         text[len - 1] == '\0' ) ) {
+    while ( len > 0 && ( text.at(len - 1) == QChar ('\r') || text.at(len - 1) == QChar ('\n') ||
+                         text.at(len - 1) == QChar ('\0') ) ) {
         --len;
     }
     m.setText( text.left( len ) );

--
2.23.0

#24 lore raw

PATCH v2 5/8 configure.ac: fix checking for host_bins variable

In reply to Jonah Brüchert

From: Martin Jansa <[email protected]>

$PKG_CONFIG --variable=host_bins Qt5Core
returns absolute path without the prefix to sysroot when cross compiling

Before https://github.com/meta-qt5/meta-qt5/commit/b716195f609de6547cfdfadfd4fd25292a6bbf09
this will return:

pkg-config --variable=host_bins Qt5Core
/usr/bin/qt5

which is bad, but is replaced with ${OE_QMAKE_PATH_EXTERNAL_HOST_BINS} in the generated Makefile after configure as in:
https://github.com/webOS-ports/meta-webos-ports/blob/e4283e7906e3fbd2e0bcffcd317d2d1a9e2ebcd5/meta-luneos/recipes-connectivity/ofono/phonesim_1.20.bb#L22

but with empty QT_DIR_NAME the returned value is:
pkg-config --variable=host_bins Qt5Core
/usr/bin

and these 2 replaces fail, causing
make: /usr/bin/uic: Command not found

Use PKG_CHECK_VAR for host_bins which we can override with OE_QMAKE_PATH_EXTERNAL_HOST_BINS from the environment and the generated Mafile will be correct right away.

---
 configure.ac | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
configure.ac +7 -2
index 4eb969a..e339691 100644
@@ -31,13 +31,18 @@ CXXFLAGS="$CXXFLAGS --std=gnu++11"
 AC_SUBST(QT_CFLAGS)
 AC_SUBST(QT_LIBS)
 
+AC_MSG_CHECKING(for Qt5 host_bins)
+PKG_CHECK_VAR(QMAKE_PATH_HOST_BINS, Qt5Core, host_bins)
+AC_SUBST(QMAKE_PATH_HOST_BINS)
+AC_MSG_RESULT($QMAKE_PATH_HOST_BINS)
+
 AC_MSG_CHECKING(for moc)
-MOC="`$PKG_CONFIG --variable=host_bins Qt5Core`/moc"
+MOC="$QMAKE_PATH_HOST_BINS/moc"
 AC_SUBST(MOC)
 AC_MSG_RESULT($MOC)
 
 AC_MSG_CHECKING(for uic)
-UIC="`$PKG_CONFIG --variable=host_bins Qt5Core`/uic"
+UIC="$QMAKE_PATH_HOST_BINS/uic"
 AC_SUBST(UIC)
 AC_MSG_RESULT($UIC)
 

--
2.23.0

#25 lore raw

PATCH v2 6/8 Make Qt detect fPIC flag correctly

In reply to Jonah Brüchert
---
 Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile.am +1 -1
index 59fb421..74cf657 100644
@@ -46,7 +46,7 @@ nodist_src_phonesim_SOURCES = src/ui_controlbase.h \
 
 src_phonesim_LDADD = $(QT_LIBS)
 
-AM_CXXFLAGS = -Wall $(QT_CFLAGS) -fPIC -fPIE
+AM_CXXFLAGS = -Wall $(QT_CFLAGS) -fPIC
 
 AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src
 

--
2.23.0

#26 lore raw

PATCH v2 7/8 Fix Qt5 port on 64-bit platforms

In reply to Jonah Brüchert

From: Alexander Akulich <[email protected]>

---
 src/phonesim.cpp | 2 +-
 src/phonesim.h   | 2 +-
 src/server.cpp   | 2 +-
 src/server.h     | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
src/phonesim.cpp +1 -1
index 0e446f6..f14281b 100644
@@ -516,7 +516,7 @@ static bool readXmlFile( SimXmlHandler *handler, const QString& filename )
     return !reader.hasError();
 }
 
-SimRules::SimRules( int fd, QObject *p,  const QString& filename, HardwareManipulatorFactory *hmf )
+SimRules::SimRules(qintptr fd, QObject *p,  const QString& filename, HardwareManipulatorFactory *hmf )
     : QTcpSocket(p)
 {
     setSocketDescriptor(fd);
src/phonesim.h +1 -1
index c8bcaad..466f88d 100644
@@ -247,7 +247,7 @@ class SimRules : public QTcpSocket
 {
     Q_OBJECT
 public:
-    SimRules(int fd, QObject *parent, const QString& filename, HardwareManipulatorFactory *hmf );
+    SimRules(qintptr fd, QObject *parent, const QString& filename, HardwareManipulatorFactory *hmf );
     ~SimRules() {}
 
     // get the variable value for.
src/server.cpp +1 -1
index cd68969..62487ee 100644
@@ -44,7 +44,7 @@ void PhoneSimServer::setHardwareManipulator(HardwareManipulatorFactory *f)
         f->setRuleFile(filename);
 }
 
-void PhoneSimServer::incomingConnection(int s)
+void PhoneSimServer::incomingConnection(qintptr s)
 {
   SimRules *sr = new SimRules(s, this, filename, fact);
     sr->setPhoneNumber(QString::number(phonenumber));
src/server.h +1 -1
index 5915cc1..3342a90 100644
@@ -40,7 +40,7 @@ public:
     SimRules *rules() const { return currentRules; }
 
 protected:
-    void incomingConnection(int s);
+    void incomingConnection(qintptr s);
 
 private:
     QString filename;

--
2.23.0

#27 lore raw

PATCH v2 8/8 Use override at least in server header

In reply to Jonah Brüchert

From: Alexander Akulich <[email protected]>

---
 src/server.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
src/server.h +3 -3
index 3342a90..9175359 100644
@@ -32,15 +32,15 @@ class HardwareManipulatorFactory;
 class PhoneSimServer : public QTcpServer
 {
 public:
-    PhoneSimServer(const QString &, quint16 port, QObject *parent = 0);
-    ~PhoneSimServer();
+    PhoneSimServer(const QString &, quint16 port, QObject *parent = nullptr);
+    ~PhoneSimServer() override;
 
     void setHardwareManipulator(HardwareManipulatorFactory *f);
 
     SimRules *rules() const { return currentRules; }
 
 protected:
-    void incomingConnection(qintptr s);
+    void incomingConnection(qintptr s) override;
 
 private:
     QString filename;

--
2.23.0