[RFC,v3,1/5] package/qt6: Add qmake functionality

Message ID 20250814153259.6822-2-dario.binacchi@amarulasolutions.com
State New
Headers show
Series
  • Support qmake for Qt6
Related show

Commit Message

Dario Binacchi Aug. 14, 2025, 3:32 p.m. UTC
From: Jesse Van Gavere <jesseevg@gmail.com>

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.

Signed-off-by: Jesse Van Gavere <jesseevg@gmail.com>
Tested-by: Angelo Compagnucci <angelo@amarulasolutions.com>
[dario: fix HostData in qt.conf.in]
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>

---

Changes v2 -> v3:
  - Drop package/qt6/qt6base/qt6base.mk.save

 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 +++++++++++++++
 5 files changed, 80 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

Comments

'Julien Olivain' via Amarula Linux Aug. 15, 2025, 3:28 p.m. UTC | #1
Hello Dario,

Thanks for bringing this further. This really seems like a copy/paste
of the Qt5 logic, with even some parts that are dead code (see below).
How much have you validated that everything added by this patch is
actually *needed*, as opposed to just blindly copy/pasted from the Qt5
logic?

Also, in the commit log:

> 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.

I'm a bit confused by what this means. Is this about
QT6_INSTALL_QT_CONF being called not only by QT6_QT_CONF_FIXUP in the
BR2_PER_PACKAGE_DIRECTORIES=y case but also being called by:

QT6BASE_POST_INSTALL_STAGING_HOOKS += QT6_INSTALL_QT_CONF

 ?

If so, why does this has to be different?

On Thu, 14 Aug 2025 17:32:55 +0200
Dario Binacchi <dario.binacchi@amarulasolutions.com> wrote:


> diff --git a/package/qt6/qt6base/qt6base.mk b/package/qt6/qt6base/qt6base.mk
> index 51a4f1b5be7f..697d1a96a920 100644
> --- a/package/qt6/qt6base/qt6base.mk
> +++ b/package/qt6/qt6base/qt6base.mk
> @@ -55,6 +55,9 @@ QT6BASE_CONF_OPTS = \
>  	-DFEATURE_system_zlib=ON \
>  	-DFEATURE_system_libb2=ON
>  
> +QT6BASE_CFLAGS = $(TARGET_CFLAGS)
> +QT6BASE_CXXFLAGS = $(TARGET_CXXFLAGS)

These variables are not "changed" anywhere, so you could directly use
TARGET_CFLAGS/TARGET_CXXFLAGS. Unless the goal is to keep the logic as
similar as qt5 as possible.

> +
>  # 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

$(QT6BASE_EGLFS_DEVICE) doesn't seem to be defined anywhere, so I have
some doubts that this is doing something useful.

This also means the @EGLFS_DEVICE@ in qmake.conf.in is not relevant.

> +	$(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)"

What is this doing? Does it actually work? I'm asking because that
doesn't seem to exist in the Qt5 case.

Thanks!

Thomas
'Julien Olivain' via Amarula Linux Sept. 1, 2025, 12:43 p.m. UTC | #2
Le 14/08/2025 à 17:32, Dario Binacchi a écrit :
> From: Jesse Van Gavere <jesseevg@gmail.com>
> 
> 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.
> 
> Signed-off-by: Jesse Van Gavere <jesseevg@gmail.com>
> Tested-by: Angelo Compagnucci <angelo@amarulasolutions.com>

Tested-by: Richard GENOUD <richard.genoud@bootlin.com>
> [dario: fix HostData in qt.conf.in]
> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> 
> ---
> 
> Changes v2 -> v3:
>    - Drop package/qt6/qt6base/qt6base.mk.save
> 
>   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 +++++++++++++++
>   5 files changed, 80 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
> 
> diff --git a/package/qt6/qt6.mk b/package/qt6/qt6.mk
> index 33cbf7551f23..2d51c69269ac 100644
> --- a/package/qt6/qt6.mk
> +++ b/package/qt6/qt6.mk
> @@ -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++
> diff --git a/package/qt6/qt6base/qmake.conf.in b/package/qt6/qt6base/qmake.conf.in
> new file mode 100644
> index 000000000000..ebb8497d2df5
> --- /dev/null
> +++ b/package/qt6/qt6base/qmake.conf.in
> @@ -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)
> 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/qt.conf.in b/package/qt6/qt6base/qt.conf.in
> new file mode 100644
> index 000000000000..fee209f38c00
> --- /dev/null
> +++ b/package/qt6/qt6base/qt.conf.in
> @@ -0,0 +1,7 @@
> +[Paths]
> +Prefix=/usr
> +HostPrefix=@@HOST_DIR@@
> +HostData=@@STAGING_DIR@@/usr
> +Sysroot=@@STAGING_DIR@@
> +SysrootifyPrefix=true
> +TargetSpec=devices/linux-buildroot-g++
> diff --git a/package/qt6/qt6base/qt6base.mk b/package/qt6/qt6base/qt6base.mk
> index 51a4f1b5be7f..697d1a96a920 100644
> --- a/package/qt6/qt6base/qt6base.mk
> +++ b/package/qt6/qt6base/qt6base.mk
> @@ -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))
Dario Binacchi Sept. 1, 2025, 8:32 p.m. UTC | #3
Hello Thomas,

