From: Dario Binacchi <dario.binacchi@amarulasolutions.com>
To: buildroot@buildroot.org
Cc: Dario Binacchi <dario.binacchi@amarulasolutions.com>,
Andrea Ricchi <andrea.ricchi@amarulasolutions.com>,
Roy Kollen Svendsen <roykollensvendsen@gmail.com>,
Angelo Compagnucci <angelo.compagnucci@gmail.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Jesse Van Gavere <jesseevg@gmail.com>,
richard.genoud@bootlin.com,
Angelo Compagnucci <angelo@amarulasolutions.com>
Subject: [Buildroot] [PATCH v5 1/6] package/qt6: Add qmake functionality
Date: Tue, 8 Sep 2026 16:12:48 +0200 [thread overview]
Message-ID: <20260908141253.1556634-2-dario.binacchi@amarulasolutions.com> (raw)
In-Reply-To: <20260908141253.1556634-1-dario.binacchi@amarulasolutions.com>
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.
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 and add the target install dirs in qt.conf.in,
quote QT_QMAKE_DEVICE_OPTIONS, use TARGET_CFLAGS/TARGET_CXXFLAGS,
change the commit message]
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
Changes v4 -> v5:
- Add ArchData, LibraryExecutables, Plugins and QmlImports to
qt.conf.in
- Quote QT_QMAKE_DEVICE_OPTIONS
- Use TARGET_CFLAGS/TARGET_CXXFLAGS
- Drop the redundant mkdir in QT6BASE_MAKE_BR_SPEC
- Add Tested-by of Richard Genoud
Changes v3 -> v4:
- Drop QT6_QT_CONF_FIXUP
- Drop -@EGLFS_DEVICE@
- Update the commit message
Changes v2 -> v3:
- Drop package/qt6/qt6base/qt6base.mk.save
package/qt6/qt6.mk | 12 ++++++++++
package/qt6/qt6base/qmake.conf | 34 +++++++++++++++++++++++++++++
package/qt6/qt6base/qplatformdefs.h | 1 +
package/qt6/qt6base/qt.conf.in | 11 ++++++++++
package/qt6/qt6base/qt6base.mk | 14 ++++++++++++
5 files changed, 72 insertions(+)
create mode 100644 package/qt6/qt6base/qmake.conf
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 f56a9ff1fa83..bcf735c19e3b 100644
--- a/package/qt6/qt6.mk
+++ b/package/qt6/qt6.mk
@@ -12,3 +12,15 @@ 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
+
+# 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 b/package/qt6/qt6base/qmake.conf
new file mode 100644
index 000000000000..e0d53d755d41
--- /dev/null
+++ b/package/qt6/qt6base/qmake.conf
@@ -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.
+
+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 =
+
+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..d1d2d9490fbb
--- /dev/null
+++ b/package/qt6/qt6base/qt.conf.in
@@ -0,0 +1,11 @@
+[Paths]
+Prefix=/usr
+HostPrefix=@@HOST_DIR@@
+HostData=@@STAGING_DIR@@/usr
+Sysroot=@@STAGING_DIR@@
+SysrootifyPrefix=true
+TargetSpec=devices/linux-buildroot-g++
+ArchData=/usr/lib/qt6
+LibraryExecutables=/usr/lib/qt6/libexec
+Plugins=/usr/lib/qt6/plugins
+QmlImports=/usr/lib/qt6/qml
diff --git a/package/qt6/qt6base/qt6base.mk b/package/qt6/qt6base/qt6base.mk
index 01661b7f01d4..032947417259 100644
--- a/package/qt6/qt6base/qt6base.mk
+++ b/package/qt6/qt6base/qt6base.mk
@@ -436,5 +436,19 @@ define QT6BASE_RM_SBOMS
endef
QT6BASE_TARGET_FINALIZE_HOOKS += QT6BASE_RM_SBOMS
+define QT6BASE_MAKE_BR_SPEC
+ $(INSTALL) -m 0644 -D $(QT6BASE_PKGDIR)/qmake.conf \
+ $(@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=$(TARGET_CFLAGS);BR_COMPILER_CXXFLAGS=$(TARGET_CXXFLAGS)"
+
+QT6BASE_PRE_CONFIGURE_HOOKS += QT6BASE_MAKE_BR_SPEC
+
+QT6BASE_POST_INSTALL_STAGING_HOOKS += QT6_INSTALL_QT_CONF
+
$(eval $(cmake-package))
$(eval $(host-cmake-package))
--
2.43.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2026-09-08 14:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 14:12 [Buildroot] [PATCH v5 0/6] Support qmake for Qt6 Dario Binacchi
2026-09-08 14:12 ` Dario Binacchi [this message]
2026-09-08 14:12 ` [Buildroot] [PATCH v5 2/6] package/qt6: add QT6_QT_CONF_FIXUP hook Dario Binacchi
2026-09-08 14:12 ` [Buildroot] [PATCH v5 3/6] package/qwt: bump to version 6.3.0 Dario Binacchi
2026-09-08 14:12 ` [Buildroot] [PATCH v5 4/6] package/pkg-qmake: support Qt6 Dario Binacchi
2026-09-08 14:12 ` [Buildroot] [PATCH v5 5/6] package/qwt: enable build with Qt6 Dario Binacchi
2026-09-08 14:12 ` [Buildroot] [PATCH v5 6/6] package/cutekeyboard: " Dario Binacchi
2026-09-10 9:52 ` Andrea Ricchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260908141253.1556634-2-dario.binacchi@amarulasolutions.com \
--to=dario.binacchi@amarulasolutions.com \
--cc=andrea.ricchi@amarulasolutions.com \
--cc=angelo.compagnucci@gmail.com \
--cc=angelo@amarulasolutions.com \
--cc=buildroot@buildroot.org \
--cc=jesseevg@gmail.com \
--cc=richard.genoud@bootlin.com \
--cc=roykollensvendsen@gmail.com \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox