Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/qt6/qt6base: Make qmake work
@ 2024-04-11 14:55 Ben Hutchings via buildroot
  2024-04-11 14:55 ` [Buildroot] [PATCH] package/qt6/qt6base: Restore DirectFB support Ben Hutchings via buildroot
  2024-09-14 16:16 ` [Buildroot] [PATCH] package/qt6/qt6base: Make qmake work Thomas Petazzoni via buildroot
  0 siblings, 2 replies; 7+ messages in thread
From: Ben Hutchings via buildroot @ 2024-04-11 14:55 UTC (permalink / raw)
  To: buildroot; +Cc: Ben Hutchings

Currently the qt6base package does not install a working qmake
program, so applications can only be built with CMake.

To ease upgrades from Qt 5, make qmake work as well:

- Create a linux-buildroot-g++ device spec, like we do for Qt 5.

- Fix the generated target_qt.conf file.  The Qt build system
  currently generates this with the sysroot directory wrongly added in
  various places.

- Fix the qmake wrapper script in the sysroot to set the QMAKEPATH
  environment variable.

Signed-off-by: Ben Hutchings <ben.hutchings@mind.be>
---
 package/qt6/qt6base/qmake.conf.in     | 34 +++++++++++++++++++++++
 package/qt6/qt6base/qplatformdefs.h   |  1 +
 package/qt6/qt6base/qt6base.mk        | 39 +++++++++++++++++++++++++++
 package/qt6/qt6base/target_qt.conf.in | 11 ++++++++
 4 files changed, 85 insertions(+)
 create mode 100644 package/qt6/qt6base/qmake.conf.in
 create mode 100644 package/qt6/qt6base/qplatformdefs.h
 create mode 100644 package/qt6/qt6base/target_qt.conf.in

diff --git a/package/qt6/qt6base/qmake.conf.in b/package/qt6/qt6base/qmake.conf.in
new file mode 100644
index 0000000000..b62a671c35
--- /dev/null
+++ b/package/qt6/qt6base/qmake.conf.in
@@ -0,0 +1,34 @@
+# Qt6 has a mechanism to support "device" profiles, so that people can
+# specify the compiler, compiler flags and so on for a specific device.
+
+# We leverage this mechanism in the Buildroot packaging of qt6 to
+# simplify cross-compilation: we have our own "device" definition, which
+# allows us to easily pass the cross-compiler paths and flags from our
+# qt6.mk.
+
+CROSS_COMPILE = @CROSS_COMPILE@
+
+include(../common/linux_device_pre.conf)
+
+# modifications to gcc-base.conf
+QMAKE_CFLAGS           += $${BR_COMPILER_CFLAGS}
+QMAKE_CXXFLAGS         += $${BR_COMPILER_CXXFLAGS}
+# Remove all optimisation flags, we really only want our own.
+QMAKE_CFLAGS_OPTIMIZE       =
+QMAKE_CFLAGS_OPTIMIZE_DEBUG =
+QMAKE_CFLAGS_OPTIMIZE_FULL  =
+QMAKE_CFLAGS_OPTIMIZE_SIZE  =
+QMAKE_CFLAGS_DEBUG =
+QMAKE_CXXFLAGS_DEBUG =
+QMAKE_CFLAGS_RELEASE =
+QMAKE_CXXFLAGS_RELEASE =
+CONFIG                 += nostrip
+
+QMAKE_LIBS             += -lrt -lpthread -ldl
+QMAKE_CFLAGS_ISYSTEM   =
+
+# Architecture specific configuration
+include(arch.conf)
+
+include(../common/linux_device_post.conf)
+load(qt_config)
diff --git a/package/qt6/qt6base/qplatformdefs.h b/package/qt6/qt6base/qplatformdefs.h
new file mode 100644
index 0000000000..99e9a27923
--- /dev/null
+++ b/package/qt6/qt6base/qplatformdefs.h
@@ -0,0 +1 @@
+#include "../../linux-g++/qplatformdefs.h"
diff --git a/package/qt6/qt6base/qt6base.mk b/package/qt6/qt6base/qt6base.mk
index 6857725ef5..049d73a84f 100644
--- a/package/qt6/qt6base/qt6base.mk
+++ b/package/qt6/qt6base/qt6base.mk
@@ -78,6 +78,45 @@ QT6BASE_CONF_OPTS += \
 	-DFEATURE_avx512vl=OFF \
 	-DFEATURE_vaes=OFF
 
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+define QT6BASE_MKSPEC_ARCH_CONFIG
+# Qt 6 needs atomics, which on various architectures are in -latomic
+	printf '!host_build { \n LIBS += -latomic\n }' > \
+		$(STAGING_DIR)/usr/mkspecs/devices/linux-buildroot-g++/arch.conf
+endef
+endif
+
+define QT6BASE_INSTALL_MKSPEC
+	mkdir -p $(STAGING_DIR)/usr/mkspecs/devices/linux-buildroot-g++
+	$(INSTALL) -m 0644 $(QT6BASE_PKGDIR)/qplatformdefs.h \
+		$(STAGING_DIR)/usr/mkspecs/devices/linux-buildroot-g++/
+	sed 's%@CROSS_COMPILE@%$(TARGET_CROSS)%' \
+		< $(QT6BASE_PKGDIR)/qmake.conf.in \
+		> $(STAGING_DIR)/usr/mkspecs/devices/linux-buildroot-g++/qmake.conf
+	touch $(STAGING_DIR)/usr/mkspecs/devices/linux-buildroot-g++/arch.conf
+	$(QT6BASE_MKSPEC_ARCH_CONFIG)
+endef
+
+# The generated broken target_qt.conf is broken, so replace it
+define QT6BASE_INSTALL_TARGET_QT_CONF
+	sed 's%@HOST_DIR@%$(HOST_DIR)%; s%@SYSROOT@%$(STAGING_DIR)%' \
+		< $(QT6BASE_PKGDIR)/target_qt.conf.in \
+		> $(STAGING_DIR)/usr/bin/target_qt.conf
+endef
+
+# The qmake wrapper script doesn't set QMAKEPATH, so qmake doesn't
+# find specs and modules installed for the target
+define QT6BASE_FIX_QMAKE_SCRIPT
+	sed -i '1a\
+export QMAKEPATH=$(STAGING_DIR)/usr' \
+		$(STAGING_DIR)/usr/bin/qmake
+endef
+
+QT6BASE_POST_INSTALL_STAGING_HOOKS += \
+	QT6BASE_INSTALL_MKSPEC \
+	QT6BASE_INSTALL_TARGET_QT_CONF \
+	QT6BASE_FIX_QMAKE_SCRIPT
+
 HOST_QT6BASE_DEPENDENCIES = \
 	host-double-conversion \
 	host-libb2 \
diff --git a/package/qt6/qt6base/target_qt.conf.in b/package/qt6/qt6base/target_qt.conf.in
new file mode 100644
index 0000000000..5702970c47
--- /dev/null
+++ b/package/qt6/qt6base/target_qt.conf.in
@@ -0,0 +1,11 @@
+[Paths]
+Prefix=/usr
+HostPrefix=@HOST_DIR@
+HostBinaries=bin
+HostLibraries=lib
+HostLibraryExecutables=libexec
+HostData=.
+Sysroot=@SYSROOT@
+SysrootifyPrefix=true
+TargetSpec=devices/linux-buildroot-g++
+HostSpec=
-- 
2.39.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] package/qt6/qt6base: Restore DirectFB support
  2024-04-11 14:55 [Buildroot] [PATCH] package/qt6/qt6base: Make qmake work Ben Hutchings via buildroot
@ 2024-04-11 14:55 ` Ben Hutchings via buildroot
  2024-04-11 18:48   ` Yann E. MORIN
  2024-09-14 16:44   ` Thomas Petazzoni via buildroot
  2024-09-14 16:16 ` [Buildroot] [PATCH] package/qt6/qt6base: Make qmake work Thomas Petazzoni via buildroot
  1 sibling, 2 replies; 7+ messages in thread
From: Ben Hutchings via buildroot @ 2024-04-11 14:55 UTC (permalink / raw)
  To: buildroot; +Cc: Ben Hutchings

Apply a patch from upstream to make Qt 6 support DirectFB again.

Implement a config option for this, similar to what we do for Qt 5.

Signed-off-by: Ben Hutchings <ben.hutchings@mind.be>
---
 package/qt6/qt6base/Config.in                 |   8 +
 .../qt6base-directfb-Fix-compilation.patch    | 288 ++++++++++++++++++
 package/qt6/qt6base/qt6base.mk                |   7 +
 3 files changed, 303 insertions(+)
 create mode 100644 package/qt6/qt6base/qt6base-directfb-Fix-compilation.patch

diff --git a/package/qt6/qt6base/Config.in b/package/qt6/qt6base/Config.in
index 3b15d40c83..b21cc33cde 100644
--- a/package/qt6/qt6base/Config.in
+++ b/package/qt6/qt6base/Config.in
@@ -36,6 +36,7 @@ config BR2_PACKAGE_QT6BASE_GUI
 	# At least one graphic backend must be enabled, so enable
 	# linuxfb if nothing is enabled.
 	select BR2_PACKAGE_QT6BASE_LINUXFB if \
+	       !BR2_PACKAGE_QT6BASE_DIRECTFB && \
 	       !BR2_PACKAGE_QT6BASE_XCB && \
 	       !BR2_PACKAGE_QT6BASE_EGLFS
 	help
@@ -56,6 +57,13 @@ config BR2_PACKAGE_QT6BASE_VULKAN
 config BR2_PACKAGE_QT6BASE_LINUXFB
 	bool "linuxfb support"
 
+config BR2_PACKAGE_QT6BASE_DIRECTFB
+	bool "directfb support"
+	depends on BR2_PACKAGE_DIRECTFB
+
+comment "directfb backend available if directfb is enabled"
+	depends on !BR2_PACKAGE_DIRECTFB
+
 config BR2_PACKAGE_QT6BASE_XCB
 	bool "X.org XCB support"
 	depends on BR2_PACKAGE_XORG7
diff --git a/package/qt6/qt6base/qt6base-directfb-Fix-compilation.patch b/package/qt6/qt6base/qt6base-directfb-Fix-compilation.patch
new file mode 100644
index 0000000000..5a7df51779
--- /dev/null
+++ b/package/qt6/qt6base/qt6base-directfb-Fix-compilation.patch
@@ -0,0 +1,288 @@
+From d86ab16a86ec4d6fb92855a3c9913b6b74b6bb0f Mon Sep 17 00:00:00 2001
+From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
+Date: Tue, 30 Aug 2022 14:54:01 +0200
+Subject: [PATCH] directfb: Fix compilation
+
+The DirectFB QPA plugin has not built since Qt 6, because it used
+deprecated API which has been removed and private API which has
+changed.
+
+This change updates the handleMouseEvent() and
+handleWheelEvent() calls with the contents of the deprecated
+overloads the way they were in Qt 5.15.
+
+In addition, it updates usage of GlyphAndSubPixelPosition to default to
+vertical subpixel position of 0, and adds override qualifiers where
+necessary.
+
+Fixes: QTBUG-105061
+Change-Id: Id7516f8e3c0a466d15b754f8e5f6df15a5f9526a
+Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
+---
+ src/plugins/platforms/directfb/main.cpp       |  2 +-
+ .../directfb/qdirectfbbackingstore.h          |  8 ++---
+ .../platforms/directfb/qdirectfbblitter.cpp   |  2 +-
+ .../platforms/directfb/qdirectfbblitter.h     | 31 ++++++++++++-------
+ .../platforms/directfb/qdirectfbcursor.h      |  2 +-
+ .../platforms/directfb/qdirectfbinput.cpp     | 11 ++++---
+ .../platforms/directfb/qdirectfbinput.h       |  2 +-
+ .../platforms/directfb/qdirectfbintegration.h | 20 ++++++------
+ .../platforms/directfb/qdirectfbscreen.h      | 10 +++---
+ .../platforms/directfb/qdirectfbwindow.h      | 20 ++++++------
+ 10 files changed, 60 insertions(+), 48 deletions(-)
+
+diff --git a/src/plugins/platforms/directfb/main.cpp b/src/plugins/platforms/directfb/main.cpp
+index 02cceeb487..4618696154 100644
+--- a/src/plugins/platforms/directfb/main.cpp
++++ b/src/plugins/platforms/directfb/main.cpp
+@@ -24,7 +24,7 @@ class QDirectFbIntegrationPlugin : public QPlatformIntegrationPlugin
+     Q_OBJECT
+     Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "directfb.json")
+ public:
+-    QPlatformIntegration *create(const QString&, const QStringList&);
++    QPlatformIntegration *create(const QString&, const QStringList&) override;
+ };
+ 
+ QPlatformIntegration * QDirectFbIntegrationPlugin::create(const QString& system, const QStringList& paramList)
+diff --git a/src/plugins/platforms/directfb/qdirectfbbackingstore.h b/src/plugins/platforms/directfb/qdirectfbbackingstore.h
+index c51f29271d..625b672a40 100644
+--- a/src/plugins/platforms/directfb/qdirectfbbackingstore.h
++++ b/src/plugins/platforms/directfb/qdirectfbbackingstore.h
+@@ -18,10 +18,10 @@ class QDirectFbBackingStore : public QPlatformBackingStore
+ public:
+     QDirectFbBackingStore(QWindow *window);
+ 
+-    QPaintDevice *paintDevice();
+-    void flush(QWindow *window, const QRegion &region, const QPoint &offset);
+-    void resize (const QSize &size, const QRegion &staticContents);
+-    bool scroll(const QRegion &area, int dx, int dy);
++    QPaintDevice *paintDevice() override;
++    void flush(QWindow *window, const QRegion &region, const QPoint &offset) override;
++    void resize (const QSize &size, const QRegion &staticContents) override;
++    bool scroll(const QRegion &area, int dx, int dy) override;
+ 
+     QImage toImage() const override;
+ 
+diff --git a/src/plugins/platforms/directfb/qdirectfbblitter.cpp b/src/plugins/platforms/directfb/qdirectfbblitter.cpp
+index 0a110da798..aac0e3d800 100644
+--- a/src/plugins/platforms/directfb/qdirectfbblitter.cpp
++++ b/src/plugins/platforms/directfb/qdirectfbblitter.cpp
+@@ -216,7 +216,7 @@ bool QDirectFbBlitter::drawCachedGlyphs(const QPaintEngineState *state, QFontEng
+     for (int i=0; i<numGlyphs; ++i) {
+ 
+         QFixed subPixelPosition = fontEngine->subPixelPositionForX(positions[i].x);
+-        QTextureGlyphCache::GlyphAndSubPixelPosition glyph(glyphs[i], subPixelPosition);
++        QTextureGlyphCache::GlyphAndSubPixelPosition glyph(glyphs[i], QFixedPoint(subPixelPosition, 0));
+         const QTextureGlyphCache::Coord &c = cache->coords[glyph];
+         if (c.isNull())
+             continue;
+diff --git a/src/plugins/platforms/directfb/qdirectfbblitter.h b/src/plugins/platforms/directfb/qdirectfbblitter.h
+index 591021061c..6183859613 100644
+--- a/src/plugins/platforms/directfb/qdirectfbblitter.h
++++ b/src/plugins/platforms/directfb/qdirectfbblitter.h
+@@ -19,11 +19,20 @@ public:
+     QDirectFbBlitter(const QSize &size, bool alpha);
+     virtual ~QDirectFbBlitter();
+ 
+-    virtual void fillRect(const QRectF &rect, const QColor &color);
+-    virtual void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect);
+-    void alphaFillRect(const QRectF &rect, const QColor &color, QPainter::CompositionMode cmode);
+-    void drawPixmapOpacity(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect, QPainter::CompositionMode cmode, qreal opacity);
+-    virtual bool drawCachedGlyphs(const QPaintEngineState *state, QFontEngine::GlyphFormat glyphFormat, int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions, QFontEngine *fontEngine);
++    void fillRect(const QRectF &rect, const QColor &color) override;
++    void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect) override;
++    void alphaFillRect(const QRectF &rect, const QColor &color, QPainter::CompositionMode cmode) override;
++    void drawPixmapOpacity(const QRectF &rect,
++                           const QPixmap &pixmap,
++                           const QRectF &subrect,
++                           QPainter::CompositionMode cmode,
++                           qreal opacity) override;
++    bool drawCachedGlyphs(const QPaintEngineState *state,
++                          QFontEngine::GlyphFormat glyphFormat,
++                          int numGlyphs,
++                          const glyph_t *glyphs,
++                          const QFixedPoint *positions,
++                          QFontEngine *fontEngine) override;
+ 
+     IDirectFBSurface *dfbSurface() const;
+ 
+@@ -32,8 +41,8 @@ public:
+     static DFBSurfacePixelFormat selectPixmapFormat(bool withAlpha);
+ 
+ protected:
+-    virtual QImage *doLock();
+-    virtual void doUnlock();
++    QImage *doLock() override;
++    void doUnlock() override;
+ 
+     QDirectFBPointer<IDirectFBSurface> m_surface;
+     QImage m_image;
+@@ -50,12 +59,12 @@ private:
+ class QDirectFbBlitterPlatformPixmap : public QBlittablePlatformPixmap
+ {
+ public:
+-    QBlittable *createBlittable(const QSize &size, bool alpha) const;
++    QBlittable *createBlittable(const QSize &size, bool alpha) const override;
+ 
+     QDirectFbBlitter *dfbBlitter() const;
+ 
+-    virtual bool fromFile(const QString &filename, const char *format,
+-                          Qt::ImageConversionFlags flags);
++    bool fromFile(const QString &filename, const char *format,
++                  Qt::ImageConversionFlags flags) override;
+ 
+ private:
+     bool fromDataBufferDescription(const DFBDataBufferDescription &);
+@@ -83,7 +92,7 @@ public:
+         : QImageTextureGlyphCache(format, matrix)
+     {}
+ 
+-    virtual void resizeTextureData(int width, int height);
++    void resizeTextureData(int width, int height) override;
+ 
+     IDirectFBSurface *sourceSurface();
+ 
+diff --git a/src/plugins/platforms/directfb/qdirectfbcursor.h b/src/plugins/platforms/directfb/qdirectfbcursor.h
+index 9a480fc8f8..21a8f4353d 100644
+--- a/src/plugins/platforms/directfb/qdirectfbcursor.h
++++ b/src/plugins/platforms/directfb/qdirectfbcursor.h
+@@ -19,7 +19,7 @@ class QDirectFBCursor : public QPlatformCursor
+ public:
+     QDirectFBCursor(QPlatformScreen *screen);
+ #ifndef QT_NO_CURSOR
+-    void changeCursor(QCursor *cursor, QWindow *window);
++    void changeCursor(QCursor *cursor, QWindow *window) override;
+ #endif
+ 
+ private:
+diff --git a/src/plugins/platforms/directfb/qdirectfbinput.cpp b/src/plugins/platforms/directfb/qdirectfbinput.cpp
+index a62ff9882c..516dc1e9d8 100644
+--- a/src/plugins/platforms/directfb/qdirectfbinput.cpp
++++ b/src/plugins/platforms/directfb/qdirectfbinput.cpp
+@@ -126,7 +126,7 @@ void QDirectFbInput::handleMouseEvents(const DFBEvent &event)
+     long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000);
+ 
+     QWindow *tlw = m_tlwMap.value(event.window.window_id);
+-    QWindowSystemInterface::handleMouseEvent(tlw, timestamp, p, globalPos, buttons);
++    QWindowSystemInterface::handleMouseEvent(tlw, timestamp, p, globalPos, buttons, Qt::NoButton, QEvent::None);
+ }
+ 
+ void QDirectFbInput::handleWheelEvent(const DFBEvent &event)
+@@ -135,9 +135,12 @@ void QDirectFbInput::handleWheelEvent(const DFBEvent &event)
+     QPoint globalPos(event.window.cx, event.window.cy);
+     long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000);
+     QWindow *tlw = m_tlwMap.value(event.window.window_id);
+-    QWindowSystemInterface::handleWheelEvent(tlw, timestamp, p, globalPos,
+-                                          event.window.step*120,
+-                                          Qt::Vertical);
++    QWindowSystemInterface::handleWheelEvent(tlw,
++                                             timestamp,
++                                             p,
++                                             globalPos,
++                                             QPoint(),
++                                             QPoint(0, event.window.step*120));
+ }
+ 
+ void QDirectFbInput::handleKeyEvents(const DFBEvent &event)
+diff --git a/src/plugins/platforms/directfb/qdirectfbinput.h b/src/plugins/platforms/directfb/qdirectfbinput.h
+index 5496f537a2..02175abc7b 100644
+--- a/src/plugins/platforms/directfb/qdirectfbinput.h
++++ b/src/plugins/platforms/directfb/qdirectfbinput.h
+@@ -26,7 +26,7 @@ public:
+     void stopInputEventLoop();
+ 
+ protected:
+-    void run();
++    void run() override;
+ 
+ private:
+     void handleEvents();
+diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.h b/src/plugins/platforms/directfb/qdirectfbintegration.h
+index aa369d7c05..8dd2a4516a 100644
+--- a/src/plugins/platforms/directfb/qdirectfbintegration.h
++++ b/src/plugins/platforms/directfb/qdirectfbintegration.h
+@@ -25,16 +25,16 @@ public:
+ 
+     void connectToDirectFb();
+ 
+-    bool hasCapability(Capability cap) const;
+-    QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const;
+-    QPlatformWindow *createPlatformWindow(QWindow *window) const;
+-    QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
+-    QAbstractEventDispatcher *createEventDispatcher() const;
+-
+-    QPlatformFontDatabase *fontDatabase() const;
+-    QPlatformServices *services() const;
+-    QPlatformInputContext *inputContext() const { return m_inputContext; }
+-    QPlatformNativeInterface *nativeInterface() const;
++    bool hasCapability(Capability cap) const override;
++    QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const override;
++    QPlatformWindow *createPlatformWindow(QWindow *window) const override;
++    QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override;
++    QAbstractEventDispatcher *createEventDispatcher() const override;
++
++    QPlatformFontDatabase *fontDatabase() const override;
++    QPlatformServices *services() const override;
++    QPlatformInputContext *inputContext() const override { return m_inputContext; }
++    QPlatformNativeInterface *nativeInterface() const override;
+ 
+ protected:
+     virtual void initializeDirectFB();
+diff --git a/src/plugins/platforms/directfb/qdirectfbscreen.h b/src/plugins/platforms/directfb/qdirectfbscreen.h
+index a4f2e9adb1..cbcb6a55da 100644
+--- a/src/plugins/platforms/directfb/qdirectfbscreen.h
++++ b/src/plugins/platforms/directfb/qdirectfbscreen.h
+@@ -19,11 +19,11 @@ class QDirectFbScreen : public QPlatformScreen
+ public:
+     QDirectFbScreen(int display);
+ 
+-    QRect geometry() const { return m_geometry; }
+-    int depth() const { return m_depth; }
+-    QImage::Format format() const { return m_format; }
+-    QSizeF physicalSize() const { return m_physicalSize; }
+-    QPlatformCursor *cursor() const { return m_cursor.data(); }
++    QRect geometry() const override { return m_geometry; }
++    int depth() const override { return m_depth; }
++    QImage::Format format() const override { return m_format; }
++    QSizeF physicalSize() const override { return m_physicalSize; }
++    QPlatformCursor *cursor() const override { return m_cursor.data(); }
+ 
+     // DirectFb helpers
+     IDirectFBDisplayLayer *dfbLayer() const;
+diff --git a/src/plugins/platforms/directfb/qdirectfbwindow.h b/src/plugins/platforms/directfb/qdirectfbwindow.h
+index 6413d91860..f05038d8ca 100644
+--- a/src/plugins/platforms/directfb/qdirectfbwindow.h
++++ b/src/plugins/platforms/directfb/qdirectfbwindow.h
+@@ -15,19 +15,19 @@ class QDirectFbWindow : public QPlatformWindow
+ {
+ public:
+     QDirectFbWindow(QWindow *tlw, QDirectFbInput *inputhandler);
+-    ~QDirectFbWindow();
++    ~QDirectFbWindow() override;
+ 
+-    void setGeometry(const QRect &rect);
+-    void setOpacity(qreal level);
++    void setGeometry(const QRect &rect) override;
++    void setOpacity(qreal level) override;
+ 
+-    void setVisible(bool visible);
++    void setVisible(bool visible) override;
+ 
+-    void setWindowFlags(Qt::WindowFlags flags);
+-    bool setKeyboardGrabEnabled(bool grab);
+-    bool setMouseGrabEnabled(bool grab);
+-    void raise();
+-    void lower();
+-    WId winId() const;
++    void setWindowFlags(Qt::WindowFlags flags) override;
++    bool setKeyboardGrabEnabled(bool grab) override;
++    bool setMouseGrabEnabled(bool grab) override;
++    void raise() override;
++    void lower() override;
++    WId winId() const override;
+ 
+     virtual void createDirectFBWindow();
+     IDirectFBWindow *dfbWindow() const;
+-- 
+2.39.2
+
diff --git a/package/qt6/qt6base/qt6base.mk b/package/qt6/qt6base/qt6base.mk
index 049d73a84f..a904d6edc8 100644
--- a/package/qt6/qt6base/qt6base.mk
+++ b/package/qt6/qt6base/qt6base.mk
@@ -181,6 +181,13 @@ else
 QT6BASE_CONF_OPTS += -DFEATURE_linuxfb=OFF
 endif
 
+ifeq ($(BR2_PACKAGE_QT6BASE_DIRECTFB),y)
+QT6BASE_CONF_OPTS += -DFEATURE_directfb=ON
+QT6BASE_DEPENDENCIES += directfb
+else
+QT6BASE_CONF_OPTS += -DFEATURE_directfb=OFF
+endif
+
 ifeq ($(BR2_PACKAGE_QT6BASE_XCB),y)
 QT6BASE_CONF_OPTS += \
 	-DFEATURE_xcb=ON \
-- 
2.39.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Buildroot] [PATCH] package/qt6/qt6base: Restore DirectFB support
  2024-04-11 14:55 ` [Buildroot] [PATCH] package/qt6/qt6base: Restore DirectFB support Ben Hutchings via buildroot
@ 2024-04-11 18:48   ` Yann E. MORIN
  2024-04-12 21:18     ` Ben Hutchings via buildroot
  2024-09-14 16:44   ` Thomas Petazzoni via buildroot
  1 sibling, 1 reply; 7+ messages in thread
From: Yann E. MORIN @ 2024-04-11 18:48 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: buildroot

Ben, All,

On 2024-04-11 16:55 +0200, Ben Hutchings via buildroot spake thusly:
> Apply a patch from upstream to make Qt 6 support DirectFB again.
> 
> Implement a config option for this, similar to what we do for Qt 5.
> 
> Signed-off-by: Ben Hutchings <ben.hutchings@mind.be>
> ---
>  package/qt6/qt6base/Config.in                 |   8 +
>  .../qt6base-directfb-Fix-compilation.patch    | 288 ++++++++++++++++++
>  package/qt6/qt6base/qt6base.mk                |   7 +

    $ ./utils/docker-run make check-package
    package/qt6/qt6base/qt6base-directfb-Fix-compilation.patch:0: use name <number>-<description>.patch (https://nightly.buildroot.org/#_providing_patches)
    package/qt6/qt6base/qt6base-directfb-Fix-compilation.patch:0: missing Signed-off-by in the header (https://nightly.buildroot.org/#_format_and_licensing_of_the_package_patches)
    package/qt6/qt6base/qt6base-directfb-Fix-compilation.patch:0: missing Upstream in the header (https://nightly.buildroot.org/#_additional_patch_documentation)

Also, we currently only have qt6.4, while qt-6.7 is already released
now, and the patch you add was already present in qt-6.5.

So, maybe it would be better to actually bump qt6 rather than backport
patches?

Regards,
Yann E. MORIN.

>  3 files changed, 303 insertions(+)
>  create mode 100644 package/qt6/qt6base/qt6base-directfb-Fix-compilation.patch
> 
> diff --git a/package/qt6/qt6base/Config.in b/package/qt6/qt6base/Config.in
> index 3b15d40c83..b21cc33cde 100644
> --- a/package/qt6/qt6base/Config.in
> +++ b/package/qt6/qt6base/Config.in
> @@ -36,6 +36,7 @@ config BR2_PACKAGE_QT6BASE_GUI
>  	# At least one graphic backend must be enabled, so enable
>  	# linuxfb if nothing is enabled.
>  	select BR2_PACKAGE_QT6BASE_LINUXFB if \
> +	       !BR2_PACKAGE_QT6BASE_DIRECTFB && \
>  	       !BR2_PACKAGE_QT6BASE_XCB && \
>  	       !BR2_PACKAGE_QT6BASE_EGLFS
>  	help
> @@ -56,6 +57,13 @@ config BR2_PACKAGE_QT6BASE_VULKAN
>  config BR2_PACKAGE_QT6BASE_LINUXFB
>  	bool "linuxfb support"
>  
> +config BR2_PACKAGE_QT6BASE_DIRECTFB
> +	bool "directfb support"
> +	depends on BR2_PACKAGE_DIRECTFB
> +
> +comment "directfb backend available if directfb is enabled"
> +	depends on !BR2_PACKAGE_DIRECTFB
> +
>  config BR2_PACKAGE_QT6BASE_XCB
>  	bool "X.org XCB support"
>  	depends on BR2_PACKAGE_XORG7
> diff --git a/package/qt6/qt6base/qt6base-directfb-Fix-compilation.patch b/package/qt6/qt6base/qt6base-directfb-Fix-compilation.patch
> new file mode 100644
> index 0000000000..5a7df51779
> --- /dev/null
> +++ b/package/qt6/qt6base/qt6base-directfb-Fix-compilation.patch
> @@ -0,0 +1,288 @@
> +From d86ab16a86ec4d6fb92855a3c9913b6b74b6bb0f Mon Sep 17 00:00:00 2001
> +From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
> +Date: Tue, 30 Aug 2022 14:54:01 +0200
> +Subject: [PATCH] directfb: Fix compilation
> +
> +The DirectFB QPA plugin has not built since Qt 6, because it used
> +deprecated API which has been removed and private API which has
> +changed.
> +
> +This change updates the handleMouseEvent() and
> +handleWheelEvent() calls with the contents of the deprecated
> +overloads the way they were in Qt 5.15.
> +
> +In addition, it updates usage of GlyphAndSubPixelPosition to default to
> +vertical subpixel position of 0, and adds override qualifiers where
> +necessary.
> +
> +Fixes: QTBUG-105061
> +Change-Id: Id7516f8e3c0a466d15b754f8e5f6df15a5f9526a
> +Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
> +---
> + src/plugins/platforms/directfb/main.cpp       |  2 +-
> + .../directfb/qdirectfbbackingstore.h          |  8 ++---
> + .../platforms/directfb/qdirectfbblitter.cpp   |  2 +-
> + .../platforms/directfb/qdirectfbblitter.h     | 31 ++++++++++++-------
> + .../platforms/directfb/qdirectfbcursor.h      |  2 +-
> + .../platforms/directfb/qdirectfbinput.cpp     | 11 ++++---
> + .../platforms/directfb/qdirectfbinput.h       |  2 +-
> + .../platforms/directfb/qdirectfbintegration.h | 20 ++++++------
> + .../platforms/directfb/qdirectfbscreen.h      | 10 +++---
> + .../platforms/directfb/qdirectfbwindow.h      | 20 ++++++------
> + 10 files changed, 60 insertions(+), 48 deletions(-)
> +
> +diff --git a/src/plugins/platforms/directfb/main.cpp b/src/plugins/platforms/directfb/main.cpp
> +index 02cceeb487..4618696154 100644
> +--- a/src/plugins/platforms/directfb/main.cpp
> ++++ b/src/plugins/platforms/directfb/main.cpp
> +@@ -24,7 +24,7 @@ class QDirectFbIntegrationPlugin : public QPlatformIntegrationPlugin
> +     Q_OBJECT
> +     Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "directfb.json")
> + public:
> +-    QPlatformIntegration *create(const QString&, const QStringList&);
> ++    QPlatformIntegration *create(const QString&, const QStringList&) override;
> + };
> + 
> + QPlatformIntegration * QDirectFbIntegrationPlugin::create(const QString& system, const QStringList& paramList)
> +diff --git a/src/plugins/platforms/directfb/qdirectfbbackingstore.h b/src/plugins/platforms/directfb/qdirectfbbackingstore.h
> +index c51f29271d..625b672a40 100644
> +--- a/src/plugins/platforms/directfb/qdirectfbbackingstore.h
> ++++ b/src/plugins/platforms/directfb/qdirectfbbackingstore.h
> +@@ -18,10 +18,10 @@ class QDirectFbBackingStore : public QPlatformBackingStore
> + public:
> +     QDirectFbBackingStore(QWindow *window);
> + 
> +-    QPaintDevice *paintDevice();
> +-    void flush(QWindow *window, const QRegion &region, const QPoint &offset);
> +-    void resize (const QSize &size, const QRegion &staticContents);
> +-    bool scroll(const QRegion &area, int dx, int dy);
> ++    QPaintDevice *paintDevice() override;
> ++    void flush(QWindow *window, const QRegion &region, const QPoint &offset) override;
> ++    void resize (const QSize &size, const QRegion &staticContents) override;
> ++    bool scroll(const QRegion &area, int dx, int dy) override;
> + 
> +     QImage toImage() const override;
> + 
> +diff --git a/src/plugins/platforms/directfb/qdirectfbblitter.cpp b/src/plugins/platforms/directfb/qdirectfbblitter.cpp
> +index 0a110da798..aac0e3d800 100644
> +--- a/src/plugins/platforms/directfb/qdirectfbblitter.cpp
> ++++ b/src/plugins/platforms/directfb/qdirectfbblitter.cpp
> +@@ -216,7 +216,7 @@ bool QDirectFbBlitter::drawCachedGlyphs(const QPaintEngineState *state, QFontEng
> +     for (int i=0; i<numGlyphs; ++i) {
> + 
> +         QFixed subPixelPosition = fontEngine->subPixelPositionForX(positions[i].x);
> +-        QTextureGlyphCache::GlyphAndSubPixelPosition glyph(glyphs[i], subPixelPosition);
> ++        QTextureGlyphCache::GlyphAndSubPixelPosition glyph(glyphs[i], QFixedPoint(subPixelPosition, 0));
> +         const QTextureGlyphCache::Coord &c = cache->coords[glyph];
> +         if (c.isNull())
> +             continue;
> +diff --git a/src/plugins/platforms/directfb/qdirectfbblitter.h b/src/plugins/platforms/directfb/qdirectfbblitter.h
> +index 591021061c..6183859613 100644
> +--- a/src/plugins/platforms/directfb/qdirectfbblitter.h
> ++++ b/src/plugins/platforms/directfb/qdirectfbblitter.h
> +@@ -19,11 +19,20 @@ public:
> +     QDirectFbBlitter(const QSize &size, bool alpha);
> +     virtual ~QDirectFbBlitter();
> + 
> +-    virtual void fillRect(const QRectF &rect, const QColor &color);
> +-    virtual void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect);
> +-    void alphaFillRect(const QRectF &rect, const QColor &color, QPainter::CompositionMode cmode);
> +-    void drawPixmapOpacity(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect, QPainter::CompositionMode cmode, qreal opacity);
> +-    virtual bool drawCachedGlyphs(const QPaintEngineState *state, QFontEngine::GlyphFormat glyphFormat, int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions, QFontEngine *fontEngine);
> ++    void fillRect(const QRectF &rect, const QColor &color) override;
> ++    void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect) override;
> ++    void alphaFillRect(const QRectF &rect, const QColor &color, QPainter::CompositionMode cmode) override;
> ++    void drawPixmapOpacity(const QRectF &rect,
> ++                           const QPixmap &pixmap,
> ++                           const QRectF &subrect,
> ++                           QPainter::CompositionMode cmode,
> ++                           qreal opacity) override;
> ++    bool drawCachedGlyphs(const QPaintEngineState *state,
> ++                          QFontEngine::GlyphFormat glyphFormat,
> ++                          int numGlyphs,
> ++                          const glyph_t *glyphs,
> ++                          const QFixedPoint *positions,
> ++                          QFontEngine *fontEngine) override;
> + 
> +     IDirectFBSurface *dfbSurface() const;
> + 
> +@@ -32,8 +41,8 @@ public:
> +     static DFBSurfacePixelFormat selectPixmapFormat(bool withAlpha);
> + 
> + protected:
> +-    virtual QImage *doLock();
> +-    virtual void doUnlock();
> ++    QImage *doLock() override;
> ++    void doUnlock() override;
> + 
> +     QDirectFBPointer<IDirectFBSurface> m_surface;
> +     QImage m_image;
> +@@ -50,12 +59,12 @@ private:
> + class QDirectFbBlitterPlatformPixmap : public QBlittablePlatformPixmap
> + {
> + public:
> +-    QBlittable *createBlittable(const QSize &size, bool alpha) const;
> ++    QBlittable *createBlittable(const QSize &size, bool alpha) const override;
> + 
> +     QDirectFbBlitter *dfbBlitter() const;
> + 
> +-    virtual bool fromFile(const QString &filename, const char *format,
> +-                          Qt::ImageConversionFlags flags);
> ++    bool fromFile(const QString &filename, const char *format,
> ++                  Qt::ImageConversionFlags flags) override;
> + 
> + private:
> +     bool fromDataBufferDescription(const DFBDataBufferDescription &);
> +@@ -83,7 +92,7 @@ public:
> +         : QImageTextureGlyphCache(format, matrix)
> +     {}
> + 
> +-    virtual void resizeTextureData(int width, int height);
> ++    void resizeTextureData(int width, int height) override;
> + 
> +     IDirectFBSurface *sourceSurface();
> + 
> +diff --git a/src/plugins/platforms/directfb/qdirectfbcursor.h b/src/plugins/platforms/directfb/qdirectfbcursor.h
> +index 9a480fc8f8..21a8f4353d 100644
> +--- a/src/plugins/platforms/directfb/qdirectfbcursor.h
> ++++ b/src/plugins/platforms/directfb/qdirectfbcursor.h
> +@@ -19,7 +19,7 @@ class QDirectFBCursor : public QPlatformCursor
> + public:
> +     QDirectFBCursor(QPlatformScreen *screen);
> + #ifndef QT_NO_CURSOR
> +-    void changeCursor(QCursor *cursor, QWindow *window);
> ++    void changeCursor(QCursor *cursor, QWindow *window) override;
> + #endif
> + 
> + private:
> +diff --git a/src/plugins/platforms/directfb/qdirectfbinput.cpp b/src/plugins/platforms/directfb/qdirectfbinput.cpp
> +index a62ff9882c..516dc1e9d8 100644
> +--- a/src/plugins/platforms/directfb/qdirectfbinput.cpp
> ++++ b/src/plugins/platforms/directfb/qdirectfbinput.cpp
> +@@ -126,7 +126,7 @@ void QDirectFbInput::handleMouseEvents(const DFBEvent &event)
> +     long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000);
> + 
> +     QWindow *tlw = m_tlwMap.value(event.window.window_id);
> +-    QWindowSystemInterface::handleMouseEvent(tlw, timestamp, p, globalPos, buttons);
> ++    QWindowSystemInterface::handleMouseEvent(tlw, timestamp, p, globalPos, buttons, Qt::NoButton, QEvent::None);
> + }
> + 
> + void QDirectFbInput::handleWheelEvent(const DFBEvent &event)
> +@@ -135,9 +135,12 @@ void QDirectFbInput::handleWheelEvent(const DFBEvent &event)
> +     QPoint globalPos(event.window.cx, event.window.cy);
> +     long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000);
> +     QWindow *tlw = m_tlwMap.value(event.window.window_id);
> +-    QWindowSystemInterface::handleWheelEvent(tlw, timestamp, p, globalPos,
> +-                                          event.window.step*120,
> +-                                          Qt::Vertical);
> ++    QWindowSystemInterface::handleWheelEvent(tlw,
> ++                                             timestamp,
> ++                                             p,
> ++                                             globalPos,
> ++                                             QPoint(),
> ++                                             QPoint(0, event.window.step*120));
> + }
> + 
> + void QDirectFbInput::handleKeyEvents(const DFBEvent &event)
> +diff --git a/src/plugins/platforms/directfb/qdirectfbinput.h b/src/plugins/platforms/directfb/qdirectfbinput.h
> +index 5496f537a2..02175abc7b 100644
> +--- a/src/plugins/platforms/directfb/qdirectfbinput.h
> ++++ b/src/plugins/platforms/directfb/qdirectfbinput.h
> +@@ -26,7 +26,7 @@ public:
> +     void stopInputEventLoop();
> + 
> + protected:
> +-    void run();
> ++    void run() override;
> + 
> + private:
> +     void handleEvents();
> +diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.h b/src/plugins/platforms/directfb/qdirectfbintegration.h
> +index aa369d7c05..8dd2a4516a 100644
> +--- a/src/plugins/platforms/directfb/qdirectfbintegration.h
> ++++ b/src/plugins/platforms/directfb/qdirectfbintegration.h
> +@@ -25,16 +25,16 @@ public:
> + 
> +     void connectToDirectFb();
> + 
> +-    bool hasCapability(Capability cap) const;
> +-    QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const;
> +-    QPlatformWindow *createPlatformWindow(QWindow *window) const;
> +-    QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
> +-    QAbstractEventDispatcher *createEventDispatcher() const;
> +-
> +-    QPlatformFontDatabase *fontDatabase() const;
> +-    QPlatformServices *services() const;
> +-    QPlatformInputContext *inputContext() const { return m_inputContext; }
> +-    QPlatformNativeInterface *nativeInterface() const;
> ++    bool hasCapability(Capability cap) const override;
> ++    QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const override;
> ++    QPlatformWindow *createPlatformWindow(QWindow *window) const override;
> ++    QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override;
> ++    QAbstractEventDispatcher *createEventDispatcher() const override;
> ++
> ++    QPlatformFontDatabase *fontDatabase() const override;
> ++    QPlatformServices *services() const override;
> ++    QPlatformInputContext *inputContext() const override { return m_inputContext; }
> ++    QPlatformNativeInterface *nativeInterface() const override;
> + 
> + protected:
> +     virtual void initializeDirectFB();
> +diff --git a/src/plugins/platforms/directfb/qdirectfbscreen.h b/src/plugins/platforms/directfb/qdirectfbscreen.h
> +index a4f2e9adb1..cbcb6a55da 100644
> +--- a/src/plugins/platforms/directfb/qdirectfbscreen.h
> ++++ b/src/plugins/platforms/directfb/qdirectfbscreen.h
> +@@ -19,11 +19,11 @@ class QDirectFbScreen : public QPlatformScreen
> + public:
> +     QDirectFbScreen(int display);
> + 
> +-    QRect geometry() const { return m_geometry; }
> +-    int depth() const { return m_depth; }
> +-    QImage::Format format() const { return m_format; }
> +-    QSizeF physicalSize() const { return m_physicalSize; }
> +-    QPlatformCursor *cursor() const { return m_cursor.data(); }
> ++    QRect geometry() const override { return m_geometry; }
> ++    int depth() const override { return m_depth; }
> ++    QImage::Format format() const override { return m_format; }
> ++    QSizeF physicalSize() const override { return m_physicalSize; }
> ++    QPlatformCursor *cursor() const override { return m_cursor.data(); }
> + 
> +     // DirectFb helpers
> +     IDirectFBDisplayLayer *dfbLayer() const;
> +diff --git a/src/plugins/platforms/directfb/qdirectfbwindow.h b/src/plugins/platforms/directfb/qdirectfbwindow.h
> +index 6413d91860..f05038d8ca 100644
> +--- a/src/plugins/platforms/directfb/qdirectfbwindow.h
> ++++ b/src/plugins/platforms/directfb/qdirectfbwindow.h
> +@@ -15,19 +15,19 @@ class QDirectFbWindow : public QPlatformWindow
> + {
> + public:
> +     QDirectFbWindow(QWindow *tlw, QDirectFbInput *inputhandler);
> +-    ~QDirectFbWindow();
> ++    ~QDirectFbWindow() override;
> + 
> +-    void setGeometry(const QRect &rect);
> +-    void setOpacity(qreal level);
> ++    void setGeometry(const QRect &rect) override;
> ++    void setOpacity(qreal level) override;
> + 
> +-    void setVisible(bool visible);
> ++    void setVisible(bool visible) override;
> + 
> +-    void setWindowFlags(Qt::WindowFlags flags);
> +-    bool setKeyboardGrabEnabled(bool grab);
> +-    bool setMouseGrabEnabled(bool grab);
> +-    void raise();
> +-    void lower();
> +-    WId winId() const;
> ++    void setWindowFlags(Qt::WindowFlags flags) override;
> ++    bool setKeyboardGrabEnabled(bool grab) override;
> ++    bool setMouseGrabEnabled(bool grab) override;
> ++    void raise() override;
> ++    void lower() override;
> ++    WId winId() const override;
> + 
> +     virtual void createDirectFBWindow();
> +     IDirectFBWindow *dfbWindow() const;
> +-- 
> +2.39.2
> +
> diff --git a/package/qt6/qt6base/qt6base.mk b/package/qt6/qt6base/qt6base.mk
> index 049d73a84f..a904d6edc8 100644
> --- a/package/qt6/qt6base/qt6base.mk
> +++ b/package/qt6/qt6base/qt6base.mk
> @@ -181,6 +181,13 @@ else
>  QT6BASE_CONF_OPTS += -DFEATURE_linuxfb=OFF
>  endif
>  
> +ifeq ($(BR2_PACKAGE_QT6BASE_DIRECTFB),y)
> +QT6BASE_CONF_OPTS += -DFEATURE_directfb=ON
> +QT6BASE_DEPENDENCIES += directfb
> +else
> +QT6BASE_CONF_OPTS += -DFEATURE_directfb=OFF
> +endif
> +
>  ifeq ($(BR2_PACKAGE_QT6BASE_XCB),y)
>  QT6BASE_CONF_OPTS += \
>  	-DFEATURE_xcb=ON \
> -- 
> 2.39.2
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Buildroot] [PATCH] package/qt6/qt6base: Restore DirectFB support
  2024-04-11 18:48   ` Yann E. MORIN
@ 2024-04-12 21:18     ` Ben Hutchings via buildroot
  0 siblings, 0 replies; 7+ messages in thread
From: Ben Hutchings via buildroot @ 2024-04-12 21:18 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: buildroot

On Thu, Apr 11, 2024 at 08:48:19PM +0200, Yann E. MORIN wrote:
> Ben, All,
> 
> On 2024-04-11 16:55 +0200, Ben Hutchings via buildroot spake thusly:
> > Apply a patch from upstream to make Qt 6 support DirectFB again.
> > 
> > Implement a config option for this, similar to what we do for Qt 5.
> > 
> > Signed-off-by: Ben Hutchings <ben.hutchings@mind.be>
> > ---
> >  package/qt6/qt6base/Config.in                 |   8 +
> >  .../qt6base-directfb-Fix-compilation.patch    | 288 ++++++++++++++++++
> >  package/qt6/qt6base/qt6base.mk                |   7 +
> 
>     $ ./utils/docker-run make check-package
>     package/qt6/qt6base/qt6base-directfb-Fix-compilation.patch:0: use name <number>-<description>.patch (https://nightly.buildroot.org/#_providing_patches)
>     package/qt6/qt6base/qt6base-directfb-Fix-compilation.patch:0: missing Signed-off-by in the header (https://nightly.buildroot.org/#_format_and_licensing_of_the_package_patches)
>     package/qt6/qt6base/qt6base-directfb-Fix-compilation.patch:0: missing Upstream in the header (https://nightly.buildroot.org/#_additional_patch_documentation)

Sorry, I should have known about those.

> Also, we currently only have qt6.4, while qt-6.7 is already released
> now, and the patch you add was already present in qt-6.5.
> 
> So, maybe it would be better to actually bump qt6 rather than backport
> patches?
[...]

That should also work!  But I don't know what else might break when
updating Qt.

Ben.

-- 
Ben Hutchings · Senior Embedded Software Engineer, Essensium-Mind · mind.be
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Buildroot] [PATCH] package/qt6/qt6base: Make qmake work
  2024-04-11 14:55 [Buildroot] [PATCH] package/qt6/qt6base: Make qmake work Ben Hutchings via buildroot
  2024-04-11 14:55 ` [Buildroot] [PATCH] package/qt6/qt6base: Restore DirectFB support Ben Hutchings via buildroot
@ 2024-09-14 16:16 ` Thomas Petazzoni via buildroot
  1 sibling, 0 replies; 7+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-09-14 16:16 UTC (permalink / raw)
  To: Ben Hutchings via buildroot
  Cc: Jesse Van Gavere, Ben Hutchings, Roy Kollen Svendsen,
	Angelo Compagnucci

Hello Ben,

Adding in Cc: Angelo and Jesse who already tried to fix this in the
past, and also adding Roy who is looking after Qt6 packaging.

Some comments/questions below.

On Thu, 11 Apr 2024 16:55:58 +0200
Ben Hutchings via buildroot <buildroot@buildroot.org> wrote:

> Currently the qt6base package does not install a working qmake
> program, so applications can only be built with CMake.
> 
> To ease upgrades from Qt 5, make qmake work as well:
> 
> - Create a linux-buildroot-g++ device spec, like we do for Qt 5.
> 
> - Fix the generated target_qt.conf file.  The Qt build system
>   currently generates this with the sysroot directory wrongly added in
>   various places.
> 
> - Fix the qmake wrapper script in the sysroot to set the QMAKEPATH
>   environment variable.
> 
> Signed-off-by: Ben Hutchings <ben.hutchings@mind.be>

This generally looks good, but I have two concerns.

The first one: there is nothing in Buildroot that exercises this. I
would like to have either a real package that uses this qmake support,
or a dummy package as a test case in support/testing/.

> +ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
> +define QT6BASE_MKSPEC_ARCH_CONFIG
> +# Qt 6 needs atomics, which on various architectures are in -latomic
> +	printf '!host_build { \n LIBS += -latomic\n }' > \
> +		$(STAGING_DIR)/usr/mkspecs/devices/linux-buildroot-g++/arch.conf
> +endef
> +endif
> +
> +define QT6BASE_INSTALL_MKSPEC
> +	mkdir -p $(STAGING_DIR)/usr/mkspecs/devices/linux-buildroot-g++
> +	$(INSTALL) -m 0644 $(QT6BASE_PKGDIR)/qplatformdefs.h \
> +		$(STAGING_DIR)/usr/mkspecs/devices/linux-buildroot-g++/
> +	sed 's%@CROSS_COMPILE@%$(TARGET_CROSS)%' \
> +		< $(QT6BASE_PKGDIR)/qmake.conf.in \
> +		> $(STAGING_DIR)/usr/mkspecs/devices/linux-buildroot-g++/qmake.conf
> +	touch $(STAGING_DIR)/usr/mkspecs/devices/linux-buildroot-g++/arch.conf
> +	$(QT6BASE_MKSPEC_ARCH_CONFIG)
> +endef
> +
> +# The generated broken target_qt.conf is broken, so replace it
> +define QT6BASE_INSTALL_TARGET_QT_CONF
> +	sed 's%@HOST_DIR@%$(HOST_DIR)%; s%@SYSROOT@%$(STAGING_DIR)%' \
> +		< $(QT6BASE_PKGDIR)/target_qt.conf.in \
> +		> $(STAGING_DIR)/usr/bin/target_qt.conf
> +endef

All these I'm reasonably happy with, it's very similar to what we have
for qt5. Quite puzzling that the config file is in
$(STAGING_DIR)/usr/bin/, but oh well.

> +# The qmake wrapper script doesn't set QMAKEPATH, so qmake doesn't
> +# find specs and modules installed for the target
> +define QT6BASE_FIX_QMAKE_SCRIPT
> +	sed -i '1a\
> +export QMAKEPATH=$(STAGING_DIR)/usr' \
> +		$(STAGING_DIR)/usr/bin/qmake
> +endef

This is what bothers me. Why do you fix $(STAGING_DIR)/usr/bin/qmake?
The one we care about and that will be used to build packages is
$(HOST_DIR)/usr/bin/qmake. And this one is not a script that can be
patched, but directly an ELF binary. So here we have something that
isn't good.

Do you think you could have a look into this, perhaps looping back with
Angelo, Jesse and Roy?

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Buildroot] [PATCH] package/qt6/qt6base: Restore DirectFB support
  2024-04-11 14:55 ` [Buildroot] [PATCH] package/qt6/qt6base: Restore DirectFB support Ben Hutchings via buildroot
  2024-04-11 18:48   ` Yann E. MORIN
@ 2024-09-14 16:44   ` Thomas Petazzoni via buildroot
  1 sibling, 0 replies; 7+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-09-14 16:44 UTC (permalink / raw)
  To: Ben Hutchings via buildroot; +Cc: Ben Hutchings

Hello Ben,

On Thu, 11 Apr 2024 16:55:59 +0200
Ben Hutchings via buildroot <buildroot@buildroot.org> wrote:

> Apply a patch from upstream to make Qt 6 support DirectFB again.
> 
> Implement a config option for this, similar to what we do for Qt 5.
> 
> Signed-off-by: Ben Hutchings <ben.hutchings@mind.be>
> ---
>  package/qt6/qt6base/Config.in                 |   8 +
>  .../qt6base-directfb-Fix-compilation.patch    | 288 ++++++++++++++++++
>  package/qt6/qt6base/qt6base.mk                |   7 +
>  3 files changed, 303 insertions(+)
>  create mode 100644 package/qt6/qt6base/qt6base-directfb-Fix-compilation.patch

I applied this, dropped the qt6base-directfb-Fix-compilation.patch
patch as we have a newer version of Qt6 that includes this fix, and
tried a build, but it fails with:

CMake Error at cmake/QtTargetHelpers.cmake:171 (target_link_libraries):
  Target "QDirectFbIntegrationPlugin" links to:

    EGL::EGL

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  cmake/QtPluginHelpers.cmake:348 (qt_internal_extend_target)
  src/plugins/platforms/directfb/CMakeLists.txt:11 (qt_internal_add_plugin)

so it looks like Qt6 expects EGL when the DirectFB backend is enabled?
Not sure it makes sense.

This defconfig fails to build:

BR2_arm=y
BR2_cortex_a9=y
BR2_ARM_ENABLE_VFP=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
# BR2_PACKAGE_BUSYBOX is not set
BR2_PACKAGE_DIRECTFB=y
BR2_PACKAGE_QT6=y
BR2_PACKAGE_QT6BASE_GUI=y
BR2_PACKAGE_QT6BASE_DIRECTFB=y
BR2_PACKAGE_QT6BASE_WIDGETS=y
# BR2_TARGET_ROOTFS_TAR is not set

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] package/qt6/qt6base: Make qmake work
@ 2025-03-12 13:37 Richard Genoud via buildroot
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Genoud via buildroot @ 2025-03-12 13:37 UTC (permalink / raw)
  To: buildroot
  Cc: Jesse Van Gavere, Roy Kollen Svendsen, Thomas Petazzoni,
	Ben Hutchings, Richard Genoud

Currently the qt6base package does not install a working cross-qmake
program, so applications can only be built with CMake.

There's actually a qmake in the staging directory that could be used on
the target (or in a chroot+qemu).
There's the qmake build from the host-qmake package, in the host
directory. This one can build qmake packages for the host.

And the cross-qmake (the one that create a Makfile for
cross-compilation) is missing.

We can't call it host/usr/bin/qmake since it's already taken by the
host-qmake6, but host/usr/bin/tuple-qmake seems to be a good choice,
since it's made for cross-compilation.

This patch is resurrected from:
https://lore.kernel.org/buildroot/20240411145559.1183064-1-ben.hutchings@mind.be/

To ease upgrades from Qt 5, make qmake work as well:

- Create a linux-buildroot-g++ device spec, like we do for Qt 5.

- Generate a target_qt.conf file in the host/usr/bin directory.

- Add a tuple-qmake wrapper script in the host/usr/bin/ directory to set
  the QMAKEPATH environment variable.

Changes from original version:
- Instead of modifying the qmake in the staging directory, we add a
cross-qmake in the host/usr/bin directory.
- The qmake-and-qtpaths-wrapper is modified in order to call the
  cross-qmake also in subprojects, where qmake calls itself.

Signed-off-by: Ben Hutchings <ben.hutchings@mind.be>
Signed-off-by: Richard Genoud <richard.genoud@bootlin.com>
---
 ...x-qmake-wrappers-for-recursive-qmake.patch | 15 +++++++
 package/qt6/qt6base/qmake.conf.in             | 34 +++++++++++++++
 package/qt6/qt6base/qplatformdefs.h           |  1 +
 package/qt6/qt6base/qt6base.mk                | 42 +++++++++++++++++++
 package/qt6/qt6base/target_qt.conf.in         | 11 +++++
 5 files changed, 103 insertions(+)
 create mode 100644 package/qt6/qt6base/0001-fix-qmake-wrappers-for-recursive-qmake.patch
 create mode 100644 package/qt6/qt6base/qmake.conf.in
 create mode 100644 package/qt6/qt6base/qplatformdefs.h
 create mode 100644 package/qt6/qt6base/target_qt.conf.in

diff --git a/package/qt6/qt6base/0001-fix-qmake-wrappers-for-recursive-qmake.patch b/package/qt6/qt6base/0001-fix-qmake-wrappers-for-recursive-qmake.patch
new file mode 100644
index 000000000000..9d6abee4d2ea
--- /dev/null
+++ b/package/qt6/qt6base/0001-fix-qmake-wrappers-for-recursive-qmake.patch
@@ -0,0 +1,15 @@
+--- qt6base-6.4.3/bin/qmake-and-qtpaths-wrapper.in.old	2025-03-05 09:01:11.723198499 +0100
++++ qt6base-6.4.3/bin/qmake-and-qtpaths-wrapper.in	2025-03-05 09:07:14.618403895 +0100
+@@ -1,7 +1,10 @@
+-#!/bin/sh
++#!/bin/bash
+ 
+ # The directory of this script is the expanded absolute path of the "$qt_prefix/bin" directory.
+ script_dir_path=`dirname $0`
+ script_dir_path=`(cd "$script_dir_path"; /bin/pwd)`
+ 
+-@host_qt_bindir@/@tool_name@@tool_version@ -qtconf "$script_dir_path/target_qt.conf" $*
++# bash exec -a permits to change the $0 argument of the executed program
++# like that, the qmake will think it has been called as this wrapper.
++# The goal is to use also this wrapper when qmake calls itself.
++exec -a $0 @host_qt_bindir@/@tool_name@@tool_version@ -qtconf "$script_dir_path/target_qt.conf" $*
diff --git a/package/qt6/qt6base/qmake.conf.in b/package/qt6/qt6base/qmake.conf.in
new file mode 100644
index 000000000000..b62a671c35a8
--- /dev/null
+++ b/package/qt6/qt6base/qmake.conf.in
@@ -0,0 +1,34 @@
+# Qt6 has a mechanism to support "device" profiles, so that people can
+# specify the compiler, compiler flags and so on for a specific device.
+
+# We leverage this mechanism in the Buildroot packaging of qt6 to
+# simplify cross-compilation: we have our own "device" definition, which
+# allows us to easily pass the cross-compiler paths and flags from our
+# qt6.mk.
+
+CROSS_COMPILE = @CROSS_COMPILE@
+
+include(../common/linux_device_pre.conf)
+
+# modifications to gcc-base.conf
+QMAKE_CFLAGS           += $${BR_COMPILER_CFLAGS}
+QMAKE_CXXFLAGS         += $${BR_COMPILER_CXXFLAGS}
+# Remove all optimisation flags, we really only want our own.
+QMAKE_CFLAGS_OPTIMIZE       =
+QMAKE_CFLAGS_OPTIMIZE_DEBUG =
+QMAKE_CFLAGS_OPTIMIZE_FULL  =
+QMAKE_CFLAGS_OPTIMIZE_SIZE  =
+QMAKE_CFLAGS_DEBUG =
+QMAKE_CXXFLAGS_DEBUG =
+QMAKE_CFLAGS_RELEASE =
+QMAKE_CXXFLAGS_RELEASE =
+CONFIG                 += nostrip
+
+QMAKE_LIBS             += -lrt -lpthread -ldl
+QMAKE_CFLAGS_ISYSTEM   =
+
+# Architecture specific configuration
+include(arch.conf)
+
+include(../common/linux_device_post.conf)
+load(qt_config)
diff --git a/package/qt6/qt6base/qplatformdefs.h b/package/qt6/qt6base/qplatformdefs.h
new file mode 100644
index 000000000000..99e9a2792329
--- /dev/null
+++ b/package/qt6/qt6base/qplatformdefs.h
@@ -0,0 +1 @@
+#include "../../linux-g++/qplatformdefs.h"
diff --git a/package/qt6/qt6base/qt6base.mk b/package/qt6/qt6base/qt6base.mk
index a4c56da6018d..af099e398f90 100644
--- a/package/qt6/qt6base/qt6base.mk
+++ b/package/qt6/qt6base/qt6base.mk
@@ -78,6 +78,48 @@ QT6BASE_CONF_OPTS += \
 	-DFEATURE_avx512vl=OFF \
 	-DFEATURE_vaes=OFF
 
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+define QT6BASE_MKSPEC_ARCH_CONFIG
+# Qt 6 needs atomics, which on various architectures are in -latomic
+	printf '!host_build { \n LIBS += -latomic\n }' > \
+		$(STAGING_DIR)/usr/mkspecs/devices/linux-buildroot-g++/arch.conf
+endef
+endif
+
+define QT6BASE_INSTALL_MKSPEC
+	mkdir -p $(STAGING_DIR)/usr/mkspecs/devices/linux-buildroot-g++
+	$(INSTALL) -m 0644 $(QT6BASE_PKGDIR)/qplatformdefs.h \
+		$(STAGING_DIR)/usr/mkspecs/devices/linux-buildroot-g++/
+	sed 's%@CROSS_COMPILE@%$(TARGET_CROSS)%' \
+		< $(QT6BASE_PKGDIR)/qmake.conf.in \
+		> $(STAGING_DIR)/usr/mkspecs/devices/linux-buildroot-g++/qmake.conf
+	touch $(STAGING_DIR)/usr/mkspecs/devices/linux-buildroot-g++/arch.conf
+	$(QT6BASE_MKSPEC_ARCH_CONFIG)
+endef
+
+# Install the target_qt.conf needed for cross-qmake
+define QT6BASE_INSTALL_TARGET_QT_CONF
+	sed 's%@HOST_DIR@%$(HOST_DIR)%; s%@SYSROOT@%$(STAGING_DIR)%' \
+		< $(QT6BASE_PKGDIR)/target_qt.conf.in \
+		> $(HOST_DIR)/usr/bin/target_qt.conf
+endef
+
+# Create the cross-qmake from the wrapper script in sysroot.
+# This time, we add QMAKEPATH, so that it finds specs and modules
+# installed for the target
+define QT6BASE_INSTALL_CROSS_QMAKE
+	$(INSTALL) -m 0755 $(STAGING_DIR)/usr/bin/qmake \
+		$(TARGET_CROSS)qmake
+	sed -i '1a\
+export QMAKEPATH=$(STAGING_DIR)/usr' \
+		$(TARGET_CROSS)qmake
+endef
+
+QT6BASE_POST_INSTALL_STAGING_HOOKS += \
+	QT6BASE_INSTALL_MKSPEC \
+	QT6BASE_INSTALL_TARGET_QT_CONF \
+	QT6BASE_INSTALL_CROSS_QMAKE
+
 HOST_QT6BASE_DEPENDENCIES = \
 	host-double-conversion \
 	host-libb2 \
diff --git a/package/qt6/qt6base/target_qt.conf.in b/package/qt6/qt6base/target_qt.conf.in
new file mode 100644
index 000000000000..5702970c47f6
--- /dev/null
+++ b/package/qt6/qt6base/target_qt.conf.in
@@ -0,0 +1,11 @@
+[Paths]
+Prefix=/usr
+HostPrefix=@HOST_DIR@
+HostBinaries=bin
+HostLibraries=lib
+HostLibraryExecutables=libexec
+HostData=.
+Sysroot=@SYSROOT@
+SysrootifyPrefix=true
+TargetSpec=devices/linux-buildroot-g++
+HostSpec=
-- 
2.47.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-03-12 13:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-11 14:55 [Buildroot] [PATCH] package/qt6/qt6base: Make qmake work Ben Hutchings via buildroot
2024-04-11 14:55 ` [Buildroot] [PATCH] package/qt6/qt6base: Restore DirectFB support Ben Hutchings via buildroot
2024-04-11 18:48   ` Yann E. MORIN
2024-04-12 21:18     ` Ben Hutchings via buildroot
2024-09-14 16:44   ` Thomas Petazzoni via buildroot
2024-09-14 16:16 ` [Buildroot] [PATCH] package/qt6/qt6base: Make qmake work Thomas Petazzoni via buildroot
  -- strict thread matches above, loose matches on Subject: below --
2025-03-12 13:37 Richard Genoud via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox