new file mode 100644
@@ -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)
new file mode 100644
@@ -0,0 +1 @@
+#include "../../linux-g++/qplatformdefs.h"
@@ -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 \
new file mode 100644
@@ -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=
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