On Fri, Aug 15, 2025 at 5:28 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> Hello Dario,
>
> Thanks for bringing this further. This really seems like a copy/paste
> of the Qt5 logic, with even some parts that are dead code (see below).
> How much have you validated that everything added by this patch is
> actually *needed*, as opposed to just blindly copy/pasted from the Qt5
> logic?
>
> Also, in the commit log:
>
> > 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.

I think the commit message refers to HostData=../target/usr in qt.conf.in,
which I later fixed to HostData=@@STAGING_DIR@@/usr.
So in v4 I will remove that comment from the commit message.

>
> I'm a bit confused by what this means. Is this about
> QT6_INSTALL_QT_CONF being called not only by QT6_QT_CONF_FIXUP in the
> BR2_PER_PACKAGE_DIRECTORIES=y case but also being called by:
>
> QT6BASE_POST_INSTALL_STAGING_HOOKS += QT6_INSTALL_QT_CONF
>
>  ?

Since QT6_QT_CONF_FIXUP, unlike QT5_QT_CONF_FIXUP, is not called,
I will remove it in v4.

>
> If so, why does this has to be different?
>
> On Thu, 14 Aug 2025 17:32:55 +0200
> Dario Binacchi <dario.binacchi@amarulasolutions.com> wrote:
>
>
> > diff --git a/package/qt6/qt6base/qt6base.mk b/package/qt6/qt6base/qt6base.mk
> > index 51a4f1b5be7f..697d1a96a920 100644
> > --- a/package/qt6/qt6base/qt6base.mk
> > +++ b/package/qt6/qt6base/qt6base.mk
> > @@ -55,6 +55,9 @@ QT6BASE_CONF_OPTS = \
> >       -DFEATURE_system_zlib=ON \
> >       -DFEATURE_system_libb2=ON
> >
> > +QT6BASE_CFLAGS = $(TARGET_CFLAGS)
> > +QT6BASE_CXXFLAGS = $(TARGET_CXXFLAGS)
>
> These variables are not "changed" anywhere, so you could directly use
> TARGET_CFLAGS/TARGET_CXXFLAGS. Unless the goal is to keep the logic as
> similar as qt5 as possible.

In this case, I would prefer to keep using QT6BASE_CFLAGS and QT6BASE_CXXFLAGS,
to keep the logic as close as possible to that of QT5 and in case they
might be modified
elsewhere in the future. I would keep them in v4, but I have no
problem removing them
in a possible v5 if you think it’s appropriate.

>
> > +
> >  # 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
>
> $(QT6BASE_EGLFS_DEVICE) doesn't seem to be defined anywhere, so I have
> some doubts that this is doing something useful.
>
> This also means the @EGLFS_DEVICE@ in qmake.conf.in is not relevant.

I will drop in v4

>
> > +     $(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)"
>
> What is this doing? Does it actually work? I'm asking because that
> doesn't seem to exist in the Qt5 case.

Yes, these settings are used by package/qt6/qt6base/qmake.conf, and if
I remove them
I get the following compilation error when building qwt (and also cutekeyboard):

/home/dario/projects/buildroot-qt6/buildroot-qt6/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/include/gnu/stubs.h:7:11:
fatal error: gnu/stubs-soft.h: No such file or directory
    7 | # include <gnu/stubs-soft.h>
      |           ^~~~~~~~~~~~~~~~~~
compilation terminated.

And, if I’m not mistaken, the same approach is also adopted for qt5:

$ git grep BR_COMPILER_CFLAGS package/qt5
package/qt5/qt5base/qmake.conf.in:QMAKE_CFLAGS           +=
$${BR_COMPILER_CFLAGS}
package/qt5/qt5base/qt5base.mk:         -device-option
BR_COMPILER_CFLAGS="$(QT5BASE_CFLAGS)" \

Thanks and regards,
Dario

>
> Thanks!
>
> Thomas
> --
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering and training
> https://bootlin.com

Patch

diff --git a/package/qt6/qt6.mk b/package/qt6/qt6.mk
index 33cbf7551f23..2d51c69269ac 100644
--- a/package/qt6/qt6.mk
+++ b/package/qt6/qt6.mk
@@ -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++
diff --git a/package/qt6/qt6base/qmake.conf.in b/package/qt6/qt6base/qmake.conf.in
new file mode 100644
index 000000000000..ebb8497d2df5
--- /dev/null
+++ b/package/qt6/qt6base/qmake.conf.in
@@ -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)
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/qt.conf.in b/package/qt6/qt6base/qt.conf.in
new file mode 100644
index 000000000000..fee209f38c00
--- /dev/null
+++ b/package/qt6/qt6base/qt.conf.in
@@ -0,0 +1,7 @@ 
+[Paths]
+Prefix=/usr
+HostPrefix=@@HOST_DIR@@
+HostData=@@STAGING_DIR@@/usr
+Sysroot=@@STAGING_DIR@@
+SysrootifyPrefix=true
+TargetSpec=devices/linux-buildroot-g++
diff --git a/package/qt6/qt6base/qt6base.mk b/package/qt6/qt6base/qt6base.mk
index 51a4f1b5be7f..697d1a96a920 100644
--- a/package/qt6/qt6base/qt6base.mk
+++ b/package/qt6/qt6base/qt6base.mk
@@ -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))