Support qmake for Qt6
v2 cover Support qmake for Qt6
The series supports qmake for qt6.
As stated in https://doc.qt.io/qt-6/qt6-buildsystem.html:
"This only affects users that want to build Qt from sources.
You can still use qmake as a build tool for your applications."
This series revives an older patch that exported qmake for Qt6, applying a minimal fix. It extends pkg-qmake to support Qt6 and uses qwt and cutekeyboard as test cases to validate the changes.
The series is marked as RFC because hardcoding the Qt5 and Qt6 version numbers in pkg-qmake is not ideal, even if the Qt5 versions were already hardcoded.
An alternative approach could be to add a BR2_PACKAGE_QT{5,6}_VERSION_VALUE option, but this can be discussed during review.
Dario Binacchi (4):
package/qwt: bump to version 6.3.0
package/pkg-qmake: support Qt6
package/qwt: enable build with Qt6
package/cutekeyboard: enable build with Qt6
Jesse Van Gavere (1):
package/qt6: Add qmake functionality
package/cutekeyboard/Config.in | 13 +- package/cutekeyboard/cutekeyboard.mk | 6 +- package/pkg-qmake.mk | 21 +- package/qt6/qt6.mk | 18 ++ package/qt6/qt6base/qmake.conf.in | 36 +++ package/qt6/qt6base/qplatformdefs.h | 1 + package/qt6/qt6base/qt.conf.in | 7 + package/qt6/qt6base/qt6base.mk | 18 ++ package/qt6/qt6base/qt6base.mk.save | 455 +++++++++++++++++++++++++++ package/qwt/Config.in | 22 +- package/qwt/qwt.hash | 8 +- package/qwt/qwt.mk | 6 +- 12 files changed, 587 insertions(+), 24 deletions(-) create mode 100644 package/qt6/qt6base/qmake.conf.in create mode 100644 package/qt6/qt6base/qplatformdefs.h create mode 100644 package/qt6/qt6base/qt.conf.in create mode 100644 package/qt6/qt6base/qt6base.mk.save
Signature · 6 lines
2.43.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
RFC v2 1/5 package/qt6: Add qmake functionality
From: Jesse Van Gavere <[email protected]>
The qmake functionality had been missing due to the new host/target build requirement, to get it working the main parts of the qt5 qmake has been kept, we're still making our own device spec which we use to run qmake with along with passing some additional device options for our flags/cross-compiler the biggest difference is that where previously qt.conf was used to fixup per-paths builds, this is now always created with changed contents so qmake looks at the correct target directories.
A big thanks to Angelo Compagnucci for the encouragement and testing.
---
(no changes since v1)
package/qt6/qt6.mk | 18 ++ package/qt6/qt6base/qmake.conf.in | 36 +++ package/qt6/qt6base/qplatformdefs.h | 1 + package/qt6/qt6base/qt.conf.in | 7 + package/qt6/qt6base/qt6base.mk | 18 ++ package/qt6/qt6base/qt6base.mk.save | 455 ++++++++++++++++++++++++++++ 6 files changed, 535 insertions(+) create mode 100644 package/qt6/qt6base/qmake.conf.in create mode 100644 package/qt6/qt6base/qplatformdefs.h create mode 100644 package/qt6/qt6base/qt.conf.in create mode 100644 package/qt6/qt6base/qt6base.mk.save
package/qt6/qt6.mk +18 -0
@@ -12,3 +12,21 @@ QT6_SITE = https://download.qt.io/archive/qt/$(QT6_VERSION_MAJOR)/$(QT6_VERSION) QT6_GIT = git://code.qt.io include $(sort $(wildcard package/qt6/*/*.mk)) + +# The file "qt.conf" can be used to override the hard-coded paths that are +# compiled into the Qt library. We need it to make "qmake" relocatable and +# tweak the per-package install paths +define QT6_INSTALL_QT_CONF + rm -f $(HOST_DIR)/bin/qt.conf + sed -e "s|@@HOST_DIR@@|$(HOST_DIR)|" -e "s|@@STAGING_DIR@@|$(STAGING_DIR)|" \ + $(QT6BASE_PKGDIR)/qt.conf.in > $(HOST_DIR)/bin/qt.conf +endef + +ifeq ($(BR2_PER_PACKAGE_DIRECTORIES),y) +define QT6_QT_CONF_FIXUP + $(QT6_INSTALL_QT_CONF) +endef +endif + +# Variable for other Qt applications to use +QT6_QMAKE = $(HOST_DIR)/bin/qmake -spec devices/linux-buildroot-g++
package/qt6/qt6base/qmake.conf.in new file +36 -0
@@ -0,0 +1,36 @@ +# 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. + +include(../common/linux_device_pre.conf) + +# modifications to g++-unix.conf +QMAKE_CC = $${CROSS_COMPILE}gcc +QMAKE_CXX = $${CROSS_COMPILE}g++ +QMAKE_LINK = $${CROSS_COMPILE}g++ + +# 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 = + +@EGLFS_DEVICE@ + +include(../common/linux_device_post.conf) +load(qt_config)
package/qt6/qt6base/qplatformdefs.h new file +1 -0
@@ -0,0 +1 @@ +#include "../../linux-g++/qplatformdefs.h"
package/qt6/qt6base/qt.conf.in new file +7 -0
@@ -0,0 +1,7 @@ +[Paths] +Prefix=/usr +HostPrefix=@@HOST_DIR@@ +HostData=@@STAGING_DIR@@/usr +Sysroot=@@STAGING_DIR@@ +SysrootifyPrefix=true +TargetSpec=devices/linux-buildroot-g++
package/qt6/qt6base/qt6base.mk +18 -0
@@ -55,6 +55,9 @@ QT6BASE_CONF_OPTS = \ -DFEATURE_system_zlib=ON \ -DFEATURE_system_libb2=ON +QT6BASE_CFLAGS = $(TARGET_CFLAGS) +QT6BASE_CXXFLAGS = $(TARGET_CXXFLAGS) + # x86 optimization options. While we have a BR2_X86_CPU_HAS_AVX512, it # is not clear yet how it maps to all the avx512* options of Qt, so we # for now keeps them disabled.
@@ -431,5 +434,20 @@ define QT6BASE_RM_USR_MKSPECS endef QT6BASE_TARGET_FINALIZE_HOOKS += QT6BASE_RM_USR_MKSPECS +define QT6BASE_MAKE_BR_SPEC + mkdir -p $(@D)/mkspecs/devices/linux-buildroot-g++/ + sed 's/@EGLFS_DEVICE@/$(QT6BASE_EGLFS_DEVICE)/g' \ + $(QT6BASE_PKGDIR)/qmake.conf.in > \ + $(@D)/mkspecs/devices/linux-buildroot-g++/qmake.conf + $(INSTALL) -m 0644 -D $(QT6BASE_PKGDIR)/qplatformdefs.h \ + $(@D)/mkspecs/devices/linux-buildroot-g++/qplatformdefs.h +endef + +QT6BASE_CONF_OPTS += -DQT_QMAKE_DEVICE_OPTIONS=CROSS_COMPILE="$(TARGET_CROSS)";BR_COMPILER_CFLAGS="$(QT6BASE_CFLAGS)";BR_COMPILER_CXXFLAGS="$(QT6BASE_CXX_FLAGS)" + +QT6BASE_PRE_CONFIGURE_HOOKS += QT6BASE_MAKE_BR_SPEC + +QT6BASE_POST_INSTALL_STAGING_HOOKS += QT6_INSTALL_QT_CONF + $(eval $(cmake-package)) $(eval $(host-cmake-package))
package/qt6/qt6base/qt6base.mk.save new file +455 -0
455 lines not on this page · raw message
Signature · 6 lines
2.43.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [RFC v2 1/5] package/qt6: Add qmake functionality
Hello Dario,
Thanks for your work on this!
Quoted 6 lines · On Wed, 13 Aug 2025 21:26:01 +0200 Dario Binacchi…
package/qt6/qt6.mk | 18 ++ package/qt6/qt6base/qmake.conf.in | 36 +++ package/qt6/qt6base/qplatformdefs.h | 1 + package/qt6/qt6base/qt.conf.in | 7 + package/qt6/qt6base/qt6base.mk | 18 ++ package/qt6/qt6base/qt6base.mk.save | 455 ++++++++++++++++++++++++++++
Are you sure this file is supposed to be part of the commit?
Thanks!
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
RFC v2 2/5 package/qwt: bump to version 6.3.0
In reply to Dario BinacchiRelease notes:
https://sourceforge.net/p/qwt/git/ci/qwt-6.2/tree/CHANGES-6.2
https://sourceforge.net/p/qwt/git/ci/develop/tree/CHANGES-6.3
---
(no changes since v1)
package/qwt/qwt.hash | 8 ++++---- package/qwt/qwt.mk | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)
package/qwt/qwt.hash +4 -4
@@ -1,7 +1,7 @@ -# From https://sourceforge.net/projects/qwt/files/qwt/6.1.6 -md5 cc71be5d6c33c2fc19ae8082ccdd3e83 qwt-6.1.6.tar.bz2 -sha1 b1f17a86c9b1b0790a0c0067ef69fb6277efac79 qwt-6.1.6.tar.bz2 +# From https://sourceforge.net/projects/qwt/files/qwt/6.3.0 +md5 06a8f8eb1bc07bedfb1df601804439cb qwt-6.3.0.tar.bz2 +sha1 9180f33f75ff8817f27019c94d10f92de840a5e4 qwt-6.3.0.tar.bz2 # Locally computed -sha256 99460d31c115ee4117b0175d885f47c2c590d784206f09815dc058fbe5ede1f6 qwt-6.1.6.tar.bz2 +sha256 dcb085896c28aaec5518cbc08c0ee2b4e60ada7ac929d82639f6189851a6129a qwt-6.3.0.tar.bz2 sha256 d8737db330e1eeb439962e11654ab7f1aece3561d9415454a8c538643824ede6 COPYING
package/qwt/qwt.mk +1 -1
@@ -4,7 +4,7 @@ # ################################################################################ -QWT_VERSION = 6.1.6 +QWT_VERSION = 6.3.0 QWT_SOURCE = qwt-$(QWT_VERSION).tar.bz2 QWT_SITE = http://downloads.sourceforge.net/project/qwt/qwt/$(QWT_VERSION) QWT_INSTALL_STAGING = YES
Signature · 6 lines
2.43.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
RFC v2 3/5 package/pkg-qmake: support Qt6
In reply to Dario BinacchiExtend build support to Qt6.
---
(no changes since v1)
package/pkg-qmake.mk | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
package/pkg-qmake.mk +16 -5
@@ -20,11 +20,22 @@ # ################################################################################ + +ifeq ($(BR2_PACKAGE_QT5),y) +QT_VERSION = 5.15 +else +QT_VERSION = 6.8 +endif + +QT_VERSION_MAJOR = $(word 1,$(subst ., ,$(QT_VERSION))) +QT_VERSION_MINOR = $(word 2,$(subst ., ,$(QT_VERSION))) +QT_BASE = qt$(QT_VERSION_MAJOR)base + # # Hook to sync Qt headers # define QT_HEADERS_SYNC_HOOK - sed -e '/^MODULE_VERSION/s/5\.15\.[3456789]/$(QT5_VERSION)/' -i \ + sed -e '/^MODULE_VERSION/s/$(QT_VERSION_MAJOR)\.$(QT_VERSION_MINOR)\.[3456789]/$(QT_VERSION)/' -i \ $($(PKG)_BUILDDIR)/.qmake.conf touch $($(PKG)_BUILDDIR)/.git endef
@@ -45,15 +56,15 @@ define inner-qmake-package $(2)_INSTALL_STAGING_OPTS ?= install $(2)_INSTALL_TARGET_OPTS ?= $$($(2)_INSTALL_STAGING_OPTS) -ifneq ($(1),qt5base) -$(2)_DEPENDENCIES += qt5base +ifneq ($(1),$(QT_BASE)) +$(2)_DEPENDENCIES += $(QT_BASE) endif ifeq ($$($(2)_SYNC_QT_HEADERS),YES) $(2)_PRE_CONFIGURE_HOOKS += QT_HEADERS_SYNC_HOOK endif -$(2)_POST_PREPARE_HOOKS += QT5_QT_CONF_FIXUP +$(2)_POST_PREPARE_HOOKS += QT$(QT_VERSION_MAJOR)_QT_CONF_FIXUP # # Configure step. Only define it if not already defined by the package
@@ -62,7 +73,7 @@ $(2)_POST_PREPARE_HOOKS += QT5_QT_CONF_FIXUP ifndef $(2)_CONFIGURE_CMDS define $(2)_CONFIGURE_CMDS cd $$($(2)_BUILDDIR) && \ - $$(TARGET_MAKE_ENV) $$($(2)_CONF_ENV) $$(QT5_QMAKE) $$($(2)_CONF_OPTS) + $$(TARGET_MAKE_ENV) $$($(2)_CONF_ENV) $$(QT$(QT_VERSION_MAJOR)_QMAKE) $$($(2)_CONF_OPTS) endef endif
Signature · 6 lines
2.43.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
RFC v2 4/5 package/qwt: enable build with Qt6
In reply to Dario BinacchiVersion 6.3.0 added support for Qt6, so enable building Qwt with Qt6 as well.
---
(no changes since v1)
package/qwt/Config.in | 22 ++++++++++++++-------- package/qwt/qwt.mk | 4 ++++ 2 files changed, 18 insertions(+), 8 deletions(-)
package/qwt/Config.in +14 -8
@@ -1,9 +1,13 @@ config BR2_PACKAGE_QWT bool "qwt" - depends on BR2_PACKAGE_QT5 - select BR2_PACKAGE_QT5BASE_GUI - select BR2_PACKAGE_QT5BASE_WIDGETS # printsupport - select BR2_PACKAGE_QT5BASE_CONCURRENT + depends on BR2_PACKAGE_QT5 || BR2_PACKAGE_QT6 + select BR2_PACKAGE_QT5BASE_GUI if BR2_PACKAGE_QT5 + select BR2_PACKAGE_QT5BASE_WIDGETS if BR2_PACKAGE_QT5 # printsupport + select BR2_PACKAGE_QT5BASE_CONCURRENT if BR2_PACKAGE_QT5 + select BR2_PACKAGE_QT6BASE_GUI if BR2_PACKAGE_QT6 + select BR2_PACKAGE_QT6BASE_WIDGETS if BR2_PACKAGE_QT6 + select BR2_PACKAGE_QT6BASE_PRINTSUPPORT if BR2_PACKAGE_QT6 + select BR2_PACKAGE_QT6BASE_CONCURRENT if BR2_PACKAGE_QT6 help Qwt is a graphics extension to the Qt GUI application framework. It provides a 2D plotting widget and more.
@@ -14,15 +18,17 @@ if BR2_PACKAGE_QWT config BR2_PACKAGE_QWT_SVG bool "SVG support" - select BR2_PACKAGE_QT5SVG + select BR2_PACKAGE_QT5SVG if BR2_PACKAGE_QT5 + select BR2_PACKAGE_QT6SVG if BR2_PACKAGE_QT6 config BR2_PACKAGE_QWT_MATHML bool "MathML support" config BR2_PACKAGE_QWT_OPENGL bool "OpenGL support" - depends on BR2_PACKAGE_QT5_GL_AVAILABLE - select BR2_PACKAGE_QT5BASE_OPENGL - select BR2_PACKAGE_QT5BASE_OPENGL_LIB + depends on BR2_PACKAGE_QT5_GL_AVAILABLE || BR2_PACKAGE_QT6 + select BR2_PACKAGE_QT5BASE_OPENGL if BR2_PACKAGE_QT5 + select BR2_PACKAGE_QT5BASE_OPENGL_LIB if BR2_PACKAGE_QT5 + select BR2_PACKAGE_QT6BASE_OPENGL if BR2_PACKAGE_QT6 endif
package/qwt/qwt.mk +4 -0
@@ -18,8 +18,12 @@ QWT_CONFIG += -e 's%/features%/mkspecs/features%' ifeq ($(BR2_PACKAGE_QWT_SVG),y) QWT_CONFIG += -e 's/^.*QWT_CONFIG.*QwtSvg.*$$/QWT_CONFIG += QwtSvg/' +ifeq ($(BR2_PACKAGE_QT5),y) QWT_DEPENDENCIES += qt5svg else +QWT_DEPENDENCIES += qt6svg +endif +else QWT_CONFIG += -e 's/^.*QWT_CONFIG.*QwtSvg.*$$/\# QWT_CONFIG += QwtSvg/' endif
Signature · 6 lines
2.43.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
RFC v2 5/5 package/cutekeyboard: enable build with Qt6
In reply to Dario BinacchiEnable building of cutekeyboard with Qt6. With the merge of QuickControls2 into qtdeclarative, the corresponding Kconfig option has also disappeared in Buildroot.
---
Added in v2
package/cutekeyboard/Config.in | 13 ++++++++----- package/cutekeyboard/cutekeyboard.mk | 6 +++++- 2 files changed, 13 insertions(+), 6 deletions(-)
package/cutekeyboard/Config.in +8 -5
@@ -1,10 +1,13 @@ config BR2_PACKAGE_CUTEKEYBOARD bool "cutekeyboard" - depends on BR2_PACKAGE_QT5 - depends on BR2_PACKAGE_QT5_JSCORE_AVAILABLE # qt5declarative - select BR2_PACKAGE_QT5DECLARATIVE - select BR2_PACKAGE_QT5DECLARATIVE_QUICK - select BR2_PACKAGE_QT5QUICKCONTROLS2 + depends on BR2_PACKAGE_QT5 || BR2_PACKAGE_QT6 + depends on BR2_PACKAGE_QT5_JSCORE_AVAILABLE || BR2_PACKAGE_QT6 # qt5declarative + select BR2_PACKAGE_QT5DECLARATIVE if BR2_PACKAGE_QT5 + select BR2_PACKAGE_QT5DECLARATIVE_QUICK if BR2_PACKAGE_QT5 + select BR2_PACKAGE_QT5QUICKCONTROLS2 if BR2_PACKAGE_QT5 + select BR2_PACKAGE_QT6BASE_GUI if BR2_PACKAGE_QT6 + select BR2_PACKAGE_QT6DECLARATIVE if BR2_PACKAGE_QT6 + select BR2_PACKAGE_QT6DECLARATIVE_QUICK if BR2_PACKAGE_QT6 help CuteKeyboard is a Qt virtual keyboard plugin for embedded applications.
package/cutekeyboard/cutekeyboard.mk +5 -1
@@ -6,7 +6,11 @@ CUTEKEYBOARD_VERSION = v1.3.0 CUTEKEYBOARD_SITE = $(call github,amarula,cutekeyboard,$(CUTEKEYBOARD_VERSION)) -CUTEKEYBOARD_DEPENDENCIES = qt5declarative qt5quickcontrols2 +ifeq ($(BR2_PACKAGE_QT5),y) +CUTEKEYBOARD_DEPENDENCIES += qt5declarative qt5quickcontrols2 +else +CUTEKEYBOARD_DEPENDENCIES += qt6declarative +endif CUTEKEYBOARD_INSTALL_STAGING = YES CUTEKEYBOARD_LICENSE = MIT CUTEKEYBOARD_LICENSE_FILES = LICENSE
Signature · 6 lines
2.43.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot